diff options
author | Michael Adam <obnox@samba.org> | 2009-02-26 01:43:58 +0100 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2009-02-26 13:22:55 +0100 |
commit | 61bdfd09edbdea38486bbca3c148d224c7d523fc (patch) | |
tree | 9c9799b0c393bacfe70cc2b71b64aea2a40ed98e /source3/registry | |
parent | 13ceeeedbc188f4c68f1c733f0d2ffe1f5978b42 (diff) | |
download | samba-61bdfd09edbdea38486bbca3c148d224c7d523fc.tar.gz samba-61bdfd09edbdea38486bbca3c148d224c7d523fc.tar.xz samba-61bdfd09edbdea38486bbca3c148d224c7d523fc.zip |
s3:registry: refactor deletion of various subkey lists out of regdb_store_keys()
Micheal
Diffstat (limited to 'source3/registry')
-rw-r--r-- | source3/registry/reg_backend_db.c | 61 |
1 files changed, 31 insertions, 30 deletions
diff --git a/source3/registry/reg_backend_db.c b/source3/registry/reg_backend_db.c index 8d483063c46..852e54f69d6 100644 --- a/source3/registry/reg_backend_db.c +++ b/source3/registry/reg_backend_db.c @@ -565,6 +565,35 @@ static WERROR regdb_delete_subkeylist(const char *keyname) return regdb_delete_key_with_prefix(keyname, NULL); } +static WERROR regdb_delete_key_lists(const char *keyname) +{ + WERROR werr; + + werr = regdb_delete_values(keyname); + if (!W_ERROR_IS_OK(werr)) { + DEBUG(1, (__location__ " Deleting %s/%s failed: %s\n", + REG_VALUE_PREFIX, keyname, win_errstr(werr))); + goto done; + } + + werr = regdb_delete_secdesc(keyname); + if (!W_ERROR_IS_OK(werr)) { + DEBUG(1, (__location__ " Deleting %s/%s failed: %s\n", + REG_SECDESC_PREFIX, keyname, win_errstr(werr))); + goto done; + } + + werr = regdb_delete_subkeylist(keyname); + if (!W_ERROR_IS_OK(werr)) { + DEBUG(1, (__location__ " Deleting %s failed: %s\n", + keyname, win_errstr(werr))); + goto done; + } + +done: + return werr; +} + /*********************************************************************** Add subkey strings to the registry tdb under a defined key fmt is the same format as tdb_pack except this function only supports @@ -779,37 +808,9 @@ bool regdb_store_keys(const char *key, struct regsubkey_ctr *ctr) if (!path) { goto cancel; } - path = normalize_reg_path(ctx, path); - if (!path) { - goto cancel; - } - - /* (a) Delete the value list for this key */ - - werr = regdb_delete_values(path); - if (!W_ERROR_IS_OK(werr)) { - DEBUG(1, (__location__ " Deleting %s/%s failed: %s\n", - REG_VALUE_PREFIX, path, win_errstr(werr))); - goto cancel; - } - /* (b) Delete the secdesc for this key */ - - werr = regdb_delete_secdesc(path); - if (!W_ERROR_IS_OK(werr)) { - DEBUG(1, (__location__ " Deleting %s/%s failed: %s\n", - REG_SECDESC_PREFIX, path, win_errstr(werr))); - goto cancel; - } - - /* (c) Delete the list of subkeys of this key */ - - werr = regdb_delete_subkeylist(path); - if (!W_ERROR_IS_OK(werr)) { - DEBUG(1, (__location__ " Deleting %s failed: %s\n", - path, win_errstr(werr))); - goto cancel; - } + werr = regdb_delete_key_lists(path); + W_ERROR_NOT_OK_GOTO(werr, cancel); TALLOC_FREE(path); } |