s4-ldb: add instanceType in repl_meta_data module
authorAndrew Tridgell <tridge@samba.org>
Thu, 24 Sep 2009 14:16:50 +0000 (07:16 -0700)
committerAndrew Tridgell <tridge@samba.org>
Thu, 24 Sep 2009 17:36:45 +0000 (10:36 -0700)
We need to add instanceType on new records if not added by caller. This is needed in repl_meta_data
to ensure we fill in the meta data for replication

source4/dsdb/samdb/ldb_modules/repl_meta_data.c

index bb1c5bb1a1867d770bab33797b490e0d9275b7b1..1af96220b53e5d8cfdbf7eb83ad1e4cd2ed9a725 100644 (file)
@@ -523,6 +523,14 @@ static int replmd_add(struct ldb_module *module, struct ldb_request *req)
        ldb_msg_remove_attr(msg, "uSNChanged");
        ldb_msg_remove_attr(msg, "replPropertyMetaData");
 
+       if (!ldb_msg_find_element(req->op.add.message, "instanceType")) {
+               ret = ldb_msg_add_fmt(msg, "instanceType", "%u", INSTANCE_TYPE_WRITE);
+               if (ret != LDB_SUCCESS) {
+                       ldb_oom(ldb);
+                       return LDB_ERR_OPERATIONS_ERROR;
+               }
+       }
+
        /*
         * readd replicated attributes
         */