summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2008-03-17 01:00:40 +0100
committerMichael Adam <obnox@samba.org>2008-03-17 08:22:33 +0100
commit78adf71669ab450c6198b7342c13909c54056312 (patch)
treea4e24d601e5f24cf2411c14007630009303e470d /source3
parente64825e6208e1b31ccc19a28561858db28694bae (diff)
downloadsamba-78adf71669ab450c6198b7342c13909c54056312.tar.gz
samba-78adf71669ab450c6198b7342c13909c54056312.tar.bz2
samba-78adf71669ab450c6198b7342c13909c54056312.zip
registry: separate cancel and failur exit paths in regdb_store_keys().
Michael (This used to be commit e1d4a2fa5b5b0f21d1ea4a9dffc326878c9f54b7)
Diffstat (limited to 'source3')
-rw-r--r--source3/registry/reg_backend_db.c39
1 files changed, 20 insertions, 19 deletions
diff --git a/source3/registry/reg_backend_db.c b/source3/registry/reg_backend_db.c
index 787ca76f89..8bfa3526ea 100644
--- a/source3/registry/reg_backend_db.c
+++ b/source3/registry/reg_backend_db.c
@@ -497,7 +497,7 @@ bool regdb_store_keys(const char *key, REGSUBKEY_CTR *ctr)
if (regdb->transaction_start(regdb) == -1) {
DEBUG(0, ("regdb_store_keys: transaction_start failed\n"));
- return false;
+ goto fail;
}
/*
@@ -506,7 +506,7 @@ bool regdb_store_keys(const char *key, REGSUBKEY_CTR *ctr)
if (!(old_subkeys = TALLOC_ZERO_P(ctr, REGSUBKEY_CTR))) {
DEBUG(0,("regdb_store_keys: talloc() failure!\n"));
- goto fail;
+ goto cancel;
}
regdb_fetch_keys(key, old_subkeys);
@@ -516,7 +516,7 @@ bool regdb_store_keys(const char *key, REGSUBKEY_CTR *ctr)
if (!regdb_store_keys_internal(key, ctr) ) {
DEBUG(0,("regdb_store_keys: Failed to store new subkey list "
"for parent [%s]\n", key));
- goto fail;
+ goto cancel;
}
/* now delete removed keys */
@@ -535,16 +535,16 @@ bool regdb_store_keys(const char *key, REGSUBKEY_CTR *ctr)
path = talloc_asprintf(ctx, "%s/%s", key, oldkeyname);
if (!path) {
- goto fail;
+ goto cancel;
}
path = normalize_reg_path(ctx, path);
if (!path) {
- goto fail;
+ goto cancel;
}
status = dbwrap_delete_bystring(regdb, path);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(1, ("Deleting %s failed\n", path));
- goto fail;
+ goto cancel;
}
TALLOC_FREE(path);
@@ -553,11 +553,11 @@ bool regdb_store_keys(const char *key, REGSUBKEY_CTR *ctr)
key,
oldkeyname );
if (!path) {
- goto fail;
+ goto cancel;
}
path = normalize_reg_path(ctx, path);
if (!path) {
- goto fail;
+ goto cancel;
}
/*
@@ -576,13 +576,13 @@ bool regdb_store_keys(const char *key, REGSUBKEY_CTR *ctr)
if (num_subkeys == 0) {
if (!(subkeys = TALLOC_ZERO_P(ctr, REGSUBKEY_CTR)) ) {
DEBUG(0,("regdb_store_keys: talloc() failure!\n"));
- goto fail;
+ goto cancel;
}
if (!regdb_store_keys_internal(key, subkeys)) {
DEBUG(0,("regdb_store_keys: Failed to store "
"new record for key [%s]\n", key));
- goto fail;
+ goto cancel;
}
TALLOC_FREE(subkeys);
@@ -593,11 +593,11 @@ bool regdb_store_keys(const char *key, REGSUBKEY_CTR *ctr)
key,
regsubkey_ctr_specific_key(ctr, i));
if (!path) {
- goto fail;
+ goto cancel;
}
if (!(subkeys = TALLOC_ZERO_P(ctr, REGSUBKEY_CTR)) ) {
DEBUG(0,("regdb_store_keys: talloc() failure!\n"));
- goto fail;
+ goto cancel;
}
if (regdb_fetch_keys( path, subkeys ) == -1) {
@@ -605,7 +605,7 @@ bool regdb_store_keys(const char *key, REGSUBKEY_CTR *ctr)
if (!regdb_store_keys_internal(path, subkeys)) {
DEBUG(0,("regdb_store_keys: Failed to store "
"new record for key [%s]\n", path));
- goto fail;
+ goto cancel;
}
}
@@ -615,20 +615,21 @@ bool regdb_store_keys(const char *key, REGSUBKEY_CTR *ctr)
if (regdb->transaction_commit(regdb) == -1) {
DEBUG(0, ("regdb_store_keys: Could not commit transaction\n"));
- return false;
+ goto fail;
}
return true;
- fail:
- TALLOC_FREE(old_subkeys);
- TALLOC_FREE(subkeys);
- TALLOC_FREE(ctx);
-
+cancel:
if (regdb->transaction_cancel(regdb) == -1) {
smb_panic("regdb_store_keys: transaction_cancel failed\n");
}
+fail:
+ TALLOC_FREE(old_subkeys);
+ TALLOC_FREE(subkeys);
+ TALLOC_FREE(ctx);
+
return false;
}