# HG changeset patch # User Waqas Hussain # Date 1254048641 -18000 # Node ID 5408d5100bd0722982ba1e0736f2cc8bd763f1d7 # Parent a805e4fe104a7048abf0ddf8f4c238aa0ccf639f mod_legacyauth: Don't allow server-generated resource identifiers, as these are not support by legacy auth. diff -r a805e4fe104a -r 5408d5100bd0 plugins/mod_legacyauth.lua --- a/plugins/mod_legacyauth.lua Sun Sep 27 15:30:01 2009 +0500 +++ b/plugins/mod_legacyauth.lua Sun Sep 27 15:50:41 2009 +0500 @@ -52,7 +52,7 @@ resource = resourceprep(resource) local reply = st.reply(stanza); require "core.usermanager" - if username and usermanager.validate_credentials(session.host, username, password) then + if username and resource and usermanager.validate_credentials(session.host, username, password) then -- Authentication successful! local success, err = sessionmanager.make_authenticated(session, username); if success then @@ -62,6 +62,10 @@ session.send(st.error_reply(stanza, err_type, err, err_msg)); session.username, session.type = nil, "c2s_unauthed"; -- FIXME should this be placed in sessionmanager? return true; + elseif resource ~= session.resource then -- server changed resource, not supported by legacy auth + session.send(st.error_reply(stanza, "cancel", "conflict", "The requested resource could not be assigned to this session.")); + session:close(); -- FIXME undo resource bind and auth instead of closing the session? + return true; end end session.send(st.reply(stanza));