LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File prosody-upstream-0.9-branch-fixes-since-0.12-tag.patch of Package prosody (Project home:guardian4711:branches:devel:languages:lua)

# HG changeset patch
# User Kim Alvefur <zash@zash.se>
# Date 1481292910 -3600
#      Fri Dec 09 15:15:10 2016 +0100
# Node ID 65836cf2d0578fa1d892d1f86deea787630a4bb7
# Parent  2a7b52437167a5c7b6c8a5bc79f4463afe092fd5
core.rostermanager: Add method for checking if the user is subscribed to a contact

diff -r 2a7b52437167 -r 65836cf2d057 core/rostermanager.lua
--- a/core/rostermanager.lua	Mon Nov 28 14:27:59 2016 +0100
+++ b/core/rostermanager.lua	Fri Dec 09 15:15:10 2016 +0100
@@ -210,6 +210,18 @@
 	local item = roster[jid];
 	return item and (item.subscription == "from" or item.subscription == "both"), err;
 end
+function is_user_subscribed(username, host, jid)
+	do
+		local selfjid = username.."@"..host;
+		local user_subscription = _get_online_roster_subscription(selfjid, jid);
+		if user_subscription then return (user_subscription == "both" or user_subscription == "to"); end
+		local contact_subscription = _get_online_roster_subscription(jid, selfjid);
+		if contact_subscription then return (contact_subscription == "both" or contact_subscription == "from"); end
+	end
+	local roster, err = load_roster(username, host);
+	local item = roster[jid];
+	return item and (item.subscription == "to" or item.subscription == "both"), err;
+end
 
 function is_contact_pending_in(username, host, jid)
 	local roster = load_roster(username, host);
