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
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 --------------
> 	unsigned char mac[6];
< 	status = name_status_query(fd,&nname,ip, &count);
> 	status = name_status_query(fd,&nname,ip, &count, mac);
> 		printf("\n\tMAC Address = ");
> 		for (i=0;i<5;i++) {
> 			printf("%02X-",mac[i]);
> 		}
> 		printf("%02X\n",mac[i]);
-------------- next part --------------
< 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)
> 	for (i=0;i< 6;i++) {
> 		mac[i] = p[i];
> 	}
< 				      struct in_addr to_ip, int *num_names)
> 				      struct in_addr to_ip, int *num_names,
> 				      unsigned char *mac)
< 			ret = parse_node_status(&nmb2->answers->rdata[0], num_names);
> 			ret = parse_node_status(&nmb2->answers->rdata[0], num_names, mac);
> 	unsigned char mac[6];
< 	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