From 6c8748c1605bc313f9f0c71f0667fec2bf5ac03d Mon Sep 17 00:00:00 2001 From: Gary Lockyer Date: Tue, 6 Mar 2018 13:40:21 +1300 Subject: [PATCH] dsdb:schema_load: make use of ldb_relative_path() in partition_metadata_open() Signed-off-by: Gary Lockyer Reviewed-by: Andrew Bartlett Reviewed-by: Stefan Metzmacher --- source4/dsdb/samdb/ldb_modules/schema_load.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/source4/dsdb/samdb/ldb_modules/schema_load.c b/source4/dsdb/samdb/ldb_modules/schema_load.c index 7cbbeb699ee..fd19d105162 100644 --- a/source4/dsdb/samdb/ldb_modules/schema_load.c +++ b/source4/dsdb/samdb/ldb_modules/schema_load.c @@ -32,6 +32,7 @@ #include #include "lib/tdb_wrap/tdb_wrap.h" #include "dsdb/samdb/ldb_modules/util.h" +#include "lib/ldb-samba/ldb_wrap.h" #include "system/filesys.h" struct schema_load_private_data { @@ -63,7 +64,6 @@ static int schema_metadata_open(struct ldb_module *module) struct ldb_context *ldb = ldb_module_get_ctx(module); TALLOC_CTX *tmp_ctx; struct loadparm_context *lp_ctx; - const char *sam_name; char *filename; int open_flags; struct stat statbuf; @@ -79,19 +79,9 @@ static int schema_metadata_open(struct ldb_module *module) return ldb_module_oom(module); } - sam_name = (const char *)ldb_get_opaque(ldb, "ldb_url"); - if (!sam_name) { - talloc_free(tmp_ctx); - return ldb_operr(ldb); - } - if (strncmp("tdb://", sam_name, 6) == 0) { - sam_name += 6; - } - filename = talloc_asprintf(tmp_ctx, "%s.d/metadata.tdb", sam_name); - if (!filename) { - talloc_free(tmp_ctx); - return ldb_oom(ldb); - } + filename = ldb_relative_path(ldb, + tmp_ctx, + "sam.ldb.d/metadata.tdb"); open_flags = O_RDWR; if (stat(filename, &statbuf) != 0) { -- 2.47.2