summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2000-10-12 21:19:49 +0000
committerJeremy Allison <jra@samba.org>2000-10-12 21:19:49 +0000
commitc56301b1d117c27213fe2dc4faf72a1bec19d092 (patch)
tree43ad08a6c4be169cfe4b9be70fe1ac334713669c
parent2a2a93bebec0d40e26860226f64c4964d5224f3b (diff)
downloadsamba-c56301b1d117c27213fe2dc4faf72a1bec19d092.tar.gz
samba-c56301b1d117c27213fe2dc4faf72a1bec19d092.tar.bz2
samba-c56301b1d117c27213fe2dc4faf72a1bec19d092.zip
Ignore SIGUSR2. Terminate nmbd if we have no interfaces.
Jeremy. (This used to be commit 580e2e044cfd1d011d9f28f0f49ef60ca6ba8d32)
-rw-r--r--source3/nmbd/nmbd.c24
-rw-r--r--source3/smbd/server.c5
2 files changed, 24 insertions, 5 deletions
diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c
index 914f288001..5b9a00aad0 100644
--- a/source3/nmbd/nmbd.c
+++ b/source3/nmbd/nmbd.c
@@ -186,7 +186,7 @@ static void expire_names_and_servers(time_t t)
/************************************************************************** **
reload the list of network interfaces
************************************************************************** */
-static void reload_interfaces(time_t t)
+static BOOL reload_interfaces(time_t t)
{
static time_t lastt;
int n;
@@ -194,10 +194,10 @@ static void reload_interfaces(time_t t)
extern BOOL rescan_listen_set;
extern struct in_addr loopback_ip;
- if (t && ((t - lastt) < NMBD_INTERFACES_RELOAD)) return;
+ if (t && ((t - lastt) < NMBD_INTERFACES_RELOAD)) return False;
lastt = t;
- if (!interfaces_changed()) return;
+ if (!interfaces_changed()) return False;
/* the list of probed interfaces has changed, we may need to add/remove
some subnets */
@@ -253,6 +253,13 @@ static void reload_interfaces(time_t t)
}
rescan_listen_set = True;
+
+ /* We need to shutdown if there are no subnets... */
+ if (FIRST_SUBNET == NULL) {
+ DEBUG(0,("reload_interfaces: No subnets to listen to. Shutting down...\n"));
+ return True;
+ }
+ return False;
}
@@ -484,12 +491,14 @@ static void process(void)
if(reload_after_sighup) {
reload_nmbd_services( True );
reopen_logs();
- reload_interfaces(0);
+ if(reload_interfaces(0))
+ return;
reload_after_sighup = False;
}
/* check for new network interfaces */
- reload_interfaces(t);
+ if(reload_interfaces(t))
+ return;
/* free up temp memory */
lp_talloc_free();
@@ -685,6 +694,11 @@ static void usage(char *pname)
BlockSignals(True,SIGFPE);
#endif
+ /* We no longer use USR2... */
+#if defined(SIGUSR2)
+ BlockSignals(True, SIGUSR2);
+#endif
+
while( EOF !=
(opt = getopt( argc, argv, "Vaos:T:I:C:bAB:N:Rn:l:d:Dp:hSH:G:f:" )) )
{
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index 4c136f638b..e4dd661ea5 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -635,6 +635,11 @@ static void usage(char *pname)
BlockSignals(True,SIGFPE);
#endif
+#if defined(SIGUSR2)
+ /* We are no longer interested in USR2 */
+ BlockSignals(True,SIGUSR2);
+#endif
+
/* we want total control over the permissions on created files,
so set our umask to 0 */
umask(0);