diff options
Diffstat (limited to 'src/plugins/preauth')
| -rw-r--r-- | src/plugins/preauth/pkinit/pkinit_crypto_openssl.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/plugins/preauth/pkinit/pkinit_crypto_openssl.c b/src/plugins/preauth/pkinit/pkinit_crypto_openssl.c index 2ab23b03a..2c1ec38a7 100644 --- a/src/plugins/preauth/pkinit/pkinit_crypto_openssl.c +++ b/src/plugins/preauth/pkinit/pkinit_crypto_openssl.c @@ -3200,6 +3200,7 @@ pkinit_login(krb5_context context, { krb5_data rdat; char *prompt; + const char *warning; krb5_prompt kprompt; krb5_prompt_type prompt_type; int r = 0; @@ -3208,15 +3209,17 @@ pkinit_login(krb5_context context, rdat.data = NULL; rdat.length = 0; } else { - if ((prompt = (char *) malloc(sizeof (tip->label) + 32)) == NULL) - return ENOMEM; - sprintf(prompt, "%.*s PIN", sizeof (tip->label), tip->label); if (tip->flags & CKF_USER_PIN_LOCKED) - strcat(prompt, " (Warning: PIN locked)"); + warning = " (Warning: PIN locked)"; else if (tip->flags & CKF_USER_PIN_FINAL_TRY) - strcat(prompt, " (Warning: PIN final try)"); + warning = " (Warning: PIN final try)"; else if (tip->flags & CKF_USER_PIN_COUNT_LOW) - strcat(prompt, " (Warning: PIN count low)"); + warning = " (Warning: PIN count low)"; + else + warning = ""; + if (asprintf(&prompt, "%.*s PIN%s", (int) sizeof (tip->label), + tip->label, warning) < 0) + return ENOMEM; rdat.data = (char *)malloc(tip->ulMaxPinLen + 2); rdat.length = tip->ulMaxPinLen + 1; |
