aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2012-05-18 00:27:06 +0100
committerMatthew Wild <mwild1@gmail.com>2012-05-18 00:27:06 +0100
commitd3a6cd662d586ec05452f2cce033aed6b22d8868 (patch)
tree3a7459279c70745d5f71a2d069977f3eb3245eb0
parente2ff625068f6e5ba977ce4536d7e562562af59ad (diff)
downloadprosody-d3a6cd662d586ec05452f2cce033aed6b22d8868.tar.gz
prosody-d3a6cd662d586ec05452f2cce033aed6b22d8868.zip
net.server_select: Return error when SSL handshake fails immediately (thanks Zash)
-rw-r--r--net/server_select.lua9
1 files changed, 6 insertions, 3 deletions
diff --git a/net/server_select.lua b/net/server_select.lua
index 70825ada..f5c9e86b 100644
--- a/net/server_select.lua
+++ b/net/server_select.lua
@@ -550,7 +550,7 @@ wrapconnection = function( server, listeners, socket, ip, serverport, clientport
out_put( "server.lua: ssl handshake error: ", tostring(err or "handshake too long") )
disconnect( handler, "ssl handshake failed" )
_ = handler and handler:close( true ) -- forced disconnect
- return false -- handshake failed
+ return false, err -- handshake failed
end
)
end
@@ -594,7 +594,7 @@ wrapconnection = function( server, listeners, socket, ip, serverport, clientport
handler.readbuffer = handshake
handler.sendbuffer = handshake
- handshake( socket ) -- do handshake
+ return handshake( socket ) -- do handshake
end
end
@@ -610,7 +610,10 @@ wrapconnection = function( server, listeners, socket, ip, serverport, clientport
if sslctx and luasec then
out_put "server.lua: auto-starting ssl negotiation..."
handler.autostart_ssl = true;
- handler:starttls(sslctx);
+ local ok, err = handler:starttls(sslctx);
+ if ok == false then
+ return nil, nil, err
+ end
end
return handler, socket