add pass_warn() which prints out INCORRECT_PASSWORD or an insult to stderr

This commit is contained in:
Todd C. Miller
1998-10-24 23:28:04 +00:00
parent 5bdc7d3080
commit 261cdb5d87
3 changed files with 25 additions and 20 deletions

38
check.c
View File

@@ -464,11 +464,7 @@ static void check_passwd()
} }
--counter; /* otherwise, try again */ --counter; /* otherwise, try again */
#ifdef USE_INSULTS pass_warn(stderr);
(void) fprintf(stderr, "%s\n", INSULT);
#else
(void) fprintf(stderr, "%s\n", INCORRECT_PASSWORD);
#endif /* USE_INSULTS */
} }
set_perms(PERM_USER, 0); set_perms(PERM_USER, 0);
@@ -620,11 +616,7 @@ static void check_passwd()
#endif /* HAVE_AUTHENTICATE */ #endif /* HAVE_AUTHENTICATE */
--counter; /* otherwise, try again */ --counter; /* otherwise, try again */
#ifdef USE_INSULTS pass_warn(stderr);
(void) fprintf(stderr, "%s\n", INSULT);
#else
(void) fprintf(stderr, "%s\n", INCORRECT_PASSWORD);
#endif /* USE_INSULTS */
} }
if (counter > 0) { if (counter > 0) {
@@ -724,11 +716,7 @@ static void pam_attempt_auth()
} }
--counter; --counter;
#ifdef USE_INSULTS pass_warn(stderr);
(void) fprintf(stderr, "%s\n", INSULT);
#else
(void) fprintf(stderr, "%s\n", INCORRECT_PASSWORD);
#endif /* USE_INSULTS */
} }
set_perms(PERM_USER, 0); set_perms(PERM_USER, 0);
@@ -924,3 +912,23 @@ static void reminder()
); );
} }
#endif /* NO_MESSAGE */ #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 */
}

View File

@@ -114,11 +114,7 @@ void sia_attempt_auth()
} }
--counter; --counter;
#ifdef USE_INSULTS pass_warn(stderr);
(void) fprintf(stderr, "%s\n", INSULT);
#else
(void) fprintf(stderr, "%s\n", INCORRECT_PASSWORD);
#endif /* USE_INSULTS */
} }
set_perms(PERM_USER, 0); set_perms(PERM_USER, 0);

1
sudo.h
View File

@@ -232,6 +232,7 @@ void load_interfaces __P((void));
int check_secureware __P((char *)); int check_secureware __P((char *));
void sia_attempt_auth __P((void)); void sia_attempt_auth __P((void));
int yyparse __P((void)); int yyparse __P((void));
void pass_warn __P((FILE *));
YY_DECL; YY_DECL;