mirror of
https://github.com/samba-team/samba.git
synced 2025-01-27 14:04:05 +03:00
Change construct_registry_sd() to return WERROR instead of the SEC_DESC *.
Michael (This used to be commit 91dbe79df2636959381825af6ab8a66abd7f97a1)
This commit is contained in:
parent
e16f039f26
commit
59e7ee6d7d
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user