]> granicus.if.org Git - sudo/commitdiff
LONG_SKEY_PROMPT is less of a klusge
authorTodd C. Miller <Todd.Miller@courtesan.com>
Tue, 28 Nov 1995 04:17:27 +0000 (04:17 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Tue, 28 Nov 1995 04:17:27 +0000 (04:17 +0000)
/

check.c

diff --git a/check.c b/check.c
index fa9aae0693aebe1fb6ed5900f506264647ab9c50..b89d9caad0f2167d7986ab63d4616314d7d5c215 100644 (file)
--- a/check.c
+++ b/check.c
@@ -650,9 +650,11 @@ static char *sudo_skeyprompt(user_skey, p)
     char *p;
 {
     char skeyprompt[80];
+#ifndef LONG_SKEY_PROMPT
     static char *old_prompt = NULL;
     static int plen;
     char *new_prompt;
+#endif /* LONG_SKEY_PROMPT */
 
     /* return the old prompt if we cannot get s/key info */
     if (skeychallenge(user_skey, user_name, skeyprompt)) {
@@ -666,6 +668,18 @@ static char *sudo_skeyprompt(user_skey, p)
 #  endif /* SKEY_ONLY */
     }
 
+#ifdef LONG_SKEY_PROMPT
+    /* separate s/key challenge and prompt for easy snarfing */
+    if (skeyprompt[0] == 's' && skeyprompt[1] == '/')
+       (void) puts(&skeyprompt[2]);
+    else
+       (void) puts(skeyprompt);
+
+    /* return old prompt unmodified */
+    return(p);
+
+#else
+
     /* keep a pointer to the original prompt around for future reference */
     if (old_prompt == NULL) {
        old_prompt = p;
@@ -684,19 +698,12 @@ static char *sudo_skeyprompt(user_skey, p)
        exit(1);
     }
 
-#ifdef LONG_SKEY_PROMPT
-    /* separate s/key challenge and prompt for easy snarfing */
-    if (skeyprompt[0] == 's' && skeyprompt[1] == '/')
-       (void) sprintf(new_prompt, "%s\n%s", &skeyprompt[2], old_prompt);
-    else
-       (void) sprintf(new_prompt, "%s\n%s", skeyprompt, old_prompt);
-#else
     /* embed the s/key challenge into the new password prompt */
     (void) strncpy(new_prompt, old_prompt, plen);
     (void) sprintf(new_prompt + plen, " [%s]:", skeyprompt);
-#endif /* LONG_SKEY_PROMPT */
 
     return(new_prompt);
+#endif /* LONG_SKEY_PROMPT */
 }
 #endif /* HAVE_SKEY */