loadparm: make the source3/ lp_ functions take an explicit TALLOC_CTX *.
[obnox/samba/samba-obnox.git] / source3 / passdb / secrets.c
index e40095d2af35e1fbd57f99e623c400fb43a7b9e7..dff855cce6327cf696fc481d22e630707c89baa1 100644 (file)
@@ -47,10 +47,10 @@ static struct db_context *db_ctx;
  */
 static void get_rand_seed(void *userdata, int *new_seed)
 {
-       *new_seed = sys_getpid();
+       *new_seed = getpid();
        if (db_ctx) {
-               dbwrap_trans_change_int32_atomic(db_ctx, "INFO/random_seed",
-                                                new_seed, 1);
+               dbwrap_trans_change_int32_atomic_bystring(
+                       db_ctx, "INFO/random_seed", new_seed, 1);
        }
 }
 
@@ -75,7 +75,8 @@ bool secrets_init_path(const char *private_dir)
        }
 
        db_ctx = db_open(NULL, fname, 0,
-                        TDB_DEFAULT, O_RDWR|O_CREAT, 0600);
+                        TDB_DEFAULT, O_RDWR|O_CREAT, 0600,
+                        DBWRAP_LOCK_ORDER_1);
 
        if (db_ctx == NULL) {
                DEBUG(0,("Failed to open %s\n", fname));
@@ -331,7 +332,7 @@ bool fetch_ldap_pw(char **dn, char** pw)
        char *key = NULL;
        size_t size = 0;
 
-       *dn = smb_xstrdup(lp_ldap_admin_dn());
+       *dn = smb_xstrdup(lp_ldap_admin_dn(talloc_tos()));
 
        if (asprintf(&key, "%s/%s", SECRETS_LDAP_BIND_PW, *dn) < 0) {
                SAFE_FREE(*dn);
@@ -498,22 +499,6 @@ bool secrets_store_generic(const char *owner, const char *key, const char *secre
        return ret;
 }
 
-bool secrets_delete_generic(const char *owner, const char *key)
-{
-       char *tdbkey = NULL;
-       bool ret;
-
-       if (asprintf(&tdbkey, "SECRETS/GENERIC/%s/%s", owner, key) < 0) {
-               DEBUG(0, ("asprintf failed!\n"));
-               return False;
-       }
-
-       ret = secrets_delete(tdbkey);
-
-       SAFE_FREE(tdbkey);
-       return ret;
-}
-
 /*******************************************************************
  Find the ldap password.
 ******************************************************************/