aboutsummaryrefslogtreecommitdiffstats
path: root/net/dns.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2009-08-18 13:47:21 +0100
committerMatthew Wild <mwild1@gmail.com>2009-08-18 13:47:21 +0100
commitfa96706886852a40f6b8404ffd0f3cd92a75968d (patch)
tree78b24bc8f668fbe92514f26f2a59e28b1c500409 /net/dns.lua
parent4b1f3c9e4ae2aaca4934660f5b5259ef46eea6f7 (diff)
downloadprosody-fa96706886852a40f6b8404ffd0f3cd92a75968d.tar.gz
prosody-fa96706886852a40f6b8404ffd0f3cd92a75968d.zip
net.dns: Automatically add nameserver 127.0.0.1 if /etc/resolv.conf missing or empty on a non-Windows system (thanks Louis Mamakos)
Diffstat (limited to 'net/dns.lua')
-rw-r--r--net/dns.lua9
1 files changed, 6 insertions, 3 deletions
diff --git a/net/dns.lua b/net/dns.lua
index 48c08218..ccb315de 100644
--- a/net/dns.lua
+++ b/net/dns.lua
@@ -509,9 +509,12 @@ function resolver:adddefaultnameservers () -- - - - - adddefaultnameservers
local address = string.match (line, 'nameserver%s+(%d+%.%d+%.%d+%.%d+)')
if address then self:addnameserver (address) end
end
- else -- FIXME correct for windows, using opendns nameservers for now
- self:addnameserver ("208.67.222.222")
- self:addnameserver ("208.67.220.220")
+ elseif os.getenv("WINDIR") then
+ self:addnameserver ("208.67.222.222")
+ self:addnameserver ("208.67.220.220")
+ end
+ if not self.server or #self.server == 0 then
+ self:addnameserver("127.0.0.1");
end
end