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>
Wed, 12 Oct 2011 01:49:05 +0000 (03:49 +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 64c466db81166cdb8eb73c1715fe642575a7c0dc..fad6c08b5e063b056c11b096f2088ac3b0414139 100644 (file)
@@ -1298,8 +1298,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);