# HG changeset patch # User Kim Alvefur # Date 1481649317 -3600 # Node ID 9f70d35a160225443bd8566e65a5d2e5d8e45fc6 # Parent f54c960240da600286eb5308b917684f6f805c8e core.sessionmanager, mod_saslauth: Introduce intermediate session type for authenticated but unbound sessions so that resource binding is not treated as a normal stanza diff -r f54c960240da -r 9f70d35a1602 core/sessionmanager.lua --- a/core/sessionmanager.lua Tue Dec 13 21:25:11 2016 +0100 +++ b/core/sessionmanager.lua Tue Dec 13 18:15:17 2016 +0100 @@ -108,7 +108,7 @@ if not username or #username == 0 then return nil, "Invalid username"; end session.username = username; if session.type == "c2s_unauthed" then - session.type = "c2s"; + session.type = "c2s_unbound"; end session.log("info", "Authenticated as %s@%s", username or "(unknown)", session.host or "(unknown)"); return true; @@ -176,6 +176,9 @@ session.full_jid = session.username .. '@' .. session.host .. '/' .. resource; hosts[session.host].sessions[session.username].sessions[resource] = session; full_sessions[session.full_jid] = session; + if session.type == "c2s_unbound" then + session.type = "c2s"; + end local err; session.roster, err = rm_load_roster(session.username, session.host); diff -r f54c960240da -r 9f70d35a1602 plugins/mod_saslauth.lua --- a/plugins/mod_saslauth.lua Tue Dec 13 21:25:11 2016 +0100 +++ b/plugins/mod_saslauth.lua Tue Dec 13 18:15:17 2016 +0100 @@ -273,7 +273,7 @@ end end); -module:hook("iq/self/urn:ietf:params:xml:ns:xmpp-bind:bind", function(event) +module:hook("stanza/iq/urn:ietf:params:xml:ns:xmpp-bind:bind", function(event) local origin, stanza = event.origin, event.stanza; local resource; if stanza.attr.type == "set" then