diff options
author | Andrew Tridgell <tridge@samba.org> | 2011-08-09 13:18:08 +1000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2011-08-09 11:56:23 +0200 |
commit | 2ba18d89eb066cf52d8bbd18a28e494bb4247d9c (patch) | |
tree | 48e8e40917122949d1d8e8bbe395fb5fde35c29d | |
parent | 55b25e1e23882fb8eb476408790b12f03a5d65e8 (diff) | |
download | samba-2ba18d89eb066cf52d8bbd18a28e494bb4247d9c.tar.gz samba-2ba18d89eb066cf52d8bbd18a28e494bb4247d9c.tar.bz2 samba-2ba18d89eb066cf52d8bbd18a28e494bb4247d9c.zip |
s4-dsdb: ensure rIDSetReferences is stored as an extended DN
Signed-off-by: Andrew Bartlett <abartlet@samba.org>
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/ridalloc.c | 18 | ||||
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/util.c | 2 |
2 files changed, 18 insertions, 2 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/ridalloc.c b/source4/dsdb/samdb/ldb_modules/ridalloc.c index 28fade11b1..ed87f86fa2 100644 --- a/source4/dsdb/samdb/ldb_modules/ridalloc.c +++ b/source4/dsdb/samdb/ldb_modules/ridalloc.c @@ -263,6 +263,8 @@ static int ridalloc_create_rid_set_ntds(struct ldb_module *module, TALLOC_CTX *m .next_rid = 0, .used_pool = 0, }; + const char *no_attrs[] = { NULL }; + struct ldb_result *res; /* steps: @@ -339,7 +341,21 @@ static int ridalloc_create_rid_set_ntds(struct ldb_module *module, TALLOC_CTX *m msg = ldb_msg_new(tmp_ctx); msg->dn = machine_dn; - ret = ldb_msg_add_string(msg, "rIDSetReferences", ldb_dn_get_linearized(rid_set_dn)); + /* we need the extended DN of the RID Set object for + * rIDSetReferences */ + ret = dsdb_module_search_dn(module, msg, &res, rid_set_dn, no_attrs, + DSDB_FLAG_NEXT_MODULE | DSDB_SEARCH_SHOW_DN_IN_STORAGE_FORMAT, parent); + if (ret != LDB_SUCCESS) { + ldb_asprintf_errstring(ldb, "Failed to find extended DN of RID Set %s - %s", + ldb_dn_get_linearized(msg->dn), + ldb_errstring(ldb)); + talloc_free(tmp_ctx); + return ret; + } + rid_set_dn = res->msgs[0]->dn; + + + ret = ldb_msg_add_string(msg, "rIDSetReferences", ldb_dn_get_extended_linearized(msg, rid_set_dn, 1)); if (ret != LDB_SUCCESS) { talloc_free(tmp_ctx); return ret; diff --git a/source4/dsdb/samdb/ldb_modules/util.c b/source4/dsdb/samdb/ldb_modules/util.c index ebb214dff3..dfb8600187 100644 --- a/source4/dsdb/samdb/ldb_modules/util.c +++ b/source4/dsdb/samdb/ldb_modules/util.c @@ -751,7 +751,7 @@ int dsdb_module_reference_dn(struct ldb_module *module, TALLOC_CTX *mem_ctx, str attrs[1] = NULL; ret = dsdb_module_search_dn(module, mem_ctx, &res, base, attrs, - DSDB_FLAG_NEXT_MODULE, parent); + DSDB_FLAG_NEXT_MODULE | DSDB_SEARCH_SHOW_EXTENDED_DN, parent); if (ret != LDB_SUCCESS) { return ret; } |