diff options
author | Sam Hartman <hartmans@debian.org> | 2024-12-02 09:55:34 -0700 |
---|---|---|
committer | Sam Hartman <hartmans@debian.org> | 2024-12-02 09:55:34 -0700 |
commit | 4f3cfaf827bfa42a239c255092a128a3a02198bf (patch) | |
tree | eac7f023f043739b79b2a51bd68c3006acb12964 /modules/pam_pwhistory/pam_pwhistory.c | |
parent | 6408d4b1baff9a7e58fd66e1d1c0871be0823777 (diff) | |
parent | 7c9fb6472dcfae34ddbf4fbc9ecfafae2cf173c3 (diff) | |
download | pam-4f3cfaf827bfa42a239c255092a128a3a02198bf.tar.gz pam-4f3cfaf827bfa42a239c255092a128a3a02198bf.tar.bz2 pam-4f3cfaf827bfa42a239c255092a128a3a02198bf.zip |
Update upstream source from tag 'upstream/1.7.0'
Update to upstream version '1.7.0'
with Debian dir 0b3cd490884352e14273caeca2f05c6a525499fa
Diffstat (limited to 'modules/pam_pwhistory/pam_pwhistory.c')
-rw-r--r-- | modules/pam_pwhistory/pam_pwhistory.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/modules/pam_pwhistory/pam_pwhistory.c b/modules/pam_pwhistory/pam_pwhistory.c index 5a7fb811..6a720927 100644 --- a/modules/pam_pwhistory/pam_pwhistory.c +++ b/modules/pam_pwhistory/pam_pwhistory.c @@ -37,9 +37,7 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ -#if defined(HAVE_CONFIG_H) #include <config.h> -#endif #include <pwd.h> #include <errno.h> @@ -63,6 +61,7 @@ #include "opasswd.h" #include "pam_inline.h" +#include "pam_i18n.h" #include "pwhistory_config.h" @@ -112,6 +111,7 @@ parse_option (pam_handle_t *pamh, const char *argv, options_t *options) pam_syslog (pamh, LOG_ERR, "pam_pwhistory: unknown option: %s", argv); } +#ifdef WITH_SELINUX static int run_save_helper(pam_handle_t *pamh, const char *user, int howmany, const char *filename, int debug) @@ -141,7 +141,7 @@ run_save_helper(pam_handle_t *pamh, const char *user, args[0] = (char *)PWHISTORY_HELPER; args[1] = (char *)"save"; args[2] = (char *)user; - args[3] = (char *)filename; + args[3] = (char *)((filename != NULL) ? filename : ""); DIAG_POP_IGNORE_CAST_QUAL; if (asprintf(&args[4], "%d", howmany) < 0 || asprintf(&args[5], "%d", debug) < 0) @@ -228,7 +228,7 @@ run_check_helper(pam_handle_t *pamh, const char *user, args[0] = (char *)PWHISTORY_HELPER; args[1] = (char *)"check"; args[2] = (char *)user; - args[3] = (char *)filename; + args[3] = (char *)((filename != NULL) ? filename : ""); DIAG_POP_IGNORE_CAST_QUAL; if (asprintf(&args[4], "%d", debug) < 0) { @@ -287,6 +287,7 @@ run_check_helper(pam_handle_t *pamh, const char *user, return retval; } +#endif /* This module saves the current hashed password in /etc/security/opasswd and then compares the new password with all entries in this file. */ @@ -332,8 +333,10 @@ pam_sm_chauthtok (pam_handle_t *pamh, int flags, int argc, const char **argv) retval = save_old_pass (pamh, user, options.remember, options.filename, options.debug); +#ifdef WITH_SELINUX if (retval == PAM_PWHISTORY_RUN_HELPER) retval = run_save_helper(pamh, user, options.remember, options.filename, options.debug); +#endif if (retval != PAM_SUCCESS) return retval; @@ -366,8 +369,10 @@ pam_sm_chauthtok (pam_handle_t *pamh, int flags, int argc, const char **argv) pam_syslog (pamh, LOG_DEBUG, "check against old password file"); retval = check_old_pass (pamh, user, newpass, options.filename, options.debug); +#ifdef WITH_SELINUX if (retval == PAM_PWHISTORY_RUN_HELPER) retval = run_check_helper(pamh, user, newpass, options.filename, options.debug); +#endif if (retval != PAM_SUCCESS) { |