]> granicus.if.org Git - sudo/commitdiff
add pass_warn() which prints out INCORRECT_PASSWORD or an insult to stderr
authorTodd C. Miller <Todd.Miller@courtesan.com>
Sat, 24 Oct 1998 23:28:04 +0000 (23:28 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Sat, 24 Oct 1998 23:28:04 +0000 (23:28 +0000)
check.c
check_sia.c
sudo.h

diff --git a/check.c b/check.c
index c2d3da5d45199a428c3a05824b3df6327b8267b1..63f44a3b2c538926511355cca596fda41fc4831d 100644 (file)
--- a/check.c
+++ b/check.c
@@ -464,11 +464,7 @@ static void check_passwd()
        }
 
        --counter;              /* otherwise, try again  */
-#ifdef USE_INSULTS
-       (void) fprintf(stderr, "%s\n", INSULT);
-#else
-       (void) fprintf(stderr, "%s\n", INCORRECT_PASSWORD);
-#endif /* USE_INSULTS */
+       pass_warn(stderr);
     }
     set_perms(PERM_USER, 0);
 
@@ -620,11 +616,7 @@ static void check_passwd()
 #endif /* HAVE_AUTHENTICATE */
 
        --counter;              /* otherwise, try again  */
-#ifdef USE_INSULTS
-       (void) fprintf(stderr, "%s\n", INSULT);
-#else
-       (void) fprintf(stderr, "%s\n", INCORRECT_PASSWORD);
-#endif /* USE_INSULTS */
+       pass_warn(stderr);
     }
 
     if (counter > 0) {
@@ -724,11 +716,7 @@ static void pam_attempt_auth()
         }
 
         --counter;
-#ifdef USE_INSULTS
-        (void) fprintf(stderr, "%s\n", INSULT);
-#else
-        (void) fprintf(stderr, "%s\n", INCORRECT_PASSWORD);
-#endif /* USE_INSULTS */
+        pass_warn(stderr);
     }
     set_perms(PERM_USER, 0);
 
@@ -924,3 +912,23 @@ static void reminder()
     );
 }
 #endif /* NO_MESSAGE */
+
+
+/********************************************************************
+ *
+ *  pass_warn()
+ *
+ *  warn the user that the password was incorrect
+ *  (and insult them if insults are configured).
+ */
+
+void pass_warn(fp)
+    FILE *fp;
+{
+
+#ifdef USE_INSULTS
+    (void) fprintf(fp, "%s\n", INSULT);
+#else
+    (void) fprintf(fp, "%s\n", INCORRECT_PASSWORD);
+#endif /* USE_INSULTS */
+}
index 2bc8966377e054cc5e877ff315f24c8f7d69e75a..cc08c6f859e20379aa67b99a60b4156f0002c971 100644 (file)
@@ -114,11 +114,7 @@ void sia_attempt_auth()
        }
 
        --counter;
-#ifdef USE_INSULTS
-       (void) fprintf(stderr, "%s\n", INSULT);
-#else
-       (void) fprintf(stderr, "%s\n", INCORRECT_PASSWORD);
-#endif /* USE_INSULTS */
+       pass_warn(stderr);
     }
     set_perms(PERM_USER, 0);
 
diff --git a/sudo.h b/sudo.h
index af16bf7e832c7cfe5d81b2eb994e3ca4c222c8a6..cbde069d192ce228f641c42cff699c6fff5b0684 100644 (file)
--- a/sudo.h
+++ b/sudo.h
@@ -232,6 +232,7 @@ void load_interfaces        __P((void));
 int check_secureware   __P((char *));
 void sia_attempt_auth  __P((void));
 int yyparse            __P((void));
+void pass_warn         __P((FILE *));
 YY_DECL;