Skip to content

Commit

Permalink
pam_sss: add missing optional 2nd factor handling
Browse files Browse the repository at this point in the history
This is a follow up to pull-request #7462 and adds the proper handling of
an optional second factor in case the prompting is configured.

Resolves: #7456

Reviewed-by: Justin Stephenson <[email protected]>
Reviewed-by: Tomáš Halman <[email protected]>
  • Loading branch information
sumit-bose authored and alexey-tikhonov committed Jul 18, 2024
1 parent f0d4546 commit 077d299
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/sss_client/pam_sss.c
Original file line number Diff line number Diff line change
Expand Up @@ -2505,8 +2505,13 @@ static int prompt_by_config(pam_handle_t *pamh, struct pam_items *pi)
ret = prompt_password(pamh, pi, pc_get_password_prompt(pi->pc[c]));
break;
case PC_TYPE_2FA:
ret = prompt_2fa(pamh, pi, false, pc_get_2fa_1st_prompt(pi->pc[c]),
pc_get_2fa_2nd_prompt(pi->pc[c]));
if (pi->password_prompting) {
ret = prompt_2fa(pamh, pi, true, pc_get_2fa_1st_prompt(pi->pc[c]),
pc_get_2fa_2nd_prompt(pi->pc[c]));
} else {
ret = prompt_2fa(pamh, pi, false, pc_get_2fa_1st_prompt(pi->pc[c]),
pc_get_2fa_2nd_prompt(pi->pc[c]));
}
break;
case PC_TYPE_2FA_SINGLE:
ret = prompt_2fa_single(pamh, pi,
Expand Down

0 comments on commit 077d299

Please sign in to comment.