summaryrefslogtreecommitdiff
path: root/source4/torture
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2007-01-06 01:13:59 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 14:37:06 -0500
commit3137e4f2fe036824984352edf618a8eddde17c51 (patch)
treee9bdd334bd35a5015f4546911e59bc08d8d8f483 /source4/torture
parent13881fa128d1e48b947512159271aae3f51b3572 (diff)
downloadsamba-3137e4f2fe036824984352edf618a8eddde17c51.tar.gz
samba-3137e4f2fe036824984352edf618a8eddde17c51.tar.bz2
samba-3137e4f2fe036824984352edf618a8eddde17c51.zip
r20580: pass the DSDB_CONTROL_REPLICATED_OBJECT_OID with the ldb_add request
when applying replicated objects. the samldb module ignores such requests now... and the repl_meta_data module has different functions for the replicated and originating cases... metze (This used to be commit a4d5e0126cfd6135ab829f4984269e265a868a28)
Diffstat (limited to 'source4/torture')
-rw-r--r--source4/torture/libnet/libnet_BecomeDC.c43
1 files changed, 38 insertions, 5 deletions
diff --git a/source4/torture/libnet/libnet_BecomeDC.c b/source4/torture/libnet/libnet_BecomeDC.c
index 0d4114c170..f4f232d19b 100644
--- a/source4/torture/libnet/libnet_BecomeDC.c
+++ b/source4/torture/libnet/libnet_BecomeDC.c
@@ -182,16 +182,16 @@ static NTSTATUS test_become_dc_prepare_db(void *private_data,
" \"server_sort\",\n"
" \"extended_dn\",\n"
" \"asq\",\n"
- " //\"samldb\",should only handle originating changes...\n"
+ " \"samldb\",\n"
" \"password_hash\",\n"
" \"operational\",\n"
" \"objectclass\",\n"
" \"rdn_name\",\n"
" \"partition\");\n"
"subobj.MODULES_LIST = join(\",\", modules_list);\n"
- "subobj.DOMAINDN_MOD = \"objectguid\";\n"
- "subobj.CONFIGDN_MOD = \"objectguid\";\n"
- "subobj.SCHEMADN_MOD = \"objectguid\";\n"
+ "subobj.DOMAINDN_MOD = \"repl_meta_data\";\n"
+ "subobj.CONFIGDN_MOD = \"repl_meta_data\";\n"
+ "subobj.SCHEMADN_MOD = \"repl_meta_data\";\n"
"\n"
"var paths = provision_default_paths(subobj);\n"
"paths.samdb = \"%s\";\n"
@@ -265,6 +265,9 @@ static WERROR test_object_to_ldb(struct test_become_dc_state *s,
struct drsuapi_DsReplicaMetaData *name_d;
struct replPropertyMetaData1 *rdn_m;
struct drsuapi_DsReplicaObjMetaData *rdn_mc;
+ struct ldb_request *req;
+ struct ldb_control **ctrls;
+ struct dsdb_control_replicated_object *ctrl;
int ret;
if (!obj->object.identifier) {
@@ -424,7 +427,37 @@ static WERROR test_object_to_ldb(struct test_become_dc_state *s,
NDR_PRINT_DEBUG(drsuapi_DsReplicaObjMetaDataCtr, &mdc);
}
- ret = ldb_add(s->ldb, msg);
+ /*
+ * apply the record to the ldb
+ * using an ldb_control so indicate
+ * that it's a replicated change
+ */
+ ret = ldb_msg_sanity_check(s->ldb, msg);
+ if (ret != LDB_SUCCESS) {
+ return WERR_FOOBAR;
+ }
+ ctrls = talloc_array(msg, struct ldb_control *, 2);
+ W_ERROR_HAVE_NO_MEMORY(ctrls);
+ ctrls[0] = talloc(ctrls, struct ldb_control);
+ W_ERROR_HAVE_NO_MEMORY(ctrls[0]);
+ ctrls[1] = NULL;
+
+ ctrl = talloc(ctrls, struct dsdb_control_replicated_object);
+ W_ERROR_HAVE_NO_MEMORY(ctrl);
+ ctrls[0]->oid = DSDB_CONTROL_REPLICATED_OBJECT_OID;
+ ctrls[0]->critical = True;
+ ctrls[0]->data = ctrl;
+
+ ret = ldb_build_add_req(&req, s->ldb, msg, msg, ctrls, NULL, NULL);
+ if (ret != LDB_SUCCESS) {
+ return WERR_FOOBAR;
+ }
+ ldb_set_timeout(s->ldb, req, 0); /* use default timeout */
+ ret = ldb_request(s->ldb, req);
+ if (ret == LDB_SUCCESS) {
+ ret = ldb_wait(req->handle, LDB_WAIT_ALL);
+ }
+ talloc_free(req);
if (ret != LDB_SUCCESS) {
if (ret == LDB_ERR_ENTRY_ALREADY_EXISTS) {
DEBUG(0,("record exists (ignored): %s: %d\n",