aboutsummaryrefslogtreecommitdiffstats
path: root/net/server_select.lua
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2013-12-18 17:55:03 -0500
committerdaurnimator <quae@daurnimator.com>2013-12-18 17:55:03 -0500
commit216b5fd8510866462a09a94cb0adbdf8ba5f71a3 (patch)
treeef4a05fbe3bd8cc29a7e0bf173de2407472c4113 /net/server_select.lua
parente5e8cfdccfa3bd1f55e38f19052613fe0fef2ca0 (diff)
downloadprosody-216b5fd8510866462a09a94cb0adbdf8ba5f71a3.tar.gz
prosody-216b5fd8510866462a09a94cb0adbdf8ba5f71a3.zip
net/server_select: addclient: Check arguments
Diffstat (limited to 'net/server_select.lua')
-rw-r--r--net/server_select.lua15
1 files changed, 15 insertions, 0 deletions
diff --git a/net/server_select.lua b/net/server_select.lua
index 14d55a32..61919863 100644
--- a/net/server_select.lua
+++ b/net/server_select.lua
@@ -943,6 +943,21 @@ local wrapclient = function( socket, ip, serverport, listeners, pattern, sslctx
end
local addclient = function( address, port, listeners, pattern, sslctx )
+ local err
+ if type( listeners ) ~= "table" then
+ err = "invalid listener table"
+ elseif type ( addr ) ~= "string" then
+ err = "invalid address"
+ elseif type( port ) ~= "number" or not ( port >= 0 and port <= 65535 ) then
+ err = "invalid port"
+ elseif sslctx and not has_luasec then
+ err = "luasec not found"
+ end
+ if err then
+ out_error( "server.lua, addclient: ", err )
+ return nil, err
+ end
+
local client, err = luasocket.tcp( )
if err then
return nil, err