From: Michael Adam Date: Thu, 8 May 2008 15:59:32 +0000 (+0200) Subject: registry: change order of deleting value and subkey lists in store_keys(). X-Git-Tag: samba-4.0.0alpha6~801^2~1465 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9f7653bfa1c760be0971a42d688704bf44af92df;p=thirdparty%2Fsamba.git 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) --- diff --git a/source3/registry/reg_backend_db.c b/source3/registry/reg_backend_db.c index b729e58dafa..c0ee8017c14 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); }