s3:registry: don't store differently cased entries for the same keys.
authorMichael Adam <obnox@samba.org>
Wed, 8 Jul 2009 14:16:18 +0000 (16:16 +0200)
committerMichael Adam <obnox@samba.org>
Wed, 15 Jul 2009 12:01:40 +0000 (14:01 +0200)
This happened for instance during registry initialization, when
entries for HKLM\Software and HKLM\SOFTWARE were created.
Searching these entries was case insensitive though.
But the entries ended up in the subkey-lists anyways.

This is solved by making the subkeys_hash in the regsubkey_container
structs case insensitive (using the new _bystring_upper() wrappers).

Michael

source3/registry/reg_objects.c

index 5ae1cd8aa7dec7f6b9585fb6cf295cef2e32b838..a592c76e1d1433a5cc9ddde832249b1eb1ef2e7d 100644 (file)
@@ -89,7 +89,7 @@ static WERROR regsubkey_ctr_hash_keyname(struct regsubkey_ctr *ctr,
 {
        WERROR werr;
 
-       werr = ntstatus_to_werror(dbwrap_store_bystring(ctr->subkeys_hash,
+       werr = ntstatus_to_werror(dbwrap_store_bystring_upper(ctr->subkeys_hash,
                                                keyname,
                                                make_tdb_data((uint8 *)&idx,
                                                              sizeof(idx)),
@@ -107,7 +107,7 @@ static WERROR regsubkey_ctr_unhash_keyname(struct regsubkey_ctr *ctr,
 {
        WERROR werr;
 
-       werr = ntstatus_to_werror(dbwrap_delete_bystring(ctr->subkeys_hash,
+       werr = ntstatus_to_werror(dbwrap_delete_bystring_upper(ctr->subkeys_hash,
                                  keyname));
        if (!W_ERROR_IS_OK(werr)) {
                DEBUG(1, ("error unhashing key '%s' in container: %s\n",
@@ -127,7 +127,7 @@ static WERROR regsubkey_ctr_index_for_keyname(struct regsubkey_ctr *ctr,
                return WERR_INVALID_PARAM;
        }
 
-       data = dbwrap_fetch_bystring(ctr->subkeys_hash, ctr, keyname);
+       data = dbwrap_fetch_bystring_upper(ctr->subkeys_hash, ctr, keyname);
        if (data.dptr == NULL) {
                return WERR_NOT_FOUND;
        }