From c2c4f7fbc44b9df2873e62d7f9745ba864388e38 Mon Sep 17 00:00:00 2001
From: Kim Alvefur <zash@zash.se>
Date: Tue, 21 Mar 2017 12:06:52 +0100
Subject: mod_http_files: Use path variant of config option API for
 http_files_dir

---
 plugins/mod_http_files.lua | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/plugins/mod_http_files.lua b/plugins/mod_http_files.lua
index b9a84cd3..e477bafe 100644
--- a/plugins/mod_http_files.lua
+++ b/plugins/mod_http_files.lua
@@ -16,7 +16,7 @@ local stat = lfs.attributes;
 local build_path = require"socket.url".build_path;
 local path_sep = package.config:sub(1,1);
 
-local base_path = module:get_option_string("http_files_dir", module:get_option_string("http_path"));
+local base_path = module:get_option_path("http_files_dir", module:get_option_path("http_path"));
 local cache_size = module:get_option_number("http_files_cache_size", 128);
 local cache_max_file_size = module:get_option_number("http_files_cache_max_file_size", 4096);
 local dir_indices = module:get_option_array("http_index_files", { "index.html", "index.htm" });
-- 
cgit v1.2.3


From 593b5348efee34f9db46f20eb95415dbc4247e5b Mon Sep 17 00:00:00 2001
From: Kim Alvefur <zash@zash.se>
Date: Tue, 21 Mar 2017 12:08:29 +0100
Subject: mod_posix: Use path variant of config API for pidfile option

---
 plugins/mod_posix.lua | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/plugins/mod_posix.lua b/plugins/mod_posix.lua
index 0a6845ac..2103071a 100644
--- a/plugins/mod_posix.lua
+++ b/plugins/mod_posix.lua
@@ -80,7 +80,7 @@ local function write_pidfile()
 	if pidfile_handle then
 		remove_pidfile();
 	end
-	pidfile = module:get_option_string("pidfile");
+	pidfile = module:get_option_path("pidfile", nil, "data");
 	if pidfile then
 		local err;
 		local mode = stat(pidfile) and "r+" or "w+";
-- 
cgit v1.2.3


From 4a5b4067a983ad128e4f89d9b0039f30167a3522 Mon Sep 17 00:00:00 2001
From: Kim Alvefur <zash@zash.se>
Date: Tue, 21 Mar 2017 15:18:35 +0100
Subject: util.dependencies: Give APT command for installing lua-sec

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

diff --git a/util/dependencies.lua b/util/dependencies.lua
index 8c8e731c..de840241 100644
--- a/util/dependencies.lua
+++ b/util/dependencies.lua
@@ -93,7 +93,7 @@ local function check_dependencies()
 
 	if not ssl then
 		missingdep("LuaSec", {
-				["Debian/Ubuntu"] = "http://prosody.im/download/start#debian_and_ubuntu";
+				["Debian/Ubuntu"] = "sudo apt-get install lua-sec";
 				["luarocks"] = "luarocks install luasec";
 				["Source"] = "https://github.com/brunoos/luasec";
 			}, "SSL/TLS support will not be available");
-- 
cgit v1.2.3


From 932c6e1f445a6c3ba33ffdd11ba96b6e3a8b98e8 Mon Sep 17 00:00:00 2001
From: Kim Alvefur <zash@zash.se>
Date: Wed, 22 Mar 2017 10:38:36 +0100
Subject: storagemanager: Use the existing local reference to 'hosts'

---
 core/storagemanager.lua | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/core/storagemanager.lua b/core/storagemanager.lua
index 75cb8d0f..c93438af 100644
--- a/core/storagemanager.lua
+++ b/core/storagemanager.lua
@@ -164,7 +164,7 @@ function open(host, store, typ)
 	end
 	if ret then
 		local event_data = { host = host, store_name = store, store_type = typ, store = ret };
-		prosody.hosts[host].events.fire_event("store-opened", event_data);
+		hosts[host].events.fire_event("store-opened", event_data);
 		ret, err = event_data.store, event_data.store_err;
 	end
 	return ret, err;
-- 
cgit v1.2.3


From d496a96705c14722455f85f40f38b17fc5470606 Mon Sep 17 00:00:00 2001
From: Kim Alvefur <zash@zash.se>
Date: Wed, 22 Mar 2017 12:00:21 +0100
Subject: util.datamanager: Split long line [luacheck]

---
 util/datamanager.lua | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/util/datamanager.lua b/util/datamanager.lua
index 2b47c3c4..d0a81e71 100644
--- a/util/datamanager.lua
+++ b/util/datamanager.lua
@@ -24,8 +24,10 @@ local t_insert = table.insert;
 local t_concat = table.concat;
 local envloadfile = require"util.envload".envloadfile;
 local serialize = require "util.serialization".serialize;
-local path_separator = assert ( package.config:match ( "^([^\n]+)" ) , "package.config not in standard form" ) -- Extract directory seperator from package.config (an undocumented string that comes with lua)
 local lfs = require "lfs";
