summaryrefslogtreecommitdiff
path: root/source3/nmbd/nmbd_winsproxy.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2005-12-06 23:06:38 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 11:05:45 -0500
commit83b987befdbba857131102700d237728784b6f69 (patch)
treee2256666211d54b6781c1e48ab1ba95ad1b788c3 /source3/nmbd/nmbd_winsproxy.c
parent436b3dd88a703c4f79c638d76cb0219fc8870bda (diff)
downloadsamba-83b987befdbba857131102700d237728784b6f69.tar.gz
samba-83b987befdbba857131102700d237728784b6f69.tar.bz2
samba-83b987befdbba857131102700d237728784b6f69.zip
r12107: Move to a tdb-based wins database. At the moment we still
use it as though it were an in-memory db and dump out to a flat file every 2 mins, but that can now change. Jeremy. (This used to be commit a342681792724c1ae8561ba8d352c4ee6e2a5332)
Diffstat (limited to 'source3/nmbd/nmbd_winsproxy.c')
-rw-r--r--source3/nmbd/nmbd_winsproxy.c22
1 files changed, 17 insertions, 5 deletions
diff --git a/source3/nmbd/nmbd_winsproxy.c b/source3/nmbd/nmbd_winsproxy.c
index 7531972461..d6dc6261c8 100644
--- a/source3/nmbd/nmbd_winsproxy.c
+++ b/source3/nmbd/nmbd_winsproxy.c
@@ -33,7 +33,7 @@ static void wins_proxy_name_query_request_success( struct subnet_record *subrec,
unstring name;
struct packet_struct *original_packet;
struct subnet_record *orig_broadcast_subnet;
- struct name_record *namerec;
+ struct name_record *namerec = NULL;
uint16 nb_flags;
int num_ips;
int i;
@@ -64,22 +64,34 @@ returned for name %s.\n", nmb_namestr(nmbname) ));
return;
}
- for(i = 0; i < num_ips; i++)
+ for(i = 0; i < num_ips; i++) {
putip( (char *)&iplist[i], (char *)&rrec->rdata[ (i*6) + 2]);
+ }
}
/* Add the queried name to the original subnet as a WINS_PROXY_NAME. */
- if(rrec == PERMANENT_TTL)
+ if(rrec == PERMANENT_TTL) {
ttl = lp_max_ttl();
+ }
pull_ascii_nstring(name, sizeof(name), nmbname->name);
- namerec = add_name_to_subnet( orig_broadcast_subnet, name,
+ add_name_to_subnet( orig_broadcast_subnet, name,
nmbname->name_type, nb_flags, ttl,
WINS_PROXY_NAME, num_ips, iplist );
- if(iplist != &ip)
+ namerec = find_name_on_subnet(orig_broadcast_subnet, nmbname, FIND_ANY_NAME);
+ if (!namerec) {
+ DEBUG(0,("wins_proxy_name_query_request_success: failed to add "
+ "name %s to subnet %s !\n",
+ name,
+ orig_broadcast_subnet->subnet_name ));
+ return;
+ }
+
+ if(iplist != &ip) {
SAFE_FREE(iplist);
+ }
/*
* Check that none of the IP addresses we are returning is on the