Branch: Tag:

2005-02-10

2005-02-10 17:49:41 by Martin Stjernholm <mast@lysator.liu.se>

Get privs before binding ports. This fixes the failure to add ports
when the server is running with nonpermanently changed uid/gid.

Rev: server/base_server/roxen.pike:1.888

6:   // Per Hedbor, Henrik Grubbström, Pontus Hagland, David Hedbor and others.   // ABS and suicide systems contributed freely by Francesco Chemolli    - constant cvs_version="$Id: roxen.pike,v 1.887 2005/02/01 12:37:47 wellhard Exp $"; + constant cvs_version="$Id: roxen.pike,v 1.888 2005/02/10 17:49:41 mast Exp $";      //! @appears roxen   //!
1563:    {    if (bound) return;    if (!port_obj) port_obj = Stdio.Port(); +  Privs privs = Privs (sprintf ("Binding %s://%s:%d/", +  (string) name, ip || "*", (int) port));    if (port_obj->bind(port, got_connection, ip))    { -  +  privs = 0;    bound = 1;    return;    } -  +  privs = 0;    report_error(LOC_M(6, "Failed to bind %s://%s:%d/ (%s)")+"\n",    (string)name, (ip||"*"), (int)port,    strerror(port_obj->errno())); -  +  werror (describe_backtrace (backtrace()));   #if constant(System.EADDRINUSE) || constant(system.EADDRINUSE)    if (   #if constant(System.EADDRINUSE)