debugging the dns lookup changes
authorSamba Release Account <samba-bugs@samba.org>
Fri, 25 Oct 1996 19:31:48 +0000 (19:31 +0000)
committerSamba Release Account <samba-bugs@samba.org>
Fri, 25 Oct 1996 19:31:48 +0000 (19:31 +0000)
lkcl
(This used to be commit 3f63dd6771ee1c4cd30049478ea053caefdc262f)

source3/include/proto.h
source3/namedbname.c
source3/nameservreply.c

index c2fab684293ee9e7a676d48b6a2cb4b8265e68a7..655b0fd36095507ec9f9f51b4f1514c196edd072 100644 (file)
@@ -338,8 +338,7 @@ BOOL name_equal(struct nmb_name *n1,struct nmb_name *n2);
 BOOL ms_browser_name(char *name, int type);
 void remove_name(struct subnet_record *d, struct name_record *n);
 struct name_record *find_name(struct name_record *n,
-                       struct nmb_name *name,
-                       int search);
+                       struct nmb_name *name, int search);
 struct name_record *find_name_search(struct subnet_record **d,
                        struct nmb_name *name,
                        int search, struct in_addr ip);
@@ -353,8 +352,7 @@ struct name_record *add_netbios_entry(struct subnet_record *d,
                int ttl, enum name_source source, struct in_addr ip,
                BOOL new_only,BOOL wins);
 void expire_names(time_t t);
-struct name_record *dns_name_search(struct nmb_name *question,
-                                   int Time, int search);
+struct name_record *dns_name_search(struct nmb_name *question, int Time);
 
 /*The following definitions come from  namedbresp.c  */
 
index 3a32088593a91b296d182d1413a1bf86417b73d2..8f5514be531f92b91f62032147bd771f5e41b04a 100644 (file)
@@ -140,8 +140,7 @@ void remove_name(struct subnet_record *d, struct name_record *n)
   find a name in a namelist.
   **************************************************************************/
 struct name_record *find_name(struct name_record *n,
-                       struct nmb_name *name,
-                       int search)
+                       struct nmb_name *name, int search)
 {
        struct name_record *ret;
   
@@ -510,16 +509,17 @@ void expire_names(time_t t)
 
 
 /***************************************************************************
-  reply to a name query
+  assume a WINS name is a dns name, and do a gethostbyname() on it.
   ****************************************************************************/
-struct name_record *dns_name_search(struct nmb_name *question,
-                                   int Time, int search)
+struct name_record *dns_name_search(struct nmb_name *question, int Time)
 {
        int name_type = question->name_type;
        char *qname = question->name;
+       char *r;
        BOOL dns_type = (name_type == 0x20 || name_type == 0);
        struct in_addr dns_ip;
        struct subnet_record *d = find_subnet(ipgrp);
+    pstring dns_name;
 
        if (d == NULL) return NULL;
 
@@ -532,8 +532,27 @@ struct name_record *dns_name_search(struct nmb_name *question,
                return NULL;
        }
 
+    StrnCpy(dns_name, qname, sizeof(dns_name));
+       if ((r = strchr(dns_name,'.')) == NULL)
+       {
+               /* append a dot to the name, hopefully to stop DNS recursing */
+               strcat(dns_name, ".");
+
+#ifdef NETGROUP
+       {
+               char domainname[255];
+
+               if (getdomainname(domainname, sizeof(domainname)) == 0)
+               {
+                       /* we have a domain name - append it to the dns name */
+                       strcat(dns_name, domainname);
+               }
+       }
+#endif
+       }
+
        /* look it up with DNS */      
-       dns_ip.s_addr = interpret_addr(qname);
+       dns_ip.s_addr = interpret_addr(dns_name);
 
        if (!dns_ip.s_addr)
        {
index f7df7c485b383decfd6c23dfb5eb9a1046205d83..df30e4ac412a17633292c91b46beb8b9cc34c5fb 100644 (file)
@@ -563,7 +563,7 @@ void reply_name_query(struct packet_struct *p)
      */
     if (success && !n && (lp_wins_proxy() || !bcast))
     {
-      n = dns_name_search(question, p->timestamp, search);
+      n = dns_name_search(question, p->timestamp);
     }
   }