From 9d379a1dae9a6b46a4e11a13ccdcece4f8c60679 Mon Sep 17 00:00:00 2001
From: Matthew Wild <mwild1@gmail.com>
Date: Mon, 18 Jun 2012 16:57:46 +0100
Subject: util.sasl: Make registerMechanism a public function

---
 util/sasl.lua | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/util/sasl.lua b/util/sasl.lua
index 17d10b80..afb3861b 100644
--- a/util/sasl.lua
+++ b/util/sasl.lua
@@ -35,7 +35,7 @@ local mechanisms = {};
 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.");
-- 
cgit v1.2.3


From 0c7777aeb6c1b668e2b9e1fddf036dcb27f6db46 Mon Sep 17 00:00:00 2001
From: Kim Alvefur <zash@zash.se>
Date: Tue, 3 Jul 2012 15:43:46 +0200
Subject: util.pposix: Add setenv()

---
 util-src/pposix.c | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/util-src/pposix.c b/util-src/pposix.c
index dae48390..a5a89d55 100644
--- a/util-src/pposix.c
+++ b/util-src/pposix.c
@@ -581,6 +581,37 @@ int lc_uname(lua_State* L)
 	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 @@ int luaopen_util_pposix(lua_State *L)
 
 		{ "uname", lc_uname },
 
+		{ "setenv", lc_setenv },
+
 		{ NULL, NULL }
 	};
 
-- 
cgit v1.2.3


From 92a51d69e913aca81c39b98a9c79751ee97f24e8 Mon Sep 17 00:00:00 2001
From: Kim Alvefur <zash@zash.se>
Date: Tue, 3 Jul 2012 15:56:32 +0200
Subject: prosodyctl: Fix typo

---
 prosodyctl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/prosodyctl b/prosodyctl
index 45b5604a..0e733d07 100755
--- a/prosodyctl
+++ b/prosodyctl
@@ -688,7 +688,7 @@ function cert_commands.key(arg)
 		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
 
-- 
cgit v1.2.3


From ae0fdd43a4248bda8d1f3d01ab592dff0412b574 Mon Sep 17 00:00:00 2001
From: Kim Alvefur <zash@zash.se>
Date: Thu, 5 Jul 2012 17:58:47 +0200
Subject: util.stanza: Make stanza:childtags() behave like :get_child()

---
 util/stanza.lua | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/util/stanza.lua b/util/stanza.lua
index 1449f707..5c430f1d 100644
--- a/util/stanza.lua
+++ b/util/stanza.lua
@@ -133,14 +133,14 @@ function stanza_mt:children()
 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
-- 
cgit v1.2.3


From 538620add408ab838ecd6271ea18f5dafab199a0 Mon Sep 17 00:00:00 2001
From: Matthew Wild <mwild1@gmail.com>
Date: Mon, 25 Jun 2012 00:16:08 +0100
Subject: util.logger: Remove some redundant code

---
 util/logger.lua | 2 --
 1 file changed, 2 deletions(-)

diff --git a/util/logger.lua b/util/logger.lua
index 4fadb4b9..26206d4d 100644
--- a/util/logger.lua
+++ b/util/logger.lua
@@ -23,8 +23,6 @@ function init(name)
 	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, ...);
-- 
cgit v1.2.3


From c0dcd19718cf520511c8986a5cb73d3de9c49a4c Mon Sep 17 00:00:00 2001
From: Matthew Wild <mwild1@gmail.com>
Date: Wed, 4 Jul 2012 23:43:18 +0100
Subject: TODO: Add statistics

---
 TODO | 1 +
 1 file changed, 1 insertion(+)

diff --git a/TODO b/TODO
index a49bb52b..40e775a3 100644
--- a/TODO
+++ b/TODO
@@ -5,5 +5,6 @@
 - Web interface
 
 == 1.0 ==
+- Statistics
 - Clustering
 - World domination
-- 
cgit v1.2.3


From 02dc79e546ce19f54b858c102943ee6d80eec584 Mon Sep 17 00:00:00 2001
From: Matthew Wild <mwild1@gmail.com>
Date: Wed, 4 Jul 2012 23:44:13 +0100
Subject: mod_saslauth: Pass session to usermanager.get_sasl_handler()

---
 plugins/mod_saslauth.lua | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/plugins/mod_saslauth.lua b/plugins/mod_saslauth.lua
index 804db5f9..f6abd3b8 100644
--- a/plugins/mod_saslauth.lua
+++ b/plugins/mod_saslauth.lua
@@ -208,7 +208,7 @@ module:hook("stanza/urn:ietf:params:xml:ns:xmpp-sasl:auth", function(event)
 		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 @@ module:hook("stream-features", function(event)
 		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
-- 
cgit v1.2.3