Merge of name_status_find() debugs.
authorTim Potter <tpot@samba.org>
Wed, 16 Jan 2002 01:41:30 +0000 (01:41 +0000)
committerTim Potter <tpot@samba.org>
Wed, 16 Jan 2002 01:41:30 +0000 (01:41 +0000)
(This used to be commit cfac669017afa763100e335d1516fbed18049e00)

source3/libsmb/namequery.c

index e410363de8b8d77fd93f3645c5966a807506ca89..8ac7ae2c6aeafc504dafdcc01c2c5c6a7f50016f 100644 (file)
@@ -163,33 +163,46 @@ return the matched name in *name
 
 BOOL name_status_find(const char *q_name, int q_type, int type, struct in_addr to_ip, char *name)
 {
-       struct node_status *status;
+       struct node_status *status = NULL;
        struct nmb_name nname;
        int count, i;
        int sock;
+       BOOL result = False;
+
+       DEBUG(10, ("name_status_find: looking up %s#%x\n", q_name, q_type));
 
        sock = open_socket_in(SOCK_DGRAM, 0, 3, interpret_addr(lp_socket_address()), True);
        if (sock == -1)
-               return False;
+               goto done;
 
        /* W2K PDC's seem not to respond to '*'#0. JRA */
        make_nmb_name(&nname, q_name, q_type);
        status = node_status_query(sock, &nname, to_ip, &count);
        close(sock);
        if (!status)
-               return False;
+               goto done;
 
        for (i=0;i<count;i++) {
                if (status[i].type == type)
                        break;
        }
        if (i == count)
-               return False;
+               goto done;
 
        pull_ascii(name, status[i].name, 15, 0, STR_TERMINATE);
+       result = True;
 
+ done:
        SAFE_FREE(status);
-       return True;
+
+       DEBUG(10, ("name_status_find: name %sfound", result ? "" : "not "));
+
+       if (result)
+               DEBUGADD(10, (", ip address is %s", inet_ntoa(to_ip)));
+
+       DEBUG(10, ("\n"));      
+
+       return result;
 }
 
 /****************************************************************************