summaryrefslogtreecommitdiff
path: root/source4/dsdb
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2009-10-21 18:25:00 +1100
committerAndrew Bartlett <abartlet@samba.org>2009-10-21 22:43:57 +1100
commit4209cf9860b528f2ac9da175feec8783a35950f9 (patch)
tree0bb230e8bb99694657ccffa6fe94e779c33d617e /source4/dsdb
parentfa2e04b64004f24bcac51a44ce37b8923480b819 (diff)
downloadsamba-4209cf9860b528f2ac9da175feec8783a35950f9.tar.gz
samba-4209cf9860b528f2ac9da175feec8783a35950f9.tar.bz2
samba-4209cf9860b528f2ac9da175feec8783a35950f9.zip
s4:dsdb Make the 'relative path' code in partitions handle tdb://
The previous code would fail if the caller used tdb:// in the URL for the top-level database. Andrew Bartlett
Diffstat (limited to 'source4/dsdb')
-rw-r--r--source4/dsdb/samdb/ldb_modules/partition_init.c19
-rw-r--r--source4/dsdb/samdb/samdb.c3
2 files changed, 15 insertions, 7 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/partition_init.c b/source4/dsdb/samdb/ldb_modules/partition_init.c
index c54fa50125..421169d371 100644
--- a/source4/dsdb/samdb/ldb_modules/partition_init.c
+++ b/source4/dsdb/samdb/ldb_modules/partition_init.c
@@ -385,6 +385,7 @@ int partition_reload_if_required(struct ldb_module *module,
for (i=0; partition_attributes && i < partition_attributes->num_values; i++) {
int j;
bool new_partition = true;
+ DATA_BLOB dn_blob;
struct ldb_dn *dn;
struct dsdb_partition *partition;
for (j=0; data->partitions && data->partitions[j]; j++) {
@@ -397,22 +398,26 @@ int partition_reload_if_required(struct ldb_module *module,
if (new_partition == false) {
continue;
}
-
- dn = ldb_dn_from_ldb_val(mem_ctx, ldb, &partition_attributes->values[i]);
+
+ dn_blob = partition_attributes->values[i];
+
+ dn = ldb_dn_from_ldb_val(mem_ctx, ldb, &dn_blob);
if (!dn) {
ldb_asprintf_errstring(ldb,
- "partition_init: invalid DN in partition record: %s", (const char *)partition_attributes->values[i].data);
+ "partition_init: invalid DN in partition record: %s", (const char *)dn_blob.data);
talloc_free(mem_ctx);
return LDB_ERR_CONSTRAINT_VIOLATION;
}
-
- if (ldb_dn_compare_base(ldb_get_default_basedn(ldb), dn) != 0) {
+
+ if (dn_blob.length > 4 &&
+ (strncmp((const char *)&dn_blob.data[dn_blob.length-4], ".ldb", 4) == 0) &&
+ (ldb_dn_compare_base(ldb_get_default_basedn(ldb), dn) != 0)) {
ldb_asprintf_errstring(ldb,
"partition_init: invalid DN in partition record: %s is not under %s. Perhaps an old " DSDB_PARTITION_DN " format?",
- (const char *)partition_attributes->values[i].data,
+ (const char *)dn_blob.data,
ldb_dn_get_linearized(ldb_get_default_basedn(ldb)));
DEBUG(0, ("Unable to load partitions, invalid DN %s found, perhaps you need to reprovision? See partition-upgrade.txt for instructions\n",
- (const char *)partition_attributes->values[i].data));
+ (const char *)dn_blob.data));
talloc_free(mem_ctx);
return LDB_ERR_CONSTRAINT_VIOLATION;
}
diff --git a/source4/dsdb/samdb/samdb.c b/source4/dsdb/samdb/samdb.c
index e361cc78fb..6034c25650 100644
--- a/source4/dsdb/samdb/samdb.c
+++ b/source4/dsdb/samdb/samdb.c
@@ -55,6 +55,9 @@ char *samdb_relative_path(struct ldb_context *ldb,
if (name[0] == 0 || name[0] == '/' || strstr(name, ":/")) {
return talloc_strdup(mem_ctx, name);
}
+ if (strncmp("tdb://", base_url, 6) == 0) {
+ base_url = base_url+6;
+ }
path = talloc_strdup(mem_ctx, base_url);
if (path == NULL) {
return NULL;