summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2006-12-20 21:14:44 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:29:32 -0500
commitfdf95ba0058e978f637c46f714677fc55240e51a (patch)
treeb0acc4f3acd77b519c5a9cf97d20ed84d869f926 /source4
parent02b65d5453c1f6846387f7431d7dfc0a38bc5235 (diff)
downloadsamba-fdf95ba0058e978f637c46f714677fc55240e51a.tar.gz
samba-fdf95ba0058e978f637c46f714677fc55240e51a.tar.bz2
samba-fdf95ba0058e978f637c46f714677fc55240e51a.zip
r20291: implement prepare_db hook of libnet_BecomeDC()
metze (This used to be commit 07f1075d469833e10c2f0b0d4578221c6a189b04)
Diffstat (limited to 'source4')
-rw-r--r--source4/libnet/libnet_become_dc.c8
-rw-r--r--source4/libnet/libnet_become_dc.h12
-rw-r--r--source4/torture/libnet/libnet_BecomeDC.c31
3 files changed, 47 insertions, 4 deletions
diff --git a/source4/libnet/libnet_become_dc.c b/source4/libnet/libnet_become_dc.c
index 7d1341e172..3f3bfe16b6 100644
--- a/source4/libnet/libnet_become_dc.c
+++ b/source4/libnet/libnet_become_dc.c
@@ -90,6 +90,7 @@ struct libnet_BecomeDC_state {
struct becomeDC_fsmo rid_manager_fsmo;
struct libnet_BecomeDC_CheckOptions _co;
+ struct libnet_BecomeDC_PrepareDB _pp;
struct libnet_BecomeDC_Callbacks callbacks;
};
@@ -1481,7 +1482,12 @@ 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);
+ s->_pp.domain = &s->domain;
+ s->_pp.forest = &s->forest;
+ s->_pp.source_dsa = &s->source_dsa;
+ s->_pp.dest_dsa = &s->dest_dsa;
+
+ return s->callbacks.prepare_db(s->callbacks.private_data, &s->_pp);
}
static void becomeDC_drsuapi2_bind_recv(struct rpc_request *req);
diff --git a/source4/libnet/libnet_become_dc.h b/source4/libnet/libnet_become_dc.h
index cffa0fd129..7549e369e4 100644
--- a/source4/libnet/libnet_become_dc.h
+++ b/source4/libnet/libnet_become_dc.h
@@ -75,11 +75,19 @@ struct libnet_BecomeDC_DestDSA {
uint32_t user_account_control;
};
+struct libnet_BecomeDC_PrepareDB {
+ const struct libnet_BecomeDC_Domain *domain;
+ const struct libnet_BecomeDC_Forest *forest;
+ const struct libnet_BecomeDC_SourceDSA *source_dsa;
+ const struct libnet_BecomeDC_DestDSA *dest_dsa;
+};
+
struct libnet_BecomeDC_Callbacks {
void *private_data;
NTSTATUS (*check_options)(void *private_data,
- const struct libnet_BecomeDC_CheckOptions *options);
- NTSTATUS (*prepare_db)(void *private_data, void *todo);
+ const struct libnet_BecomeDC_CheckOptions *info);
+ NTSTATUS (*prepare_db)(void *private_data,
+ const struct libnet_BecomeDC_PrepareDB *info);
NTSTATUS (*schema_chunk)(void *private_data, void *todo);
NTSTATUS (*config_chunk)(void *private_data, void *todo);
NTSTATUS (*domain_chunk)(void *private_data, void *todo);
diff --git a/source4/torture/libnet/libnet_BecomeDC.c b/source4/torture/libnet/libnet_BecomeDC.c
index 8db3b8d448..561ad622bb 100644
--- a/source4/torture/libnet/libnet_BecomeDC.c
+++ b/source4/torture/libnet/libnet_BecomeDC.c
@@ -30,7 +30,7 @@
#define TORTURE_NETBIOS_NAME "smbtorturedc"
static NTSTATUS test_become_dc_check_options(void *private_data,
- const struct libnet_BecomeDC_CheckOptions *o)
+ const struct libnet_BecomeDC_CheckOptions *o)
{
DEBUG(0,("Become DC of Domain[%s]/[%s]\n",
o->domain->netbios_name, o->domain->dns_name));
@@ -50,6 +50,33 @@ static NTSTATUS test_become_dc_check_options(void *private_data,
return NT_STATUS_OK;
}
+static NTSTATUS test_become_dc_prepare_db(void *private_data,
+ const struct libnet_BecomeDC_PrepareDB *p)
+{
+ struct test_join *tj = talloc_get_type(private_data, struct test_join);
+
+ DEBUG(0,("New Server[%s] in Site[%s]\n",
+ p->dest_dsa->dns_name, p->dest_dsa->site_name));
+
+ DEBUG(0,("DSA Instance [%s]\n"
+ "\tobjectGUID[%s]\n"
+ "\tinvocationId[%s]\n",
+ p->dest_dsa->ntds_dn_str,
+ GUID_string(tj, &p->dest_dsa->ntds_guid),
+ GUID_string(tj, &p->dest_dsa->invocation_id)));
+
+ DEBUG(0,("Schema Partition[%s]\n",
+ p->forest->schema_dn_str));
+
+ DEBUG(0,("Config Partition[%s]\n",
+ p->forest->config_dn_str));
+
+ DEBUG(0,("Domain Partition[%s]\n",
+ p->domain->dn_str));
+
+ return NT_STATUS_OK;
+}
+
BOOL torture_net_become_dc(struct torture_context *torture)
{
BOOL ret = True;
@@ -80,7 +107,9 @@ BOOL torture_net_become_dc(struct torture_context *torture)
b.in.source_dsa_address = lp_parm_string(-1, "torture", "host");
b.in.dest_dsa_netbios_name = TORTURE_NETBIOS_NAME;
+ b.in.callbacks.private_data = tj;
b.in.callbacks.check_options = test_become_dc_check_options;
+ b.in.callbacks.prepare_db = test_become_dc_prepare_db;
status = libnet_BecomeDC(ctx, ctx, &b);
if (!NT_STATUS_IS_OK(status)) {