From cc7c572b3d87d2bd16cd7ec939a2d8a81bf36ef9 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 23 Jun 2010 21:15:43 +1000 Subject: s4:secrets Ensure secrets.ldb uses the same hooks as the rest of Samba This ensures that, for example, the utf8 functions are the same, the GUID handler is the same and the NOSYNC flag is applied. Andrew Bartlett --- source4/param/secrets.c | 43 +++---------------------------------------- 1 file changed, 3 insertions(+), 40 deletions(-) (limited to 'source4/param') diff --git a/source4/param/secrets.c b/source4/param/secrets.c index 47a3f6b842..8c135dc2c6 100644 --- a/source4/param/secrets.c +++ b/source4/param/secrets.c @@ -26,6 +26,7 @@ #include "param/param.h" #include "system/filesys.h" #include "tdb_wrap.h" +#include "lib/ldb-samba/ldb_wrap.h" #include "lib/ldb/include/ldb.h" #include "../tdb/include/tdb.h" #include "../lib/util/util_tdb.h" @@ -92,46 +93,8 @@ struct ldb_context *secrets_db_connect(TALLOC_CTX *mem_ctx, struct tevent_context *ev_ctx, struct loadparm_context *lp_ctx) { - char *path; - const char *url; - struct ldb_context *ldb; - - url = lp_secrets_url(lp_ctx); - if (!url || !url[0]) { - return NULL; - } - - path = private_path(mem_ctx, lp_ctx, url); - if (!path) { - return NULL; - } - - /* Secrets.ldb *must* always be local. If we call for a - * system_session() we will recurse */ - ldb = ldb_init(mem_ctx, ev_ctx); - if (!ldb) { - talloc_free(path); - return NULL; - } - - ldb_set_modules_dir(ldb, - talloc_asprintf(ldb, "%s/ldb", lp_modulesdir(lp_ctx))); - - if (ldb_connect(ldb, path, 0, NULL) != 0) { - talloc_free(path); - return NULL; - } - - /* the update_keytab module relies on this being setup */ - if (ldb_set_opaque(ldb, "loadparm", lp_ctx) != LDB_SUCCESS) { - talloc_free(path); - talloc_free(ldb); - return NULL; - } - - talloc_free(path); - - return ldb; + return ldb_wrap_connect(mem_ctx, ev_ctx, lp_ctx, lp_secrets_url(lp_ctx), + NULL, NULL, 0); } /** -- cgit