X-Git-Url: http://git.samba.org/?p=samba.git;a=blobdiff_plain;f=source3%2Fnamedbname.c;h=8bf65117374913ed28079da4cd4b036e11ad0a3e;hp=833a870c6cb4b9b279cc2f057d35327d47ccf26c;hb=e010ad006ea1c4754f357951be648b8f45458613;hpb=e5893bdfbef0ac16772199d7ec6fac7d3e4f8431 diff --git a/source3/namedbname.c b/source3/namedbname.c index 833a870c6cb..8bf65117374 100644 --- a/source3/namedbname.c +++ b/source3/namedbname.c @@ -512,35 +512,32 @@ void expire_names(time_t t) /*************************************************************************** reply to a name query ****************************************************************************/ -struct name_record *search_for_name(struct subnet_record **d, - struct nmb_name *question, - struct in_addr ip, int Time, int search) +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; - + BOOL dns_type = (name_type == 0x20 || name_type == 0); struct name_record *n; + if (d == NULL) return NULL; + DEBUG(3,("Search for %s from %s - ", namestr(question), inet_ntoa(ip))); - /* first look up name in cache */ - n = find_name_search(d,question,search,ip); - - if (*d == NULL) return NULL; - - if (!n && (search & FIND_SELF)) { - DEBUG(3,("FIND_SELF set - failing lookup\n")); + 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; } - DEBUG(4,("subnet %s ", inet_ntoa((*d)->bcast_ip))); - /* now try DNS lookup. */ if (!n) { struct in_addr dns_ip; - uint32 a; /* only do DNS lookups if the query is for type 0x20 or type 0x0 */ if (!dns_type && name_type != 0x1b) @@ -550,11 +547,9 @@ struct name_record *search_for_name(struct subnet_record **d, } /* look it up with DNS */ - a = interpret_addr(qname); - - putip((char *)&dns_ip,(char *)&a); + dns_ip.s_addr = interpret_addr(qname); - if (!a) + if (dns_ip.s_addr) { /* no luck with DNS. We could possibly recurse here XXXX */ DEBUG(3,("no recursion.\n")); @@ -572,21 +567,6 @@ struct name_record *search_for_name(struct subnet_record **d, if (!n) return NULL; } - /* is our entry already dead? */ - if (n->death_time) - { - if (n->death_time < Time) return False; - } - - /* it may have been an earlier failure */ - if (n->source == DNSFAIL) - { - DEBUG(3,("DNSFAIL\n")); - return NULL; - } - - DEBUG(3,("OK %s\n",inet_ntoa(n->ip_flgs[0].ip))); - return n; }