diff options
author | Michael Adam <obnox@samba.org> | 2010-09-20 02:43:33 +0200 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2010-09-21 06:53:30 +0200 |
commit | 7cefb898729bc46e1ba9fd1c8b48e7aef0486339 (patch) | |
tree | 282a5d49131532791fae5c23cf3beccc356e028e /source3 | |
parent | f53c17b4ff27c39fbeccce4d369f4bb8f1b13ce7 (diff) | |
download | samba-7cefb898729bc46e1ba9fd1c8b48e7aef0486339.tar.gz |
s3:services_db: rewrite svcctl_set_secdesc() using reg_api calls instead of legacy
Diffstat (limited to 'source3')
-rw-r--r-- | source3/services/services_db.c | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/source3/services/services_db.c b/source3/services/services_db.c index c819862b550..f32b305505c 100644 --- a/source3/services/services_db.c +++ b/source3/services/services_db.c @@ -26,6 +26,7 @@ #include "registry/reg_util_legacy.h" #include "registry/reg_dispatcher.h" #include "registry/reg_objects.h" +#include "registry/reg_api_util.h" struct rcinit_file_information { char *description; @@ -575,11 +576,10 @@ done: bool svcctl_set_secdesc( TALLOC_CTX *ctx, const char *name, struct security_descriptor *sec_desc, struct security_token *token ) { - struct registry_key_handle *key = NULL; + struct registry_key *key = NULL; WERROR wresult; char *path = NULL; - struct regval_ctr *values = NULL; - DATA_BLOB blob; + struct registry_value value; NTSTATUS status; bool ret = False; @@ -588,8 +588,9 @@ bool svcctl_set_secdesc( TALLOC_CTX *ctx, const char *name, struct security_desc if (asprintf(&path, "%s\\%s\\%s", KEY_SERVICES, name, "Security") < 0) { return false; } - wresult = regkey_open_internal( NULL, &key, path, token, - REG_KEY_ALL ); + + wresult = reg_open_path(NULL, path, REG_KEY_ALL, token, &key); + if ( !W_ERROR_IS_OK(wresult) ) { DEBUG(0,("svcctl_get_secdesc: key lookup failed! [%s] (%s)\n", path, win_errstr(wresult))); @@ -598,24 +599,24 @@ bool svcctl_set_secdesc( TALLOC_CTX *ctx, const char *name, struct security_desc } SAFE_FREE(path); - wresult = regval_ctr_init(key, &values); - if (!W_ERROR_IS_OK(wresult)) { - DEBUG(0,("svcctl_set_secdesc: talloc() failed!\n")); - TALLOC_FREE( key ); - return False; - } - /* stream the printer security descriptor */ - status = marshall_sec_desc(ctx, sec_desc, &blob.data, &blob.length); + status = marshall_sec_desc(ctx, sec_desc, &value.data.data, &value.data.length); if (!NT_STATUS_IS_OK(status)) { DEBUG(0,("svcctl_set_secdesc: ndr_push_struct_blob() failed!\n")); TALLOC_FREE( key ); return False; } - regval_ctr_addvalue( values, "Security", REG_BINARY, blob.data, blob.length); - ret = store_reg_values( key, values ); + value.type = REG_BINARY; + + wresult = reg_setvalue(key, "Security", &value); + if (!W_ERROR_IS_OK(wresult)) { + DEBUG(0, ("svcctl_set_secdesc: reg_setvalue failed: %s\n", + win_errstr(wresult))); + talloc_free(key); + return false; + } /* cleanup */ |