diff options
author | Andrew Bartlett <abartlet@samba.org> | 2010-06-23 21:15:43 +1000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2010-06-29 16:59:31 +1000 |
commit | cc7c572b3d87d2bd16cd7ec939a2d8a81bf36ef9 (patch) | |
tree | 16b1331d3029c6f5039916597b068aa5012361da /source4/param | |
parent | 48c8896f2ede1c441a1448c2e45106a317b64832 (diff) | |
download | samba-cc7c572b3d87d2bd16cd7ec939a2d8a81bf36ef9.tar.gz samba-cc7c572b3d87d2bd16cd7ec939a2d8a81bf36ef9.tar.xz samba-cc7c572b3d87d2bd16cd7ec939a2d8a81bf36ef9.zip |
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
Diffstat (limited to 'source4/param')
-rw-r--r-- | source4/param/secrets.c | 43 |
1 files changed, 3 insertions, 40 deletions
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); } /** |