From 9305ea7d234c19ccdb938259bb8301c732a8366c Mon Sep 17 00:00:00 2001
From: Kim Alvefur <zash@zash.se>
Date: Tue, 8 Dec 2015 20:19:30 +0100
Subject: MUC: Process only options that are included in a form (Fixes #521)

---
 plugins/muc/muc.lib.lua | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

(limited to 'plugins')

diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua
index 48231c37..20e91192 100644
--- a/plugins/muc/muc.lib.lua
+++ b/plugins/muc/muc.lib.lua
@@ -674,7 +674,7 @@ function room_mt:process_form(origin, stanza)
 	if form.attr.type == "cancel" then origin.send(st.reply(stanza)); return; end
 	if form.attr.type ~= "submit" then origin.send(st.error_reply(stanza, "cancel", "bad-request", "Not a submitted form")); return; end
 
-	local fields = self:get_form_layout(stanza.attr.from):data(form);
+	local fields, errors, present = self:get_form_layout(stanza.attr.from):data(form);
 	if fields.FORM_TYPE ~= "http://jabber.org/protocol/muc#roomconfig" then
 		origin.send(st.error_reply(stanza, "cancel", "bad-request", "Form is not of type room configuration"));
 		return;
@@ -683,8 +683,8 @@ function room_mt:process_form(origin, stanza)
 	local changed = {};
 
 	local function handle_option(name, field, allowed)
-		local new = fields[field];
-		if new == nil then return; end
+		local new, err, included = fields[field], errors[field], present[field];
+		if not included then return; end
 		if allowed and not allowed[new] then return; end
 		if new == self["get_"..name](self) then return; end
 		changed[name] = true;
-- 
cgit v1.2.3


From ca4e8af415556c119982ed45ccbbbae4d45cb7f4 Mon Sep 17 00:00:00 2001
From: Kim Alvefur <zash@zash.se>
Date: Wed, 9 Dec 2015 16:33:43 +0100
Subject: MUC: Fix previous commit

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

(limited to 'plugins')

diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua
index 20e91192..6f21ec3a 100644
--- a/plugins/muc/muc.lib.lua
+++ b/plugins/muc/muc.lib.lua
@@ -683,8 +683,8 @@ function room_mt:process_form(origin, stanza)
 	local changed = {};
 
 	local function handle_option(name, field, allowed)
-		local new, err, included = fields[field], errors[field], present[field];
-		if not included then return; end
+		if not present[field] then return; end
+		local new = fields[field];
 		if allowed and not allowed[new] then return; end
 		if new == self["get_"..name](self) then return; end
 		changed[name] = true;
-- 
cgit v1.2.3


From 2f5368193dd206e1a8734373e9251569bc24ae40 Mon Sep 17 00:00:00 2001
From: Kim Alvefur <zash@zash.se>
Date: Thu, 10 Dec 2015 15:16:49 +0100
Subject: mod_compression: Remove FIXMEs, mod_c2s and mod_s2s checks if TLS
 compression is used and sets a flag since 969e0a054795

---
 plugins/mod_compression.lua | 2 --
 1 file changed, 2 deletions(-)

(limited to 'plugins')

diff --git a/plugins/mod_compression.lua b/plugins/mod_compression.lua
index da55e5bb..d49e3880 100644
--- a/plugins/mod_compression.lua
+++ b/plugins/mod_compression.lua
@@ -27,14 +27,12 @@ end
 module:hook("stream-features", function(event)
 	local origin, features = event.origin, event.features;
 	if not origin.compressed and origin.type == "c2s" then
-		-- FIXME only advertise compression support when TLS layer has no compression enabled
 		features:add_child(compression_stream_feature);
 	end
 end);
 
 module:hook("s2s-stream-features", function(event)
 	local origin, features = event.origin, event.features;
-	-- FIXME only advertise compression support when TLS layer has no compression enabled
 	if not origin.compressed and origin.type == "s2sin" then
 		features:add_child(compression_stream_feature);
 	end
-- 
cgit v1.2.3


From 47fd3f55f22d92f1fa2d25097545a6b4a17d3564 Mon Sep 17 00:00:00 2001
From: Matthew Wild <mwild1@gmail.com>
Date: Thu, 10 Dec 2015 18:00:08 +0000
Subject: mod_admin_telnet: Add http:list() command to get info about current
 HTTP endpoints on the server

---
 plugins/mod_admin_telnet.lua | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

(limited to 'plugins')

diff --git a/plugins/mod_admin_telnet.lua b/plugins/mod_admin_telnet.lua
index 16bc786d..b77a1f56 100644
--- a/plugins/mod_admin_telnet.lua
+++ b/plugins/mod_admin_telnet.lua
@@ -282,6 +282,8 @@ end
 -- Session environment --
 -- Anything in def_env will be accessible within the session as a global variable
 
+--luacheck: ignore 212/self
+
 def_env.server = {};
 
 function def_env.server:insane_reload()
@@ -1093,6 +1095,33 @@ function def_env.dns:cache()
 	return true, "Cache:\n"..tostring(dns.cache())
 end
 
+def_env.http = {};
+
+function def_env.http:list()
+	local print = self.session.print;
+
+	for host in pairs(prosody.hosts) do
+		local http_apps = modulemanager.get_items("http-provider", host);
+		if #http_apps > 0 then
+			local http_host = module:context(host):get_option("http_host");
+			print("HTTP endpoints on "..host..(http_host and (" (using "..http_host.."):") or ":"));
+			for _, provider in ipairs(http_apps) do
+				local url = module:context(host):http_url(provider.name);
+				print("", url);
+			end
+			print("");
+		end
+	end
+
+	local default_host = module:get_option("http_default_host");
+	if not default_host then
+		print("HTTP requests to unknown hosts will return 404 Not Found");
+	else
+		print("HTTP requests to unknown hosts will be handled by "..default_host);
+	end
+	return true;
+end
+
 -------------
 
 function printbanner(session)
-- 
cgit v1.2.3