summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Adam <obnox@samba.org>2008-02-18 14:55:48 +0100
committerMichael Adam <obnox@samba.org>2008-02-18 17:41:20 +0100
commit59e7ee6d7db618432ab22e023ddc1cf03bb34da8 (patch)
tree38c3ef5787f203911a263086b5e8cb28ff58165d
parente16f039f26c88b8c602dc0d5e8a836688f7464d2 (diff)
downloadsamba-59e7ee6d7db618432ab22e023ddc1cf03bb34da8.tar.gz
samba-59e7ee6d7db618432ab22e023ddc1cf03bb34da8.tar.bz2
samba-59e7ee6d7db618432ab22e023ddc1cf03bb34da8.zip
Change construct_registry_sd() to return WERROR instead of the SEC_DESC *.
Michael (This used to be commit 91dbe79df2636959381825af6ab8a66abd7f97a1)
-rw-r--r--source3/registry/reg_dispatcher.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/source3/registry/reg_dispatcher.c b/source3/registry/reg_dispatcher.c
index f3fe5de98c..778a844883 100644
--- a/source3/registry/reg_dispatcher.c
+++ b/source3/registry/reg_dispatcher.c
@@ -34,7 +34,7 @@ static const struct generic_mapping reg_generic_map =
/********************************************************************
********************************************************************/
-static SEC_DESC* construct_registry_sd(TALLOC_CTX *ctx)
+static WERROR construct_registry_sd(TALLOC_CTX *ctx, SEC_DESC **psd)
{
SEC_ACE ace[3];
SEC_ACCESS mask;
@@ -65,17 +65,18 @@ static SEC_DESC* construct_registry_sd(TALLOC_CTX *ctx)
acl = make_sec_acl(ctx, NT4_ACL_REVISION, i, ace);
if (acl == NULL) {
- return NULL;
+ return WERR_NOMEM;
}
sd = make_sec_desc(ctx, SEC_DESC_REVISION, SEC_DESC_SELF_RELATIVE,
&global_sid_Builtin_Administrators, NULL, NULL, acl,
&sd_size);
if (sd == NULL) {
- return NULL;
+ return WERR_NOMEM;
}
- return sd;
+ *psd = sd;
+ return WERR_OK;
}
/***********************************************************************
@@ -185,19 +186,19 @@ WERROR regkey_get_secdesc(TALLOC_CTX *mem_ctx, REGISTRY_KEY *key,
struct security_descriptor **psecdesc)
{
struct security_descriptor *secdesc;
+ WERROR werr;
if (key->hook && key->hook->ops && key->hook->ops->get_secdesc) {
- WERROR err;
-
- err = key->hook->ops->get_secdesc(mem_ctx, key->name,
- psecdesc);
- if (W_ERROR_IS_OK(err)) {
+ werr = key->hook->ops->get_secdesc(mem_ctx, key->name,
+ psecdesc);
+ if (W_ERROR_IS_OK(werr)) {
return WERR_OK;
}
}
- if (!(secdesc = construct_registry_sd(mem_ctx))) {
- return WERR_NOMEM;
+ werr = construct_registry_sd(mem_ctx, &secdesc);
+ if (!W_ERROR_IS_OK(werr)) {
+ return werr;
}
*psecdesc = secdesc;