From: Volker Lendecke Date: Sat, 2 Nov 2019 13:01:10 +0000 (+0100) Subject: ntlm_auth: Simplify session generation X-Git-Tag: talloc-2.3.1~120 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=995de9c2d2e95a782b81c215efc8d4ab4b3d54b9;p=thirdparty%2Fsamba.git ntlm_auth: Simplify session generation We don't need to parse a text sid, we have those as binary available Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- diff --git a/source3/utils/ntlm_auth.c b/source3/utils/ntlm_auth.c index 85862e389e8..c9d2e44adb4 100644 --- a/source3/utils/ntlm_auth.c +++ b/source3/utils/ntlm_auth.c @@ -731,7 +731,6 @@ static NTSTATUS ntlm_auth_generate_session_info(struct auth4_context *auth_conte struct auth_session_info **session_info_out) { const char *unix_username = (const char *)server_returned_info; - bool ok; struct dom_sid *sids = NULL; struct auth_session_info *session_info = NULL; @@ -764,21 +763,9 @@ static NTSTATUS ntlm_auth_generate_session_info(struct auth4_context *auth_conte TALLOC_FREE(session_info); return NT_STATUS_NO_MEMORY; } - ok = dom_sid_parse(SID_WORLD, &sids[0]); - if (!ok) { - TALLOC_FREE(session_info); - return NT_STATUS_INTERNAL_ERROR; - } - ok = dom_sid_parse(SID_NT_NETWORK, &sids[1]); - if (!ok) { - TALLOC_FREE(session_info); - return NT_STATUS_INTERNAL_ERROR; - } - ok = dom_sid_parse(SID_NT_AUTHENTICATED_USERS, &sids[2]); - if (!ok) { - TALLOC_FREE(session_info); - return NT_STATUS_INTERNAL_ERROR; - } + sid_copy(&sids[0], &global_sid_World); + sid_copy(&sids[1], &global_sid_Network); + sid_copy(&sids[2], &global_sid_Authenticated_Users); session_info->security_token->num_sids = talloc_array_length(sids); session_info->security_token->sids = sids;