|
Message-ID: <20180704233238.GE29590@altlinux.org> Date: Thu, 5 Jul 2018 02:32:38 +0300 From: "Dmitry V. Levin" <ldv@...linux.org> To: owl-dev@...ts.openwall.com Subject: [PATCH 4/5] pam_tcb: sync password expiration messages with Linux-PAM --- pam_tcb/pam_unix_acct.c | 5 ++--- pam_tcb/support.h | 19 ++++++++++++++----- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/pam_tcb/pam_unix_acct.c b/pam_tcb/pam_unix_acct.c index 3ac372d..a69b931 100644 --- a/pam_tcb/pam_unix_acct.c +++ b/pam_tcb/pam_unix_acct.c @@ -148,7 +148,7 @@ PAM_EXTERN int pam_sm_acct_mgmt(pam_handle_t *pamh, int flags, pam_syslog(pamh, LOG_INFO, "Expired password for %s (root enforced)", user); if (off(UNIX__QUIET)) - pam_error(pamh, "%s", MESSAGE_PASS_EXPIRED); + pam_error(pamh, "%s", MESSAGE_PASS_ENFORCED); D(("need a new password (1)")); return PAM_NEW_AUTHTOK_REQD; @@ -165,8 +165,7 @@ PAM_EXTERN int pam_sm_acct_mgmt(pam_handle_t *pamh, int flags, "Password for %s will expire in %d day%s", user, daysleft, daysleft == 1 ? "" : "s"); if (off(UNIX__QUIET)) - pam_info(pamh, MESSAGE_WARN_EXPIRE, - daysleft, daysleft == 1 ? "" : "s"); + pam_info(pamh, MESSAGE_WARN_EXPIRE(daysleft)); return PAM_SUCCESS; default: diff --git a/pam_tcb/support.h b/pam_tcb/support.h index 4abf1f1..f576e62 100644 --- a/pam_tcb/support.h +++ b/pam_tcb/support.h @@ -15,9 +15,13 @@ #if defined(ENABLE_NLS) && defined(NLS_PACKAGE) #include <libintl.h> #define _(msgid) dgettext(NLS_PACKAGE, msgid) +#define P3_(msgid, msgid_plural, count) \ + (dngettext(NLS_PACKAGE, (msgid), (msgid_plural), (count))) #define N_(msgid) msgid #else #define _(msgid) (msgid) +#define P3_(msgid, msgid_plural, count) \ + ((count) == 1 ? (msgid) : (msgid_plural)) #define N_(msgid) msgid #endif /* ENABLE_NLS && NLS_PACKAGE */ @@ -30,18 +34,23 @@ /* Possible messages during account management */ #define MESSAGE_ACCT_EXPIRED \ _("Your account has expired; please contact your system administrator.") +#define MESSAGE_PASS_ENFORCED \ + _("You are required to change your password immediately (administrator enforced).") #define MESSAGE_PASS_EXPIRED \ - _("You are required to change your password immediately.") -#define MESSAGE_WARN_EXPIRE \ - _("Warning: your password will expire in %d day%s.") + _("You are required to change your password immediately (password expired).") +#define MESSAGE_WARN_EXPIRE(count) \ + P3_("Warning: your password will expire in %d day.", \ + "Warning: your password will expire in %d days.", \ + (count)), (count) + /* Possible messages during password changes */ #define MESSAGE_CHANGING \ _("Changing password for %s.") #define MESSAGE_PASS_SAME \ - _("Password unchanged.") + _("The password has not been changed.") #define MESSAGE_PASS_NONE \ - _("No password supplied.") + _("No password has been supplied.") #define MESSAGE_TOOSOON \ _("You must wait longer to change your password.") -- ldv
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.