mirror of
https://github.com/samba-team/samba.git
synced 2024-12-23 17:34:34 +03:00
r20291: implement prepare_db hook of libnet_BecomeDC()
metze
This commit is contained in:
parent
6d0c788f3d
commit
07f1075d46
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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)) {
|
||||
|
Loading…
Reference in New Issue
Block a user