such as the local SID and machine trust password */
#include "includes.h"
+#include "lib/tdb/include/tdbutil.h"
#include "secrets.h"
+#include "system/filesys.h"
+#include "pstring.h"
+#include "db_wrap.h"
#undef DBGC_CLASS
#define DBGC_CLASS DBGC_PASSDB
return False;
if (ref_count == 0) {
- ret = tdb_lock_bystring(tdb->tdb, name, timeout);
+ ret = tdb_lock_bystring(tdb->tdb, name);
if (ret == 0)
DEBUG(10,("secrets_named_mutex: got mutex for %s\n", name ));
}
/*
connect to the schannel ldb
*/
-struct ldb_wrap *secrets_db_connect(TALLOC_CTX *mem_ctx)
+struct ldb_context *secrets_db_connect(TALLOC_CTX *mem_ctx)
{
char *path;
- struct ldb_wrap *ldb;
+ struct ldb_context *ldb;
+ BOOL existed;
+ const char *init_ldif =
+ "dn: @ATTRIBUTES\n" \
+ "computerName: CASE_INSENSITIVE\n" \
+ "flatname: CASE_INSENSITIVE\n";
path = private_path(mem_ctx, "secrets.ldb");
if (!path) {
return NULL;
}
+ existed = file_exists(path);
+
ldb = ldb_wrap_connect(mem_ctx, path, 0, NULL);
talloc_free(path);
if (!ldb) {
return NULL;
}
+
+ if (!existed) {
+ gendb_add_ldif(ldb, init_ldif);
+ }
return ldb;
}