Comparison

plugins/mod_saslauth.lua @ 1217:844ef764ef0e

mod_saslauth: Don't offer bind/session when they aren't authenticated yet :) [thanks albert, again...]
author Matthew Wild <mwild1@gmail.com>
date Fri, 29 May 2009 18:03:48 +0100
parent 1216:fd8ce71bc72b
child 1375:50ee4b327f86
comparison
equal deleted inserted replaced
1216:fd8ce71bc72b 1217:844ef764ef0e
119 local mechanisms_attr = { xmlns='urn:ietf:params:xml:ns:xmpp-sasl' }; 119 local mechanisms_attr = { xmlns='urn:ietf:params:xml:ns:xmpp-sasl' };
120 local bind_attr = { xmlns='urn:ietf:params:xml:ns:xmpp-bind' }; 120 local bind_attr = { xmlns='urn:ietf:params:xml:ns:xmpp-bind' };
121 local xmpp_session_attr = { xmlns='urn:ietf:params:xml:ns:xmpp-session' }; 121 local xmpp_session_attr = { xmlns='urn:ietf:params:xml:ns:xmpp-session' };
122 module:add_event_hook("stream-features", 122 module:add_event_hook("stream-features",
123 function (session, features) 123 function (session, features)
124 if not session.username and ((not secure_auth_only) or session.secure) then 124 if not session.username then
125 if secure_auth_only and not session.secure then
126 return;
127 end
125 features:tag("mechanisms", mechanisms_attr); 128 features:tag("mechanisms", mechanisms_attr);
126 -- TODO: Provide PLAIN only if TLS is active, this is a SHOULD from the introduction of RFC 4616. This behavior could be overridden via configuration but will issuing a warning or so. 129 -- TODO: Provide PLAIN only if TLS is active, this is a SHOULD from the introduction of RFC 4616. This behavior could be overridden via configuration but will issuing a warning or so.
127 if config.get(session.host or "*", "core", "anonymous_login") then 130 if config.get(session.host or "*", "core", "anonymous_login") then
128 features:tag("mechanism"):text("ANONYMOUS"):up(); 131 features:tag("mechanism"):text("ANONYMOUS"):up();
129 else 132 else