From 007ebd8a1880d79508904672ff3587bdeff52298 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Fri, 18 May 2012 00:27:06 +0100 Subject: net.server_select: Return error when SSL handshake fails immediately (thanks Zash) --- net/server_select.lua | 9 ++++++--- 1 file 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 -- cgit v1.2.3