util.dependencies, util.xmppstream: Move LuaExpat version checking to util.dependencies.
authorWaqas Hussain <waqas20@gmail.com>
Tue, 22 Nov 2011 02:13:42 +0500
changeset 4421 ee65aa40ef60
parent 4420 6f5ed0f4a3e6
child 4427 ae71ae5ddcfc
util.dependencies, util.xmppstream: Move LuaExpat version checking to util.dependencies.
util/dependencies.lua
util/xmppstream.lua
--- a/util/dependencies.lua	Tue Nov 22 01:44:28 2011 +0500
+++ b/util/dependencies.lua	Tue Nov 22 02:13:42 2011 +0500
@@ -136,6 +136,14 @@
 			log("error", "This version of LuaSec contains a known bug that causes disconnects, see http://prosody.im/doc/depends");
 		end
 	end
+	if lxp then
+		if not pcall(lxp.new, { StartDoctypeDecl = false }) then
+			log("error", "The version of LuaExpat on your system leaves Prosody "
+				.."vulnerable to denial-of-service attacks. You should upgrade to "
+				.."LuaExpat 1.1.1 or higher as soon as possible. See "
+				.."http://prosody.im/doc/depends#luaexpat for more information.");
+		end
+	end
 end
 
 return _M;
--- a/util/xmppstream.lua	Tue Nov 22 01:44:28 2011 +0500
+++ b/util/xmppstream.lua	Tue Nov 22 02:13:42 2011 +0500
@@ -20,13 +20,6 @@
 
 -- COMPAT: w/LuaExpat 1.1.0
 local lxp_supports_doctype = pcall(lxp.new, { StartDoctypeDecl = false });
-if not lxp_supports_doctype then
-	local default_log = require "util.logger".init("xmppstream");
-	default_log("warn", "The version of LuaExpat on your system leaves Prosody "
-		.."vulnerable to denial-of-service attacks. You should upgrade to "
-		.."LuaExpat 1.1.1 or higher as soon as possible. See "
-		.."http://prosody.im/doc/depends#luaexpat for more information.");
-end
 
 module "xmppstream"