diff options
author | Matthew Wild <mwild1@gmail.com> | 2012-05-18 00:27:06 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2012-05-18 00:27:06 +0100 |
commit | 007ebd8a1880d79508904672ff3587bdeff52298 (patch) | |
tree | 3a7459279c70745d5f71a2d069977f3eb3245eb0 /net | |
parent | 644b8615f37782ae0ed7cdc07cc430f8995309a2 (diff) | |
download | prosody-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.lua | 9 |
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 |