diff options
author | Andrew Bartlett <abartlet@samba.org> | 2005-08-03 18:30:21 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:31:07 -0500 |
commit | e7d87f8538a78f6d4aa22799af18dfbbbc999715 (patch) | |
tree | 604b9b21c324a72d2103c4321b0346dd1d62451b /source4/cldap_server/netlogon.c | |
parent | ae650da0b81700d4e62814cdff8ab57536f07ccb (diff) | |
download | samba-e7d87f8538a78f6d4aa22799af18dfbbbc999715.tar.gz samba-e7d87f8538a78f6d4aa22799af18dfbbbc999715.tar.xz samba-e7d87f8538a78f6d4aa22799af18dfbbbc999715.zip |
r9011: Remove more references to "name" as a netbios name, using the
cross-reference instead.
Andrew Bartlett
(This used to be commit 0f7b1136f6e0779f28f2132a8606dd64be20c42e)
Diffstat (limited to 'source4/cldap_server/netlogon.c')
-rw-r--r-- | source4/cldap_server/netlogon.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/source4/cldap_server/netlogon.c b/source4/cldap_server/netlogon.c index 3e99fe80b86..a39ad64a8e1 100644 --- a/source4/cldap_server/netlogon.c +++ b/source4/cldap_server/netlogon.c @@ -39,8 +39,9 @@ static NTSTATUS cldapd_netlogon_fill(struct cldapd_server *cldapd, uint32_t version, union nbt_cldap_netlogon *netlogon) { - const char *attrs[] = {"realm", "dnsDomain", "objectGUID", "name", NULL}; - struct ldb_message **res; + const char *ref_attrs[] = {"nETBIOSName", NULL}; + const char *dom_attrs[] = {"dnsDomain", "objectGUID", NULL}; + struct ldb_message **ref_res, **dom_res; int ret; const char **services = lp_server_services(); uint32_t server_type; @@ -68,7 +69,7 @@ static NTSTATUS cldapd_netlogon_fill(struct cldapd_server *cldapd, } /* try and find the domain */ - ret = gendb_search(cldapd->samctx, mem_ctx, NULL, &res, attrs, + ret = gendb_search(cldapd->samctx, mem_ctx, NULL, &dom_res, dom_attrs, "(&(objectClass=domainDNS)(|(dnsDomain=%s)(objectGUID=%s)))", domain?domain:"", domain_guid?domain_guid:""); @@ -77,6 +78,15 @@ static NTSTATUS cldapd_netlogon_fill(struct cldapd_server *cldapd, return NT_STATUS_NO_SUCH_DOMAIN; } + /* try and find the domain */ + ret = gendb_search(cldapd->samctx, mem_ctx, NULL, &ref_res, ref_attrs, + "(&(objectClass=crossRef)(ncName=%s))", + dom_res[0]->dn); + if (ret != 1) { + DEBUG(2,("Unable to find referece to '%s' in sam\n", dom_res[0]->dn)); + return NT_STATUS_NO_SUCH_DOMAIN; + } + server_type = NBT_SERVER_PDC | NBT_SERVER_GC | NBT_SERVER_DS | NBT_SERVER_TIMESERV | @@ -92,13 +102,14 @@ static NTSTATUS cldapd_netlogon_fill(struct cldapd_server *cldapd, } pdc_name = talloc_asprintf(mem_ctx, "\\\\%s", lp_netbios_name()); - domain_uuid = samdb_result_guid(res[0], "objectGUID"); - realm = samdb_result_string(res[0], "dnsDomain", lp_realm()); - dns_domain = samdb_result_string(res[0], "dnsDomain", lp_realm()); + domain_uuid = samdb_result_guid(dom_res[0], "objectGUID"); + realm = samdb_result_string(dom_res[0], "dnsDomain", lp_realm()); + dns_domain = samdb_result_string(dom_res[0], "dnsDomain", lp_realm()); pdc_dns_name = talloc_asprintf(mem_ctx, "%s.%s", strlower_talloc(mem_ctx, lp_netbios_name()), dns_domain); - flatname = samdb_result_string(res[0], "name", lp_workgroup()); + + flatname = samdb_result_string(ref_res[0], "nETBIOSName", lp_workgroup()); site_name = "Default-First-Site-Name"; site_name2 = "Default-First-Site-Name"; pdc_ip = iface_best_ip(src_address); |