1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00

gensec: Slightly simplify gensec_generate_session_info_pac()

Reduce indentation by an early error return and by introducing a
helper variable.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
This commit is contained in:
Volker Lendecke 2021-04-21 11:30:20 +02:00 committed by Andreas Schneider
parent 349bd015d2
commit ad7628b2cb

View File

@ -38,6 +38,8 @@ NTSTATUS gensec_generate_session_info_pac(TALLOC_CTX *mem_ctx,
struct auth_session_info **session_info)
{
uint32_t session_info_flags = 0;
struct auth4_context *auth_context = NULL;
NTSTATUS status;
if (gensec_security->want_features & GENSEC_FEATURE_UNIX_TOKEN) {
session_info_flags |= AUTH_SESSION_INFO_UNIX_TOKEN;
@ -55,8 +57,17 @@ NTSTATUS gensec_generate_session_info_pac(TALLOC_CTX *mem_ctx,
"user lookup\n", principal_string);
}
if (gensec_security->auth_context && gensec_security->auth_context->generate_session_info_pac) {
return gensec_security->auth_context->generate_session_info_pac(gensec_security->auth_context,
auth_context = gensec_security->auth_context;
if ((auth_context == NULL) ||
(auth_context->generate_session_info_pac == NULL)) {
DBG_ERR("Cannot generate a session_info without "
"the auth_context\n");
return NT_STATUS_INTERNAL_ERROR;
}
status = auth_context->generate_session_info_pac(
auth_context,
mem_ctx,
smb_krb5_context,
pac_blob,
@ -64,10 +75,7 @@ NTSTATUS gensec_generate_session_info_pac(TALLOC_CTX *mem_ctx,
remote_address,
session_info_flags,
session_info);
} else {
DEBUG(0, ("Cannot generate a session_info without the auth_context\n"));
return NT_STATUS_INTERNAL_ERROR;
}
return status;
}
/*