added comment to remind us to fix binary output breaking the terminal
[prosody.git] / prosody
diff --git a/prosody b/prosody
index 71d157bfdbcfe617f701bdb92781cb8e6a152641..0577179f291c37caab5d75bcda7f76b14dc6985f 100755 (executable)
--- a/prosody
+++ b/prosody
@@ -193,23 +193,23 @@ function init_global_state()
        local cl = require "net.connlisteners";
        function prosody.net_activate_ports(option, listener, default, conntype)
                conntype = conntype or (global_ssl_ctx and "tls") or "tcp";
-               option = option and option.."_ports" or "ports";
+               local ports_option = option and option.."_ports" or "ports";
                if not cl.get(listener) then return; end
-               local ports = config.get("*", "core", option) or default;
+               local ports = config.get("*", "core", ports_option) or default;
                if type(ports) == "number" then ports = {ports} end;
                
                if type(ports) ~= "table" then
-                       log("error", "core."..option.." is not a table");
+                       log("error", "core."..ports_option.." is not a table");
                else
                        for _, port in ipairs(ports) do
                                if type(port) ~= "number" then
-                                       log("error", "Non-numeric "..option.."_ports: "..tostring(port));
+                                       log("error", "Non-numeric "..ports_option..": "..tostring(port));
                                else
                                        cl.start(listener, { 
                                                ssl = conntype ~= "tcp" and global_ssl_ctx,
                                                port = port,
-                                               interface = config.get("*", "core", option.."_interface") 
-                                                       or cl.get(listener).default_interface 
+                                               interface = (option and config.get("*", "core", option.."_interface"))
+                                                       or cl.get(listener).default_interface
                                                        or config.get("*", "core", "interface"),
                                                type = conntype
                                        });
@@ -288,6 +288,9 @@ function prepare_to_start()
        -- start listening on sockets
        if config.get("*", "core", "ports") then
                prosody.net_activate_ports(nil, "multiplex", {5222, 5269});
+               if config.get("*", "core", "ssl_ports") then
+                       prosody.net_activate_ports("ssl", "multiplex", {5223}, "ssl");
+               end
        else
                prosody.net_activate_ports("c2s", "xmppclient", {5222});
                prosody.net_activate_ports("s2s", "xmppserver", {5269});