summaryrefslogtreecommitdiff
path: root/source4/libnet/libnet_become_dc.c
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2006-12-04 16:30:27 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:28:49 -0500
commit408db037ac43fd8dd1692e975cd55833d0e38315 (patch)
tree5a21b24b42c37981abd4a1bc92eaaa2e24a768ac /source4/libnet/libnet_become_dc.c
parent9079448fce8b5d4a5e3dcaf5bbc4a2b5ffdaab5b (diff)
downloadsamba-408db037ac43fd8dd1692e975cd55833d0e38315.tar.gz
samba-408db037ac43fd8dd1692e975cd55833d0e38315.tar.bz2
samba-408db037ac43fd8dd1692e975cd55833d0e38315.zip
r20029: - implement source_dsa site object search
metze (This used to be commit c6166a564178e65738fa1dc79e60b8aefea61dd2)
Diffstat (limited to 'source4/libnet/libnet_become_dc.c')
-rw-r--r--source4/libnet/libnet_become_dc.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/source4/libnet/libnet_become_dc.c b/source4/libnet/libnet_become_dc.c
index 420c13efc1..807ebfe724 100644
--- a/source4/libnet/libnet_become_dc.c
+++ b/source4/libnet/libnet_become_dc.c
@@ -69,6 +69,7 @@ struct libnet_BecomeDC_state {
const char *dns_name;
const char *netbios_name;
const char *site_name;
+ struct GUID site_guid;
const char *server_dn_str;
const char *ntds_dn_str;
} source_dsa;
@@ -532,6 +533,33 @@ static NTSTATUS becomeDC_ldap1_rid_manager_fsmo(struct libnet_BecomeDC_state *s)
return NT_STATUS_OK;
}
+static NTSTATUS becomeDC_ldap1_site_object(struct libnet_BecomeDC_state *s)
+{
+ int ret;
+ struct ldb_result *r;
+ struct ldb_dn *basedn;
+
+ basedn = ldb_dn_new_fmt(s, s->ldap1.ldb, "CN=%s,CN=Sites,%s",
+ s->dest_dsa.site_name,
+ s->forest.config_dn_str);
+ NT_STATUS_HAVE_NO_MEMORY(basedn);
+
+ ret = ldb_search(s->ldap1.ldb, basedn, LDB_SCOPE_BASE,
+ "(objectClass=*)", NULL, &r);
+ talloc_free(basedn);
+ if (ret != LDB_SUCCESS) {
+ return NT_STATUS_LDAP(ret);
+ } else if (r->count != 1) {
+ talloc_free(r);
+ return NT_STATUS_INVALID_NETWORK_RESPONSE;
+ }
+
+ s->source_dsa.site_guid = samdb_result_guid(r->msgs[0], "objectGUID");
+
+ talloc_free(r);
+ return NT_STATUS_OK;
+}
+
static void becomeDC_connect_ldap1(struct libnet_BecomeDC_state *s)
{
@@ -561,6 +589,9 @@ static void becomeDC_connect_ldap1(struct libnet_BecomeDC_state *s)
c->status = becomeDC_ldap1_rid_manager_fsmo(s);
if (!composite_is_ok(c)) return;
+ c->status = becomeDC_ldap1_site_object(s);
+ if (!composite_is_ok(c)) return;
+
composite_error(c, NT_STATUS_NOT_IMPLEMENTED);
}