s3:registry: remove a superfluous fill_subkey_cache() in reg_createkey()
[ddiss/samba.git] / source3 / registry / reg_api.c
index bfc7aec35d1a6f85d2461a5fc95d12e915c68c32..0363ca4fed777e428aaef4e36c4ebd429b1dd0a2 100644 (file)
@@ -116,7 +116,7 @@ static WERROR fill_subkey_cache(struct registry_key *key)
 
        if (fetch_reg_keys(key->key, key->subkeys) == -1) {
                TALLOC_FREE(key->subkeys);
-               return WERR_NO_MORE_ITEMS;
+               return WERR_BADFILE;
        }
 
        return WERR_OK;
@@ -137,7 +137,6 @@ static WERROR regkey_open_onelevel(TALLOC_CTX *mem_ctx,
        WERROR          result = WERR_OK;
        struct registry_key *regkey;
        struct registry_key_handle *key;
-       struct regsubkey_ctr    *subkeys = NULL;
 
        DEBUG(7,("regkey_open_onelevel: name = [%s]\n", name));
 
@@ -203,21 +202,13 @@ static WERROR regkey_open_onelevel(TALLOC_CTX *mem_ctx,
                goto done;
        }
 
-       /* check if the path really exists; failed is indicated by -1 */
-       /* if the subkey count failed, bail out */
+       /* FIXME: Existence is currently checked by fetching the subkeys */
 
-       result = regsubkey_ctr_init(key, &subkeys);
+       result = fill_subkey_cache(regkey);
        if (!W_ERROR_IS_OK(result)) {
                goto done;
        }
 
-       if ( fetch_reg_keys( key, subkeys ) == -1 )  {
-               result = WERR_BADFILE;
-               goto done;
-       }
-
-       TALLOC_FREE( subkeys );
-
        if ( !regkey_access_check( key, access_desired, &key->access_granted,
                                   token ) ) {
                result = WERR_ACCESS_DENIED;
@@ -640,11 +631,6 @@ WERROR reg_createkey(TALLOC_CTX *ctx, struct registry_key *parent,
         * Actually create the subkey
         */
 
-       err = fill_subkey_cache(create_parent);
-       if (!W_ERROR_IS_OK(err)) {
-               goto trans_done;
-       }
-
        err = create_reg_subkey(key->key, path);
        if (!W_ERROR_IS_OK(err)) {
                goto trans_done;