Changeset

893:cec476fcc19f

Automated merge with http://waqas.ath.cx:8000/
author Matthew Wild <mwild1@gmail.com>
date Sun, 08 Mar 2009 03:38:22 +0000
parents 892:2128891180b7 (current diff) 887:eef21d7bbe04 (diff)
children 895:43f7653fb662 896:2c0b9e3c11c3
files
diffstat 5 files changed, 31 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/net/adns.lua	Sun Mar 08 05:03:22 2009 +0500
+++ b/net/adns.lua	Sun Mar 08 03:38:22 2009 +0000
@@ -29,7 +29,7 @@
 	newconn.handler, newconn._socket = server.wrapclient(sock, "dns", 53, listener);
 	newconn.handler.settimeout = function () end
 	newconn.handler.setsockname = function (_, ...) return sock:setsockname(...); end
-	newconn.handler.setpeername = function (_, ...) return sock:setpeername(...); end
+	newconn.handler.setpeername = function (_, ...) local ret = sock:setpeername(...); _.setsend(sock.send); return ret; end
 	newconn.handler.connect = function (_, ...) return sock:connect(...) end	
 	newconn.handler.send = function (_, data) return _.write(data) end	
 	return newconn.handler;
--- a/net/server.lua	Sun Mar 08 05:03:22 2009 +0500
+++ b/net/server.lua	Sun Mar 08 03:38:22 2009 +0000
@@ -386,6 +386,10 @@
         pattern = new or pattern
         return pattern
     end
+    handler.setsend = function ( newsend )
+        send = newsend or send
+        return send
+    end
     handler.bufferlen = function( readlen, sendlen )
         maxsendlen = sendlen or maxsendlen
         maxreadlen = readlen or maxreadlen
--- a/plugins/mod_saslauth.lua	Sun Mar 08 05:03:22 2009 +0500
+++ b/plugins/mod_saslauth.lua	Sun Mar 08 03:38:22 2009 +0000
@@ -17,6 +17,7 @@
 local tostring = tostring;
 local jid_split = require "util.jid".split
 local md5 = require "util.hashes".md5;
+local config = require "core.configmanager";
 
 local log = require "util.logger".init("mod_saslauth");
 
@@ -106,7 +107,9 @@
 				-- TODO: Provide PLAIN only if TLS is active, this is a SHOULD from the introduction of RFC 4616. This behavior could be overridden via configuration but will issuing a warning or so.
 					features:tag("mechanism"):text("PLAIN"):up();
 					features:tag("mechanism"):text("DIGEST-MD5"):up();
-					features:tag("mechanism"):text("ANONYMOUS"):up();
+					if config.get(session.host or "*", "core", "sasl_anonymous") then
+						features:tag("mechanism"):text("ANONYMOUS"):up();
+					end
 				features:up();
 			else
 				features:tag("bind", bind_attr):tag("required"):up():up();
--- a/prosody	Sun Mar 08 05:03:22 2009 +0500
+++ b/prosody	Sun Mar 08 03:38:22 2009 +0000
@@ -32,10 +32,6 @@
 
 
 config = require "core.configmanager"
-log = require "util.logger".init("general");
-
--- Disable log output, needs to read from config
--- require "util.logger".setwriter(function () end);
 
 do
 	-- TODO: Check for other formats when we add support for them
@@ -63,6 +59,11 @@
 	end
 end
 
+log = require "util.logger".init("general");
+
+-- Disable log output, needs to read from config
+-- require "util.logger".setwriter(function () end);
+
 require "util.dependencies"
 
 local server = require "net.server"
--- a/util/logger.lua	Sun Mar 08 05:03:22 2009 +0500
+++ b/util/logger.lua	Sun Mar 08 03:38:22 2009 +0000
@@ -13,8 +13,13 @@
 local tostring = tostring;
 local math_max = math.max;
 
+local config = require "core.configmanager";
+local log_sources = config.get("*", "core", "log_sources");
+
 local getstyle, getstring = require "util.termcolours".getstyle, require "util.termcolours".getstring;
 local do_pretty_printing = not os.getenv("WINDIR");
+local find = string.find;
+local ipairs = ipairs;
 
 module "logger"
 
@@ -32,6 +37,18 @@
 local outfunction = nil;
 
 function init(name)
+	if log_sources then
+		local log_this = false;
+		for _, source in ipairs(log_sources) do
+			if find(name, source) then 
+				log_this = true;
+				break;
+			end
+		end
+		
+		if not log_this then return function () end end
+	end
+	
 	--name = nil; -- While this line is not commented, will automatically fill in file/line number info
 	local namelen = #name;
 	return 	function (level, message, ...)