diff options
author | Sam Hartman <hartmans@debian.org> | 2023-09-11 14:10:02 -0600 |
---|---|---|
committer | Sam Hartman <hartmans@debian.org> | 2023-09-11 14:10:02 -0600 |
commit | 42408448b00a7a2150b5853dc4f63296b6827e0e (patch) | |
tree | f2d801e728b41563b77ebe89a3d560319ff37d31 /modules/pam_pwhistory/pwhistory_helper.c | |
parent | b99a4f53dcf4725e4b3b861fd8a28c0156a8a147 (diff) | |
parent | e9aa2ef52a423a3a33299bf7e8715eb5bd76ea67 (diff) | |
download | pam-42408448b00a7a2150b5853dc4f63296b6827e0e.tar.gz pam-42408448b00a7a2150b5853dc4f63296b6827e0e.tar.bz2 pam-42408448b00a7a2150b5853dc4f63296b6827e0e.zip |
Update upstream source from tag 'upstream/1.5.3'
Update to upstream version '1.5.3'
with Debian dir 6b9d9dfb8a4ca02d4557097ee59960e72a6a4a29
Diffstat (limited to 'modules/pam_pwhistory/pwhistory_helper.c')
-rw-r--r-- | modules/pam_pwhistory/pwhistory_helper.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/modules/pam_pwhistory/pwhistory_helper.c b/modules/pam_pwhistory/pwhistory_helper.c index b08a14a7..469d95fa 100644 --- a/modules/pam_pwhistory/pwhistory_helper.c +++ b/modules/pam_pwhistory/pwhistory_helper.c @@ -51,7 +51,7 @@ static int -check_history(const char *user, const char *debug) +check_history(const char *user, const char *filename, const char *debug) { char pass[PAM_MAX_RESP_SIZE + 1]; char *passwords[] = { pass }; @@ -68,21 +68,21 @@ check_history(const char *user, const char *debug) return PAM_AUTHTOK_ERR; } - retval = check_old_pass(user, pass, dbg); + retval = check_old_pass(user, pass, filename, dbg); - memset(pass, '\0', PAM_MAX_RESP_SIZE); /* clear memory of the password */ + pam_overwrite_array(pass); /* clear memory of the password */ return retval; } static int -save_history(const char *user, const char *howmany, const char *debug) +save_history(const char *user, const char *filename, const char *howmany, const char *debug) { int num = atoi(howmany); int dbg = atoi(debug); /* no need to be too fancy here */ int retval; - retval = save_old_pass(user, num, dbg); + retval = save_old_pass(user, num, filename, dbg); return retval; } @@ -92,13 +92,14 @@ main(int argc, char *argv[]) { const char *option; const char *user; + const char *filename; /* * we establish that this program is running with non-tty stdin. * this is to discourage casual use. */ - if (isatty(STDIN_FILENO) || argc < 4) + if (isatty(STDIN_FILENO) || argc < 5) { fprintf(stderr, "This binary is not designed for running in this way.\n"); @@ -107,11 +108,12 @@ main(int argc, char *argv[]) option = argv[1]; user = argv[2]; + filename = argv[3]; - if (strcmp(option, "check") == 0 && argc == 4) - return check_history(user, argv[3]); - else if (strcmp(option, "save") == 0 && argc == 5) - return save_history(user, argv[3], argv[4]); + if (strcmp(option, "check") == 0 && argc == 5) + return check_history(user, filename, argv[4]); + else if (strcmp(option, "save") == 0 && argc == 6) + return save_history(user, filename, argv[4], argv[5]); fprintf(stderr, "This binary is not designed for running in this way.\n"); |