From 83b987befdbba857131102700d237728784b6f69 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 6 Dec 2005 23:06:38 +0000 Subject: 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) --- source3/nmbd/nmbd_winsproxy.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'source3/nmbd/nmbd_winsproxy.c') 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 -- cgit