NetServerEnum2 and looking for dc

Steven French sfrench at
Mon Feb 11 08:47:51 GMT 2002

Make sure that you look at the function get_dc_list (see namequery.c - at
least in the head branch) which does something similar to what you want but
using the Netbios name lookup (which is less reliable in some cases - since
not all servers register 0x1C and WINS with multiple subnets is a mess).
Probably best would be to modify the get_pdc_name function to make it
"get_dc_name" and adding a parm ala get_dc_list to make the new function
find either the PDC or all logon servers for the domain (via NetServerEnum
rather than WINS).  The new function would be useful in the many cases when
Netbios-over-TCPIP is disabled or the netbios names are unreachable.   Come
to think of it - we should not forget the "best" way - checking for the dns
server resource records that the domain controllers register - the third
and final.   The functions in

There may be cases where a combination of calls to get_dc_list and
get_dc_name and even a dns RR lookup is required in order to successfully
get the (complete) list of domain controllers in a domain.

Steve French
Senior Software Engineer
Linux Technology Center - IBM Austin
phone: 512-838-2294
email: sfrench at

More information about the samba-technical mailing list