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;
        }
}





------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
Gambas-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to