I was trying to do a net rpc user as follows: net rpc user -Uadministrator%password -S `net lookup host LOTHLORIEN 0x1b` abartlet suggested that I use the following: net rpc user -Uadministrator%password -S LOTHLORIEN#1b However, the latter doesn't work. IMO, net should be able to resolve the # names since smbclient, nmblookup, and other programs that use libsmb can.
changing priority
It's pretty easy to get net lookup host to take # names but that doesn't really sound like something it should do, as a #1b name isn't a host name. How about renaming net lookup host to net lookup netbios or something? Also if you are looking up a #1c name then you are sometimes interested in looking at the list of names returned. Currently net lookup host foo#1c will only display the first returned name. While I'm on the subject of complaining (-: making up a new syntax for the name type is pretty sucky. Just stick with the defacto name#type as per the other Samba tools. Anyway here's a patch to save abartlet a bit of time: *** net_lookup.c.~1.3.2.6.~ Thu Jan 30 15:40:12 2003 --- net_lookup.c Wed May 28 16:32:41 2003 *************** *** 23,29 **** int net_lookup_usage(int argc, const char **argv) { d_printf( ! " net lookup host HOSTNAME <type>\n\tgives IP for a hostname\n\n" " net lookup ldap [domain]\n\tgives IP of domain's ldap server\n\n" " net lookup kdc [realm]\n\tgives IP of realm's kerberos KDC\n\n" " net lookup dc [domain]\n\tgives IP of domains Domain Controllers\n\n" --- 23,29 ---- int net_lookup_usage(int argc, const char **argv) { d_printf( ! " net lookup host HOSTNAME[#<type>]\n\tgives IP for a hostname\n\n" " net lookup ldap [domain]\n\tgives IP of domain's ldap server\n\n" " net lookup kdc [realm]\n\tgives IP of realm's kerberos KDC\n\n" " net lookup dc [domain]\n\tgives IP of domains Domain Controllers\n\n" *************** *** 37,50 **** { struct in_addr ip; int name_type = 0x20; ! if (argc == 0) return net_lookup_usage(argc, argv); ! if (argc > 1) name_type = strtol(argv[1], NULL, 0); ! if (!resolve_name(argv[0], &ip, name_type)) { /* we deliberately use DEBUG() here to send it to stderr so scripts aren't mucked up */ ! DEBUG(0,("Didn't find %s#%02x\n", argv[0], name_type)); return -1; } --- 37,58 ---- { struct in_addr ip; int name_type = 0x20; + const char *name = argv[0]; + char *p; ! if (argc == 0) ! return net_lookup_usage(argc, argv); ! p = strchr_m(name,'#'); ! if (p) { ! *p = '\0'; ! sscanf(++p,"%x",&name_type); ! } ! ! if (!resolve_name(name, &ip, name_type)) { /* we deliberately use DEBUG() here to send it to stderr so scripts aren't mucked up */ ! DEBUG(0,("Didn't find %s#%02x\n", name, name_type)); return -1; }
Tim, If this patch works for you, please apply it to the 3.0 tree.
Done!
originally reported against 3.0alpha23. Bugzilla spring cleaning.
sorry for the same, cleaning up the database to prevent unecessary reopens of bugs.