Changeset

4940:39781d4d3173

Merge 0.9->trunk
author Matthew Wild <mwild1@gmail.com>
date Thu, 05 Jul 2012 17:40:12 +0100
parents 4932:212e81ac6ebb (current diff) 4939:0545a574667b (diff)
children 4942:716db7d94481
files
diffstat 7 files changed, 40 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/TODO	Thu Jul 05 00:15:49 2012 +0200
+++ b/TODO	Thu Jul 05 17:40:12 2012 +0100
@@ -5,5 +5,6 @@
 - Web interface
 
 == 1.0 ==
+- Statistics
 - Clustering
 - World domination
--- a/plugins/mod_saslauth.lua	Thu Jul 05 00:15:49 2012 +0200
+++ b/plugins/mod_saslauth.lua	Thu Jul 05 17:40:12 2012 +0100
@@ -208,7 +208,7 @@
 		session.sasl_handler = nil; -- allow starting a new SASL negotiation before completing an old one
 	end
 	if not session.sasl_handler then
-		session.sasl_handler = usermanager_get_sasl_handler(module.host);
+		session.sasl_handler = usermanager_get_sasl_handler(module.host, session);
 	end
 	local mechanism = stanza.attr.mechanism;
 	if not session.secure and (secure_auth_only or (mechanism == "PLAIN" and not allow_unencrypted_plain_auth)) then
@@ -246,7 +246,7 @@
 		if secure_auth_only and not origin.secure then
 			return;
 		end
-		origin.sasl_handler = usermanager_get_sasl_handler(module.host);
+		origin.sasl_handler = usermanager_get_sasl_handler(module.host, origin);
 		local mechanisms = st.stanza("mechanisms", mechanisms_attr);
 		for mechanism in pairs(origin.sasl_handler:mechanisms()) do
 			if mechanism ~= "PLAIN" or origin.secure or allow_unencrypted_plain_auth then
--- a/prosodyctl	Thu Jul 05 00:15:49 2012 +0200
+++ b/prosodyctl	Thu Jul 05 17:40:12 2012 +0100
@@ -688,7 +688,7 @@
 		show_message("There was a problem, see OpenSSL output");
 	else
 		show_usage("cert key HOSTNAME <bits>", "Generates a RSA key named HOSTNAME.key\n "
-		.."Promps for a key size if none given")
+		.."Prompts for a key size if none given")
 	end
 end
 
--- a/util-src/pposix.c	Thu Jul 05 00:15:49 2012 +0200
+++ b/util-src/pposix.c	Thu Jul 05 17:40:12 2012 +0100
@@ -581,6 +581,37 @@
 	return 1;
 }
 
+int lc_setenv(lua_State* L)
+{
+	const char *var = luaL_checkstring(L, 1);
+	const char *value;
+
+	/* If the second argument is nil or nothing, unset the var */
+	if(lua_isnoneornil(L, 2))
+	{
+		if(unsetenv(var) != 0)
+		{
+			lua_pushnil(L);
+			lua_pushstring(L, strerror(errno));
+			return 2;
+		}
+		lua_pushboolean(L, 1);
+		return 1;
+	}
+
+	value = luaL_checkstring(L, 2);
+
+	if(setenv(var, value, 1) != 0)
+	{
+		lua_pushnil(L);
+		lua_pushstring(L, strerror(errno));
+		return 2;
+	}
+
+	lua_pushboolean(L, 1);
+	return 1;
+}
+
 /* Register functions */
 
 int luaopen_util_pposix(lua_State *L)
@@ -612,6 +643,8 @@
 
 		{ "uname", lc_uname },
 
+		{ "setenv", lc_setenv },
+
 		{ NULL, NULL }
 	};
 
--- a/util/logger.lua	Thu Jul 05 00:15:49 2012 +0200
+++ b/util/logger.lua	Thu Jul 05 17:40:12 2012 +0100
@@ -23,8 +23,6 @@
 	local log_warn = make_logger(name, "warn");
 	local log_error = make_logger(name, "error");
 
-	--name = nil; -- While this line is not commented, will automatically fill in file/line number info
-	local namelen = #name;
 	return function (level, message, ...)
 			if level == "debug" then
 				return log_debug(message, ...);
--- a/util/sasl.lua	Thu Jul 05 00:15:49 2012 +0200
+++ b/util/sasl.lua	Thu Jul 05 17:40:12 2012 +0100
@@ -35,7 +35,7 @@
 local backend_mechanism = {};
 
 -- register a new SASL mechanims
-local function registerMechanism(name, backends, f)
+function registerMechanism(name, backends, f)
 	assert(type(name) == "string", "Parameter name MUST be a string.");
 	assert(type(backends) == "string" or type(backends) == "table", "Parameter backends MUST be either a string or a table.");
 	assert(type(f) == "function", "Parameter f MUST be a function.");
--- a/util/stanza.lua	Thu Jul 05 00:15:49 2012 +0200
+++ b/util/stanza.lua	Thu Jul 05 17:40:12 2012 +0100
@@ -133,14 +133,14 @@
 end
 
 function stanza_mt:childtags(name, xmlns)
-	xmlns = xmlns or self.attr.xmlns;
 	local tags = self.tags;
 	local start_i, max_i = 1, #tags;
 	return function ()
 		for i = start_i, max_i do
 			local v = tags[i];
 			if (not name or v.name == name)
-			and (not xmlns or xmlns == v.attr.xmlns) then
+			and ((not xmlns and self.attr.xmlns == v.attr.xmlns)
+				or v.attr.xmlns == xmlns) then
 				start_i = i+1;
 				return v;
 			end