summaryrefslogtreecommitdiff
path: root/source3/registry/reg_backend_db.c
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2008-05-08 17:59:32 +0200
committerMichael Adam <obnox@samba.org>2008-05-08 18:29:10 +0200
commit9f7653bfa1c760be0971a42d688704bf44af92df (patch)
tree0b9278b8f88568caea979152f95dcfebb4256fac /source3/registry/reg_backend_db.c
parent453141b39549ebce7ed16421ba246491ea5b17be (diff)
downloadsamba-9f7653bfa1c760be0971a42d688704bf44af92df.tar.gz
samba-9f7653bfa1c760be0971a42d688704bf44af92df.tar.bz2
samba-9f7653bfa1c760be0971a42d688704bf44af92df.zip
registry: change order of deleting value and subkey lists in store_keys().
Next step in the plan to make store_keys safer without transactions. Michael (This used to be commit f7c8718dead63964481954a86427b8c05d15452c)
Diffstat (limited to 'source3/registry/reg_backend_db.c')
-rw-r--r--source3/registry/reg_backend_db.c29
1 files changed, 13 insertions, 16 deletions
diff --git a/source3/registry/reg_backend_db.c b/source3/registry/reg_backend_db.c
index b729e58daf..c0ee8017c1 100644
--- a/source3/registry/reg_backend_db.c
+++ b/source3/registry/reg_backend_db.c
@@ -671,7 +671,10 @@ bool regdb_store_keys(const char *key, REGSUBKEY_CTR *ctr)
continue;
}
- path = talloc_asprintf(ctx, "%s/%s", key, oldkeyname);
+ path = talloc_asprintf(ctx, "%s/%s/%s",
+ REG_VALUE_PREFIX,
+ key,
+ oldkeyname );
if (!path) {
goto cancel;
}
@@ -679,17 +682,11 @@ bool regdb_store_keys(const char *key, REGSUBKEY_CTR *ctr)
if (!path) {
goto cancel;
}
- status = dbwrap_delete_bystring(regdb, path);
- if (!NT_STATUS_IS_OK(status)) {
- DEBUG(1, ("Deleting %s failed\n", path));
- goto cancel;
- }
-
+ /* Ignore errors here, we might have no values around */
+ dbwrap_delete_bystring(regdb, path);
TALLOC_FREE(path);
- path = talloc_asprintf(ctx, "%s/%s/%s",
- REG_VALUE_PREFIX,
- key,
- oldkeyname );
+
+ path = talloc_asprintf(ctx, "%s/%s", key, oldkeyname);
if (!path) {
goto cancel;
}
@@ -697,11 +694,11 @@ bool regdb_store_keys(const char *key, REGSUBKEY_CTR *ctr)
if (!path) {
goto cancel;
}
-
- /*
- * Ignore errors here, we might have no values around
- */
- dbwrap_delete_bystring(regdb, path);
+ status = dbwrap_delete_bystring(regdb, path);
+ if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(1, ("Deleting %s failed\n", path));
+ goto cancel;
+ }
TALLOC_FREE(path);
}