summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source4/libnet/libnet_become_dc.c79
-rw-r--r--source4/libnet/libnet_become_dc.h61
-rw-r--r--source4/torture/libnet/libnet_BecomeDC.c25
3 files changed, 93 insertions, 72 deletions
diff --git a/source4/libnet/libnet_become_dc.c b/source4/libnet/libnet_become_dc.c
index 677cfb7cd3..7d1341e172 100644
--- a/source4/libnet/libnet_become_dc.c
+++ b/source4/libnet/libnet_become_dc.c
@@ -60,54 +60,10 @@ struct libnet_BecomeDC_state {
struct policy_handle bind_handle;
} drsuapi1, drsuapi2, drsuapi3;
- struct {
- /* input */
- const char *dns_name;
- const char *netbios_name;
- const struct dom_sid *sid;
-
- /* constructed */
- struct GUID guid;
- const char *dn_str;
- } domain;
-
- struct {
- /* constructed */
- const char *dns_name;
- const char *root_dn_str;
- const char *config_dn_str;
- const char *schema_dn_str;
- } forest;
-
- struct {
- /* input */
- const char *address;
-
- /* constructed */
- const char *dns_name;
- const char *netbios_name;
- const char *site_name;
- const char *server_dn_str;
- const char *ntds_dn_str;
- } source_dsa;
-
- struct {
- /* input */
- const char *netbios_name;
-
- /* constructed */
- const char *dns_name;
- const char *site_name;
- struct GUID site_guid;
- const char *computer_dn_str;
- const char *server_dn_str;
- const char *ntds_dn_str;
- struct GUID ntds_guid;
- struct GUID invocation_id;
- uint32_t user_account_control;
- } dest_dsa;
-
- struct libnet_BecomeDC_Options ads_options;
+ struct libnet_BecomeDC_Domain domain;
+ struct libnet_BecomeDC_Forest forest;
+ struct libnet_BecomeDC_SourceDSA source_dsa;
+ struct libnet_BecomeDC_DestDSA dest_dsa;
struct becomeDC_partition {
struct drsuapi_DsReplicaObjectIdentifier nc;
@@ -133,6 +89,7 @@ struct libnet_BecomeDC_state {
struct becomeDC_fsmo rid_manager_fsmo;
+ struct libnet_BecomeDC_CheckOptions _co;
struct libnet_BecomeDC_Callbacks callbacks;
};
@@ -250,7 +207,7 @@ static NTSTATUS becomeDC_ldap1_rootdse(struct libnet_BecomeDC_state *s)
return NT_STATUS_OK;
}
-static NTSTATUS becomeDC_ldap1_config_behavior_version(struct libnet_BecomeDC_state *s)
+static NTSTATUS becomeDC_ldap1_crossref_behavior_version(struct libnet_BecomeDC_state *s)
{
int ret;
struct ldb_result *r;
@@ -273,7 +230,7 @@ static NTSTATUS becomeDC_ldap1_config_behavior_version(struct libnet_BecomeDC_st
return NT_STATUS_INVALID_NETWORK_RESPONSE;
}
- s->ads_options.config_behavior_version = ldb_msg_find_attr_as_uint(r->msgs[0], "msDs-Behavior-Version", 0);
+ s->forest.crossref_behavior_version = ldb_msg_find_attr_as_uint(r->msgs[0], "msDs-Behavior-Version", 0);
talloc_free(r);
return NT_STATUS_OK;
@@ -302,7 +259,7 @@ static NTSTATUS becomeDC_ldap1_domain_behavior_version(struct libnet_BecomeDC_st
return NT_STATUS_INVALID_NETWORK_RESPONSE;
}
- s->ads_options.domain_behavior_version = ldb_msg_find_attr_as_uint(r->msgs[0], "msDs-Behavior-Version", 0);
+ s->domain.behavior_version = ldb_msg_find_attr_as_uint(r->msgs[0], "msDs-Behavior-Version", 0);
talloc_free(r);
return NT_STATUS_OK;
@@ -331,7 +288,7 @@ static NTSTATUS becomeDC_ldap1_schema_object_version(struct libnet_BecomeDC_stat
return NT_STATUS_INVALID_NETWORK_RESPONSE;
}
- s->ads_options.schema_object_version = ldb_msg_find_attr_as_uint(r->msgs[0], "objectVersion", 0);
+ s->forest.schema_object_version = ldb_msg_find_attr_as_uint(r->msgs[0], "objectVersion", 0);
talloc_free(r);
return NT_STATUS_OK;
@@ -356,7 +313,7 @@ static NTSTATUS becomeDC_ldap1_w2k3_update_revision(struct libnet_BecomeDC_state
talloc_free(basedn);
if (ret == LDB_ERR_NO_SUCH_OBJECT) {
/* w2k doesn't have this object */
- s->ads_options.w2k3_update_revision = 0;
+ s->domain.w2k3_update_revision = 0;
return NT_STATUS_OK;
} else if (ret != LDB_SUCCESS) {
return NT_STATUS_LDAP(ret);
@@ -365,7 +322,7 @@ static NTSTATUS becomeDC_ldap1_w2k3_update_revision(struct libnet_BecomeDC_state
return NT_STATUS_INVALID_NETWORK_RESPONSE;
}
- s->ads_options.w2k3_update_revision = ldb_msg_find_attr_as_uint(r->msgs[0], "revision", 0);
+ s->domain.w2k3_update_revision = ldb_msg_find_attr_as_uint(r->msgs[0], "revision", 0);
talloc_free(r);
return NT_STATUS_OK;
@@ -601,7 +558,11 @@ 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, &s->ads_options);
+ s->_co.domain = &s->domain;
+ s->_co.forest = &s->forest;
+ s->_co.source_dsa = &s->source_dsa;
+
+ return s->callbacks.check_options(s->callbacks.private_data, &s->_co);
}
static NTSTATUS becomeDC_ldap1_computer_object(struct libnet_BecomeDC_state *s)
@@ -858,7 +819,7 @@ static void becomeDC_connect_ldap1(struct libnet_BecomeDC_state *s)
c->status = becomeDC_ldap1_rootdse(s);
if (!composite_is_ok(c)) return;
- c->status = becomeDC_ldap1_config_behavior_version(s);
+ c->status = becomeDC_ldap1_crossref_behavior_version(s);
if (!composite_is_ok(c)) return;
c->status = becomeDC_ldap1_domain_behavior_version(s);
@@ -961,7 +922,7 @@ static void becomeDC_drsuapi_bind_send(struct libnet_BecomeDC_state *s,
bind_info28->supported_extensions |= DRSUAPI_SUPPORTED_EXTENSION_RESTORE_USN_OPTIMIZATION;
bind_info28->supported_extensions |= DRSUAPI_SUPPORTED_EXTENSION_KCC_EXECUTE;
bind_info28->supported_extensions |= DRSUAPI_SUPPORTED_EXTENSION_ADDENTRY_V2;
- if (s->ads_options.domain_behavior_version == 2) {
+ if (s->domain.behavior_version == 2) {
/* TODO: find out how this is really triggered! */
bind_info28->supported_extensions |= DRSUAPI_SUPPORTED_EXTENSION_LINKED_VALUE_REPLICATION;
}
@@ -988,7 +949,7 @@ static void becomeDC_drsuapi_bind_send(struct libnet_BecomeDC_state *s,
bind_info28->supported_extensions |= DRSUAPI_SUPPORTED_EXTENSION_XPRESS_COMPRESS;
#endif
bind_info28->site_guid = s->dest_dsa.site_guid;
- if (s->ads_options.domain_behavior_version == 2) {
+ if (s->domain.behavior_version == 2) {
/* TODO: find out how this is really triggered! */
bind_info28->u1 = 528;
} else {
@@ -1075,7 +1036,7 @@ static void becomeDC_drsuapi1_add_entry_send(struct libnet_BecomeDC_state *s)
* if the schema version indicates w2k3, then
* also send some w2k3 specific attributes
*/
- if (s->ads_options.schema_object_version >= 30) {
+ if (s->forest.schema_object_version >= 30) {
w2k3 = true;
} else {
w2k3 = false;
diff --git a/source4/libnet/libnet_become_dc.h b/source4/libnet/libnet_become_dc.h
index 3803dad94b..cffa0fd129 100644
--- a/source4/libnet/libnet_become_dc.h
+++ b/source4/libnet/libnet_become_dc.h
@@ -18,16 +18,67 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
-struct libnet_BecomeDC_Options {
- uint32_t domain_behavior_version;
- uint32_t config_behavior_version;
- uint32_t schema_object_version;
+struct libnet_BecomeDC_Domain {
+ /* input */
+ const char *dns_name;
+ const char *netbios_name;
+ const struct dom_sid *sid;
+
+ /* constructed */
+ struct GUID guid;
+ const char *dn_str;
+ uint32_t behavior_version;
uint32_t w2k3_update_revision;
};
+struct libnet_BecomeDC_Forest {
+ /* constructed */
+ const char *dns_name;
+ const char *root_dn_str;
+ const char *config_dn_str;
+ uint32_t crossref_behavior_version;
+ const char *schema_dn_str;
+ uint32_t schema_object_version;
+};
+
+struct libnet_BecomeDC_SourceDSA {
+ /* input */
+ const char *address;
+
+ /* constructed */
+ const char *dns_name;
+ const char *netbios_name;
+ const char *site_name;
+ const char *server_dn_str;
+ const char *ntds_dn_str;
+};
+
+struct libnet_BecomeDC_CheckOptions {
+ const struct libnet_BecomeDC_Domain *domain;
+ const struct libnet_BecomeDC_Forest *forest;
+ const struct libnet_BecomeDC_SourceDSA *source_dsa;
+};
+
+struct libnet_BecomeDC_DestDSA {
+ /* input */
+ const char *netbios_name;
+
+ /* constructed */
+ const char *dns_name;
+ const char *site_name;
+ struct GUID site_guid;
+ const char *computer_dn_str;
+ const char *server_dn_str;
+ const char *ntds_dn_str;
+ struct GUID ntds_guid;
+ struct GUID invocation_id;
+ uint32_t user_account_control;
+};
+
struct libnet_BecomeDC_Callbacks {
void *private_data;
- NTSTATUS (*check_options)(void *private_data, const struct libnet_BecomeDC_Options *options);
+ NTSTATUS (*check_options)(void *private_data,
+ const struct libnet_BecomeDC_CheckOptions *options);
NTSTATUS (*prepare_db)(void *private_data, void *todo);
NTSTATUS (*schema_chunk)(void *private_data, void *todo);
NTSTATUS (*config_chunk)(void *private_data, void *todo);
diff --git a/source4/torture/libnet/libnet_BecomeDC.c b/source4/torture/libnet/libnet_BecomeDC.c
index cad4921f67..8db3b8d448 100644
--- a/source4/torture/libnet/libnet_BecomeDC.c
+++ b/source4/torture/libnet/libnet_BecomeDC.c
@@ -29,14 +29,23 @@
#define TORTURE_NETBIOS_NAME "smbtorturedc"
-static NTSTATUS test_become_dc_chec_options(void *private_data,
- const struct libnet_BecomeDC_Options *options)
+static NTSTATUS test_become_dc_check_options(void *private_data,
+ const struct libnet_BecomeDC_CheckOptions *o)
{
- DEBUG(0,("Options: domain[%u] config[%u] schema[%u] w2k3_update[%u]\n",
- options->domain_behavior_version,
- options->config_behavior_version,
- options->schema_object_version,
- options->w2k3_update_revision));
+ DEBUG(0,("Become DC of Domain[%s]/[%s]\n",
+ o->domain->netbios_name, o->domain->dns_name));
+
+ DEBUG(0,("Promotion Partner is Server[%s] from Site[%s]\n",
+ o->source_dsa->dns_name, o->source_dsa->site_name));
+
+ DEBUG(0,("Options:crossRef behavior_version[%u]\n"
+ "\tschema object_version[%u]\n"
+ "\tdomain behavior_version[%u]\n"
+ "\tdomain w2k3_update_revision[%u]\n",
+ o->forest->crossref_behavior_version,
+ o->forest->schema_object_version,
+ o->domain->behavior_version,
+ o->domain->w2k3_update_revision));
return NT_STATUS_OK;
}
@@ -71,7 +80,7 @@ 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.check_options = test_become_dc_chec_options;
+ b.in.callbacks.check_options = test_become_dc_check_options;
status = libnet_BecomeDC(ctx, ctx, &b);
if (!NT_STATUS_IS_OK(status)) {