diff options
author | Michael Adam <obnox@samba.org> | 2008-02-18 16:33:47 +0100 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2008-02-18 17:41:21 +0100 |
commit | 7ba906634bc89a0a9180687402ecb52ccb5f13c4 (patch) | |
tree | 96400d93efe2e4318b1334ae263f1ae90de3d362 /source3/registry | |
parent | f3694d50a37c60897849a49946128228a259207e (diff) | |
download | samba-7ba906634bc89a0a9180687402ecb52ccb5f13c4.tar.gz samba-7ba906634bc89a0a9180687402ecb52ccb5f13c4.tar.bz2 samba-7ba906634bc89a0a9180687402ecb52ccb5f13c4.zip |
Grab secdesc for key from registry for reg_savekey()
instead of construction another default secdesc.
Michael
(This used to be commit 194e00822c349aa0c11641672b35b0e0c021da08)
Diffstat (limited to 'source3/registry')
-rw-r--r-- | source3/registry/reg_api.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/source3/registry/reg_api.c b/source3/registry/reg_api.c index aba5735a0c..25cf101aaf 100644 --- a/source3/registry/reg_api.c +++ b/source3/registry/reg_api.c @@ -835,7 +835,7 @@ WERROR reg_restorekey(struct registry_key *key, const char *fname) ********************************************************************/ static WERROR reg_write_tree(REGF_FILE *regfile, const char *keypath, - REGF_NK_REC *parent, SEC_DESC *sec_desc) + REGF_NK_REC *parent) { REGF_NK_REC *key; REGVAL_CTR *values; @@ -847,6 +847,7 @@ static WERROR reg_write_tree(REGF_FILE *regfile, const char *keypath, char *subkeyname; REGISTRY_KEY registry_key; WERROR result = WERR_OK; + SEC_DESC *sec_desc = NULL; if (!regfile) { return WERR_GENERAL_FAILURE; @@ -899,6 +900,11 @@ static WERROR reg_write_tree(REGF_FILE *regfile, const char *keypath, fetch_reg_keys(®istry_key, subkeys); fetch_reg_values(®istry_key, values); + result = regkey_get_secdesc(regfile->mem_ctx, ®istry_key, &sec_desc); + if (!W_ERROR_IS_OK(result)) { + goto done; + } + /* write out this key */ key = regfio_write_key(regfile, keyname, values, subkeys, sec_desc, @@ -919,7 +925,7 @@ static WERROR reg_write_tree(REGF_FILE *regfile, const char *keypath, result = WERR_NOMEM; goto done; } - result = reg_write_tree(regfile, subkeypath, key, sec_desc); + result = reg_write_tree(regfile, subkeypath, key); if (!W_ERROR_IS_OK(result)) goto done; } @@ -985,7 +991,6 @@ static WERROR backup_registry_key(REGISTRY_KEY *krecord, const char *fname) { REGF_FILE *regfile; WERROR result; - SEC_DESC *sd = NULL; /* open the registry file....fail if the file already exists */ @@ -997,15 +1002,9 @@ static WERROR backup_registry_key(REGISTRY_KEY *krecord, const char *fname) return ntstatus_to_werror(map_nt_error_from_unix(errno)); } - result = make_default_reg_sd(regfile->mem_ctx, &sd); - if (!W_ERROR_IS_OK(result)) { - regfio_close(regfile); - return result; - } - /* write the registry tree to the file */ - result = reg_write_tree(regfile, krecord->name, NULL, sd); + result = reg_write_tree(regfile, krecord->name, NULL); /* cleanup */ |