summaryrefslogtreecommitdiff
path: root/source4/libnet
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2006-12-20 14:49:40 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:29:31 -0500
commitceaf036f42f20e8acbf0ca3cdbb599f7aeb4653c (patch)
tree039bf3642e618c5f61abd46c1e2edeeb420259ea /source4/libnet
parent89a94feef9f21c1eed267bdd5b1690209787b4a9 (diff)
downloadsamba-ceaf036f42f20e8acbf0ca3cdbb599f7aeb4653c.tar.gz
samba-ceaf036f42f20e8acbf0ca3cdbb599f7aeb4653c.tar.bz2
samba-ceaf036f42f20e8acbf0ca3cdbb599f7aeb4653c.zip
r20282: prepare callback infrastructure to check if the forest/domain
behaviors and the schema version is what the caller expects. also a callback prepares the new database and commits chunks to the partitions metze (This used to be commit 9b5116be2eb246eda2a4c63e86cf4f15f90b915e)
Diffstat (limited to 'source4/libnet')
-rw-r--r--source4/libnet/libnet_become_dc.c46
1 files changed, 46 insertions, 0 deletions
diff --git a/source4/libnet/libnet_become_dc.c b/source4/libnet/libnet_become_dc.c
index 742c92787d..acd3238089 100644
--- a/source4/libnet/libnet_become_dc.c
+++ b/source4/libnet/libnet_become_dc.c
@@ -125,6 +125,8 @@ struct libnet_BecomeDC_state {
struct drsuapi_DsReplicaObjectListItemEx *first_object;
struct drsuapi_DsReplicaObjectListItemEx *last_object;
+
+ NTSTATUS (*store_chunk)(void *private_data, void *todo);
} schema_part, config_part, domain_part;
struct becomeDC_fsmo {
@@ -135,6 +137,15 @@ struct libnet_BecomeDC_state {
} infrastructure_fsmo;
struct becomeDC_fsmo rid_manager_fsmo;
+
+ struct {
+ void *private_data;
+ NTSTATUS (*check_options)(void *private_data, void *todo);
+ NTSTATUS (*prepare_db)(void *private_data, void *todo);
+ NTSTATUS (*schema_chunk)(void *private_data, void *todo);
+ NTSTATUS (*config_chunk)(void *private_data, void *todo);
+ NTSTATUS (*domain_chunk)(void *private_data, void *todo);
+ } callbacks;
};
static void becomeDC_connect_ldap1(struct libnet_BecomeDC_state *s);
@@ -598,6 +609,13 @@ static NTSTATUS becomeDC_ldap1_site_object(struct libnet_BecomeDC_state *s)
return NT_STATUS_OK;
}
+static NTSTATUS becomeDC_check_options(struct libnet_BecomeDC_state *s)
+{
+ if (!s->callbacks.check_options) return NT_STATUS_OK;
+
+ return s->callbacks.check_options(s->callbacks.private_data, NULL);
+}
+
static NTSTATUS becomeDC_ldap1_computer_object(struct libnet_BecomeDC_state *s)
{
int ret;
@@ -873,6 +891,9 @@ static void becomeDC_connect_ldap1(struct libnet_BecomeDC_state *s)
c->status = becomeDC_ldap1_site_object(s);
if (!composite_is_ok(c)) return;
+ c->status = becomeDC_check_options(s);
+ if (!composite_is_ok(c)) return;
+
c->status = becomeDC_ldap1_computer_object(s);
if (!composite_is_ok(c)) return;
@@ -1430,6 +1451,7 @@ static void becomeDC_drsuapi1_add_entry_send(struct libnet_BecomeDC_state *s)
}
static void becomeDC_drsuapi2_connect_recv(struct composite_context *req);
+static NTSTATUS becomeDC_prepare_db(struct libnet_BecomeDC_state *s);
static void becomeDC_drsuapi1_add_entry_recv(struct rpc_request *req)
{
@@ -1500,9 +1522,19 @@ static void becomeDC_drsuapi1_add_entry_recv(struct rpc_request *req)
talloc_free(r);
+ c->status = becomeDC_prepare_db(s);
+ if (!composite_is_ok(c)) return;
+
becomeDC_drsuapi_connect_send(s, &s->drsuapi2, becomeDC_drsuapi2_connect_recv);
}
+static NTSTATUS becomeDC_prepare_db(struct libnet_BecomeDC_state *s)
+{
+ if (!s->callbacks.prepare_db) return NT_STATUS_OK;
+
+ return s->callbacks.prepare_db(s->callbacks.private_data, NULL);
+}
+
static void becomeDC_drsuapi2_bind_recv(struct rpc_request *req);
static void becomeDC_drsuapi2_connect_recv(struct composite_context *req)
@@ -1688,6 +1720,14 @@ DEBUG(0,("end NC[%s] tmp_highest_usn[%llu] highest_usn[%llu]\n",
partition->highwatermark.tmp_highest_usn,
partition->highwatermark.highest_usn));
+ if (partition->store_chunk) {
+ NTSTATUS nt_status;
+ nt_status = partition->store_chunk(s->callbacks.private_data, NULL);
+ if (!NT_STATUS_IS_OK(nt_status)) {
+ return ntstatus_to_werror(nt_status);
+ }
+ }
+
return WERR_OK;
}
@@ -1708,6 +1748,8 @@ static void becomeDC_drsuapi3_pull_schema_send(struct libnet_BecomeDC_state *s)
| DRSUAPI_DS_REPLICA_NEIGHBOUR_NEVER_SYNCED
| DRSUAPI_DS_REPLICA_NEIGHBOUR_COMPRESS_CHANGES;
+ s->schema_part.store_chunk = s->callbacks.schema_chunk;
+
becomeDC_drsuapi_pull_partition_send(s, &s->drsuapi2, &s->drsuapi3, &s->schema_part,
becomeDC_drsuapi3_pull_schema_recv);
}
@@ -1760,6 +1802,8 @@ static void becomeDC_drsuapi3_pull_config_send(struct libnet_BecomeDC_state *s)
| DRSUAPI_DS_REPLICA_NEIGHBOUR_NEVER_SYNCED
| DRSUAPI_DS_REPLICA_NEIGHBOUR_COMPRESS_CHANGES;
+ s->config_part.store_chunk = s->callbacks.config_chunk;
+
becomeDC_drsuapi_pull_partition_send(s, &s->drsuapi2, &s->drsuapi3, &s->config_part,
becomeDC_drsuapi3_pull_config_recv);
}
@@ -1810,6 +1854,8 @@ static void becomeDC_drsuapi3_pull_domain_send(struct libnet_BecomeDC_state *s)
| DRSUAPI_DS_REPLICA_NEIGHBOUR_NEVER_SYNCED
| DRSUAPI_DS_REPLICA_NEIGHBOUR_COMPRESS_CHANGES;
+ s->domain_part.store_chunk = s->callbacks.domain_chunk;
+
becomeDC_drsuapi_pull_partition_send(s, &s->drsuapi2, &s->drsuapi3, &s->domain_part,
becomeDC_drsuapi3_pull_domain_recv);
}