From e21b283d6713794fb0a415a9313943867812884d Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 1 Apr 2008 14:01:28 +0200 Subject: [PATCH] dbwrap: wait for tdb2 change notifies in smbd, nmbd and winbindd metze (This used to be commit 64450cc1e441355aa8925b7183e90872eeab20b1) --- source3/Makefile.in | 5 +++-- source3/nmbd/nmbd.c | 8 ++++++++ source3/smbd/server.c | 6 +++++- source3/winbindd/winbindd.c | 7 +++++++ 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/source3/Makefile.in b/source3/Makefile.in index 08883d8da42..59eeecf1288 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -711,7 +711,7 @@ NMBD_OBJ1 = nmbd/asyncdns.o nmbd/nmbd.o nmbd/nmbd_become_dmb.o \ nmbd/nmbd_processlogon.o nmbd/nmbd_responserecordsdb.o \ nmbd/nmbd_sendannounce.o nmbd/nmbd_serverlistdb.o \ nmbd/nmbd_subnetdb.o nmbd/nmbd_winsproxy.o nmbd/nmbd_winsserver.o \ - nmbd/nmbd_workgroupdb.o nmbd/nmbd_synclists.o + nmbd/nmbd_workgroupdb.o nmbd/nmbd_synclists.o smbd/connection.o NMBD_OBJ = $(NMBD_OBJ1) $(PARAM_OBJ) $(LIBSMB_OBJ) $(KRBCLIENT_OBJ) \ $(PROFILE_OBJ) $(LIB_NONSMBD_OBJ) $(POPT_LIB_OBJ) @@ -1032,7 +1032,8 @@ WINBINDD_OBJ1 = \ winbindd/winbindd_idmap.o \ winbindd/winbindd_locator.o \ winbindd/winbindd_ndr.o \ - auth/token_util.o + auth/token_util.o \ + smbd/connection.o WINBINDD_OBJ = \ $(WINBINDD_OBJ1) $(PASSDB_OBJ) @LIBWBCLIENT_STATIC@ $(GROUPDB_OBJ) \ diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c index 03494453179..01fdbbc5a46 100644 --- a/source3/nmbd/nmbd.c +++ b/source3/nmbd/nmbd.c @@ -847,6 +847,8 @@ static bool open_sockets(bool isdaemon, int port) DEBUG(0,("nmbd version %s started.\n", SAMBA_VERSION_STRING)); DEBUGADD(0,("%s\n", COPYRIGHT_STARTUP_MESSAGE)); + db_tdb2_setup_messaging(NULL, false); + if ( !reload_nmbd_services(False) ) return(-1); @@ -898,6 +900,10 @@ static bool open_sockets(bool isdaemon, int port) } pidfile_create("nmbd"); + + /* get broadcast messages */ + claim_connection(NULL,"",FLAG_MSG_GENERAL|FLAG_MSG_DBWRAP); + messaging_register(nmbd_messaging_context(), NULL, MSG_FORCE_ELECTION, nmbd_message_election); #if 0 @@ -912,6 +918,8 @@ static bool open_sockets(bool isdaemon, int port) messaging_register(nmbd_messaging_context(), NULL, MSG_SEND_PACKET, msg_nmbd_send_packet); + db_tdb2_setup_messaging(nmbd_messaging_context(), true); + TimeInit(); DEBUG( 3, ( "Opening sockets %d\n", global_nmb_port ) ); diff --git a/source3/smbd/server.c b/source3/smbd/server.c index 7a6e17135fe..bc0d4b70a3d 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -553,7 +553,8 @@ static bool open_sockets_smbd(bool is_daemon, bool interactive, const char *smb_ clustered mode, ctdb won't allow us to start doing database operations until it has gone thru a full startup, which includes checking to see that smbd is listening. */ - claim_connection(NULL,"",FLAG_MSG_GENERAL|FLAG_MSG_SMBD); + claim_connection(NULL,"", + FLAG_MSG_GENERAL|FLAG_MSG_SMBD|FLAG_MSG_DBWRAP); /* Listen to messages */ @@ -574,6 +575,8 @@ static bool open_sockets_smbd(bool is_daemon, bool interactive, const char *smb_ MSG_SMB_INJECT_FAULT, msg_inject_fault); #endif + db_tdb2_setup_messaging(smbd_messaging_context(), true); + /* now accept incoming connections - forking a new process for each incoming connection */ DEBUG(2,("waiting for a connection\n")); @@ -1226,6 +1229,7 @@ extern void build_options(bool screen); /* * Do this before reload_services. */ + db_tdb2_setup_messaging(NULL, false); if (!reload_services(False)) return(-1); diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c index dbfd397f8bc..ff9bbf1c24a 100644 --- a/source3/winbindd/winbindd.c +++ b/source3/winbindd/winbindd.c @@ -1102,6 +1102,8 @@ int main(int argc, char **argv, char **envp) DEBUG(0,("winbindd version %s started.\n", SAMBA_VERSION_STRING)); DEBUGADD(0,("%s\n", COPYRIGHT_STARTUP_MESSAGE)); + db_tdb2_setup_messaging(NULL, false); + if (!reload_services_file()) { DEBUG(0, ("error opening config file\n")); exit(1); @@ -1188,6 +1190,9 @@ int main(int argc, char **argv, char **envp) exit(1); } + /* get broadcast messages */ + claim_connection(NULL,"",FLAG_MSG_GENERAL|FLAG_MSG_DBWRAP); + /* React on 'smbcontrol winbindd reload-config' in the same way as to SIGHUP signal */ messaging_register(winbind_messaging_context(), NULL, @@ -1214,6 +1219,8 @@ int main(int argc, char **argv, char **envp) MSG_WINBIND_DUMP_DOMAIN_LIST, winbind_msg_dump_domain_list); + db_tdb2_setup_messaging(winbind_messaging_context(), true); + netsamlogon_cache_init(); /* Non-critical */ /* clear the cached list of trusted domains */ -- 2.34.1