From 220a7eefbd70d08a4122ba8734ddd275e84568e3 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Wed, 9 Dec 2009 13:19:50 +0000 Subject: mod_vcard: Stricter matching of vcard stanzas with vcard_compatibility enabled, fixes intercepting stanzas to the full JID that it shouldn't --- plugins/mod_vcard.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/mod_vcard.lua b/plugins/mod_vcard.lua index 0efc1638..6bf82ee7 100644 --- a/plugins/mod_vcard.lua +++ b/plugins/mod_vcard.lua @@ -51,7 +51,7 @@ if module:get_option("vcard_compatibility") then module:hook("iq/full", function(data) local stanza = data.stanza; local payload = stanza.tags[1]; - if stanza.attr.type == "get" or stanza.attr.type == "set" and payload.name == "vCard" and payload.attr.xmlns == "vcard-temp" then + if stanza.attr.type == "get" and payload.name == "vCard" and payload.attr.xmlns == "vcard-temp" then return handle_vcard(data); end end, 1); -- cgit v1.2.3 From 73f760c8965fe46d90c9376bbb2e682c3873dc79 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Wed, 20 Jan 2010 02:44:38 +0000 Subject: net.adns: Trailing whitespace --- net/adns.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/adns.lua b/net/adns.lua index b0c9a625..bc38040b 100644 --- a/net/adns.lua +++ b/net/adns.lua @@ -67,8 +67,8 @@ function new_async_socket(sock, resolver) newconn.handler.settimeout = function () end newconn.handler.setsockname = function (_, ...) return sock:setsockname(...); end newconn.handler.setpeername = function (_, ...) peername = (...); local ret = sock:setpeername(...); _.setsend(sock.send); return ret; end - newconn.handler.connect = function (_, ...) return sock:connect(...) end - newconn.handler.send = function (_, data) _.write(data); return _.sendbuffer(); end + newconn.handler.connect = function (_, ...) return sock:connect(...) end + newconn.handler.send = function (_, data) _.write(data); return _.sendbuffer(); end return newconn.handler; end -- cgit v1.2.3 From 43052f325355c2c5b03540119f08c38022e0a452 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Thu, 25 Feb 2010 02:01:00 +0000 Subject: net.server_event: Add lock_read() method to connections --- net/server_event.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/net/server_event.lua b/net/server_event.lua index 3456fb9e..d041ae43 100644 --- a/net/server_event.lua +++ b/net/server_event.lua @@ -281,6 +281,10 @@ do self.nointerface, self.noreading, self.nowriting = nointerface, noreading, nowriting return nointerface, noreading, nowriting end + + function interface_mt:lock_read(switch) + return self:_lock(self.nointerface, switch, self.nowriting); + end function interface_mt:counter(c) if c then -- cgit v1.2.3 From 1ac7b7a3b7659d52221e382e32b5eec18722e27a Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Thu, 25 Feb 2010 17:52:33 +0000 Subject: s2smanager: Fix for the logic SRV record priority comparison (thanks darkrain) --- core/s2smanager.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/s2smanager.lua b/core/s2smanager.lua index 20d932e8..e37cac73 100644 --- a/core/s2smanager.lua +++ b/core/s2smanager.lua @@ -50,7 +50,9 @@ local incoming_s2s = incoming_s2s; module "s2smanager" -local function compare_srv_priorities(a,b) return a.priority < b.priority or a.weight < b.weight; end +function compare_srv_priorities(a,b) + return a.priority < b.priority or (a.priority == b.priority and a.weight > b.weight); +end local function bounce_sendq(session) local sendq = session.sendq; -- cgit v1.2.3 From f713f780454c2a67e67d316447ad9a5da88e5731 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Thu, 25 Feb 2010 17:53:27 +0000 Subject: s2smanager: Log and fail gracefully when unable to create socket for outgoing s2s connection (thanks foucault) --- core/s2smanager.lua | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/s2smanager.lua b/core/s2smanager.lua index e37cac73..bfa3069a 100644 --- a/core/s2smanager.lua +++ b/core/s2smanager.lua @@ -306,6 +306,11 @@ function make_connect(host_session, connect_host, connect_port) local from_host, to_host = host_session.from_host, host_session.to_host; local conn, handler = socket.tcp() + + if not conn then + log("warn", "Failed to create outgoing connection, system error: %s", handler); + return false, handler; + end conn:settimeout(0); local success, err = conn:connect(connect_host, connect_port); -- cgit v1.2.3 From cc932b9c970f5119b7a1ae08111814ff085b9f6d Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Thu, 25 Feb 2010 17:54:23 +0000 Subject: tests/test_core_s2smanager.lua: Fix to compare SRV weights correctly --- tests/test_core_s2smanager.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/test_core_s2smanager.lua b/tests/test_core_s2smanager.lua index 8635ed24..6a7ebcd0 100644 --- a/tests/test_core_s2smanager.lua +++ b/tests/test_core_s2smanager.lua @@ -30,18 +30,18 @@ function compare_srv_priorities(csp) assert_equal(csp(r3, r2), false); assert_equal(csp(r3, r3), false); assert_equal(csp(r3, r4), false); - assert_equal(csp(r3, r5), true); + assert_equal(csp(r3, r5), false); assert_equal(csp(r4, r1), false); assert_equal(csp(r4, r2), false); assert_equal(csp(r4, r3), false); assert_equal(csp(r4, r4), false); - assert_equal(csp(r4, r5), true); + assert_equal(csp(r4, r5), false); assert_equal(csp(r5, r1), false); assert_equal(csp(r5, r2), false); - assert_equal(csp(r5, r3), false); - assert_equal(csp(r5, r4), false); + assert_equal(csp(r5, r3), true); + assert_equal(csp(r5, r4), true); assert_equal(csp(r5, r5), false); end -- cgit v1.2.3