/* The following definitions come from passdb/secrets.c */
+bool secrets_init_path(const char *private_dir);
bool secrets_init(void);
struct db_context *secrets_db_ctx(void);
void secrets_shutdown(void);
}
}
-/* open up the secrets database */
-bool secrets_init(void)
+/* open up the secrets database with specified private_dir path */
+bool secrets_init_path(const char *private_dir)
{
char *fname = NULL;
unsigned char dummy;
- if (db_ctx != NULL)
+ if (db_ctx != NULL) {
return True;
+ }
+
+ if (private_dir == NULL) {
+ return False;
+ }
fname = talloc_asprintf(talloc_tos(), "%s/secrets.tdb",
- lp_private_dir());
+ private_dir);
if (fname == NULL) {
- return false;
+ return False;
}
db_ctx = db_open(NULL, fname, 0,
if (db_ctx == NULL) {
DEBUG(0,("Failed to open %s\n", fname));
- TALLOC_FREE(fname);
return False;
}
return True;
}
+/* open up the secrets database */
+bool secrets_init(void)
+{
+ return secrets_init_path(lp_private_dir());
+}
+
struct db_context *secrets_db_ctx(void)
{
if (!secrets_init()) {