summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2007-01-14 18:03:26 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:40:52 -0500
commit0de68094bf80bb475d0901792f3e609565865850 (patch)
treec5a0f1cf8fa9b48c78267557965f9cbcb71773dc /source4/torture
parent4af2716c4755e8b5b24e2bb5c7a1afd4b7734a11 (diff)
downloadsamba-0de68094bf80bb475d0901792f3e609565865850.tar.gz
samba-0de68094bf80bb475d0901792f3e609565865850.tar.bz2
samba-0de68094bf80bb475d0901792f3e609565865850.zip
r20775: - use the schema_fsmo module on the schema partition, which loads the schema
if it's already in the ldb - reopen the ldb after applying the schema, to that we use the loaded schema when we apply the config and domain partition objects metze (This used to be commit 6d320ec19cac00059649703fc0455ba0ba3a16e6)
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/libnet/libnet_BecomeDC.c39
1 files changed, 38 insertions, 1 deletions
diff --git a/source4/torture/libnet/libnet_BecomeDC.c b/source4/torture/libnet/libnet_BecomeDC.c
index da0d1cac84..7605ad5c6e 100644
--- a/source4/torture/libnet/libnet_BecomeDC.c
+++ b/source4/torture/libnet/libnet_BecomeDC.c
@@ -194,7 +194,7 @@ static NTSTATUS test_become_dc_prepare_db(void *private_data,
"subobj.MODULES_LIST = join(\",\", modules_list);\n"
"subobj.DOMAINDN_MOD = \"repl_meta_data\";\n"
"subobj.CONFIGDN_MOD = \"repl_meta_data\";\n"
- "subobj.SCHEMADN_MOD = \"repl_meta_data\";\n"
+ "subobj.SCHEMADN_MOD = \"schema_fsmo,repl_meta_data\";\n"
"\n"
"var paths = provision_default_paths(subobj);\n"
"paths.samdb = \"%s\";\n"
@@ -226,6 +226,8 @@ static NTSTATUS test_become_dc_prepare_db(void *private_data,
talloc_free(s->ldb);
+ DEBUG(0,("Open the SAM LDB with system credentials: %s\n", TORTURE_SAMDB_LDB));
+
s->ldb = ldb_wrap_connect(s, TORTURE_SAMDB_LDB,
system_session(s),
NULL, 0, NULL);
@@ -270,6 +272,9 @@ static NTSTATUS test_apply_schema(struct test_become_dc_state *s,
struct ldb_val schemaInfo_val;
uint32_t i;
int ret;
+ bool ok;
+
+ DEBUG(0,("Analyze and apply schema objects\n"));
s_dsa = talloc_zero(s, struct repsFromTo1);
NT_STATUS_HAVE_NO_MEMORY(s_dsa);
@@ -444,6 +449,38 @@ static NTSTATUS test_apply_schema(struct test_become_dc_state *s,
talloc_free(s_dsa);
talloc_free(objs);
+
+ /* reopen the ldb */
+ talloc_free(s->ldb); /* this also free's the s->schema, because dsdb_set_schema() steals it */
+ s->schema = NULL;
+
+ DEBUG(0,("Reopen the SAM LDB with system credentials and a already stored schema: %s\n", TORTURE_SAMDB_LDB));
+ s->ldb = ldb_wrap_connect(s, TORTURE_SAMDB_LDB,
+ system_session(s),
+ NULL, 0, NULL);
+ if (!s->ldb) {
+ DEBUG(0,("Failed to open '%s'\n",
+ TORTURE_SAMDB_LDB));
+ return NT_STATUS_INTERNAL_DB_ERROR;
+ }
+
+ ok = samdb_set_ntds_invocation_id(s->ldb, &c->dest_dsa->invocation_id);
+ if (!ok) {
+ DEBUG(0,("Failed to set cached ntds invocationId\n"));
+ return NT_STATUS_FOOBAR;
+ }
+ ok = samdb_set_ntds_objectGUID(s->ldb, &c->dest_dsa->ntds_guid);
+ if (!ok) {
+ DEBUG(0,("Failed to set cached ntds objectGUID\n"));
+ return NT_STATUS_FOOBAR;
+ }
+
+ s->schema = dsdb_get_schema(s->ldb);
+ if (!s->schema) {
+ DEBUG(0,("Failed to get loaded dsdb_schema\n"));
+ return NT_STATUS_FOOBAR;
+ }
+
return NT_STATUS_OK;
}