aboutsummaryrefslogtreecommitdiffstats
path: root/net
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
commit007ebd8a1880d79508904672ff3587bdeff52298 (patch)
tree3a7459279c70745d5f71a2d069977f3eb3245eb0 /net
parent644b8615f37782ae0ed7cdc07cc430f8995309a2 (diff)
downloadprosody-007ebd8a1880d79508904672ff3587bdeff52298.tar.gz
prosody-007ebd8a1880d79508904672ff3587bdeff52298.zip
net.server_select: Return error when SSL handshake fails immediately (thanks Zash)
Diffstat (limited to 'net')
-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