summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2007-11-13 22:40:42 +0100
committerStefan Metzmacher <metze@samba.org>2007-12-21 05:45:11 +0100
commit7f18e15e3f48d92a4f8f2b929a6337761b26fc67 (patch)
tree197455d2b83d0b2c1a86949147d6b2b3778ffd34
parent3f2ca10d2d86f0cd64822f9e5f95633f41263237 (diff)
downloadsamba-7f18e15e3f48d92a4f8f2b929a6337761b26fc67.tar.gz
samba-7f18e15e3f48d92a4f8f2b929a6337761b26fc67.tar.bz2
samba-7f18e15e3f48d92a4f8f2b929a6337761b26fc67.zip
r25941: Use samdb_relative_path() (new function in samdb.c) in the partitions
module. Andrew Bartlett (This used to be commit c8d1ab30845fa1496c85630b138b1cb512c2b6aa)
-rw-r--r--source4/dsdb/samdb/ldb_modules/partition.c33
1 files changed, 3 insertions, 30 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/partition.c b/source4/dsdb/samdb/ldb_modules/partition.c
index 5d3663be33..f40cf5ef42 100644
--- a/source4/dsdb/samdb/ldb_modules/partition.c
+++ b/source4/dsdb/samdb/ldb_modules/partition.c
@@ -707,33 +707,6 @@ static int sort_compare(void *void1,
return ldb_dn_compare(partition1->dn, partition2->dn);
}
-static const char *relative_path(struct ldb_module *module,
- TALLOC_CTX *mem_ctx,
- const char *name)
-{
- const char *base_url =
- (const char *)ldb_get_opaque(module->ldb, "ldb_url");
- char *path, *p, *full_name;
- if (name == NULL) {
- return NULL;
- }
- if (name[0] == 0 || name[0] == '/' || strstr(name, ":/")) {
- return talloc_strdup(mem_ctx, name);
- }
- path = talloc_strdup(mem_ctx, base_url);
- if (path == NULL) {
- return NULL;
- }
- if ( (p = strrchr(path, '/')) != NULL) {
- p[0] = '\0';
- full_name = talloc_asprintf(mem_ctx, "%s/%s", path, name);
- } else {
- full_name = talloc_asprintf(mem_ctx, "./%s", name);
- }
- talloc_free(path);
- return full_name;
-}
-
static int partition_init(struct ldb_module *module)
{
int ret, i;
@@ -822,9 +795,9 @@ static int partition_init(struct ldb_module *module)
return LDB_ERR_CONSTRAINT_VIOLATION;
}
- data->partitions[i]->backend = relative_path(module,
- data->partitions[i],
- p);
+ data->partitions[i]->backend = samdb_relative_path(module->ldb,
+ data->partitions[i],
+ p);
if (!data->partitions[i]->backend) {
ldb_asprintf_errstring(module->ldb,
"partition_init: unable to determine an relative path for partition: %s", base);