summaryrefslogtreecommitdiff
path: root/source3/libsmb/namequery.c
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2002-01-16 01:41:30 +0000
committerTim Potter <tpot@samba.org>2002-01-16 01:41:30 +0000
commitbf7c56665c8483c7731eedde4ab567b2b86a5bd6 (patch)
tree3bfdc9b08989c5749057ffa94a42635aca686d74 /source3/libsmb/namequery.c
parentb5f5861225ad0376e38ca20141089076e1cc84e1 (diff)
downloadsamba-bf7c56665c8483c7731eedde4ab567b2b86a5bd6.tar.gz
samba-bf7c56665c8483c7731eedde4ab567b2b86a5bd6.tar.bz2
samba-bf7c56665c8483c7731eedde4ab567b2b86a5bd6.zip
Merge of name_status_find() debugs.
(This used to be commit cfac669017afa763100e335d1516fbed18049e00)
Diffstat (limited to 'source3/libsmb/namequery.c')
-rw-r--r--source3/libsmb/namequery.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/source3/libsmb/namequery.c b/source3/libsmb/namequery.c
index e410363de8..8ac7ae2c6a 100644
--- a/source3/libsmb/namequery.c
+++ b/source3/libsmb/namequery.c
@@ -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;
}
/****************************************************************************