2 Unix SMB/CIFS implementation.
4 Winbind daemon for ntdom nss module
6 Copyright (C) by Tim Potter 2000-2002
7 Copyright (C) Andrew Tridgell 2002
8 Copyright (C) Jelmer Vernooij 2003
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28 BOOL opt_nocache
= False
;
29 BOOL opt_dual_daemon
= True
;
31 /* Reload configuration */
33 static BOOL
reload_services_file(void)
40 pstrcpy(fname
,lp_configfile());
41 if (file_exist(fname
,NULL
) && !strcsequal(fname
,dyn_CONFIGFILE
)) {
42 pstrcpy(dyn_CONFIGFILE
,fname
);
47 ret
= lp_load(dyn_CONFIGFILE
,False
,False
,True
);
58 /**************************************************************************** **
59 Prepare to dump a core file - carefully!
60 **************************************************************************** */
62 static BOOL
dump_core(void)
66 pstrcpy( dname
, lp_logfile() );
67 if ((p
=strrchr(dname
,'/')))
69 pstrcat( dname
, "/corefiles" );
71 sys_chown( dname
, getuid(), getgid() );
81 getrlimit( RLIMIT_CORE
, &rlp
);
82 rlp
.rlim_cur
= MAX( 4*1024*1024, rlp
.rlim_cur
);
83 setrlimit( RLIMIT_CORE
, &rlp
);
84 getrlimit( RLIMIT_CORE
, &rlp
);
85 DEBUG( 3, ( "Core limits now %d %d\n", (int)rlp
.rlim_cur
, (int)rlp
.rlim_max
) );
90 DEBUG(0,("Dumping core in %s\n",dname
));
96 /**************************************************************************** **
98 **************************************************************************** */
100 static void fault_quit(void)
107 static void winbindd_status(void)
109 struct winbindd_cli_state
*tmp
;
111 DEBUG(0, ("winbindd status:\n"));
113 /* Print client state information */
115 DEBUG(0, ("\t%d clients currently active\n", winbindd_num_clients()));
117 if (DEBUGLEVEL
>= 2 && winbindd_num_clients()) {
118 DEBUG(2, ("\tclient list:\n"));
119 for(tmp
= winbindd_client_list(); tmp
; tmp
= tmp
->next
) {
120 DEBUG(2, ("\t\tpid %lu, sock %d, rbl %d, wbl %d\n",
121 (unsigned long)tmp
->pid
, tmp
->sock
, tmp
->read_buf_len
,
122 tmp
->write_buf_len
));
127 /* Print winbindd status to log file */
129 static void print_winbindd_status(void)
132 winbindd_cm_status();
135 /* Flush client cache */
137 static void flush_caches(void)
140 /* Clear cached user and group enumation info */
141 if (!opt_dual_daemon
) /* Until we have coherent cache flush. */
142 wcache_flush_cache();
145 /* We need to invalidate cached user list entries on a SIGHUP
146 otherwise cached access denied errors due to restrict anonymous
147 hang around until the sequence number changes. */
149 wcache_invalidate_cache();
152 /* Handle the signal by unlinking socket and exiting */
154 static void terminate(void)
160 /* Remove socket file */
161 pstr_sprintf(path
, "%s/%s",
162 WINBINDD_SOCKET_DIR
, WINBINDD_SOCKET_NAME
);
167 static BOOL do_sigterm
;
169 static void termination_handler(int signum
)
175 static BOOL do_sigusr2
;
177 static void sigusr2_handler(int signum
)
183 static BOOL do_sighup
;
185 static void sighup_handler(int signum
)
191 /* React on 'smbcontrol winbindd reload-config' in the same way as on SIGHUP*/
192 static void msg_reload_services(int msg_type
, pid_t src
, void *buf
, size_t len
)
194 /* Flush various caches */
196 reload_services_file();
199 /* React on 'smbcontrol winbindd shutdown' in the same way as on SIGTERM*/
200 static void msg_shutdown(int msg_type
, pid_t src
, void *buf
, size_t len
)
205 struct dispatch_table
{
206 enum winbindd_cmd cmd
;
207 enum winbindd_result (*fn
)(struct winbindd_cli_state
*state
);
208 const char *winbindd_cmd_name
;
211 static struct dispatch_table dispatch_table
[] = {
215 { WINBINDD_GETPWNAM
, winbindd_getpwnam
, "GETPWNAM" },
216 { WINBINDD_GETPWUID
, winbindd_getpwuid
, "GETPWUID" },
218 { WINBINDD_SETPWENT
, winbindd_setpwent
, "SETPWENT" },
219 { WINBINDD_ENDPWENT
, winbindd_endpwent
, "ENDPWENT" },
220 { WINBINDD_GETPWENT
, winbindd_getpwent
, "GETPWENT" },
222 { WINBINDD_GETGROUPS
, winbindd_getgroups
, "GETGROUPS" },
223 { WINBINDD_GETUSERSIDS
, winbindd_getusersids
, "GETUSERSIDS" },
225 /* Group functions */
227 { WINBINDD_GETGRNAM
, winbindd_getgrnam
, "GETGRNAM" },
228 { WINBINDD_GETGRGID
, winbindd_getgrgid
, "GETGRGID" },
229 { WINBINDD_SETGRENT
, winbindd_setgrent
, "SETGRENT" },
230 { WINBINDD_ENDGRENT
, winbindd_endgrent
, "ENDGRENT" },
231 { WINBINDD_GETGRENT
, winbindd_getgrent
, "GETGRENT" },
232 { WINBINDD_GETGRLST
, winbindd_getgrent
, "GETGRLST" },
234 /* PAM auth functions */
236 { WINBINDD_PAM_AUTH
, winbindd_pam_auth
, "PAM_AUTH" },
237 { WINBINDD_PAM_AUTH_CRAP
, winbindd_pam_auth_crap
, "AUTH_CRAP" },
238 { WINBINDD_PAM_CHAUTHTOK
, winbindd_pam_chauthtok
, "CHAUTHTOK" },
240 /* Enumeration functions */
242 { WINBINDD_LIST_USERS
, winbindd_list_users
, "LIST_USERS" },
243 { WINBINDD_LIST_GROUPS
, winbindd_list_groups
, "LIST_GROUPS" },
244 { WINBINDD_LIST_TRUSTDOM
, winbindd_list_trusted_domains
, "LIST_TRUSTDOM" },
245 { WINBINDD_SHOW_SEQUENCE
, winbindd_show_sequence
, "SHOW_SEQUENCE" },
247 /* SID related functions */
249 { WINBINDD_LOOKUPSID
, winbindd_lookupsid
, "LOOKUPSID" },
250 { WINBINDD_LOOKUPNAME
, winbindd_lookupname
, "LOOKUPNAME" },
252 /* Lookup related functions */
254 { WINBINDD_SID_TO_UID
, winbindd_sid_to_uid
, "SID_TO_UID" },
255 { WINBINDD_SID_TO_GID
, winbindd_sid_to_gid
, "SID_TO_GID" },
256 { WINBINDD_GID_TO_SID
, winbindd_gid_to_sid
, "GID_TO_SID" },
257 { WINBINDD_UID_TO_SID
, winbindd_uid_to_sid
, "UID_TO_SID" },
258 { WINBINDD_ALLOCATE_RID
, winbindd_allocate_rid
, "ALLOCATE_RID" },
262 { WINBINDD_CHECK_MACHACC
, winbindd_check_machine_acct
, "CHECK_MACHACC" },
263 { WINBINDD_PING
, winbindd_ping
, "PING" },
264 { WINBINDD_INFO
, winbindd_info
, "INFO" },
265 { WINBINDD_INTERFACE_VERSION
, winbindd_interface_version
, "INTERFACE_VERSION" },
266 { WINBINDD_DOMAIN_NAME
, winbindd_domain_name
, "DOMAIN_NAME" },
267 { WINBINDD_DOMAIN_INFO
, winbindd_domain_info
, "DOMAIN_INFO" },
268 { WINBINDD_NETBIOS_NAME
, winbindd_netbios_name
, "NETBIOS_NAME" },
269 { WINBINDD_PRIV_PIPE_DIR
, winbindd_priv_pipe_dir
, "WINBINDD_PRIV_PIPE_DIR" },
273 { WINBINDD_WINS_BYNAME
, winbindd_wins_byname
, "WINS_BYNAME" },
274 { WINBINDD_WINS_BYIP
, winbindd_wins_byip
, "WINS_BYIP" },
276 /* UNIX account management functions */
277 { WINBINDD_CREATE_USER
, winbindd_create_user
, "CREATE_USER" },
278 { WINBINDD_CREATE_GROUP
, winbindd_create_group
, "CREATE_GROUP" },
279 { WINBINDD_ADD_USER_TO_GROUP
, winbindd_add_user_to_group
, "ADD_USER_TO_GROUP" },
280 { WINBINDD_REMOVE_USER_FROM_GROUP
, winbindd_remove_user_from_group
,"REMOVE_USER_FROM_GROUP"},
281 { WINBINDD_SET_USER_PRIMARY_GROUP
, winbindd_set_user_primary_group
,"SET_USER_PRIMARY_GROUP"},
282 { WINBINDD_DELETE_USER
, winbindd_delete_user
, "DELETE_USER" },
283 { WINBINDD_DELETE_GROUP
, winbindd_delete_group
, "DELETE_GROUP" },
287 { WINBINDD_NUM_CMDS
, NULL
, "NONE" }
290 static void process_request(struct winbindd_cli_state
*state
)
292 struct dispatch_table
*table
= dispatch_table
;
294 /* Free response data - we may be interrupted and receive another
295 command before being able to send this data off. */
297 SAFE_FREE(state
->response
.extra_data
);
299 ZERO_STRUCT(state
->response
);
301 state
->response
.result
= WINBINDD_ERROR
;
302 state
->response
.length
= sizeof(struct winbindd_response
);
304 /* Process command */
306 for (table
= dispatch_table
; table
->fn
; table
++) {
307 if (state
->request
.cmd
== table
->cmd
) {
308 DEBUG(10,("process_request: request fn %s\n", table
->winbindd_cmd_name
));
309 state
->response
.result
= table
->fn(state
);
315 DEBUG(10,("process_request: unknown request fn number %d\n", (int)state
->request
.cmd
));
317 /* In case extra data pointer is NULL */
319 if (!state
->response
.extra_data
)
320 state
->response
.length
= sizeof(struct winbindd_response
);
323 /* Process a new connection by adding it to the client connection list */
325 static void new_connection(int listen_sock
, BOOL privileged
)
327 struct sockaddr_un sunaddr
;
328 struct winbindd_cli_state
*state
;
332 /* Accept connection */
334 len
= sizeof(sunaddr
);
337 sock
= accept(listen_sock
, (struct sockaddr
*)&sunaddr
, &len
);
338 } while (sock
== -1 && errno
== EINTR
);
343 DEBUG(6,("accepted socket %d\n", sock
));
345 /* Create new connection structure */
347 if ((state
= (struct winbindd_cli_state
*)
348 malloc(sizeof(*state
))) == NULL
)
354 state
->last_access
= time(NULL
);
356 state
->privileged
= privileged
;
358 /* Add to connection list */
360 winbindd_add_client(state
);
363 /* Remove a client connection from client connection list */
365 static void remove_client(struct winbindd_cli_state
*state
)
367 /* It's a dead client - hold a funeral */
375 /* Free any getent state */
377 free_getent_state(state
->getpwent_state
);
378 free_getent_state(state
->getgrent_state
);
380 /* We may have some extra data that was not freed if the
381 client was killed unexpectedly */
383 SAFE_FREE(state
->response
.extra_data
);
385 /* Remove from list and free */
387 winbindd_remove_client(state
);
393 /* Shutdown client connection which has been idle for the longest time */
395 static BOOL
remove_idle_client(void)
397 struct winbindd_cli_state
*state
, *remove_state
= NULL
;
398 time_t last_access
= 0;
401 for (state
= winbindd_client_list(); state
; state
= state
->next
) {
402 if (state
->read_buf_len
== 0 && state
->write_buf_len
== 0 &&
403 !state
->getpwent_state
&& !state
->getgrent_state
) {
405 if (!last_access
|| state
->last_access
< last_access
) {
406 last_access
= state
->last_access
;
407 remove_state
= state
;
413 DEBUG(5,("Found %d idle client connections, shutting down sock %d, pid %u\n",
414 nidle
, remove_state
->sock
, (unsigned int)remove_state
->pid
));
415 remove_client(remove_state
);
422 /* Process a complete received packet from a client */
424 void winbind_process_packet(struct winbindd_cli_state
*state
)
426 /* Process request */
428 /* Ensure null termination of entire request */
429 state
->request
.null_term
= '\0';
431 state
->pid
= state
->request
.pid
;
433 process_request(state
);
435 /* Update client state */
437 state
->read_buf_len
= 0;
438 state
->write_buf_len
= sizeof(struct winbindd_response
);
440 /* we might need to send it to the dual daemon */
441 if (opt_dual_daemon
) {
442 dual_send_request(state
);
446 /* Read some data from a client connection */
448 void winbind_client_read(struct winbindd_cli_state
*state
)
454 n
= sys_read(state
->sock
, state
->read_buf_len
+
455 (char *)&state
->request
,
456 sizeof(state
->request
) - state
->read_buf_len
);
458 DEBUG(10,("client_read: read %d bytes. Need %ld more for a full request.\n", n
, (unsigned long)(sizeof(state
->request
) - n
- state
->read_buf_len
) ));
460 /* Read failed, kill client */
462 if (n
== -1 || n
== 0) {
463 DEBUG(5,("read failed on sock %d, pid %lu: %s\n",
464 state
->sock
, (unsigned long)state
->pid
,
465 (n
== -1) ? strerror(errno
) : "EOF"));
467 state
->finished
= True
;
471 /* Update client state */
473 state
->read_buf_len
+= n
;
474 state
->last_access
= time(NULL
);
477 /* Write some data to a client connection */
479 static void client_write(struct winbindd_cli_state
*state
)
484 /* Write some data */
486 * The fancy calculation of data below allows us to handle the
487 * case where write (sys_write) does not write all the data we
488 * gave it. In that case, we will come back through here again
489 * because of the loop above us, and we want to pick up where
493 if (!state
->write_extra_data
) {
495 /* Write response structure */
497 data
= (char *)&state
->response
+ sizeof(state
->response
) -
498 state
->write_buf_len
;
502 /* Write extra data */
504 data
= (char *)state
->response
.extra_data
+
505 state
->response
.length
-
506 sizeof(struct winbindd_response
) -
507 state
->write_buf_len
;
510 num_written
= sys_write(state
->sock
, data
, state
->write_buf_len
);
512 DEBUG(10,("client_write: wrote %d bytes.\n", num_written
));
514 /* Write failed, kill cilent */
516 if (num_written
== -1 || num_written
== 0) {
518 DEBUG(3,("write failed on sock %d, pid %lu: %s\n",
519 state
->sock
, (unsigned long)state
->pid
,
520 (num_written
== -1) ? strerror(errno
) : "EOF"));
522 state
->finished
= True
;
524 SAFE_FREE(state
->response
.extra_data
);
529 /* Update client state */
531 state
->write_buf_len
-= num_written
;
532 state
->last_access
= time(NULL
);
534 /* Have we written all data? */
536 if (state
->write_buf_len
== 0) {
538 /* Take care of extra data */
540 if (state
->write_extra_data
) {
542 SAFE_FREE(state
->response
.extra_data
);
544 state
->write_extra_data
= False
;
546 DEBUG(10,("client_write: client_write: complete response written.\n"));
548 } else if (state
->response
.length
>
549 sizeof(struct winbindd_response
)) {
551 /* Start writing extra data */
553 state
->write_buf_len
=
554 state
->response
.length
-
555 sizeof(struct winbindd_response
);
557 DEBUG(10,("client_write: need to write %d extra data bytes.\n", (int)state
->write_buf_len
));
559 state
->write_extra_data
= True
;
564 /* Process incoming clients on listen_sock. We use a tricky non-blocking,
565 non-forking, non-threaded model which allows us to handle many
566 simultaneous connections while remaining impervious to many denial of
569 static void process_loop(void)
571 /* We'll be doing this a lot */
574 struct winbindd_cli_state
*state
;
576 int maxfd
, listen_sock
, listen_priv_sock
, selret
;
577 struct timeval timeout
;
579 /* Handle messages */
583 /* refresh the trusted domain cache */
585 rescan_trusted_domains();
587 /* Free up temporary memory */
590 main_loop_talloc_free();
592 /* Initialise fd lists for select() */
594 listen_sock
= open_winbindd_socket();
595 listen_priv_sock
= open_winbindd_priv_socket();
597 if (listen_sock
== -1 || listen_priv_sock
== -1) {
598 perror("open_winbind_socket");
602 maxfd
= MAX(listen_sock
, listen_priv_sock
);
606 FD_SET(listen_sock
, &r_fds
);
607 FD_SET(listen_priv_sock
, &r_fds
);
609 timeout
.tv_sec
= WINBINDD_ESTABLISH_LOOP
;
612 if (opt_dual_daemon
) {
613 maxfd
= dual_select_setup(&w_fds
, maxfd
);
616 /* Set up client readers and writers */
618 state
= winbindd_client_list();
622 /* Dispose of client connection if it is marked as
625 if (state
->finished
) {
626 struct winbindd_cli_state
*next
= state
->next
;
628 remove_client(state
);
633 /* Select requires we know the highest fd used */
635 if (state
->sock
> maxfd
)
638 /* Add fd for reading */
640 if (state
->read_buf_len
!= sizeof(state
->request
))
641 FD_SET(state
->sock
, &r_fds
);
643 /* Add fd for writing */
645 if (state
->write_buf_len
)
646 FD_SET(state
->sock
, &w_fds
);
653 selret
= sys_select(maxfd
+ 1, &r_fds
, &w_fds
, NULL
, &timeout
);
658 if ((selret
== -1 && errno
!= EINTR
) || selret
== 0) {
660 /* Select error, something is badly wrong */
666 /* Create a new connection if listen_sock readable */
670 if (opt_dual_daemon
) {
674 if (FD_ISSET(listen_sock
, &r_fds
)) {
675 while (winbindd_num_clients() > WINBINDD_MAX_SIMULTANEOUS_CLIENTS
- 1) {
676 DEBUG(5,("winbindd: Exceeding %d client connections, removing idle connection.\n",
677 WINBINDD_MAX_SIMULTANEOUS_CLIENTS
));
678 if (!remove_idle_client()) {
679 DEBUG(0,("winbindd: Exceeding %d client connections, no idle connection found\n",
680 WINBINDD_MAX_SIMULTANEOUS_CLIENTS
));
684 /* new, non-privileged connection */
685 new_connection(listen_sock
, False
);
688 if (FD_ISSET(listen_priv_sock
, &r_fds
)) {
689 while (winbindd_num_clients() > WINBINDD_MAX_SIMULTANEOUS_CLIENTS
- 1) {
690 DEBUG(5,("winbindd: Exceeding %d client connections, removing idle connection.\n",
691 WINBINDD_MAX_SIMULTANEOUS_CLIENTS
));
692 if (!remove_idle_client()) {
693 DEBUG(0,("winbindd: Exceeding %d client connections, no idle connection found\n",
694 WINBINDD_MAX_SIMULTANEOUS_CLIENTS
));
698 /* new, privileged connection */
699 new_connection(listen_priv_sock
, True
);
702 /* Process activity on client connections */
704 for (state
= winbindd_client_list(); state
;
705 state
= state
->next
) {
707 /* Data available for reading */
709 if (FD_ISSET(state
->sock
, &r_fds
)) {
713 winbind_client_read(state
);
716 * If we have the start of a
717 * packet, then check the
718 * length field to make sure
719 * the client's not talking
723 if (state
->read_buf_len
>= sizeof(uint32
)
724 && *(uint32
*) &state
->request
!= sizeof(state
->request
)) {
725 DEBUG(0,("process_loop: Invalid request size from pid %lu: %d bytes sent, should be %ld\n",
726 (unsigned long)state
->request
.pid
, *(uint32
*) &state
->request
, (unsigned long)sizeof(state
->request
)));
727 DEBUGADD(0, ("This usually means that you are running old wbinfo, pam_winbind or libnss_winbind clients\n"));
729 remove_client(state
);
733 /* A request packet might be
736 if (state
->read_buf_len
==
737 sizeof(state
->request
)) {
738 winbind_process_packet(state
);
742 /* Data available for writing */
744 if (FD_ISSET(state
->sock
, &w_fds
))
750 winbindd_check_cache_size(time(NULL
));
753 /* Check signal handling things */
760 DEBUG(3, ("got SIGHUP\n"));
762 msg_reload_services(MSG_SMB_CONF_UPDATED
, (pid_t
) 0, NULL
, 0);
767 print_winbindd_status();
775 struct winbindd_state server_state
; /* Server state information */
777 int main(int argc
, char **argv
)
780 static BOOL interactive
= False
;
781 static BOOL Fork
= True
;
782 static BOOL log_stdout
= False
;
783 struct poptOption long_options
[] = {
785 { "stdout", 'S', POPT_ARG_VAL
, &log_stdout
, True
, "Log to stdout" },
786 { "foreground", 'F', POPT_ARG_VAL
, &Fork
, False
, "Daemon in foreground mode" },
787 { "interactive", 'i', POPT_ARG_NONE
, NULL
, 'i', "Interactive mode" },
788 { "single-daemon", 'Y', POPT_ARG_VAL
, &opt_dual_daemon
, False
, "Single daemon mode" },
789 { "no-caching", 'n', POPT_ARG_VAL
, &opt_nocache
, True
, "Disable caching" },
796 /* glibc (?) likes to print "User defined signal 1" and exit if a
797 SIGUSR[12] is received before a handler is installed */
799 CatchSignal(SIGUSR1
, SIG_IGN
);
800 CatchSignal(SIGUSR2
, SIG_IGN
);
802 fault_setup((void (*)(void *))fault_quit
);
804 /* Initialise for running in non-root mode */
808 set_remote_machine_name("winbindd", False
);
810 /* Set environment variable so we don't recursively call ourselves.
811 This may also be useful interactively. */
813 setenv(WINBINDD_DONT_ENV
, "1", 1);
815 /* Initialise samba/rpc client stuff */
817 pc
= poptGetContext("winbindd", argc
, (const char **)argv
, long_options
,
818 POPT_CONTEXT_KEEP_FIRST
);
820 while ((opt
= poptGetNextOpt(pc
)) != -1) {
822 /* Don't become a daemon */
832 if (log_stdout
&& Fork
) {
833 printf("Can't log to stdout (-S) unless daemon is in foreground +(-F) or interactive (-i)\n");
834 poptPrintUsage(pc
, stderr
, 0);
838 pstr_sprintf(logfile
, "%s/log.winbindd", dyn_LOGFILEBASE
);
839 lp_set_logfile(logfile
);
840 setup_logging("winbindd", log_stdout
);
843 DEBUG(1, ("winbindd version %s started.\n", SAMBA_VERSION_STRING
) );
844 DEBUGADD( 1, ( "Copyright The Samba Team 2000-2004\n" ) );
846 if (!reload_services_file()) {
847 DEBUG(0, ("error opening config file\n"));
858 if (!secrets_init()) {
860 DEBUG(0,("Could not initialize domain trust account secrets. Giving up\n"));
864 /* Enable netbios namecache */
868 /* Check winbindd parameters are valid */
870 ZERO_STRUCT(server_state
);
872 if (!winbindd_param_init())
875 /* Winbind daemon initialisation */
877 if (!winbindd_upgrade_idmap())
880 if (!idmap_init(lp_idmap_backend()))
883 /* Unblock all signals we are interested in as they may have been
884 blocked by the parent process. */
886 BlockSignals(False
, SIGINT
);
887 BlockSignals(False
, SIGQUIT
);
888 BlockSignals(False
, SIGTERM
);
889 BlockSignals(False
, SIGUSR1
);
890 BlockSignals(False
, SIGUSR2
);
891 BlockSignals(False
, SIGHUP
);
893 /* Setup signal handlers */
895 CatchSignal(SIGINT
, termination_handler
); /* Exit on these sigs */
896 CatchSignal(SIGQUIT
, termination_handler
);
897 CatchSignal(SIGTERM
, termination_handler
);
899 CatchSignal(SIGPIPE
, SIG_IGN
); /* Ignore sigpipe */
901 CatchSignal(SIGUSR2
, sigusr2_handler
); /* Debugging sigs */
902 CatchSignal(SIGHUP
, sighup_handler
);
907 pidfile_create("winbindd");
911 * If we're interactive we want to set our own process group for
915 setpgid( (pid_t
)0, (pid_t
)0);
918 if (opt_dual_daemon
) {
922 /* Initialise messaging system */
924 if (!message_init()) {
925 DEBUG(0, ("unable to initialise messaging system\n"));
929 /* React on 'smbcontrol winbindd reload-config' in the same way
930 as to SIGHUP signal */
931 message_register(MSG_SMB_CONF_UPDATED
, msg_reload_services
);
932 message_register(MSG_SHUTDOWN
, msg_shutdown
);
936 netsamlogon_cache_init(); /* Non-critical */
940 /* Loop waiting for requests */
944 trustdom_cache_shutdown();