Index: nsswitch/winbindd.c =================================================================== --- nsswitch/winbindd.c (revision 22003) +++ nsswitch/winbindd.c (working copy) @@ -121,6 +121,8 @@ { pstring path; + close_winbindd_socket(); + /* Remove socket file */ pstr_sprintf(path, "%s/%s", WINBINDD_SOCKET_DIR, WINBINDD_SOCKET_NAME); @@ -718,23 +720,14 @@ simultaneous connections while remaining impervious to many denial of service attacks. */ -static void process_loop(void) +static void process_loop(int listen_sock, int listen_priv_sock) { struct winbindd_cli_state *state; struct fd_event *ev; fd_set r_fds, w_fds; - int maxfd, listen_sock, listen_priv_sock, selret; + int maxfd, selret; struct timeval timeout, ev_timeout; - /* Open Sockets here to get stuff going ASAP */ - listen_sock = open_winbindd_socket(); - listen_priv_sock = open_winbindd_priv_socket(); - - if (listen_sock == -1 || listen_priv_sock == -1) { - perror("open_winbind_socket"); - exit(1); - } - /* We'll be doing this a lot */ /* Handle messages */ @@ -924,6 +917,8 @@ }; poptContext pc; int opt; + int listen_sock; + int listen_priv_sock; /* glibc (?) likes to print "User defined signal 1" and exit if a SIGUSR[12] is received before a handler is installed */ @@ -1087,10 +1082,19 @@ smb_nscd_flush_user_cache(); smb_nscd_flush_group_cache(); + /* Open Sockets here to get stuff going ASAP */ + listen_sock = open_winbindd_socket(); + listen_priv_sock = open_winbindd_priv_socket(); + + if (listen_sock == -1 || listen_priv_sock == -1) { + perror("open_winbind_socket"); + exit(1); + } + /* Loop waiting for requests */ while (1) - process_loop(); + process_loop(listen_sock, listen_priv_sock); return 0; }