summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamba Release Account <samba-bugs@samba.org>1997-05-31 01:11:40 +0000
committerSamba Release Account <samba-bugs@samba.org>1997-05-31 01:11:40 +0000
commit9f4e01224751134c2f7701e2aea87d06a79d77a4 (patch)
treecc64a8070622596af11a4c47b9fe2c100be69863
parentfbeaf146c0903f0939d1128af01cff8ea18a2546 (diff)
downloadsamba-9f4e01224751134c2f7701e2aea87d06a79d77a4.tar.gz
samba-9f4e01224751134c2f7701e2aea87d06a79d77a4.tar.xz
samba-9f4e01224751134c2f7701e2aea87d06a79d77a4.zip
namepacket.c: Block SIGTERM correctly - we can only take them at defined points.
nameserv.c: Fixup name release code - used when we are going down. nameservreply.c: Relaxed check for deleting name - original code never deleted. nmbd.c: Block SIGTERM signals most of the time - see comment on namepacket above. Jeremy (jallison@whistle.com)
-rw-r--r--source/namepacket.c3
-rw-r--r--source/nameserv.c16
-rw-r--r--source/nameservreply.c5
-rw-r--r--source/nmbd/nmbd.c2
4 files changed, 24 insertions, 2 deletions
diff --git a/source/namepacket.c b/source/namepacket.c
index 31cad927911..418155bbd85 100644
--- a/source/namepacket.c
+++ b/source/namepacket.c
@@ -522,7 +522,10 @@ void listen_for_packets(BOOL run_election)
timeout.tv_sec = (run_election||num_response_packets) ? 1:NMBD_SELECT_LOOP;
timeout.tv_usec = 0;
+ /* We can only take term signals when we are in the select. */
+ BlockSignals(False, SIGTERM);
selrtn = sys_select(&fds,&timeout);
+ BlockSignals(True, SIGTERM);
if (FD_ISSET(ClientNMB,&fds))
{
diff --git a/source/nameserv.c b/source/nameserv.c
index 93111eb2689..aba7ddadb60 100644
--- a/source/nameserv.c
+++ b/source/nameserv.c
@@ -62,12 +62,18 @@ void remove_name_entry(struct subnet_record *d, char *name,int type, BOOL direct
a de-registration packet to the local subnet before removing the
name from its local-subnet name database. */
+ int search = FIND_SELF;
struct name_record n;
struct name_record *n2=NULL;
make_nmb_name(&n.name,name,type,scope);
- if ((n2 = find_name_search(&d, &n.name, FIND_SELF, ipzero)))
+ if(d == wins_subnet)
+ search |= FIND_WINS;
+ else
+ search |= FIND_LOCAL;
+
+ if ((n2 = find_name_search(&d, &n.name, search, ipzero)))
{
/* check name isn't already being de-registered */
if (NAME_DEREG(n2->ip_flgs[0].nb_flags))
@@ -79,6 +85,14 @@ void remove_name_entry(struct subnet_record *d, char *name,int type, BOOL direct
if (!n2) return;
+ /* Only remove names with non-zero death times. */
+ if(n2->death_time == 0)
+ {
+ DEBUG(5,("remove_name_entry: Name %s(%d) has zero ttl - not removing.\n",
+ name, type));
+ return;
+ }
+
/* remove the name immediately. even if the spec says we should
first try to release them, this is too dangerous with our current
name structures as otherwise we will end up replying to names we
diff --git a/source/nameservreply.c b/source/nameservreply.c
index a4888b04d4d..9f7b3da70ba 100644
--- a/source/nameservreply.c
+++ b/source/nameservreply.c
@@ -135,10 +135,13 @@ void reply_name_release(struct packet_struct *p)
search, ip);
/* XXXX under what conditions should we reject the removal?? */
- if (n && n->ip_flgs[0].nb_flags == nb_flags)
+ /* For now - remove if the names match and the group bit matches. */
+ if (n && (NAME_GROUP(n->ip_flgs[0].nb_flags) == NAME_GROUP(nb_flags)))
{
success = True;
+ DEBUG(5, ("reply_name_release: Removing name %s on subnet %s\n",
+ namestr(&nmb->question.question_name), inet_ntoa(d->bcast_ip)));
remove_name(d,n);
n = NULL;
}
diff --git a/source/nmbd/nmbd.c b/source/nmbd/nmbd.c
index 99d65d551aa..dc3f642cd60 100644
--- a/source/nmbd/nmbd.c
+++ b/source/nmbd/nmbd.c
@@ -571,6 +571,8 @@ static void usage(char *pname)
DEBUG(3,("Dumped names\n"));
+ /* We can only take sigterm signals in the select. */
+ BlockSignals(True,SIGTERM);
process();
close_sockets();