diff options
author | Richard Sharpe <sharpe@samba.org> | 2004-04-16 03:57:30 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 10:51:16 -0500 |
commit | 0374be5d931903f1040fd4e759e6b1d681be2047 (patch) | |
tree | ab3c2af8653c20f7d51e4763c420b3f0853aaba8 /source3/libsmb | |
parent | 4938095e77b0b5334935833b34e23bde74c6849d (diff) | |
download | samba-0374be5d931903f1040fd4e759e6b1d681be2047.tar.gz samba-0374be5d931903f1040fd4e759e6b1d681be2047.tar.bz2 samba-0374be5d931903f1040fd4e759e6b1d681be2047.zip |
r248: Add support for printing out the MAC address on nmblookup.
(This used to be commit bf9f02be5fc1d09c8c08c78c3f2df23b2099ba4f)
Diffstat (limited to 'source3/libsmb')
-rw-r--r-- | source3/libsmb/namequery.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/source3/libsmb/namequery.c b/source3/libsmb/namequery.c index b9bc4e1166..2bb7359e74 100644 --- a/source3/libsmb/namequery.c +++ b/source3/libsmb/namequery.c @@ -45,7 +45,7 @@ static int generate_trn_id(void) Parse a node status response into an array of structures. ****************************************************************************/ -static struct node_status *parse_node_status(char *p, int *num_names) +static struct node_status *parse_node_status(char *p, int *num_names, struct node_status_extra *extra) { struct node_status *ret; int i; @@ -68,6 +68,12 @@ static struct node_status *parse_node_status(char *p, int *num_names) DEBUG(10, ("%s#%02x: flags = 0x%02x\n", ret[i].name, ret[i].type, ret[i].flags)); } + /* + * Also, pick up the MAC address ... + */ + if (extra) { + memcpy(&extra->mac_addr, p, 6); /* Fill in the mac addr */ + } return ret; } @@ -78,7 +84,8 @@ static struct node_status *parse_node_status(char *p, int *num_names) **************************************************************************/ struct node_status *node_status_query(int fd,struct nmb_name *name, - struct in_addr to_ip, int *num_names) + struct in_addr to_ip, int *num_names, + struct node_status_extra *extra) { BOOL found=False; int retries = 2; @@ -149,7 +156,7 @@ struct node_status *node_status_query(int fd,struct nmb_name *name, continue; } - ret = parse_node_status(&nmb2->answers->rdata[0], num_names); + ret = parse_node_status(&nmb2->answers->rdata[0], num_names, extra); free_packet(p2); return ret; } @@ -190,7 +197,7 @@ BOOL name_status_find(const char *q_name, int q_type, int type, struct in_addr t /* 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); + status = node_status_query(sock, &nname, to_ip, &count, NULL); close(sock); if (!status) goto done; |