From 9f7653bfa1c760be0971a42d688704bf44af92df Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 8 May 2008 17:59:32 +0200 Subject: 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) --- source3/registry/reg_backend_db.c | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) (limited to 'source3/registry/reg_backend_db.c') 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); } -- cgit