summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry V. Levin <ldv@altlinux.org>2020-03-05 22:27:33 +0000
committerDmitry V. Levin <ldv@altlinux.org>2020-03-11 14:59:45 +0000
commit4daceedd3387b418ff23fc1ac5b8342558a459f5 (patch)
tree1a28ec299f77b1238f01e76343b0c58296d25a1d
parentc6c51832af8e7724cfbd454daa65a6644f5b45c2 (diff)
pam_get_authtok: fix i18n of default prompts
Change formatting of default prompts, making them translatable to those languages that use a different word order. From non-i18n perspective this change is essentially a no-op. * libpam/pam_get_authtok.c (PROMPTCURRENT): Replace with PROMPT_CURRENT_ARG and PROMPT_CURRENT_NOARG. (PROMPT1): Replace with PROMPT_NEW_ARG and PROMPT_NEW_NOARG. (PROMPT2): Replace with PROMPT_RETYPE_ARG and PROMPT_RETYPE_NOARG. (pam_get_authtok_internal, pam_get_authtok_verify): Use new macros. * po/Linux-PAM.pot: Regenerated. Resolves: https://github.com/linux-pam/linux-pam/issues/29
-rw-r--r--libpam/pam_get_authtok.c54
-rw-r--r--po/Linux-PAM.pot28
2 files changed, 54 insertions, 28 deletions
diff --git a/libpam/pam_get_authtok.c b/libpam/pam_get_authtok.c
index 99eb25f2..3fa7f7df 100644
--- a/libpam/pam_get_authtok.c
+++ b/libpam/pam_get_authtok.c
@@ -37,12 +37,15 @@
#include <security/pam_ext.h>
#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: ")
+/* For Translators: "%s" is replaced with "<service>". */
+#define PROMPT_CURRENT_ARG _("Current %s password: ")
+#define PROMPT_CURRENT_NOARG _("Current password: ")
+/* For Translators: "%s" is replaced with "<service>". */
+#define PROMPT_NEW_ARG _("New %s password: ")
+#define PROMPT_NEW_NOARG _("New password: ")
+/* For Translators: "%s" is replaced with "<service>". */
+#define PROMPT_RETYPE_ARG _("Retype new %s password: ")
+#define PROMPT_RETYPE_NOARG _("Retype new password: ")
#define MISTYPED_PASS _("Sorry, passwords do not match.")
#define PAM_GETAUTHTOK_NOVERIFY 1
@@ -142,21 +145,30 @@ pam_get_authtok_internal (pam_handle_t *pamh, int item,
{
pamh->authtok_verified = 0;
- retval = pam_prompt (pamh, PAM_PROMPT_ECHO_OFF, &resp[0],
- PROMPT1, authtok_type,
- strlen (authtok_type) > 0?" ":"");
+ retval = *authtok_type ?
+ pam_prompt (pamh, PAM_PROMPT_ECHO_OFF, &resp[0],
+ PROMPT_NEW_ARG, authtok_type) :
+ pam_prompt (pamh, PAM_PROMPT_ECHO_OFF, &resp[0],
+ "%s", PROMPT_NEW_NOARG);
if (retval == PAM_SUCCESS && chpass > 1 && resp[0] != NULL)
- retval = pam_prompt (pamh, PAM_PROMPT_ECHO_OFF, &resp[1],
- PROMPT2, authtok_type,
- strlen (authtok_type) > 0?" ":"");
+ {
+ retval = *authtok_type ?
+ pam_prompt (pamh, PAM_PROMPT_ECHO_OFF, &resp[1],
+ PROMPT_RETYPE_ARG, authtok_type) :
+ pam_prompt (pamh, PAM_PROMPT_ECHO_OFF, &resp[1],
+ "%s", PROMPT_RETYPE_NOARG);
+ }
}
else if (item == PAM_OLDAUTHTOK)
- retval = pam_prompt (pamh, PAM_PROMPT_ECHO_OFF, &resp[0],
- PROMPTCURRENT, authtok_type,
- strlen (authtok_type) > 0?" ":"");
+ {
+ retval = *authtok_type ?
+ pam_prompt (pamh, PAM_PROMPT_ECHO_OFF, &resp[0],
+ PROMPT_CURRENT_ARG, authtok_type) :
+ pam_prompt (pamh, PAM_PROMPT_ECHO_OFF, &resp[0],
+ "%s", PROMPT_CURRENT_NOARG);
+ }
else
- retval = pam_prompt (pamh, PAM_PROMPT_ECHO_OFF, &resp[0], "%s",
- PROMPT);
+ retval = pam_prompt (pamh, PAM_PROMPT_ECHO_OFF, &resp[0], "%s", PROMPT);
if (retval != PAM_SUCCESS || resp[0] == NULL ||
(chpass > 1 && resp[1] == NULL))
@@ -232,9 +244,11 @@ pam_get_authtok_verify (pam_handle_t *pamh, const char **authtok,
retval = pam_get_item (pamh, PAM_AUTHTOK_TYPE, (const void **)&authtok_type);
if (retval != PAM_SUCCESS || authtok_type == NULL)
authtok_type = "";
- retval = pam_prompt (pamh, PAM_PROMPT_ECHO_OFF, &resp,
- PROMPT2, authtok_type,
- strlen (authtok_type) > 0?" ":"");
+ retval = *authtok_type ?
+ pam_prompt (pamh, PAM_PROMPT_ECHO_OFF, &resp,
+ PROMPT_RETYPE_ARG, authtok_type) :
+ pam_prompt (pamh, PAM_PROMPT_ECHO_OFF, &resp,
+ "%s", PROMPT_RETYPE_NOARG);
}
if (retval != PAM_SUCCESS || resp == NULL)
diff --git a/po/Linux-PAM.pot b/po/Linux-PAM.pot
index 309dbef7..dc74d537 100644
--- a/po/Linux-PAM.pot
+++ b/po/Linux-PAM.pot
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Linux-PAM 1.4.0\n"
"Report-Msgid-Bugs-To: https://github.com/linux-pam/linux-pam/issues\n"
-"POT-Creation-Date: 2020-03-05 19:33+0000\n"
+"POT-Creation-Date: 2020-03-05 22:27+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -38,29 +38,41 @@ msgstr ""
#: libpam/pam_get_authtok.c:41
#, c-format
-msgid "Current %s%spassword: "
+msgid "Current %s password: "
msgstr ""
-#: libpam/pam_get_authtok.c:43
+#: libpam/pam_get_authtok.c:42
+msgid "Current password: "
+msgstr ""
+
+#: libpam/pam_get_authtok.c:44
#, c-format
-msgid "New %s%spassword: "
+msgid "New %s password: "
msgstr ""
#: libpam/pam_get_authtok.c:45
+msgid "New password: "
+msgstr ""
+
+#: libpam/pam_get_authtok.c:47
#, c-format
-msgid "Retype new %s%spassword: "
+msgid "Retype new %s password: "
+msgstr ""
+
+#: libpam/pam_get_authtok.c:48
+msgid "Retype new password: "
msgstr ""
-#: libpam/pam_get_authtok.c:46
+#: libpam/pam_get_authtok.c:49
msgid "Sorry, passwords do not match."
msgstr ""
-#: libpam/pam_get_authtok.c:139 libpam/pam_get_authtok.c:228
+#: libpam/pam_get_authtok.c:142 libpam/pam_get_authtok.c:240
#, c-format
msgid "Retype %s"
msgstr ""
-#: libpam/pam_get_authtok.c:166 libpam/pam_get_authtok.c:244
+#: libpam/pam_get_authtok.c:178 libpam/pam_get_authtok.c:258
msgid "Password change has been aborted."
msgstr ""