[Gambas-user] [Gambas Bug Tracker] Bug #921: CServerSocket.c doesn't handle all error codes. E.g. trying to listen as none-root, on port <1024 doesn't raise an error.
bugtracker at ...3416...
bugtracker at ...3416...
Sat Apr 16 19:25:19 CEST 2016
http://gambaswiki.org/bugtracker/edit?object=BUG.921&from=L21haW4-
Alexander KUIPER reported a new bug.
Summary
-------
CServerSocket.c doesn't handle all error codes. E.g. trying to listen as none-root, on port <1024 doesn't raise an error.
Type : Bug
Priority : Medium
Gambas version : 3.8
Product : Unknown
Description
-----------
The 'gb.net/src/CServerSocket.c' start the listening the procedure 'static int do_srvsock_listen(...)', this procedure returns an errorcode. Only a few errorcodes aren't mapped and this results in the fact it 'looks looks good', but doesn't work!
The example scenario is when starting as a none-root on a port <1024, this isn't allowed be Linux ... but ServerSocket doesn't give an error!
Changes in gb.net/src/CServerSocket.c':
------------
Change from:
------------
static void srvsock_listen(CSERVERSOCKET *_object, int max)
{
switch(do_srvsock_listen(THIS, max))
{
case 1: GB.Error("Socket is already listening"); break;
case 7: GB.Error("Path is not defined"); break;
case 8: GB.Error("Port is not defined"); break;
case 13: GB.Error("Invalid maximum number of connections"); break;
case 15: GB.Error("Unable to bind socket to interface"); break;
default: break;
}
}
----------
Change to:
----------
static void srvsock_listen(CSERVERSOCKET *_object, int max)
{
switch(do_srvsock_listen(THIS, max))
{
case 1: GB.Error("Socket is already listening"); break;
case 2: GB.Error("Cannot create socket"); break;
case 7: GB.Error("Path is not defined"); break;
case 8: GB.Error("Port is not defined"); break;
case 10: GB.Error("Cannot bind to socket"); break;
case 13: GB.Error("Invalid maximum number of connections"); break;
case 14: GB.Error("Cannot listen on socket"); break;
case 15: GB.Error("Unable to bind socket to interface"); break;
default: break;
}
}
More information about the User
mailing list