Mercurial > prosody-hg
comparison core/xmlhandlers.lua @ 4277:683523db4fe8
Merge 0.6->0.7
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Wed, 01 Jun 2011 23:25:24 +0100 |
| parents | 692b3c6c5bd2 a37522bf6b1b |
| children | 5a0144a032d8 |
comparison
equal
deleted
inserted
replaced
| 3399:3976bad56640 | 4277:683523db4fe8 |
|---|---|
| 14 local tostring = tostring; | 14 local tostring = tostring; |
| 15 local t_insert = table.insert; | 15 local t_insert = table.insert; |
| 16 local t_concat = table.concat; | 16 local t_concat = table.concat; |
| 17 | 17 |
| 18 local default_log = require "util.logger".init("xmlhandlers"); | 18 local default_log = require "util.logger".init("xmlhandlers"); |
| 19 | |
| 20 -- COMPAT: w/LuaExpat 1.1.0 | |
| 21 local lxp_supports_doctype = pcall(lxp.new, { StartDoctypeDecl = false }); | |
| 22 | |
| 23 if not lxp_supports_doctype then | |
| 24 default_log("warn", "The version of LuaExpat on your system leaves Prosody " | |
| 25 .."vulnerable to denial-of-service attacks. You should upgrade to " | |
| 26 .."LuaExpat 1.1.1 or higher as soon as possible. See " | |
| 27 .."http://prosody.im/doc/depends#luaexpat for more information."); | |
| 28 end | |
| 19 | 29 |
| 20 local error = error; | 30 local error = error; |
| 21 | 31 |
| 22 module "xmlhandlers" | 32 module "xmlhandlers" |
| 23 | 33 |
| 137 cb_error(session, "parse-error", "unexpected-element-close", name); | 147 cb_error(session, "parse-error", "unexpected-element-close", name); |
| 138 end | 148 end |
| 139 stanza, chardata = nil, {}; | 149 stanza, chardata = nil, {}; |
| 140 end | 150 end |
| 141 end | 151 end |
| 152 | |
| 153 local function restricted_handler() | |
| 154 cb_error(session, "parse-error", "restricted-xml", "Restricted XML, see RFC 6120 section 11.1."); | |
| 155 end | |
| 156 | |
| 157 if lxp_supports_doctype then | |
| 158 xml_handlers.StartDoctypeDecl = restricted_handler; | |
| 159 end | |
| 160 xml_handlers.Comment = restricted_handler; | |
| 161 xml_handlers.StartCdataSection = restricted_handler; | |
| 162 xml_handlers.ProcessingInstruction = restricted_handler; | |
| 163 | |
| 142 return xml_handlers; | 164 return xml_handlers; |
| 143 end | 165 end |
| 144 | 166 |
| 145 return init_xmlhandlers; | 167 return init_xmlhandlers; |