+-- Extract directory seperator from package.config (an undocumented string that comes with lua)
+local path_separator = assert ( package.config:match ( "^([^\n]+)" ) , "package.config not in standard form" )
+
 local prosody = prosody;
 
 local raw_mkdir = lfs.mkdir;
-- 
cgit v1.2.3


From 2e06e8e75d004d079ac264abc3f086051c4b62fb Mon Sep 17 00:00:00 2001
From: Kim Alvefur <zash@zash.se>
Date: Wed, 22 Mar 2017 12:02:52 +0100
Subject: util.datamanager: Remove check for file non-existence since ENOENT
 tells us that already

---
 util/datamanager.lua | 22 ++++------------------
 1 file changed, 4 insertions(+), 18 deletions(-)

diff --git a/util/datamanager.lua b/util/datamanager.lua
index d0a81e71..b825cb33 100644
--- a/util/datamanager.lua
+++ b/util/datamanager.lua
@@ -132,15 +132,8 @@ local function load(username, host, datastore)
 			-- No such file, ok to ignore
 			return nil;
 		end
-		local mode = lfs.attributes(getpath(username, host, datastore), "mode");
-		if not mode then
-			log("debug", "Assuming empty %s storage ('%s') for user: %s@%s", datastore, err, username or "nil", host or "nil");
-			return nil;
-		else -- file exists, but can't be read
-			-- TODO more detailed error checking and logging?
-			log("error", "Failed to load %s storage ('%s') for user: %s@%s", datastore, err, username or "nil", host or "nil");
-			return nil, "Error reading storage";
-		end
+		log("error", "Failed to load %s storage ('%s') for user: %s@%s", datastore, err, username or "nil", host or "nil");
+		return nil, "Error reading storage";
 	end
 
 	local success, ret = pcall(data);
@@ -306,15 +299,8 @@ local function list_load(username, host, datastore)
 			-- No such file, ok to ignore
 			return nil;
 		end
-		local mode = lfs.attributes(getpath(username, host, datastore, "list"), "mode");
-		if not mode then
-			log("debug", "Assuming empty %s storage ('%s') for user: %s@%s", datastore, err, username or "nil", host or "nil");
-			return nil;
-		else -- file exists, but can't be read
-			-- TODO more detailed error checking and logging?
-			log("error", "Failed to load %s storage ('%s') for user: %s@%s", datastore, err, username or "nil", host or "nil");
-			return nil, "Error reading storage";
-		end
+		log("error", "Failed to load %s storage ('%s') for user: %s@%s", datastore, err, username or "nil", host or "nil");
+		return nil, "Error reading storage";
 	end
 
 	local success, ret = pcall(data);
-- 
cgit v1.2.3


From ccb4cfcc212b83e1528115aae7095e710e550dbd Mon Sep 17 00:00:00 2001
From: Kim Alvefur <zash@zash.se>
Date: Wed, 22 Mar 2017 14:13:28 +0100
Subject: MUC: Log when denying entry to locked room

---
 plugins/muc/muc.lib.lua | 1 +
 1 file changed, 1 insertion(+)

diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua
index cc147d19..df4c50bb 100644
--- a/plugins/muc/muc.lib.lua
+++ b/plugins/muc/muc.lib.lua
@@ -496,6 +496,7 @@ function room_mt:handle_to_occupant(origin, stanza) -- PM, vCards, etc
 							self.locked = nil; -- Older groupchat protocol doesn't lock
 						end
 					elseif self.locked then -- Deny entry
+						module:log("debug", "Room is locked, denying entry");
 						origin.send(st.error_reply(stanza, "cancel", "item-not-found"));
 						return;
 					end
-- 
cgit v1.2.3


From 711e2c8713466ff5fa8d1ed29dcf04d6e2b6e0da Mon Sep 17 00:00:00 2001
From: Kim Alvefur <zash@zash.se>
Date: Wed, 22 Mar 2017 23:40:53 +0100
Subject: util.encodings: Make limit lookup table a const (from Lua f2a813ae)

---
 util-src/encodings.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/util-src/encodings.c b/util-src/encodings.c
index a633d7fa..465819d5 100644
--- a/util-src/encodings.c
+++ b/util-src/encodings.c
@@ -173,7 +173,7 @@ static const luaL_Reg Reg_base64[] = {
  * Decode one UTF-8 sequence, returning NULL if byte sequence is invalid.
  */
 static const char *utf8_decode(const char *o, int *val) {
-	static unsigned int limits[] = {0xFF, 0x7F, 0x7FF, 0xFFFF};
+	static const unsigned int limits[] = {0xFF, 0x7F, 0x7FF, 0xFFFF};
 	const unsigned char *s = (const unsigned char *)o;
 	unsigned int c = s[0];
 	unsigned int res = 0;  /* final result */
-- 
cgit v1.2.3