s3:registry: improve regdb_create_subkey_internal() to always complete incomlete...
authorMichael Adam <obnox@samba.org>
Fri, 30 Sep 2011 13:42:31 +0000 (15:42 +0200)
committerMichael Adam <obnox@samba.org>
Tue, 11 Oct 2011 13:21:20 +0000 (15:21 +0200)
Originally, this function did not create the key's subkey list record if only
the record was listed in the subkeylist of its parent key. Now this is fixed.

Pair-Programmed-With: Gregor Beck <gbeck@sernet.de>

source3/registry/reg_backend_db.c

index a646244e81377d28aacada6acd292699c2fccd47..32051ad20cdf1514860ed215bf9fdf0de44ca385 100644 (file)
@@ -1280,8 +1280,18 @@ static WERROR regdb_create_subkey_internal(struct db_context *db,
        W_ERROR_NOT_OK_GOTO_DONE(werr);
 
        if (regsubkey_ctr_key_exists(subkeys, subkey)) {
-               werr = WERR_OK;
-               goto done;
+               char *newkey;
+
+               newkey = talloc_asprintf(mem_ctx, "%s\\%s", key, subkey);
+               if (newkey == NULL) {
+                       werr = WERR_NOMEM;
+                       goto done;
+               }
+
+               if (regdb_key_exists(db, newkey)) {
+                       werr = WERR_OK;
+                       goto done;
+               }
        }
 
        talloc_free(subkeys);