From 67dc0fb56ae204ea57288b56bc85fd28cb2ad1d1 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Fri, 25 Nov 2016 05:06:13 +0100 Subject: core.stanza_router: Require 'id' attribute on iq stanzas (fixes #785) --- core/stanza_router.lua | 3 +++ 1 file changed, 3 insertions(+) (limited to 'core') diff --git a/core/stanza_router.lua b/core/stanza_router.lua index cf098258..2fb480ee 100644 --- a/core/stanza_router.lua +++ b/core/stanza_router.lua @@ -70,6 +70,9 @@ function core_process_stanza(origin, stanza) if not iq_types[st_type] or ((st_type == "set" or st_type == "get") and (#stanza.tags ~= 1)) then origin.send(st.error_reply(stanza, "modify", "bad-request", "Invalid IQ type or incorrect number of children")); return; + elseif not stanza.attr.id then + origin.send(st.error_reply(stanza, "modify", "bad-request", "Missing required 'id' attribute")); + return; end end -- cgit v1.2.3 From 212ff87e61748fe14571202b1ab85fc7d1e5c2a1 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Fri, 25 Nov 2016 05:08:09 +0100 Subject: core.stanza_router: Separate iq type check from child count check --- core/stanza_router.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'core') diff --git a/core/stanza_router.lua b/core/stanza_router.lua index 2fb480ee..af797f08 100644 --- a/core/stanza_router.lua +++ b/core/stanza_router.lua @@ -67,12 +67,15 @@ function core_process_stanza(origin, stanza) return handle_unhandled_stanza(origin.host, origin, stanza); end if name == "iq" then - if not iq_types[st_type] or ((st_type == "set" or st_type == "get") and (#stanza.tags ~= 1)) then - origin.send(st.error_reply(stanza, "modify", "bad-request", "Invalid IQ type or incorrect number of children")); + if not iq_types[st_type] then + origin.send(st.error_reply(stanza, "modify", "bad-request", "Invalid IQ type")); return; elseif not stanza.attr.id then origin.send(st.error_reply(stanza, "modify", "bad-request", "Missing required 'id' attribute")); return; + elseif (st_type == "set" or st_type == "get") and (#stanza.tags ~= 1) then + origin.send(st.error_reply(stanza, "modify", "bad-request", "Incorrect number of children for IQ stanz")); + return; end end -- cgit v1.2.3 From 269b993aeec5f68784ae10fa7a2d7113b4a44768 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sat, 26 Nov 2016 20:08:48 +0100 Subject: core.certmanager: Translate "no start line" to something friendlier (thanks santiago) --- core/certmanager.lua | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'core') diff --git a/core/certmanager.lua b/core/certmanager.lua index 3872bd9a..12ae94b1 100644 --- a/core/certmanager.lua +++ b/core/certmanager.lua @@ -184,9 +184,12 @@ local function create_context(host, mode, ...) err = err or "invalid ssl config" local file = err:match("^error loading (.-) %("); if file then + local typ; if file == "private key" then + typ = file; file = user_ssl_config.key or "your private key"; elseif file == "certificate" then + typ = file; file = user_ssl_config.certificate or "your certificate file"; end local reason = err:match("%((.+)%)$") or "some reason"; @@ -196,6 +199,8 @@ local function create_context(host, mode, ...) reason = "Check that the path is correct, and the file exists."; elseif reason == "system lib" then reason = "Previous error (see logs), or other system error."; + elseif reason == "no start line" then + reason = "Check that the file contains a "..(typ or file); elseif reason == "(null)" or not reason then reason = "Check that the file exists and the permissions are correct"; else -- cgit v1.2.3