summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2008-03-01 00:32:36 +0100
committerKarolin Seeger <ks@sernet.de>2008-03-04 09:33:40 +0100
commit143e709c8c0e689b5ad288f4d7eeb8ac9429a199 (patch)
tree80863574c456207e9670d67fc0d5d8c19df87b46
parent9ad8af0d067ae7598b693b21efa0b2d243ecda03 (diff)
downloadsamba-143e709c8c0e689b5ad288f4d7eeb8ac9429a199.tar.gz
samba-143e709c8c0e689b5ad288f4d7eeb8ac9429a199.tar.bz2
samba-143e709c8c0e689b5ad288f4d7eeb8ac9429a199.zip
Fix init_registry_data for subkeyless top-level keys.
On a fresh install with no existing registry.tdb, make sure we are able to create our initial top-level entries. Michael, Volker, please check. Guenther (cherry picked from commit 956bc602062825493e1c357e2388fee1e5514b50) (This used to be commit bf03cba57d3cfe07b8d848aa3b5a165bb198b7aa)
-rw-r--r--source3/registry/reg_backend_db.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/source3/registry/reg_backend_db.c b/source3/registry/reg_backend_db.c
index 52e0fd4289..518078a062 100644
--- a/source3/registry/reg_backend_db.c
+++ b/source3/registry/reg_backend_db.c
@@ -454,7 +454,8 @@ bool regdb_store_keys(const char *key, REGSUBKEY_CTR *ctr)
regdb_fetch_keys(key, old_subkeys);
- if (ctr->num_subkeys == old_subkeys->num_subkeys) {
+ if ((ctr->num_subkeys && old_subkeys->num_subkeys) &&
+ (ctr->num_subkeys == old_subkeys->num_subkeys)) {
for (i = 0; i<ctr->num_subkeys; i++) {
if (strcmp(ctr->subkeys[i],
@@ -550,6 +551,22 @@ bool regdb_store_keys(const char *key, REGSUBKEY_CTR *ctr)
/* now create records for any subkeys that don't already exist */
num_subkeys = regsubkey_ctr_numkeys(ctr);
+
+ if (num_subkeys == 0) {
+ if (!(subkeys = TALLOC_ZERO_P(ctr, REGSUBKEY_CTR)) ) {
+ DEBUG(0,("regdb_store_keys: talloc() failure!\n"));
+ goto fail;
+ }
+
+ if (!regdb_store_keys_internal(key, subkeys)) {
+ DEBUG(0,("regdb_store_keys: Failed to store "
+ "new record for key [%s]\n", key));
+ goto fail;
+ }
+ TALLOC_FREE(subkeys);
+
+ }
+
for (i=0; i<num_subkeys; i++) {
path = talloc_asprintf(ctx, "%s/%s",
key,