diff options
author | Samba Release Account <samba-bugs@samba.org> | 1996-10-25 16:43:04 +0000 |
---|---|---|
committer | Samba Release Account <samba-bugs@samba.org> | 1996-10-25 16:43:04 +0000 |
commit | 186c119d6ffb437e3d95dac798f6069aa4645e42 (patch) | |
tree | 2ad18aefefd50118eaa1f54baea06302d4614c08 | |
parent | 3340bdcca1f4663e344fde589e78d1828ea0f7a5 (diff) | |
download | samba-186c119d6ffb437e3d95dac798f6069aa4645e42.tar.gz samba-186c119d6ffb437e3d95dac798f6069aa4645e42.tar.xz samba-186c119d6ffb437e3d95dac798f6069aa4645e42.zip |
debugged dns lookup / netbios name query code from yesterday.
lkcl
(This used to be commit 7c2f1da3773bac59ba0aeea7c0cac1134a74381c)
-rw-r--r-- | source3/namedbname.c | 76 | ||||
-rw-r--r-- | source3/nameservreply.c | 4 |
2 files changed, 30 insertions, 50 deletions
diff --git a/source3/namedbname.c b/source3/namedbname.c index 8bf65117374..3a32088593a 100644 --- a/source3/namedbname.c +++ b/source3/namedbname.c @@ -515,59 +515,39 @@ void expire_names(time_t t) struct name_record *dns_name_search(struct nmb_name *question, int Time, int search) { - struct subnet_record *d = find_subnet(ipgrp); - int name_type = question->name_type; - char *qname = question->name; - BOOL dns_type = (name_type == 0x20 || name_type == 0); - struct name_record *n; - - if (d == NULL) return NULL; + int name_type = question->name_type; + char *qname = question->name; + BOOL dns_type = (name_type == 0x20 || name_type == 0); + struct in_addr dns_ip; + struct subnet_record *d = find_subnet(ipgrp); - DEBUG(3,("Search for %s from %s - ", namestr(question), inet_ntoa(ip))); - - if (!n && (search & FIND_SELF)) - { - if (!lp_wins_proxy()) - DEBUG(3,("wins proxy not enabled - failing lookup\n")); - else - DEBUG(3,("FIND_SELF set - failing lookup\n")); - return NULL; - } + if (d == NULL) return NULL; - /* now try DNS lookup. */ - if (!n) - { - struct in_addr dns_ip; - - /* only do DNS lookups if the query is for type 0x20 or type 0x0 */ - if (!dns_type && name_type != 0x1b) + DEBUG(3,("Search for %s - ", namestr(question))); + + /* only do DNS lookups if the query is for type 0x20 or type 0x0 */ + if (!dns_type && name_type != 0x1b) { - DEBUG(3,("types 0x20 0x1b 0x0 only: name not found\n")); - return NULL; + DEBUG(3,("types 0x20 0x1b 0x0 only: name not found\n")); + return NULL; } - - /* look it up with DNS */ - dns_ip.s_addr = interpret_addr(qname); - - if (dns_ip.s_addr) + + /* look it up with DNS */ + dns_ip.s_addr = interpret_addr(qname); + + if (!dns_ip.s_addr) { - /* no luck with DNS. We could possibly recurse here XXXX */ - DEBUG(3,("no recursion.\n")); - /* add the fail to our WINS cache of names. give it 1 hour in the cache */ - add_netbios_entry(*d,qname,name_type,NB_ACTIVE,60*60,DNSFAIL,dns_ip, - True, True); - return NULL; + /* no luck with DNS. We could possibly recurse here XXXX */ + DEBUG(3,("not found. no recursion.\n")); + /* add the fail to WINS cache of names. give it 1 hour in the cache */ + add_netbios_entry(d,qname,name_type,NB_ACTIVE,60*60,DNSFAIL,dns_ip, + True, True); + return NULL; } - - /* add it to our WINS cache of names. give it 2 hours in the cache */ - n = add_netbios_entry(*d,qname,name_type,NB_ACTIVE,2*60*60,DNS,dns_ip, - True,True); - - /* failed to add it? yikes! */ - if (!n) return NULL; - } - - return n; -} + DEBUG(3,("found with DNS: %s\n", inet_ntoa(dns_ip))); + /* add it to our WINS cache of names. give it 2 hours in the cache */ + return add_netbios_entry(d,qname,name_type,NB_ACTIVE,2*60*60,DNS,dns_ip, + True,True); +} diff --git a/source3/nameservreply.c b/source3/nameservreply.c index 407459b617c..f7df7c485b3 100644 --- a/source3/nameservreply.c +++ b/source3/nameservreply.c @@ -502,7 +502,7 @@ void reply_name_query(struct packet_struct *p) char rdata[6]; struct subnet_record *d = NULL; BOOL success = True; - struct name_record *n; + struct name_record *n = NULL; /* directed queries are for WINS server: broadcasts are local SELF queries. the exception is Domain Master names. */ @@ -546,7 +546,7 @@ void reply_name_query(struct packet_struct *p) if (success) { /* look up the name in the cache */ - n = find_name_search(&d, question, p->ip, search)); + n = find_name_search(&d, question, search, p->ip); /* it is a name that already failed DNS lookup or it's expired */ if (n->source == DNSFAIL || |