summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2003-05-06 02:32:47 +0000
committerTim Potter <tpot@samba.org>2003-05-06 02:32:47 +0000
commit45f8fd3fa99772b5f65b205a96ee3286b1e85ff4 (patch)
treee9b51511625533955777699de8c5f76be384816b /source3
parent7cd3bdc7846e8d93c37d0f9e470d31ec23c4dad1 (diff)
downloadsamba-45f8fd3fa99772b5f65b205a96ee3286b1e85ff4.tar.gz
samba-45f8fd3fa99772b5f65b205a96ee3286b1e85ff4.tar.bz2
samba-45f8fd3fa99772b5f65b205a96ee3286b1e85ff4.zip
There appears to be no reason why we have to execute the
initialisation code in winbindd_init_common() after the fork when running in dual daemon mode. The only tricky bit is we have to run a tdb_reopen_all() somewhere in the child to avoid tdb corruption. Fixed bug #60. (This used to be commit 25e55aca0fe315c2ccf4e34a94107b2321313714)
Diffstat (limited to 'source3')
-rw-r--r--source3/nsswitch/winbindd.c102
-rw-r--r--source3/nsswitch/winbindd_dual.c3
2 files changed, 45 insertions, 60 deletions
diff --git a/source3/nsswitch/winbindd.c b/source3/nsswitch/winbindd.c
index ff21a4644f..fb6f67625c 100644
--- a/source3/nsswitch/winbindd.c
+++ b/source3/nsswitch/winbindd.c
@@ -730,59 +730,6 @@ static void process_loop(void)
}
}
-
-/*
- these are split out from the main winbindd for use by the background daemon
- */
-BOOL winbind_setup_common(void)
-{
- load_interfaces();
-
- if (!secrets_init()) {
-
- DEBUG(0,("Could not initialize domain trust account secrets. Giving up\n"));
- return False;
- }
-
- namecache_enable(); /* Enable netbios namecache */
-
- /* Check winbindd parameters are valid */
-
- ZERO_STRUCT(server_state);
-
- if (!winbindd_param_init())
- return False;
-
- /* Winbind daemon initialisation */
-
- if (!winbindd_idmap_init())
- return False;
-
- /* Unblock all signals we are interested in as they may have been
- blocked by the parent process. */
-
- BlockSignals(False, SIGINT);
- BlockSignals(False, SIGQUIT);
- BlockSignals(False, SIGTERM);
- BlockSignals(False, SIGUSR1);
- BlockSignals(False, SIGUSR2);
- BlockSignals(False, SIGHUP);
-
- /* Setup signal handlers */
-
- CatchSignal(SIGINT, termination_handler); /* Exit on these sigs */
- CatchSignal(SIGQUIT, termination_handler);
- CatchSignal(SIGTERM, termination_handler);
-
- CatchSignal(SIGPIPE, SIG_IGN); /* Ignore sigpipe */
-
- CatchSignal(SIGUSR2, sigusr2_handler); /* Debugging sigs */
- CatchSignal(SIGHUP, sighup_handler);
-
- return True;
-}
-
-
/* Main function */
struct winbindd_state server_state; /* Server state information */
@@ -866,6 +813,51 @@ int main(int argc, char **argv)
if (!init_names())
exit(1);
+ load_interfaces();
+
+ if (!secrets_init()) {
+
+ DEBUG(0,("Could not initialize domain trust account secrets. Giving up\n"));
+ return False;
+ }
+
+ /* Enable netbios namecache */
+
+ namecache_enable();
+
+ /* Check winbindd parameters are valid */
+
+ ZERO_STRUCT(server_state);
+
+ if (!winbindd_param_init())
+ return 1;
+
+ /* Winbind daemon initialisation */
+
+ if (!winbindd_idmap_init())
+ return 1;
+
+ /* Unblock all signals we are interested in as they may have been
+ blocked by the parent process. */
+
+ BlockSignals(False, SIGINT);
+ BlockSignals(False, SIGQUIT);
+ BlockSignals(False, SIGTERM);
+ BlockSignals(False, SIGUSR1);
+ BlockSignals(False, SIGUSR2);
+ BlockSignals(False, SIGHUP);
+
+ /* Setup signal handlers */
+
+ CatchSignal(SIGINT, termination_handler); /* Exit on these sigs */
+ CatchSignal(SIGQUIT, termination_handler);
+ CatchSignal(SIGTERM, termination_handler);
+
+ CatchSignal(SIGPIPE, SIG_IGN); /* Ignore sigpipe */
+
+ CatchSignal(SIGUSR2, sigusr2_handler); /* Debugging sigs */
+ CatchSignal(SIGHUP, sighup_handler);
+
if (!interactive)
become_daemon(Fork);
@@ -880,10 +872,6 @@ int main(int argc, char **argv)
setpgid( (pid_t)0, (pid_t)0);
#endif
- if (!winbind_setup_common()) {
- return 1;
- }
-
if (opt_dual_daemon) {
do_dual_daemon();
}
diff --git a/source3/nsswitch/winbindd_dual.c b/source3/nsswitch/winbindd_dual.c
index 3597171005..167630b0e1 100644
--- a/source3/nsswitch/winbindd_dual.c
+++ b/source3/nsswitch/winbindd_dual.c
@@ -166,9 +166,6 @@ void do_dual_daemon(void)
_exit(0);
}
- if (!winbind_setup_common())
- _exit(0);
-
dual_daemon_pipe = -1;
opt_dual_daemon = False;