aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2009-07-28 19:17:09 +0100
committerMatthew Wild <mwild1@gmail.com>2009-07-28 19:17:09 +0100
commit5dfe9cf891dc5becd805dfbad79653d9eb840001 (patch)
treef64c675fbbac1f4acbcc959d820ddba16fd57a06 /net
parent39e1b4b1df2c49739e89b80f4b4351a4e6b20f81 (diff)
parent8ad65c2824d2ee3bd52175df34fdd7bd9d393231 (diff)
downloadprosody-5dfe9cf891dc5becd805dfbad79653d9eb840001.tar.gz
prosody-5dfe9cf891dc5becd805dfbad79653d9eb840001.zip
Merge with 0.5
Diffstat (limited to 'net')
-rw-r--r--net/server.lua33
-rw-r--r--net/xmppclient_listener.lua5
-rw-r--r--net/xmppcomponent_listener.lua5
-rw-r--r--net/xmppserver_listener.lua5
4 files changed, 42 insertions, 6 deletions
diff --git a/net/server.lua b/net/server.lua
index 6fe72712..966006c1 100644
--- a/net/server.lua
+++ b/net/server.lua
@@ -181,20 +181,41 @@ wrapserver = function( listeners, socket, ip, serverport, pattern, sslctx, maxco
out_error "server.lua: wrong server sslctx"
ssl = false
end
- sslctx, err = ssl_newcontext( sslctx )
- if not sslctx then
+ local ctx;
+ ctx, err = ssl_newcontext( sslctx )
+ if not ctx then
err = err or "wrong sslctx parameters"
- out_error( "server.lua: ", err )
+ local file;
+ file = err:match("^error loading (.-) %(");
+ if file then
+ if file == "private key" then
+ file = sslctx.key or "your private key";
+ elseif file == "certificate" then
+ file = sslctx.certificate or "your certificate file";
+ end
+ local reason = err:match("%((.+)%)$") or "some reason";
+ if reason == "Permission denied" then
+ reason = "Check that the permissions allow Prosody to read this file.";
+ elseif reason == "No such file or directory" then
+ 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.";
+ else
+ reason = "Reason: "..tostring(reason or "unknown"):lower();
+ end
+ log("error", "SSL/TLS: Failed to load %s: %s", file, reason);
+ else
+ log("error", "SSL/TLS: Error initialising for port %d: %s", serverport, err );
+ end
ssl = false
end
+ sslctx = ctx;
end
if not ssl then
sslctx = false;
if startssl then
- out_error( "server.lua: Cannot start ssl on port: ", serverport )
+ log("error", "Failed to listen on port %d due to SSL/TLS to SSL/TLS initialisation errors (see logs)", serverport )
return nil, "Cannot start ssl, see log for details"
- else
- out_put("server.lua: ", "ssl not enabled on ", serverport);
end
end
diff --git a/net/xmppclient_listener.lua b/net/xmppclient_listener.lua
index e882546f..dcc561f3 100644
--- a/net/xmppclient_listener.lua
+++ b/net/xmppclient_listener.lua
@@ -70,9 +70,14 @@ end
local stream_xmlns_attr = {xmlns='urn:ietf:params:xml:ns:xmpp-streams'};
+local default_stream_attr = { ["xmlns:stream"] = stream_callbacks.stream_tag:gsub("%|[^|]+$", ""), xmlns = stream_callbacks.default_ns, version = "1.0", id = "" };
local function session_close(session, reason)
local log = session.log or log;
if session.conn then
+ if session.notopen then
+ session.send("<?xml version='1.0'?>");
+ session.send(st.stanza("stream:stream", default_stream_attr):top_tag());
+ end
if reason then
if type(reason) == "string" then -- assume stream error
log("info", "Disconnecting client, <stream:error> is: %s", reason);
diff --git a/net/xmppcomponent_listener.lua b/net/xmppcomponent_listener.lua
index e62bb810..36d74579 100644
--- a/net/xmppcomponent_listener.lua
+++ b/net/xmppcomponent_listener.lua
@@ -87,9 +87,14 @@ end
--- Closing a component connection
local stream_xmlns_attr = {xmlns='urn:ietf:params:xml:ns:xmpp-streams'};
+local default_stream_attr = { ["xmlns:stream"] = stream_callbacks.stream_tag:gsub("%|[^|]+$", ""), xmlns = stream_callbacks.default_ns, version = "1.0", id = "" };
local function session_close(session, reason)
local log = session.log or log;
if session.conn then
+ if session.notopen then
+ session.send("<?xml version='1.0'?>");
+ session.send(st.stanza("stream:stream", default_stream_attr):top_tag());
+ end
if reason then
if type(reason) == "string" then -- assume stream error
log("info", "Disconnecting component, <stream:error> is: %s", reason);
diff --git a/net/xmppserver_listener.lua b/net/xmppserver_listener.lua
index 2e70145d..1f27d841 100644
--- a/net/xmppserver_listener.lua
+++ b/net/xmppserver_listener.lua
@@ -70,9 +70,14 @@ end
local stream_xmlns_attr = {xmlns='urn:ietf:params:xml:ns:xmpp-streams'};
+local default_stream_attr = { ["xmlns:stream"] = stream_callbacks.stream_tag:gsub("%|[^|]+$", ""), xmlns = stream_callbacks.default_ns, version = "1.0", id = "" };
local function session_close(session, reason)
local log = session.log or log;
if session.conn then
+ if session.notopen then
+ session.sends2s("<?xml version='1.0'?>");
+ session.sends2s(st.stanza("stream:stream", default_stream_attr):top_tag());
+ end
if reason then
if type(reason) == "string" then -- assume stream error
log("info", "Disconnecting %s[%s], <stream:error> is: %s", session.host or "(unknown host)", session.type, reason);