diff options
author | Andrew Bartlett <abartlet@samba.org> | 2009-10-22 09:45:14 +1100 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2009-10-22 09:45:14 +1100 |
commit | 925a94b67c83fb9a0d762f6b11740d1091623f7c (patch) | |
tree | d09645f3376ff9a0f3a9a1062ad256d35dba1d66 | |
parent | f4240973ba40934d435c7777753094bbb32ce474 (diff) | |
download | samba-925a94b67c83fb9a0d762f6b11740d1091623f7c.tar.gz samba-925a94b67c83fb9a0d762f6b11740d1091623f7c.tar.bz2 samba-925a94b67c83fb9a0d762f6b11740d1091623f7c.zip |
s4:dsdb Use the 'correct' case for the namingContext values in rootDSE
This makes the namingContext attributes in the rootDSE a little more pretty, by
using the exact same values as used in the database DNs.
Andrew Bartlett
-rw-r--r-- | source4/dsdb/samdb/ldb_modules/partition_init.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/partition_init.c b/source4/dsdb/samdb/ldb_modules/partition_init.c index c88d418783..f4163dab3d 100644 --- a/source4/dsdb/samdb/ldb_modules/partition_init.c +++ b/source4/dsdb/samdb/ldb_modules/partition_init.c @@ -394,6 +394,9 @@ int partition_reload_if_required(struct ldb_module *module, DATA_BLOB dn_blob; struct ldb_dn *dn; struct dsdb_partition *partition; + struct ldb_result *dn_res; + const char *no_attrs[] = { NULL }; + for (j=0; data->partitions && data->partitions[j]; j++) { DATA_BLOB casefold = data_blob_string_const(ldb_dn_get_casefold(data->partitions[j]->ctrl->dn)); if (data_blob_cmp(&casefold, &partition_attributes->values[i]) == 0) { @@ -451,6 +454,25 @@ int partition_reload_if_required(struct ldb_module *module, return ret; } + /* Get the 'correct' case of the partition DNs from the database */ + ret = dsdb_module_search_dn(partition->module, data, &dn_res, + dn, no_attrs); + if (ret == LDB_SUCCESS) { + talloc_free(partition->ctrl->dn); + partition->ctrl->dn = talloc_steal(partition->ctrl, dn_res->msgs[0]->dn); + talloc_free(dn_res); + } else if (ret != LDB_ERR_NO_SUCH_OBJECT) { + ldb_asprintf_errstring(ldb, + "Failed to search for %s from " DSDB_PARTITION_DN + " replicateEntries for new partition at %s on %s: %s", + ldb_dn_get_linearized(data->replicate[i]), + partition->backend_url, + ldb_dn_get_linearized(partition->ctrl->dn), + ldb_errstring(ldb)); + talloc_free(mem_ctx); + return ret; + } + ret = add_partition_to_data(ldb, data, partition); if (ret != LDB_SUCCESS) { talloc_free(mem_ctx); |