diff options
Diffstat (limited to 'source3/registry')
-rw-r--r-- | source3/registry/reg_api.c | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/source3/registry/reg_api.c b/source3/registry/reg_api.c index 405a10591c..7ae84ed5f0 100644 --- a/source3/registry/reg_api.c +++ b/source3/registry/reg_api.c @@ -726,14 +726,37 @@ WERROR reg_deletekey(struct registry_key *parent, const char *path) err = reg_openkey(mem_ctx, parent, path, REG_KEY_READ, &key); W_ERROR_NOT_OK_GOTO_DONE(err); + err = regdb_transaction_start(); + if (!W_ERROR_IS_OK(err)) { + DEBUG(0, ("reg_deletekey: Error starting transaction: %s\n", + win_errstr(err))); + goto done; + } + err = fill_subkey_cache(key); - W_ERROR_NOT_OK_GOTO_DONE(err); + if (!W_ERROR_IS_OK(err)) { + goto trans_done; + } if (regsubkey_ctr_numkeys(key->subkeys) > 0) { err = WERR_ACCESS_DENIED; - goto done; + goto trans_done; } err = reg_deletekey_internal(mem_ctx, parent, path, false); + +trans_done: + if (W_ERROR_IS_OK(err)) { + err = regdb_transaction_commit(); + if (!W_ERROR_IS_OK(err)) { + DEBUG(0, ("reg_deletekey: Error committing transaction: %s\n", win_errstr(err))); + } + } else { + WERROR err1 = regdb_transaction_cancel(); + if (!W_ERROR_IS_OK(err1)) { + DEBUG(0, ("reg_deletekey: Error cancelling transaction: %s\n", win_errstr(err1))); + } + } + done: TALLOC_FREE(mem_ctx); return err; |