svn commit: samba r20775 - in branches/SAMBA_4_0/source/torture/libnet: .

metze at samba.org metze at samba.org
Sun Jan 14 18:03:27 GMT 2007


Author: metze
Date: 2007-01-14 18:03:26 +0000 (Sun, 14 Jan 2007)
New Revision: 20775

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=20775

Log:
- 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
Modified:
   branches/SAMBA_4_0/source/torture/libnet/libnet_BecomeDC.c


Changeset:
Modified: branches/SAMBA_4_0/source/torture/libnet/libnet_BecomeDC.c
===================================================================
--- branches/SAMBA_4_0/source/torture/libnet/libnet_BecomeDC.c	2007-01-14 17:58:24 UTC (rev 20774)
+++ branches/SAMBA_4_0/source/torture/libnet/libnet_BecomeDC.c	2007-01-14 18:03:26 UTC (rev 20775)
@@ -194,7 +194,7 @@
 		"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 @@
 
 	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,7 +272,10 @@
 	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);
 	s_dsa->other_info	= talloc(s_dsa, struct repsFromTo1OtherInfo);
@@ -444,6 +449,38 @@
 
 	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;
 }
 



More information about the samba-cvs mailing list