diff options
author | Steve Langasek <vorlon@debian.org> | 2019-01-22 15:01:39 -0800 |
---|---|---|
committer | Steve Langasek <vorlon@debian.org> | 2019-01-22 15:02:03 -0800 |
commit | 5cd7bb4511a7c2b355a615f19a9eca193320aa3e (patch) | |
tree | ceb3e40947d1f0f4712f473e410494177d5763e0 /libpam/pam_get_authtok.c | |
parent | cfa575497a113d8da1a2c79ef028b5c9648dc136 (diff) | |
parent | f00afb1ef201b2eef7f9ddbe5a0c6ca802cf49bb (diff) | |
download | pam-5cd7bb4511a7c2b355a615f19a9eca193320aa3e.tar.gz pam-5cd7bb4511a7c2b355a615f19a9eca193320aa3e.tar.bz2 pam-5cd7bb4511a7c2b355a615f19a9eca193320aa3e.zip |
Merge upstream version 1.3.0
Diffstat (limited to 'libpam/pam_get_authtok.c')
-rw-r--r-- | libpam/pam_get_authtok.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/libpam/pam_get_authtok.c b/libpam/pam_get_authtok.c index 31bb1627..9bfbdf0f 100644 --- a/libpam/pam_get_authtok.c +++ b/libpam/pam_get_authtok.c @@ -38,6 +38,8 @@ #define PROMPT _("Password: ") /* For Translators: "%s%s" could be replaced with "<service> " or "". */ +#define PROMPTCURRENT _("Current %s%spassword: ") +/* For Translators: "%s%s" could be replaced with "<service> " or "". */ #define PROMPT1 _("New %s%spassword: ") /* For Translators: "%s%s" could be replaced with "<service> " or "". */ #define PROMPT2 _("Retype new %s%spassword: ") @@ -89,12 +91,14 @@ pam_get_authtok_internal (pam_handle_t *pamh, int item, /* PAM_AUTHTOK in password stack returns new password, which needs to be verified. */ - if (item == PAM_AUTHTOK && pamh->choice == PAM_CHAUTHTOK) + if (pamh->choice == PAM_CHAUTHTOK) { - chpass = 1; - if (!(flags & PAM_GETAUTHTOK_NOVERIFY)) - ++chpass; - + if (item == PAM_AUTHTOK) + { + chpass = 1; + if (!(flags & PAM_GETAUTHTOK_NOVERIFY)) + ++chpass; + } authtok_type = get_option (pamh, "authtok_type"); if (authtok_type == NULL) { @@ -144,6 +148,10 @@ pam_get_authtok_internal (pam_handle_t *pamh, int item, PROMPT2, authtok_type, strlen (authtok_type) > 0?" ":""); } + else if (item == PAM_OLDAUTHTOK) + retval = pam_prompt (pamh, PAM_PROMPT_ECHO_OFF, &resp[0], + PROMPTCURRENT, authtok_type, + strlen (authtok_type) > 0?" ":""); else retval = pam_prompt (pamh, PAM_PROMPT_ECHO_OFF, &resp[0], "%s", PROMPT); @@ -151,8 +159,9 @@ pam_get_authtok_internal (pam_handle_t *pamh, int item, if (retval != PAM_SUCCESS || resp[0] == NULL || (chpass > 1 && resp[1] == NULL)) { - /* We want to abort the password change */ - pam_error (pamh, _("Password change aborted.")); + /* We want to abort */ + if (chpass) + pam_error (pamh, _("Password change aborted.")); return PAM_AUTHTOK_ERR; } |