nmblookup patches

Jerry Williams jwilliam at xmission.com
Thu Oct 25 22:09:02 GMT 2001


This is not a bug, but an enhancement.

I noticed that the windows version of nbtstat -a returned the MAC
Address and that nmblookup -A didn't.
So I looked into it and found that if I used -d 4 that it had that MAC
Address in the code.  So I created a couple of patches so that it would
look like the output from nbtstat -a.  Also you need to do the make
proto
which I am sure that isn't anything new to you.

This is from the 2.2.2 version of Samba.

source/utils/nmblookup.c and source/libsmb/namequery.c
If you can see a better way to do this great!  But this is that way I
did it.
Thanks for a great program!


-------------- next part --------------
111a112
> 	unsigned char mac[6];
116c117
< 	status = name_status_query(fd,&nname,ip, &count);
---
> 	status = name_status_query(fd,&nname,ip, &count, mac);
126a128,132
> 		printf("\n\tMAC Address = ");
> 		for (i=0;i<5;i++) {
> 			printf("%02X-",mac[i]);
> 		}
> 		printf("%02X\n",mac[i]);
-------------- next part --------------
50c50,51
< static struct node_status *parse_node_status(char *p, int *num_names)
---
> static struct node_status *parse_node_status(char *p, int *num_names,
> 					     unsigned char *mac)
69a71,73
> 	for (i=0;i< 6;i++) {
> 		mac[i] = p[i];
> 	}
79c83,84
< 				      struct in_addr to_ip, int *num_names)
---
> 				      struct in_addr to_ip, int *num_names,
> 				      unsigned char *mac)
150c155
< 			ret = parse_node_status(&nmb2->answers->rdata[0], num_names);
---
> 			ret = parse_node_status(&nmb2->answers->rdata[0], num_names, mac);
170a176
> 	unsigned char mac[6];
176c182
< 	status = name_status_query(sock, &nname, to_ip, &count);
---
> 	status = name_status_query(sock, &nname, to_ip, &count, mac);


More information about the samba mailing list