aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2010-03-05 18:35:02 +0000
committerMatthew Wild <mwild1@gmail.com>2010-03-05 18:35:02 +0000
commitf3d2b07f3f93458d5b5c348af576c7d2f317f16e (patch)
treec58364b5a626dd3ebe79dc4c3b37a73bd0e1076d
parent651f61921bc5a867fdba3337ae7541fa4feccf7d (diff)
parenta201db970b44ac05204b19aa1c3fa973ea6e2e2a (diff)
downloadprosody-f3d2b07f3f93458d5b5c348af576c7d2f317f16e.tar.gz
prosody-f3d2b07f3f93458d5b5c348af576c7d2f317f16e.zip
Merge with 0.7
-rw-r--r--core/certmanager.lua6
-rw-r--r--net/dns.lua13
-rw-r--r--net/server_select.lua2
3 files changed, 14 insertions, 7 deletions
diff --git a/core/certmanager.lua b/core/certmanager.lua
index c2db63fe..fa920b91 100644
--- a/core/certmanager.lua
+++ b/core/certmanager.lua
@@ -3,7 +3,7 @@ local log = require "util.logger".init("certmanager");
local ssl = ssl;
local ssl_newcontext = ssl and ssl.newcontext;
-local setmetatable = setmetatable;
+local setmetatable, tostring = setmetatable, tostring;
local prosody = prosody;
@@ -39,8 +39,10 @@ function create_context(host, mode, config)
reason = "Check that the path is correct, and the file exists.";
elseif reason == "system lib" then
reason = "Previous error (see logs), or other system error.";
+ elseif reason == "(null)" or not reason then
+ reason = "Check that the file exists and the permissions are correct";
else
- reason = "Reason: "..tostring(reason or "unknown"):lower();
+ reason = "Reason: "..tostring(reason):lower();
end
log("error", "SSL/TLS: Failed to load %s: %s", file, reason);
else
diff --git a/net/dns.lua b/net/dns.lua
index ca5f3c62..8855cc61 100644
--- a/net/dns.lua
+++ b/net/dns.lua
@@ -532,14 +532,19 @@ function resolver:adddefaultnameservers() -- - - - - adddefaultnameservers
if not self.server or #self.server == 0 then
-- TODO log warning about no nameservers, adding opendns servers as fallback
self:addnameserver("208.67.222.222");
- self:addnameserver("208.67.220.220") ;
+ self:addnameserver("208.67.220.220");
end
else -- posix
local resolv_conf = io.open("/etc/resolv.conf");
if resolv_conf then
for line in resolv_conf:lines() do
- local address = line:gsub("#.*$", ""):match('^%s*nameserver%s+(%d+%.%d+%.%d+%.%d+)%s*$');
- if address then self:addnameserver(address) end
+ line = line:gsub("#.*$", "")
+ :match('^%s*nameserver%s+(.*)%s*$');
+ if line then
+ line:gsub("%f[%d.](%d+%.%d+%.%d+%.%d+)%f[^%d.]", function (address)
+ self:addnameserver(address)
+ end);
+ end
end
end
if not self.server or #self.server == 0 then
@@ -796,7 +801,7 @@ function resolver:feed(sock, packet)
set(self.wanted, q.class, q.type, q.name, nil);
end
end
- end
+ end
return response;
end
diff --git a/net/server_select.lua b/net/server_select.lua
index c4a1f19a..49cbe25d 100644
--- a/net/server_select.lua
+++ b/net/server_select.lua
@@ -430,7 +430,7 @@ wrapconnection = function( server, listeners, socket, ip, serverport, clientport
end
local _readbuffer = function( ) -- this function reads data
local buffer, err, part = receive( socket, pattern ) -- receive buffer with "pattern"
- if not err or (err == "wantread" or err == "timeout") or string_len(part) > 0 then -- received something
+ if not err or (err == "wantread" or err == "timeout") or (part and string_len(part) > 0) then -- received something
local buffer = buffer or part or ""
local len = string_len( buffer )
if len > maxreadlen then