From 6a6318f92488d69d5bb003c2d0b91c54cc9a4b69 Mon Sep 17 00:00:00 2001
From: Waqas Hussain <waqas20@gmail.com>
Date: Tue, 1 Nov 2011 23:41:32 +0500
Subject: util.jid: Added escape() and unescape().

---
 util/jid.lua | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/util/jid.lua b/util/jid.lua
index 069817c6..4c4371d8 100644
--- a/util/jid.lua
+++ b/util/jid.lua
@@ -13,6 +13,16 @@ local nodeprep = require "util.encodings".stringprep.nodeprep;
 local nameprep = require "util.encodings".stringprep.nameprep;
 local resourceprep = require "util.encodings".stringprep.resourceprep;
 
+local escapes = {
+	[" "] = "\\20"; ['"'] = "\\22";
+	["&"] = "\\26"; ["'"] = "\\27";
+	["/"] = "\\2f"; [":"] = "\\3a";
+	["<"] = "\\3c"; [">"] = "\\3e";
+	["@"] = "\\40"; ["\\"] = "\\5c";
+};
+local unescapes = {};
+for k,v in pairs(escapes) do unescapes[v] = k; end
+
 module "jid"
 
 local function _split(jid)
@@ -91,4 +101,7 @@ function compare(jid, acl)
 	return false
 end
 
+function escape(s) return s and (s:gsub(".", escapes)); end
+function unescape(s) return s and (s:gsub("\\%x%x", unescapes)); end
+
 return _M;
-- 
cgit v1.2.3


From 163e9d4bef7a7affe4de50816b61fa729c1802b3 Mon Sep 17 00:00:00 2001
From: Waqas Hussain <waqas20@gmail.com>
Date: Tue, 1 Nov 2011 23:57:42 +0500
Subject: certmanager: More informative logging.

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

diff --git a/core/certmanager.lua b/core/certmanager.lua
index 7b8ca9e1..8b82ac47 100644
--- a/core/certmanager.lua
+++ b/core/certmanager.lua
@@ -75,9 +75,9 @@ function create_context(host, mode, user_ssl_config)
 			else
 				reason = "Reason: "..tostring(reason):lower();
 			end
-			log("error", "SSL/TLS: Failed to load %s: %s", file, reason);
+			log("error", "SSL/TLS: Failed to load %s: %s (host: %s)", file, reason, host);
 		else
-			log("error", "SSL/TLS: Error initialising for host %s: %s", host, err );
+			log("error", "SSL/TLS: Error initialising for host %s: %s (host: %s)", host, err, host);
 		end
 	end
 	return ctx, err;
-- 
cgit v1.2.3


From 464f525c81423ff7b8d6814fceeb0657b8cbcc29 Mon Sep 17 00:00:00 2001
From: Waqas Hussain <waqas20@gmail.com>
Date: Wed, 2 Nov 2011 00:00:42 +0500
Subject: prosody: Ensure prosody.paths.config is never nil
 (certmanager.create_context fails otherwise).

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

diff --git a/prosody b/prosody
index b354089b..e18b4e61 100755
--- a/prosody
+++ b/prosody
@@ -203,7 +203,7 @@ function init_global_state()
 		-- path1;path2;path3;defaultpath...
 		CFG_PLUGINDIR = table.concat(custom_plugin_paths, path_sep)..path_sep..(CFG_PLUGINDIR or "plugins");
 	end
-	prosody.paths = { source = CFG_SOURCEDIR, config = CFG_CONFIGDIR, 
+	prosody.paths = { source = CFG_SOURCEDIR, config = CFG_CONFIGDIR or ".", 
 	                  plugins = CFG_PLUGINDIR or "plugins", data = data_path };
 
 	prosody.arg = _G.arg;
-- 
cgit v1.2.3