s3:registry: recreate the sorted subkeys cache when storing keys
authorMichael Adam <obnox@samba.org>
Wed, 11 May 2011 13:58:48 +0000 (15:58 +0200)
committerVolker Lendecke <vl@samba.org>
Thu, 12 May 2011 09:48:30 +0000 (11:48 +0200)
This is to avoid turning the next read operation into a write op.

source3/registry/reg_backend_db.c

index 28439ab914d7cc04907c097e51a9d9f19fc2f1c3..cd57868efa89229b7d0cbe6e3a762396c93aea53 100644 (file)
@@ -834,22 +834,9 @@ static WERROR regdb_store_keys_internal2(struct db_context *db,
        W_ERROR_NOT_OK_GOTO_DONE(werr);
 
        /*
-        * Delete a sorted subkey cache for regdb_key_exists, will be
-        * recreated automatically
+        * recreate the sorted subkey cache for regdb_key_exists()
         */
-       keyname = talloc_asprintf(ctx, "%s\\%s", REG_SORTED_SUBKEYS_PREFIX,
-                                 keyname);
-       if (keyname == NULL) {
-               werr = WERR_NOMEM;
-               goto done;
-       }
-
-       werr = ntstatus_to_werror(dbwrap_delete_bystring(db, keyname));
-
-       /* don't treat WERR_NOT_FOUND as an error here */
-       if (W_ERROR_EQUAL(werr, WERR_NOT_FOUND)) {
-               werr = WERR_OK;
-       }
+       werr = ntstatus_to_werror(create_sorted_subkeys(keyname));
 
 done:
        TALLOC_FREE(ctx);