Changeset

7786:b62353e6a8e5

Merge 0.10->trunk
author Kim Alvefur <zash@zash.se>
date Wed, 14 Dec 2016 01:47:19 +0100
parents 7780:dbd202e7c587 (current diff) 7785:cdffbda59b03 (diff)
children 7788:cf1d7e35a160
files core/sessionmanager.lua
diffstat 4 files changed, 7 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/core/sessionmanager.lua	Sat Dec 10 02:55:38 2016 +0100
+++ b/core/sessionmanager.lua	Wed Dec 14 01:47:19 2016 +0100
@@ -109,7 +109,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;
@@ -177,6 +177,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);
--- a/core/stanza_router.lua	Sat Dec 10 02:55:38 2016 +0100
+++ b/core/stanza_router.lua	Wed Dec 14 01:47:19 2016 +0100
@@ -79,16 +79,6 @@
 			end
 		end
 
-		if not origin.full_jid
-			and not(name == "iq" and st_type == "set" and stanza.tags[1] and stanza.tags[1].name == "bind"
-					and stanza.tags[1].attr.xmlns == "urn:ietf:params:xml:ns:xmpp-bind") then
-			-- authenticated client isn't bound and current stanza is not a bind request
-			if stanza.attr.type ~= "result" and stanza.attr.type ~= "error" then
-				origin.send(st.error_reply(stanza, "auth", "not-authorized")); -- FIXME maybe allow stanzas to account or server
-			end
-			return;
-		end
-
 		-- TODO also, stanzas should be returned to their original state before the function ends
 		stanza.attr.from = origin.full_jid;
 	end
--- a/plugins/mod_roster.lua	Sat Dec 10 02:55:38 2016 +0100
+++ b/plugins/mod_roster.lua	Wed Dec 14 01:47:19 2016 +0100
@@ -19,7 +19,6 @@
 local rm_remove_from_roster = require "core.rostermanager".remove_from_roster;
 local rm_add_to_roster = require "core.rostermanager".add_to_roster;
 local rm_roster_push = require "core.rostermanager".roster_push;
-local core_post_stanza = prosody.core_post_stanza;
 
 module:add_feature("jabber:iq:roster");
 
@@ -136,7 +135,6 @@
 	local username, host = event.username, event.host;
 	local origin = event.origin or prosody.hosts[host];
 	if host ~= module.host then return end
-	local bare = username .. "@" .. host;
 	local roster = rm_load_roster(username, host);
 	for jid, item in pairs(roster) do
 		if jid then
@@ -144,9 +142,9 @@
 				username = username, jid = jid, item = item, roster = roster, origin = origin,
 			});
 		else
-			for jid in pairs(item.pending) do
+			for pending_jid in pairs(item.pending) do
 				module:fire_event("roster-item-removed", {
-					username = username, jid = jid, roster = roster, origin = origin,
+					username = username, jid = pending_jid, roster = roster, origin = origin,
 				});
 			end
 		end
--- a/plugins/mod_saslauth.lua	Sat Dec 10 02:55:38 2016 +0100
+++ b/plugins/mod_saslauth.lua	Wed Dec 14 01:47:19 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