Hajimu UMEMOTO wrote:
> 
> Hi,
> 
> It seems reconfig is not working well.  There are two problems:
> 
>   - The master doesn't issue shutdown(2) at clean up sockets.  So,
>     re-bind to same address fails with `Address already in use' at
>     least under FreeBSD.

How does shutdown() affect daemons that are already running?  Does this
only shutdown the socket for master?

>   - Since the master is running without root privilege, re-bind to
>     privileged port is fail.  Setting become_cyrus_early to 0 seems to
>     solve this problem.  However, it may need further security
>     consideration.
> 
> Here is a patch.
> 
> Index: master/master.c
> diff -u master/master.c.orig master/master.c
> --- master/master.c.orig        Sun Jul  8 07:56:48 2001
> +++ master/master.c     Mon Jul  9 21:28:30 2001
> @@ -94,7 +94,7 @@
>  #define SERVICE_PATH (CYRUS_PATH "/bin")
> 
>  enum {
> -    become_cyrus_early = 1,
> +    become_cyrus_early = 0,
>      child_table_size = 10000,
>      child_table_inc = 100
>  };
> @@ -954,7 +954,10 @@
>             Services[i].nactive = 0;
> 
>             /* close all listeners */
> -           if (Services[i].socket > 0) close(Services[i].socket);
> +           if (Services[i].socket > 0) {
> +               shutdown(Services[i].socket, SHUT_RDWR);
> +               close(Services[i].socket);
> +           }
>             Services[i].socket = 0;
>             Services[i].saddr = NULL;
> 
> 
> --
> Hajimu UMEMOTO @ Internet Mutual Aid Society Yokohama, Japan
> [EMAIL PROTECTED]  [EMAIL PROTECTED]  ume@{,jp.}FreeBSD.org
> http://www.imasy.org/~ume/

-- 
Kenneth Murchison     Oceana Matrix Ltd.
Software Engineer     21 Princeton Place
716-662-8973 x26      Orchard Park, NY 14127
--PGP Public Key--    http://www.oceana.com/~ken/ksm.pgp

Reply via email to