s4-dsdb: ensure we will in all the attributes for RID Set
authorAndrew Tridgell <tridge@samba.org>
Thu, 7 Jan 2010 07:16:14 +0000 (18:16 +1100)
committerAndrew Tridgell <tridge@samba.org>
Fri, 8 Jan 2010 02:03:05 +0000 (13:03 +1100)
We need to go to the top of the module stack so that all the extra
attributes get filled in

source4/dsdb/samdb/ldb_modules/ridalloc.c

index 2d0753f3930f6d4469a4e4a019588c923a534336..07b3739f8ed453ee1ccb794bb4cc5c086aa599fc 100644 (file)
@@ -175,26 +175,11 @@ static int ridalloc_create_rid_set_ntds(struct ldb_module *module, TALLOC_CTX *m
        msg = ldb_msg_new(tmp_ctx);
        msg->dn = rid_set_dn;
 
-       ret = ldb_msg_add_string(msg, "objectClass", "top");
-       if (ret != LDB_SUCCESS) {
-               talloc_free(tmp_ctx);
-               return ret;
-       }
        ret = ldb_msg_add_string(msg, "objectClass", "rIDSet");
        if (ret != LDB_SUCCESS) {
                talloc_free(tmp_ctx);
                return ret;
        }
-       ret = ldb_msg_add_string(msg, "cn", "RID Set");
-       if (ret != LDB_SUCCESS) {
-               talloc_free(tmp_ctx);
-               return ret;
-       }
-       ret = ldb_msg_add_string(msg, "name", "RID Set");
-       if (ret != LDB_SUCCESS) {
-               talloc_free(tmp_ctx);
-               return ret;
-       }
        ret = ldb_msg_add_fmt(msg, "rIDAllocationPool", "%llu", (unsigned long long)dc_pool);
        if (ret != LDB_SUCCESS) {
                talloc_free(tmp_ctx);
@@ -218,7 +203,10 @@ static int ridalloc_create_rid_set_ntds(struct ldb_module *module, TALLOC_CTX *m
                return ret;
        }
 
-       ret = dsdb_module_add(module, msg, 0);
+       /* we need this to go all the way to the top of the module
+        * stack, as we need all the extra attributes added (including
+        * complex ones like ntsecuritydescriptor) */
+       ret = dsdb_module_add(module, msg, DSDB_FLAG_TOP_MODULE | DSDB_MODIFY_RELAX);
        if (ret != LDB_SUCCESS) {
                ldb_asprintf_errstring(ldb, "Failed to add RID Set %s - %s",
                                       ldb_dn_get_linearized(msg->dn),