Comparison

plugins/mod_saslauth.lua @ 3418:e75af8e6af54

mod_saslauth: Fixed a nil global access.
author Waqas Hussain <waqas20@gmail.com>
date Sat, 31 Jul 2010 15:16:15 +0500
parent 3417:53e854b52110
child 3463:1644ab13a4ca
comparison
equal deleted inserted replaced
3417:53e854b52110 3418:e75af8e6af54
111 end 111 end
112 112
113 local function sasl_handler(session, stanza) 113 local function sasl_handler(session, stanza)
114 if stanza.name == "auth" then 114 if stanza.name == "auth" then
115 -- FIXME ignoring duplicates because ejabberd does 115 -- FIXME ignoring duplicates because ejabberd does
116 local mechanism = stanza.attr.mechanism;
116 if anonymous_login then 117 if anonymous_login then
117 if stanza.attr.mechanism ~= "ANONYMOUS" then 118 if mechanism ~= "ANONYMOUS" then
118 return session.send(build_reply("failure", "invalid-mechanism")); 119 return session.send(build_reply("failure", "invalid-mechanism"));
119 end 120 end
120 elseif stanza.attr.mechanism == "ANONYMOUS" then 121 elseif mechanism == "ANONYMOUS" then
121 return session.send(build_reply("failure", "mechanism-too-weak")); 122 return session.send(build_reply("failure", "mechanism-too-weak"));
122 end 123 end
123 if not session.secure and (secure_auth_only or (mechanism == "PLAIN" and not allow_unencrypted_plain_auth)) then 124 if not session.secure and (secure_auth_only or (mechanism == "PLAIN" and not allow_unencrypted_plain_auth)) then
124 return session.send(build_reply("failure", "encryption-required")); 125 return session.send(build_reply("failure", "encryption-required"));
125 end 126 end
126 local valid_mechanism = session.sasl_handler:select(stanza.attr.mechanism); 127 local valid_mechanism = session.sasl_handler:select(mechanism);
127 if not valid_mechanism then 128 if not valid_mechanism then
128 return session.send(build_reply("failure", "invalid-mechanism")); 129 return session.send(build_reply("failure", "invalid-mechanism"));
129 end 130 end
130 elseif not session.sasl_handler then 131 elseif not session.sasl_handler then
131 return; -- FIXME ignoring out of order stanzas because ejabberd does 132 return; -- FIXME ignoring out of order stanzas because ejabberd does