From 26df5eea856fb8b6f9a4b312eb8b5341fa828ad6 Mon Sep 17 00:00:00 2001 From: Waqas Hussain Date: Thu, 10 Dec 2009 01:56:16 +0500 Subject: Mainfile: Broke up a really long line. --- prosody | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'prosody') diff --git a/prosody b/prosody index 7f69e085..95be55e3 100755 --- a/prosody +++ b/prosody @@ -284,8 +284,11 @@ function prepare_to_start() end function init_global_protection() - -- Catch global accesses -- - local locked_globals_mt = { __index = function (t, k) error("Attempt to read a non-existent global '"..k.."'", 2); end, __newindex = function (t, k, v) error("Attempt to set a global: "..tostring(k).." = "..tostring(v), 2); end } + -- Catch global accesses + local locked_globals_mt = { + __index = function (t, k) error("Attempt to read a non-existent global '"..k.."'", 2); end; + __newindex = function (t, k, v) error("Attempt to set a global: "..tostring(k).." = "..tostring(v), 2); end; + }; function prosody.unlock_globals() setmetatable(_G, nil); -- cgit v1.2.3 From eaa3a4e22570bb7ce13f6c372a2033d33c712ef9 Mon Sep 17 00:00:00 2001 From: Waqas Hussain Date: Thu, 10 Dec 2009 02:47:13 +0500 Subject: prosody: Log a warning and traceback, but don't throw an error on nil global read. --- prosody | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'prosody') diff --git a/prosody b/prosody index 95be55e3..2ca4241c 100755 --- a/prosody +++ b/prosody @@ -286,7 +286,7 @@ end function init_global_protection() -- Catch global accesses local locked_globals_mt = { - __index = function (t, k) error("Attempt to read a non-existent global '"..k.."'", 2); end; + __index = function (t, k) log("warn", "%s", debug.traceback("Attempt to read a non-existent global '"..k.."'", 2)); end; __newindex = function (t, k, v) error("Attempt to set a global: "..tostring(k).." = "..tostring(v), 2); end; }; -- cgit v1.2.3 From b62a35519f8f76f702a504cbb28d63647c93745a Mon Sep 17 00:00:00 2001 From: Waqas Hussain Date: Thu, 10 Dec 2009 02:50:23 +0500 Subject: prosody: Call tostring on the key being used for nil global read before concatenating it with a string. --- prosody | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'prosody') diff --git a/prosody b/prosody index 2ca4241c..593a0e34 100755 --- a/prosody +++ b/prosody @@ -286,7 +286,7 @@ end function init_global_protection() -- Catch global accesses local locked_globals_mt = { - __index = function (t, k) log("warn", "%s", debug.traceback("Attempt to read a non-existent global '"..k.."'", 2)); end; + __index = function (t, k) log("warn", "%s", debug.traceback("Attempt to read a non-existent global '"..tostring(k).."'", 2)); end; __newindex = function (t, k, v) error("Attempt to set a global: "..tostring(k).." = "..tostring(v), 2); end; }; -- cgit v1.2.3 From 06ffadf829c80908d9056d51417468da8eb5bce1 Mon Sep 17 00:00:00 2001 From: Waqas Hussain Date: Sun, 24 Jan 2010 05:35:21 +0500 Subject: prosody: Listen for component connections on port 5347 by default. --- prosody | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'prosody') diff --git a/prosody b/prosody index 593a0e34..01512c1b 100755 --- a/prosody +++ b/prosody @@ -277,7 +277,7 @@ function prepare_to_start() -- start listening on sockets prosody.net_activate_ports("c2s", "xmppclient", {5222}); prosody.net_activate_ports("s2s", "xmppserver", {5269}); - prosody.net_activate_ports("component", "xmppcomponent", {}, "tcp"); + prosody.net_activate_ports("component", "xmppcomponent", {5347}, "tcp"); prosody.net_activate_ports("legacy_ssl", "xmppclient", {}, "ssl"); prosody.start_time = os.time(); -- cgit v1.2.3 From 43644666de538fedd188088111cefcead0f989db Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Sun, 31 Jan 2010 16:40:47 +0000 Subject: prosody: Log error message when failing to open ports --- prosody | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'prosody') diff --git a/prosody b/prosody index 01512c1b..05d91b7d 100755 --- a/prosody +++ b/prosody @@ -195,7 +195,7 @@ function init_global_state() if type(port) ~= "number" then log("error", "Non-numeric "..option.."_ports: "..tostring(port)); else - cl.start(listener, { + local ok, err = cl.start(listener, { ssl = conntype ~= "tcp" and global_ssl_ctx, port = port, interface = config.get("*", "core", option.."_interface") @@ -203,6 +203,24 @@ function init_global_state() or config.get("*", "core", "interface"), type = conntype }); + if not ok then + local friendly_message = err; + if err:match(" in use") then + if port == 5222 or port == 5223 or port == 5269 then + friendly_message = "check that Prosody or another XMPP server is " + .."not already running and using this port"; + elseif port == 80 or port == 81 then + friendly_message = "check that a HTTP server is not already using " + .."this port"; + elseif port == 5280 then + friendly_message = "check that Prosody or a BOSH connection manager " + .."is not already running"; + end + elseif err:match("permission") then + friendly_message = "Prosody does not have sufficient privileges to use this port"; + end + log("error", "Failed to open server port %d, %s", port, friendly_message); + end end end end -- cgit v1.2.3 From 4dbc6b605d93a998517eb96c4bae43038199d75a Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Sun, 31 Jan 2010 17:15:35 +0000 Subject: prosody: Show friendly error when no config present for legacy SSL ports --- prosody | 3 +++ 1 file changed, 3 insertions(+) (limited to 'prosody') diff --git a/prosody b/prosody index 05d91b7d..ce56fbb1 100755 --- a/prosody +++ b/prosody @@ -218,6 +218,9 @@ function init_global_state() end elseif err:match("permission") then friendly_message = "Prosody does not have sufficient privileges to use this port"; + elseif err == "no ssl context" then + friendly_message = "there is no 'ssl' config under Host \"*\" which is " + .."require for legacy SSL ports"; end log("error", "Failed to open server port %d, %s", port, friendly_message); end -- cgit v1.2.3 From 85d9e34b7ef05738e88fa83a8eece3b5ee9077b2 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Fri, 5 Feb 2010 15:05:39 +0000 Subject: prosody: Add a catch-all friendly message for when any port is in use we want to use --- prosody | 2 ++ 1 file changed, 2 insertions(+) (limited to 'prosody') diff --git a/prosody b/prosody index ce56fbb1..65d8dceb 100755 --- a/prosody +++ b/prosody @@ -215,6 +215,8 @@ function init_global_state() elseif port == 5280 then friendly_message = "check that Prosody or a BOSH connection manager " .."is not already running"; + else + friendly_message = "this port is in use by another application"; end elseif err:match("permission") then friendly_message = "Prosody does not have sufficient privileges to use this port"; -- cgit v1.2.3 From 27114996e41d03b74913ccf02240ae572e09ad82 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Sat, 13 Feb 2010 16:22:05 +0000 Subject: prosody: More accurate friendly error message in the event that creating the global SSL context fails --- prosody | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'prosody') diff --git a/prosody b/prosody index 65d8dceb..55198c2f 100755 --- a/prosody +++ b/prosody @@ -221,8 +221,12 @@ function init_global_state() elseif err:match("permission") then friendly_message = "Prosody does not have sufficient privileges to use this port"; elseif err == "no ssl context" then - friendly_message = "there is no 'ssl' config under Host \"*\" which is " - .."require for legacy SSL ports"; + if not config.get("*", "core", "ssl") then + friendly_message = "there is no 'ssl' config under Host \"*\" which is " + .."require for legacy SSL ports"; + else + friendly_message = "initializing SSL support failed, see previous log entries"; + end end log("error", "Failed to open server port %d, %s", port, friendly_message); end -- cgit v1.2.3