From: Stefan Metzmacher Date: Tue, 6 Mar 2018 16:14:34 +0000 (+0100) Subject: s3:auth: move add_local_groups() out of finalize_local_nt_token() X-Git-Tag: talloc-2.1.12~163 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=df3d278853ec097df27c221369dfb3ed0297d6c8;p=thirdparty%2Fsamba.git s3:auth: move add_local_groups() out of finalize_local_nt_token() finalize_local_nt_token() will be used in another place, were we don't want to add local groups in a following commit. BUG: https://bugzilla.samba.org/show_bug.cgi?id=13328 Signed-off-by: Stefan Metzmacher Reviewed-by: Ralph Boehme --- diff --git a/source3/auth/token_util.c b/source3/auth/token_util.c index 03c4b646007..e5a12db1ba3 100644 --- a/source3/auth/token_util.c +++ b/source3/auth/token_util.c @@ -208,6 +208,8 @@ static NTSTATUS add_builtin_administrators(struct security_token *token, return NT_STATUS_OK; } +static NTSTATUS add_local_groups(struct security_token *result, + bool is_guest); static NTSTATUS finalize_local_nt_token(struct security_token *result, bool is_guest); @@ -323,6 +325,13 @@ NTSTATUS create_local_nt_token_from_info3(TALLOC_CTX *mem_ctx, } } + status = add_local_groups(usrtok, is_guest); + if (!NT_STATUS_IS_OK(status)) { + DEBUG(3, ("Failed to add local groups\n")); + TALLOC_FREE(usrtok); + return status; + } + status = finalize_local_nt_token(usrtok, is_guest); if (!NT_STATUS_IS_OK(status)) { DEBUG(3, ("Failed to finalize nt token\n")); @@ -392,6 +401,12 @@ struct security_token *create_local_nt_token(TALLOC_CTX *mem_ctx, } } + status = add_local_groups(result, is_guest); + if (!NT_STATUS_IS_OK(status)) { + TALLOC_FREE(result); + return NULL; + } + status = finalize_local_nt_token(result, is_guest); if (!NT_STATUS_IS_OK(status)) { TALLOC_FREE(result); @@ -502,13 +517,6 @@ static NTSTATUS finalize_local_nt_token(struct security_token *result, NTSTATUS status; struct acct_info *info; - /* Add any local groups. */ - - status = add_local_groups(result, is_guest); - if (!NT_STATUS_IS_OK(status)) { - return status; - } - /* Add in BUILTIN sids */ status = add_sid_to_array(result, &global_sid_World,