Diff

core/sessionmanager.lua @ 7784:9f70d35a1602

core.sessionmanager, mod_saslauth: Introduce intermediate session type for authenticated but unbound sessions so that resource binding is not treated as a normal stanza
author Kim Alvefur <zash@zash.se>
date Tue, 13 Dec 2016 18:15:17 +0100
parent 7496:98c8d14be4ef
child 7786:b62353e6a8e5
child 7947:24170d74b00b
line wrap: on
line diff
--- 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);