s3:registry: add create_sorted_subkeys() to delete and recreate the sorted subkeys key
authorMichael Adam <obnox@samba.org>
Wed, 11 May 2011 13:27:01 +0000 (15:27 +0200)
committerVolker Lendecke <vl@samba.org>
Thu, 12 May 2011 09:48:30 +0000 (11:48 +0200)
This is to be used from other places than the key_exists() code path.

source3/registry/reg_backend_db.c

index b99ef916a53600ae7f98692a9416606dde20848e..28439ab914d7cc04907c097e51a9d9f19fc2f1c3 100644 (file)
@@ -48,6 +48,8 @@ static int regdb_fetch_values_internal(struct db_context *db, const char* key,
 static bool regdb_store_values_internal(struct db_context *db, const char *key,
                                        struct regval_ctr *values);
 
+static NTSTATUS create_sorted_subkeys(const char *key);
+
 /* List the deepest path into the registry.  All part components will be created.*/
 
 /* If you want to have a part of the path controlled by the tdb and part by
@@ -1424,6 +1426,25 @@ static NTSTATUS create_sorted_subkeys_internal(const char *key,
        return status;
 }
 
+static NTSTATUS create_sorted_subkeys(const char *key)
+{
+       char *sorted_subkeys_keyname;
+       NTSTATUS status;
+
+       sorted_subkeys_keyname = talloc_asprintf(talloc_tos(), "%s\\%s",
+                                                REG_SORTED_SUBKEYS_PREFIX,
+                                                key);
+       if (sorted_subkeys_keyname == NULL) {
+               status = NT_STATUS_NO_MEMORY;
+               goto done;
+       }
+
+       status = create_sorted_subkeys_internal(key, sorted_subkeys_keyname);
+
+done:
+       return status;
+}
+
 struct scan_subkey_state {
        char *name;
        bool scanned;