# HG changeset patch
# User Kim Alvefur <zash@zash.se>
# Date 1481226575 -3600
#      Thu Dec 08 20:49:35 2016 +0100
# Node ID 62e7d6a73c721aacdb9f7bf3aecc764e094e3c68
# Parent  65836cf2d0578fa1d892d1f86deea787630a4bb7
mod_presence: Send probe once subscribed (fixes #794)

diff -r 65836cf2d057 -r 62e7d6a73c72 plugins/mod_presence.lua
--- a/plugins/mod_presence.lua	Fri Dec 09 15:15:10 2016 +0100
+++ b/plugins/mod_presence.lua	Thu Dec 08 20:49:35 2016 +0100
@@ -201,7 +201,9 @@
 		end
 		core_post_stanza(origin, stanza);
 		send_presence_of_available_resources(node, host, to_bare, origin);
-		core_post_stanza(origin, st.presence({ type = "probe", from = from_bare, to = to_bare }));
+		if rostermanager.is_user_subscribed(node, host, to_bare) then
+			core_post_stanza(origin, st.presence({ type = "probe", from = from_bare, to = to_bare }));
+		end
 	elseif stanza.attr.type == "unsubscribed" then
 		-- 1. send unavailable
 		-- 2. route stanza
# HG changeset patch
# User Kim Alvefur <zash@zash.se>
# Date 1482314537 -3600
#      Wed Dec 21 11:02:17 2016 +0100
# Node ID 00bca79ae778fa29db2434f8c189efa5e423dca7
# Parent  1cb90024e8db6001f64ebe9b58aa126f2f5e1b82
mod_net_multiplex: Enable SSL on the SSL port (fixes #803)

diff -r 1cb90024e8db -r 00bca79ae778 plugins/mod_net_multiplex.lua
--- a/plugins/mod_net_multiplex.lua	Sat Dec 10 03:00:50 2016 +0100
+++ b/plugins/mod_net_multiplex.lua	Wed Dec 21 11:02:17 2016 +0100
@@ -67,5 +67,6 @@
 module:provides("net", {
 	name = "multiplex_ssl";
 	config_prefix = "ssl";
+	encryption = "ssl";
 	listener = listener;
 });
# HG changeset patch
# User Kim Alvefur <zash@zash.se>
# Date 1487699684 -3600
#      Tue Feb 21 18:54:44 2017 +0100
# Node ID 72b6d5ab4137f87e91c23b639b13351f7c41575f
# Parent  00bca79ae778fa29db2434f8c189efa5e423dca7
mod_register: Require encryption before registration if c2s_require_encryption is set (fixes #595)

diff -r 00bca79ae778 -r 72b6d5ab4137 plugins/mod_register.lua
--- a/plugins/mod_register.lua	Wed Dec 21 11:02:17 2016 +0100
+++ b/plugins/mod_register.lua	Tue Feb 21 18:54:44 2017 +0100
@@ -20,6 +20,7 @@
 local compat = module:get_option_boolean("registration_compat", true);
 local allow_registration = module:get_option_boolean("allow_registration", false);
 local additional_fields = module:get_option("additional_registration_fields", {});
+local require_encryption = module:get_option("c2s_require_encryption") or module:get_option("require_encryption");
 
 local account_details = module:open_store("account_details");
 
@@ -75,7 +76,7 @@
         local session, features = event.origin, event.features;
 
 	-- Advertise registration to unauthorized clients only.
-	if not(allow_registration) or session.type ~= "c2s_unauthed" then
+	if not(allow_registration) or session.type ~= "c2s_unauthed" or (require_encryption and not session.secure) then
 		return
 	end
 
@@ -183,6 +184,8 @@
 
 	if not(allow_registration) or session.type ~= "c2s_unauthed" then
 		session.send(st.error_reply(stanza, "cancel", "service-unavailable"));
+	elseif require_encryption and not session.secure then
+		session.send(st.error_reply(stanza, "modify", "policy-violation", "Encryption is required"));
 	else
 		local query = stanza.tags[1];
 		if stanza.attr.type == "get" then
# HG changeset patch
# User Kim Alvefur <zash@zash.se>
# Date 1488464252 -3600
#      Thu Mar 02 15:17:32 2017 +0100
# Node ID 6940d6db970be1382e80395f1a5f97d48711abaf
# Parent  72b6d5ab4137f87e91c23b639b13351f7c41575f
mod_saslauth: Log SASL failure reason

diff -r 72b6d5ab4137 -r 6940d6db970b plugins/mod_saslauth.lua
--- a/plugins/mod_saslauth.lua	Tue Feb 21 18:54:44 2017 +0100
+++ b/plugins/mod_saslauth.lua	Thu Mar 02 15:17:32 2017 +0100
@@ -96,8 +96,19 @@
 module:hook_stanza(xmlns_sasl, "failure", function (session, stanza)
 	if session.type ~= "s2sout_unauthed" or session.external_auth ~= "attempting" then return; end
 
-	module:log("info", "SASL EXTERNAL with %s failed", session.to_host)
-	-- TODO: Log the failure reason
+	local text = stanza:get_child_text("text");
+	local condition = "unknown-condition";
+	for child in stanza:childtags() do
+		if child.name ~= "text" then
+			condition = child.name;
+			break;
+		end
+	end
+	if text and condition then
+		condition = connection .. ": " .. text;
+	end
+	module:log("info", "SASL EXTERNAL with %s failed: %s", session.to_host, condition);
+
 	session.external_auth = "failed"
 end, 500)
 
# HG changeset patch
# User Kim Alvefur <zash@zash.se>
# Date 1490311549 -3600
#      Fri Mar 24 00:25:49 2017 +0100
# Node ID 57060d0cee4b906ccc307f145ab3f53ba901a94c
# Parent  6940d6db970be1382e80395f1a5f97d48711abaf
mod_disco: Correctly set the 'node' attr (fixes #449)

diff -r 6940d6db970b -r 57060d0cee4b plugins/mod_disco.lua
--- a/plugins/mod_disco.lua	Thu Mar 02 15:17:32 2017 +0100
+++ b/plugins/mod_disco.lua	Fri Mar 24 00:25:49 2017 +0100
@@ -99,7 +99,7 @@
 	local node = stanza.tags[1].attr.node;
 	if node and node ~= "" and node ~= "http://prosody.im#"..get_server_caps_hash() then return; end -- TODO fire event?
 	local reply_query = get_server_disco_info();
-	reply_query.node = node;
+	reply_query.attr.node = node;
 	local reply = st.reply(stanza):add_child(reply_query);
 	origin.send(reply);
 	return true;
# HG changeset patch
# User Kim Alvefur <zash@zash.se>
# Date 1492458006 -7200
#      Mon Apr 17 21:40:06 2017 +0200
# Node ID 8d1fd6d34bda2d74872f402f66e35888e2e316b8
# Parent  57060d0cee4b906ccc307f145ab3f53ba901a94c
mod_bosh: Update session.conn to point to the current connection (fixes #890)

diff -r 57060d0cee4b -r 8d1fd6d34bda plugins/mod_bosh.lua
--- a/plugins/mod_bosh.lua	Fri Mar 24 00:25:49 2017 +0100
+++ b/plugins/mod_bosh.lua	Mon Apr 17 21:40:06 2017 +0200
@@ -247,7 +247,7 @@
 		-- New session
 		sid = new_uuid();
 		local session = {
-			type = "c2s_unauthed", conn = {}, sid = sid, rid = tonumber(attr.rid)-1, host = attr.to,
+			type = "c2s_unauthed", conn = request.conn, sid = sid, rid = tonumber(attr.rid)-1, host = attr.to,
 			bosh_version = attr.ver, bosh_wait = math_min(attr.wait, bosh_max_wait), streamid = sid,
 			bosh_hold = BOSH_DEFAULT_HOLD, bosh_max_inactive = BOSH_DEFAULT_INACTIVITY,
 			requests = { }, send_buffer = {}, reset_stream = bosh_reset_stream,
@@ -316,6 +316,8 @@
 		context.notopen = nil;
 		return;
 	end
+
+	session.conn = request.conn;
 	
 	if session.rid then
 		local rid = tonumber(attr.rid);
# HG changeset patch
# User Kim Alvefur <zash@zash.se>
# Date 1495423931 -7200
#      Mon May 22 05:32:11 2017 +0200
# Node ID 2c65f8be38aabe3307101d8bed3f61ce6adde671
# Parent  8d1fd6d34bda2d74872f402f66e35888e2e316b8
net.dns: Simplify expiry calculation (fixes #919)

diff -r 8d1fd6d34bda -r 2c65f8be38aa net/dns.lua
--- a/net/dns.lua	Mon Apr 17 21:40:06 2017 +0200
+++ b/net/dns.lua	Mon May 22 05:32:11 2017 +0200
@@ -137,9 +137,7 @@
 	time = time or socket.gettime();
 	for i,rr in ipairs(rrs) do
 		if rr.tod then
-			-- rr.tod = rr.tod - 50    -- accelerated decripitude
-			rr.ttl = math.floor(rr.tod - time);
-			if rr.ttl <= 0 then
+			if rr.tod < time then
 				rrs[rr[rr.type:lower()]] = nil;
 				table.remove(rrs, i);
 				return prune(rrs, time, soft); -- Re-iterate
@@ -515,11 +513,7 @@
 	rr.ttl      = 0x10000*self:word() + self:word();
 	rr.rdlength = self:word();
 
-	if rr.ttl <= 0 then
-		rr.tod = self.time + 30;
-	else
-		rr.tod = self.time + rr.ttl;
-	end
+	rr.tod = self.time + rr.ttl;
 
 	local remember = self.offset;
 	local rr_parser = self[dns.type[rr.type]];
# HG changeset patch
# User Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
# Date 1495891423 -3600
#      Sat May 27 14:23:43 2017 +0100
# Node ID 8e26672df704269911cc806a9571d53b5e9fcbcb
# Parent  2c65f8be38aabe3307101d8bed3f61ce6adde671
mod_watchregistrations: Return the pointer to the root of the stanza, fixes #922.

diff -r 2c65f8be38aa -r 8e26672df704 plugins/mod_watchregistrations.lua
--- a/plugins/mod_watchregistrations.lua	Mon May 22 05:32:11 2017 +0200
+++ b/plugins/mod_watchregistrations.lua	Sat May 27 14:23:43 2017 +0100
@@ -21,7 +21,8 @@
 		:tag("body")
 			:text(registration_notification:gsub("%$(%w+)", function (v)
 				return user[v] or user.session and user.session[v] or nil;
-			end));
+			end))
+		:up();
 	for jid in registration_watchers do
 		module:log("debug", "Notifying %s", jid);
 		message.attr.to = jid;
# HG changeset patch
# User Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
# Date 1495896810 -3600
#      Sat May 27 15:53:30 2017 +0100
# Node ID f0d847316723ddd4c453c0478adca00221122479
# Parent  8e26672df704269911cc806a9571d53b5e9fcbcb
mod_disco: Add an account/registered identity on subscribed accounts, fixes #826.

diff -r 8e26672df704 -r f0d847316723 plugins/mod_disco.lua
--- a/plugins/mod_disco.lua	Sat May 27 14:23:43 2017 +0100
+++ b/plugins/mod_disco.lua	Sat May 27 15:53:30 2017 +0100
@@ -138,6 +138,7 @@
 	if not stanza.attr.to or is_contact_subscribed(username, module.host, jid_bare(stanza.attr.from)) then
 		local reply = st.reply(stanza):tag('query', {xmlns='http://jabber.org/protocol/disco#info'});
 		if not reply.attr.from then reply.attr.from = origin.username.."@"..origin.host; end -- COMPAT To satisfy Psi when querying own account
+		reply:tag('identity', {category='account', type='registered'}):up();
 		module:fire_event("account-disco-info", { origin = origin, stanza = reply });
 		origin.send(reply);
 		return true;
# HG changeset patch
# User Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
# Date 1496173942 -3600
#      Tue May 30 20:52:22 2017 +0100
# Node ID 5566f82ffea413146a3d10d0746a940fa102b994
# Parent  f0d847316723ddd4c453c0478adca00221122479
mod_welcome: Return the pointer to the root of the stanza, fixes a bug similar to #922.

diff -r f0d847316723 -r 5566f82ffea4 plugins/mod_welcome.lua
--- a/plugins/mod_welcome.lua	Sat May 27 15:53:30 2017 +0100
+++ b/plugins/mod_welcome.lua	Tue May 30 20:52:22 2017 +0100
@@ -14,8 +14,8 @@
 module:hook("user-registered",
 	function (user)
 		local welcome_stanza =
-			st.message({ to = user.username.."@"..user.host, from = host })
-				:tag("body"):text(welcome_text:gsub("$(%w+)", user));
+			st.message({ to = user.username.."@"..user.host, from = host },
+				welcome_text:gsub("$(%w+)", user));
 		module:send(welcome_stanza);
 		module:log("debug", "Welcomed user %s@%s", user.username, user.host);
 	end);
# HG changeset patch
# User Kim Alvefur <zash@zash.se>
# Date 1497364607 -7200
#      Tue Jun 13 16:36:47 2017 +0200
# Node ID a55eb6c3b45c196ee8df7bed941b0ff2fdfb4815
# Parent  5566f82ffea413146a3d10d0746a940fa102b994
net.dns: Prevent answers from immediately expiring even if TTL=0 (see #919)

diff -r 5566f82ffea4 -r a55eb6c3b45c net/dns.lua
--- a/net/dns.lua	Tue May 30 20:52:22 2017 +0100
+++ b/net/dns.lua	Tue Jun 13 16:36:47 2017 +0200
@@ -513,7 +513,7 @@
 	rr.ttl      = 0x10000*self:word() + self:word();
 	rr.rdlength = self:word();
 
-	rr.tod = self.time + rr.ttl;
+	rr.tod = self.time + math.min(rr.ttl, 1);
 
 	local remember = self.offset;
 	local rr_parser = self[dns.type[rr.type]];
# HG changeset patch
# User Kim Alvefur <zash@zash.se>
# Date 1499530905 -7200
#      Sat Jul 08 18:21:45 2017 +0200
# Node ID 67a9d2de2300dc259decc3251646219e6903e16e
# Parent  a55eb6c3b45c196ee8df7bed941b0ff2fdfb4815
mod_saslauth: Use correct varible name (thanks Roi)

diff -r a55eb6c3b45c -r 67a9d2de2300 plugins/mod_saslauth.lua
--- a/plugins/mod_saslauth.lua	Tue Jun 13 16:36:47 2017 +0200
+++ b/plugins/mod_saslauth.lua	Sat Jul 08 18:21:45 2017 +0200
@@ -105,7 +105,7 @@
 		end
 	end
 	if text and condition then
-		condition = connection .. ": " .. text;
+		condition = condition .. ": " .. text;
 	end
 	module:log("info", "SASL EXTERNAL with %s failed: %s", session.to_host, condition);
 
# HG changeset patch
# User Kim Alvefur <zash@zash.se>
# Date 1500981391 -7200
#      Tue Jul 25 13:16:31 2017 +0200
# Node ID adfffc5b4e2aa15bc062479875998aa4ce0272db
# Parent  67a9d2de2300dc259decc3251646219e6903e16e
util.dependencies: Add compatibility code for LuaSocket no longer exporting as a global

diff -r 67a9d2de2300 -r adfffc5b4e2a util/dependencies.lua
--- a/util/dependencies.lua	Sat Jul 08 18:21:45 2017 +0200
+++ b/util/dependencies.lua	Tue Jul 25 13:16:31 2017 +0200
@@ -79,6 +79,9 @@
 				["Source"] = "http://www.tecgraf.puc-rio.br/~diego/professional/luasocket/";
 			});
 		fatal = true;
+	elseif not _G.socket then
+		-- COMPAT Code expecting LuaSocket to export as a global
+		_G.socket = socket;
 	end
 	
 	local lfs, err = softreq "lfs"
# HG changeset patch
# User Kim Alvefur <zash@zash.se>
# Date 1500981949 -7200
#      Tue Jul 25 13:25:49 2017 +0200
# Node ID 776789a98047b6ccd4c536c4da295ea78ff7e829
# Parent  adfffc5b4e2aa15bc062479875998aa4ce0272db
util.dependencies: Add comment about LuaSec compat

diff -r adfffc5b4e2a -r 776789a98047 util/dependencies.lua
--- a/util/dependencies.lua	Tue Jul 25 13:16:31 2017 +0200
+++ b/util/dependencies.lua	Tue Jul 25 13:25:49 2017 +0200
@@ -103,6 +103,7 @@
 				["Source"] = "http://www.inf.puc-rio.br/~brunoos/luasec/";
 			}, "SSL/TLS support will not be available");
 	elseif not _G.ssl then
+		-- COMPAT Code expecting LuaSec to export as a global (see #749)
 		_G.ssl = ssl;
 		_G.ssl.context = require "ssl.context";
 		_G.ssl.x509 = softreq "ssl.x509";