Blob Blame History Raw
From 59ffbc2016ae2e164a0da7bacc5449bd9898337c Mon Sep 17 00:00:00 2001
From: Greg Hudson <ghudson@mit.edu>
Date: Mon, 25 Jul 2016 13:23:31 -0400
Subject: [PATCH] Set prompt type for OTP preauth prompt

Add k5_set_prompt_type() calls around the prompter invocation in
preauth_otp.c, and add the comment we conventionally put before
prompter invocations.

ticket: 8464 (new)
(cherry picked from commit 7d497a56279dcb59b6be9f8994257e76788d2e89)
---
 src/lib/krb5/krb/preauth_otp.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/lib/krb5/krb/preauth_otp.c b/src/lib/krb5/krb/preauth_otp.c
index 37f98b2..48fcbb5 100644
--- a/src/lib/krb5/krb/preauth_otp.c
+++ b/src/lib/krb5/krb/preauth_otp.c
@@ -31,6 +31,7 @@
 #include "k5-int.h"
 #include "k5-json.h"
 #include "int-proto.h"
+#include "os-proto.h"
 
 #include <krb5/clpreauth_plugin.h>
 #include <ctype.h>
@@ -475,6 +476,7 @@ doprompt(krb5_context context, krb5_prompter_fct prompter, void *prompter_data,
     krb5_prompt prompt;
     krb5_data prompt_reply;
     krb5_error_code retval;
+    krb5_prompt_type prompt_type = KRB5_PROMPT_TYPE_PREAUTH;
 
     if (prompttxt == NULL || out == NULL)
         return EINVAL;
@@ -486,7 +488,10 @@ doprompt(krb5_context context, krb5_prompter_fct prompter, void *prompter_data,
     prompt.prompt = (char *)prompttxt;
     prompt.hidden = 1;
 
+    /* PROMPTER_INVOCATION */
+    k5_set_prompt_types(context, &prompt_type);
     retval = (*prompter)(context, prompter_data, NULL, banner, 1, &prompt);
+    k5_set_prompt_types(context, NULL);
     if (retval != 0)
         return retval;
 
-- 
2.9.3