Changeset

2744:887d3a0e1e4e

Merge with trunk
author Matthew Wild <mwild1@gmail.com>
date Fri, 05 Mar 2010 18:35:23 +0000
parents 2743:fd1d4d96a708 (diff) 2737:2251f8898900 (current diff)
children 2879:94299e640ed0 2997:6ccaefea80ec
files
diffstat 3 files changed, 14 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/core/certmanager.lua	Tue Mar 02 14:08:32 2010 +0500
+++ b/core/certmanager.lua	Fri Mar 05 18:35:23 2010 +0000
@@ -3,7 +3,7 @@
 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 @@
 					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
--- a/net/dns.lua	Tue Mar 02 14:08:32 2010 +0500
+++ b/net/dns.lua	Fri Mar 05 18:35:23 2010 +0000
@@ -532,14 +532,19 @@
 		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 @@
 				set(self.wanted, q.class, q.type, q.name, nil);
 			end
 		end
-	end 
+	end
 
 	return response;
 end
--- a/net/server_select.lua	Tue Mar 02 14:08:32 2010 +0500
+++ b/net/server_select.lua	Fri Mar 05 18:35:23 2010 +0000
@@ -430,7 +430,7 @@
 	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