From 9398ba77f3a9abf825b3e7b4e57c4a0d1252a106 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Thu, 3 Jul 2014 17:53:24 +0200 Subject: mod_register: get_child_text! (thanks Lloyd) --- plugins/mod_register.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/mod_register.lua b/plugins/mod_register.lua index 141a4997..3d7a068c 100644 --- a/plugins/mod_register.lua +++ b/plugins/mod_register.lua @@ -115,8 +115,8 @@ local function handle_registration_stanza(event) module:log("info", "User removed their account: %s@%s", username, host); module:fire_event("user-deregistered", { username = username, host = host, source = "mod_register", session = session }); else - local username = nodeprep(query:get_child("username"):get_text()); - local password = query:get_child("password"):get_text(); + local username = nodeprep(query:get_child_text("username")); + local password = query:get_child_text("password"); if username and password then if username == session.username then if usermanager_set_password(username, password, session.host) then -- cgit v1.2.3 From c93e0181f117120b39ad70820c7607f08646e25d Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Fri, 25 Jul 2014 12:08:07 +0100 Subject: net.dns: Ensure all pending requests get notified of a timeout when looking up a record (fix for d122420542fb) --- net/dns.lua | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/net/dns.lua b/net/dns.lua index 492bd1c5..906365ce 100644 --- a/net/dns.lua +++ b/net/dns.lua @@ -770,7 +770,7 @@ function resolver:query(qname, qtype, qclass) -- - - - - - - - - - -- query end end -- Tried everything, failed - self:cancel(qclass, qtype, qname, co, true); + self:cancel(qclass, qtype, qname); end end) end @@ -910,13 +910,13 @@ function resolver:feed(sock, packet, force) return response; end -function resolver:cancel(qclass, qtype, qname, co, call_handler) +function resolver:cancel(qclass, qtype, qname) local cos = get(self.wanted, qclass, qtype, qname); if cos then - if call_handler then - coroutine.resume(co); + for co in pairs(cos) do + if coroutine.status(co) == "suspended" then coroutine.resume(co); end end - cos[co] = nil; + set(self.wanted, qclass, qtype, qname, nil); end end -- cgit v1.2.3 From b3fd3b1c7be1a187655658cdf60f76a5cbb2464a Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Fri, 25 Jul 2014 12:54:31 +0100 Subject: net.dns: Remove unused obsolete code --- net/dns.lua | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/net/dns.lua b/net/dns.lua index 906365ce..89bd3564 100644 --- a/net/dns.lua +++ b/net/dns.lua @@ -745,7 +745,6 @@ function resolver:query(qname, qtype, qclass) -- - - - - - - - - - -- query -- remember which coroutine wants the answer if co then set(self.wanted, qclass, qtype, qname, co, true); - --set(self.yielded, co, qclass, qtype, qname, true); end local conn, err = self:getsocket(o.server) @@ -858,7 +857,6 @@ function resolver:receive(rset) -- - - - - - - - - - - - - - - - - receive local cos = get(self.wanted, q.class, q.type, q.name); if cos then for co in pairs(cos) do - set(self.yielded, co, q.class, q.type, q.name, nil); if coroutine.status(co) == "suspended" then coroutine.resume(co); end end set(self.wanted, q.class, q.type, q.name, nil); @@ -899,7 +897,6 @@ function resolver:feed(sock, packet, force) local cos = get(self.wanted, q.class, q.type, q.name); if cos then for co in pairs(cos) do - set(self.yielded, co, q.class, q.type, q.name, nil); if coroutine.status(co) == "suspended" then coroutine.resume(co); end end set(self.wanted, q.class, q.type, q.name, nil); @@ -1037,7 +1034,7 @@ end function dns.resolver () -- - - - - - - - - - - - - - - - - - - - - resolver -- this function seems to be redundant with resolver.new () - local r = { active = {}, cache = {}, unsorted = {}, wanted = {}, yielded = {}, best_server = 1 }; + local r = { active = {}, cache = {}, unsorted = {}, wanted = {}, best_server = 1 }; setmetatable (r, resolver); setmetatable (r.cache, cache_metatable); setmetatable (r.unsorted, { __mode = 'kv' }); -- cgit v1.2.3 From b9134d61df1554dbff3ab62391abe88e5da02c20 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Fri, 25 Jul 2014 13:59:17 +0200 Subject: mod_admin_telnet: Fix dns:(add,set)nameservers() --- plugins/mod_admin_telnet.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/mod_admin_telnet.lua b/plugins/mod_admin_telnet.lua index 6f02f030..671b6d89 100644 --- a/plugins/mod_admin_telnet.lua +++ b/plugins/mod_admin_telnet.lua @@ -1058,12 +1058,12 @@ function def_env.dns:lookup(name, typ, class) end function def_env.dns:addnameserver(...) - dns.addnameserver(...) + dns._resolver:addnameserver(...) return true end function def_env.dns:setnameserver(...) - dns.setnameserver(...) + dns._resolver:setnameserver(...) return true end -- cgit v1.2.3