diff options
Diffstat (limited to 'source3/nmbd')
-rw-r--r-- | source3/nmbd/asyncdns.c | 22 | ||||
-rw-r--r-- | source3/nmbd/nmbd.c | 3 |
2 files changed, 24 insertions, 1 deletions
diff --git a/source3/nmbd/asyncdns.c b/source3/nmbd/asyncdns.c index 3b71369d67..3fb16a08e9 100644 --- a/source3/nmbd/asyncdns.c +++ b/source3/nmbd/asyncdns.c @@ -103,7 +103,8 @@ static void asyncdns_process(void) } /**************************************************************************** ** - catch a sigterm + catch a sigterm (in the child process - the parent has a different handler + see nmbd.c for details). We need a separate term handler here so we don't release any names that our parent is going to release, or overwrite a WINS db that our parent is going to write. @@ -117,6 +118,17 @@ static int sig_term() } /*************************************************************************** + Called by the parent process when it receives a SIGTERM - also kills the + child so we don't get child async dns processes lying around, causing trouble. + ****************************************************************************/ + +void kill_async_dns_child() +{ + if(child_pid != 0 && child_pid != -1) + kill(child_pid, SIGTERM); +} + +/*************************************************************************** create a child process to handle DNS lookups ****************************************************************************/ void start_async_dns(void) @@ -326,4 +338,12 @@ BOOL queue_dns_query(struct packet_struct *p,struct nmb_name *question, send_wins_name_query_response(0, p, *n); return False; } + +/*************************************************************************** + With sync dns there is no child to kill on SIGTERM. + ****************************************************************************/ +void kill_async_dns_child() +{ + return; +} #endif diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c index d42580bcbd..1a12e0eec0 100644 --- a/source3/nmbd/nmbd.c +++ b/source3/nmbd/nmbd.c @@ -74,6 +74,9 @@ static int sig_term() /* Announce all server entries as 0 time-to-live, 0 type. */ announce_my_servers_removed(); + /* If there was an async dns child - kill it. */ + kill_async_dns_child(); + exit(0); /* Keep compiler happy.. */ |