Changeset

938:663f75dd7b42

Fixed: Some nil access bugs
author Waqas Hussain <waqas20@gmail.com>
date Mon, 30 Mar 2009 05:26:10 +0500
parents 937:40ccaacb2000
children 939:b832f786af62
files core/s2smanager.lua plugins/mod_saslauth.lua
diffstat 2 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- 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);