Fixed: Some nil access bugs

Mon, 30 Mar 2009 05:26:10 +0500

author
Waqas Hussain <waqas20@gmail.com>
date
Mon, 30 Mar 2009 05:26:10 +0500
changeset 938
663f75dd7b42
parent 937
40ccaacb2000
child 939
b832f786af62

Fixed: Some nil access bugs

core/s2smanager.lua file | annotate | diff | comparison | revisions
plugins/mod_saslauth.lua file | annotate | diff | comparison | revisions
--- a/core/s2smanager.lua	Mon Mar 30 04:39:12 2009 +0500
+++ b/core/s2smanager.lua	Mon Mar 30 05:26:10 2009 +0500
@@ -212,8 +212,8 @@
 	
 	if session.direction == "incoming" then
 		-- Send a reply stream header
-		session.to_host = nameprep(attr.to);
-		session.from_host = nameprep(attr.from);
+		session.to_host = attr.to and nameprep(attr.to);
+		session.from_host = attr.from and nameprep(attr.from);
 	
 		session.streamid = uuid_gen();
 		(session.log or log)("debug", "incoming s2s received <stream:stream>");
--- a/plugins/mod_saslauth.lua	Mon Mar 30 04:39:12 2009 +0500
+++ b/plugins/mod_saslauth.lua	Mon Mar 30 05:26:10 2009 +0500
@@ -74,7 +74,7 @@
 		-- FIXME ignoring duplicates because ejabberd does
 		if config.get(session.host or "*", "core", "anonymous_login") and stanza.attr.mechanism ~= "ANONYMOUS" then
 			return session.send(build_reply("failure", "invalid-mechanism"));
-		elseif mechanism == "ANONYMOUS" then
+		elseif stanza.attr.mechanism == "ANONYMOUS" then
 			return session.send(build_reply("failure", "mechanism-too-weak"));
 		end
 		session.sasl_handler = new_sasl(stanza.attr.mechanism, session.host, password_callback);

mercurial