From 775c721023130e7ced2abb28ec7ff3a035328253 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Thu, 24 Sep 2009 23:25:18 +0100 Subject: net.dns: Stricter matching of nameserver entries in resolv.conf --- net/dns.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/dns.lua b/net/dns.lua index da06ceaa..8448b7ca 100644 --- a/net/dns.lua +++ b/net/dns.lua @@ -507,7 +507,7 @@ function resolver:adddefaultnameservers () -- - - - - adddefaultnameservers local resolv_conf = io.open("/etc/resolv.conf"); if resolv_conf then for line in resolv_conf:lines() do - local address = string.match (line, '^%s*nameserver%s+(%d+%.%d+%.%d+%.%d+)') + local address = string.match (line, '^%s*nameserver%s+(%d+%.%d+%.%d+%.%d+)%s*$') if address then self:addnameserver (address) end end elseif os.getenv("WINDIR") then -- cgit v1.2.3 From 467f2e52aa1fe8399ce28e0c449cd44274f4f603 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Thu, 24 Sep 2009 23:44:13 +0100 Subject: mod_console: s2s:close: Use session:close() if that exists, otherwise just destroy the session --- plugins/mod_console.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/mod_console.lua b/plugins/mod_console.lua index b3963d6c..716c2525 100644 --- a/plugins/mod_console.lua +++ b/plugins/mod_console.lua @@ -496,7 +496,7 @@ function def_env.s2s:close(from, to) if not session then print("No outgoing connection from "..from.." to "..to) else - s2smanager.destroy_session(session); + (session.close or s2smanager.destroy_session)(session); count = count + 1; print("Closed outgoing session from "..from.." to "..to); end @@ -504,7 +504,7 @@ function def_env.s2s:close(from, to) -- Is an incoming connection for session in pairs(incoming_s2s) do if session.to_host == to and session.from_host == from then - s2smanager.destroy_session(session); + (session.close or s2smanager.destroy_session)(session); count = count + 1; end end -- cgit v1.2.3 From 9118f712274368d5794fb8b8a2831f678ae1c15b Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Thu, 24 Sep 2009 23:46:12 +0100 Subject: net.dns: Remove elements from the cache when expired so as to not leave holes in the array --- net/dns.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/net/dns.lua b/net/dns.lua index 8448b7ca..d6462031 100644 --- a/net/dns.lua +++ b/net/dns.lua @@ -95,7 +95,10 @@ local function prune (rrs, time, soft) -- - - - - - - - - - - - - - - prune if rr.tod then -- rr.tod = rr.tod - 50 -- accelerated decripitude rr.ttl = math.floor (rr.tod - time) - if rr.ttl <= 0 then rrs[i] = nil end + if rr.ttl <= 0 then + table.remove(rrs, i); + return prune(rrs, time, soft); -- Re-iterate + end elseif soft == 'soft' then -- What is this? I forget! assert (rr.ttl == 0) -- cgit v1.2.3