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) struct auth_session_info **session_info)
{ {
uint32_t session_info_flags = 0; uint32_t session_info_flags = 0;
struct auth4_context *auth_context = NULL;
NTSTATUS status;
if (gensec_security->want_features & GENSEC_FEATURE_UNIX_TOKEN) { if (gensec_security->want_features & GENSEC_FEATURE_UNIX_TOKEN) {
session_info_flags |= AUTH_SESSION_INFO_UNIX_TOKEN; session_info_flags |= AUTH_SESSION_INFO_UNIX_TOKEN;
@ -55,19 +57,25 @@ NTSTATUS gensec_generate_session_info_pac(TALLOC_CTX *mem_ctx,
"user lookup\n", principal_string); "user lookup\n", principal_string);
} }
if (gensec_security->auth_context && gensec_security->auth_context->generate_session_info_pac) { auth_context = gensec_security->auth_context;
return gensec_security->auth_context->generate_session_info_pac(gensec_security->auth_context,
mem_ctx, if ((auth_context == NULL) ||
smb_krb5_context, (auth_context->generate_session_info_pac == NULL)) {
pac_blob, DBG_ERR("Cannot generate a session_info without "
principal_string, "the auth_context\n");
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 NT_STATUS_INTERNAL_ERROR;
} }
status = auth_context->generate_session_info_pac(
auth_context,
mem_ctx,
smb_krb5_context,
pac_blob,
principal_string,
remote_address,
session_info_flags,
session_info);
return status;
} }
/* /*