summaryrefslogtreecommitdiff
path: root/source3/nmbd
diff options
context:
space:
mode:
authorAlexander Bokovoy <ab@samba.org>2003-07-15 17:21:21 +0000
committerAlexander Bokovoy <ab@samba.org>2003-07-15 17:21:21 +0000
commit8c4be2bbc9d1b42ae1b26a3a2519dd2c911dee45 (patch)
tree8714ccf9f0658d5adf0adcfcb0cfeb771f843ef6 /source3/nmbd
parentcf8628e5858f2875cfccbac87eb9b02ef5f7228d (diff)
downloadsamba-8c4be2bbc9d1b42ae1b26a3a2519dd2c911dee45.tar.gz
samba-8c4be2bbc9d1b42ae1b26a3a2519dd2c911dee45.tar.bz2
samba-8c4be2bbc9d1b42ae1b26a3a2519dd2c911dee45.zip
Add support for MSG_SMB_CONF_UPDATED and MSG_SHUTDOWN to all daemons (smbd, nmbd, winbindd). Reviewed by jerry and tridge.
(This used to be commit 02c5e2fc6f0721ebd82a9e6a2b34190607de55fe)
Diffstat (limited to 'source3/nmbd')
-rw-r--r--source3/nmbd/nmbd.c31
1 files changed, 26 insertions, 5 deletions
diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c
index d9300f4668..2801e54551 100644
--- a/source3/nmbd/nmbd.c
+++ b/source3/nmbd/nmbd.c
@@ -299,12 +299,35 @@ static BOOL reload_nmbd_services(BOOL test)
}
/**************************************************************************** **
+ * React on 'smbcontrol nmbd reload-config' in the same way as to SIGHUP
+ * We use buf here to return BOOL result to process() when reload_interfaces()
+ * detects that there are no subnets.
+ **************************************************************************** */
+static void msg_reload_nmbd_services(int msg_type, pid_t src, void *buf, size_t len)
+{
+ write_browse_list( 0, True );
+ dump_all_namelists();
+ reload_nmbd_services( True );
+ reopen_logs();
+
+ if(buf) {
+ /* We were called from process() */
+ /* If reload_interfaces() returned True */
+ /* we need to shutdown if there are no subnets... */
+ /* pass this info back to process() */
+ *((BOOL*)buf) = reload_interfaces(0);
+ }
+}
+
+
+/**************************************************************************** **
The main select loop.
**************************************************************************** */
static void process(void)
{
BOOL run_election;
+ BOOL no_subnets;
while( True ) {
time_t t = time(NULL);
@@ -513,11 +536,8 @@ static void process(void)
if(reload_after_sighup) {
DEBUG( 0, ( "Got SIGHUP dumping debug info.\n" ) );
- write_browse_list( 0, True );
- dump_all_namelists();
- reload_nmbd_services( True );
- reopen_logs();
- if(reload_interfaces(0))
+ msg_reload_nmbd_services(MSG_SMB_CONF_UPDATED, (pid_t) 0, (void*) &no_subnets, 0);
+ if(no_subnets)
return;
reload_after_sighup = 0;
}
@@ -696,6 +716,7 @@ static BOOL open_sockets(BOOL isdaemon, int port)
message_register(MSG_FORCE_ELECTION, nmbd_message_election);
message_register(MSG_WINS_NEW_ENTRY, nmbd_wins_new_entry);
message_register(MSG_SHUTDOWN, nmbd_terminate);
+ message_register(MSG_SMB_CONF_UPDATED, msg_reload_nmbd_services);
DEBUG( 3, ( "Opening sockets %d\n", global_nmb_port ) );