SHA256
1
0
forked from pool/pam
pam/pam_pwhistory-type.diff

103 lines
3.3 KiB
Diff

Index: modules/pam_pwhistory/pam_pwhistory.8.xml
===================================================================
RCS file: /cvsroot/pam/Linux-PAM/modules/pam_pwhistory/pam_pwhistory.8.xml,v
retrieving revision 1.1
diff -u -r1.1 pam_pwhistory.8.xml
--- modules/pam_pwhistory/pam_pwhistory.8.xml 10 Oct 2008 06:53:45 -0000 1.1
+++ modules/pam_pwhistory/pam_pwhistory.8.xml 19 Nov 2008 14:24:00 -0000
@@ -33,6 +33,9 @@
<arg choice="opt">
retry=<replaceable>N</replaceable>
</arg>
+ <arg choice="opt">
+ type=<replaceable>STRING</replaceable>
+ </arg>
</cmdsynopsis>
</refsynopsisdiv>
@@ -119,6 +122,21 @@
</listitem>
</varlistentry>
+ <varlistentry>
+ <term>
+ <option>type=<replaceable>STRING</replaceable></option>
+ </term>
+ <listitem>
+ <para>
+ The default action is for the module to use the
+ following prompts when requesting passwords:
+ "New UNIX password: " and "Retype UNIX password: ".
+ The default word <emphasis>UNIX</emphasis> can
+ be replaced with this option.
+ </para>
+ </listitem>
+ </varlistentry>
+
</variablelist>
</refsect1>
Index: modules/pam_pwhistory/pam_pwhistory.c
===================================================================
RCS file: /cvsroot/pam/Linux-PAM/modules/pam_pwhistory/pam_pwhistory.c,v
retrieving revision 1.1
diff -u -r1.1 pam_pwhistory.c
--- modules/pam_pwhistory/pam_pwhistory.c 10 Oct 2008 06:53:45 -0000 1.1
+++ modules/pam_pwhistory/pam_pwhistory.c 19 Nov 2008 14:24:00 -0000
@@ -58,7 +58,9 @@
#include "opasswd.h"
+/* For Translators: "%s%s" could be replaced with "<service> " or "". */
#define NEW_PASSWORD_PROMPT _("New %s%spassword: ")
+/* For Translators: "%s%s" could be replaced with "<service> " or "". */
#define AGAIN_PASSWORD_PROMPT _("Retype new %s%spassword: ")
#define MISTYPED_PASSWORD _("Sorry, passwords do not match.")
@@ -70,6 +72,7 @@
int enforce_for_root;
int remember;
int tries;
+ const char *prompt_type;
};
typedef struct options_t options_t;
@@ -101,6 +104,8 @@
}
else if (strcasecmp (argv, "enforce_for_root") == 0)
options->enforce_for_root = 1;
+ else if (strncasecmp (argv, "type=", 5) == 0)
+ options->prompt_type = &argv[5];
else
pam_syslog (pamh, LOG_ERR, "pam_pwhistory: unknown option: %s", argv);
}
@@ -121,6 +126,7 @@
/* Set some default values, which could be overwritten later. */
options.remember = 10;
options.tries = 1;
+ options.prompt_type = "UNIX";
/* Parse parameters for module */
for ( ; argc-- > 0; argv++)
@@ -209,7 +215,8 @@
while ((newpass == NULL) && (tries++ < options.tries))
{
retval = pam_prompt (pamh, PAM_PROMPT_ECHO_OFF, &newpass,
- NEW_PASSWORD_PROMPT, "UNIX", " ");
+ NEW_PASSWORD_PROMPT, options.prompt_type,
+ strlen (options.prompt_type) > 0?" ":"");
if (retval != PAM_SUCCESS)
{
_pam_drop (newpass);
@@ -249,7 +256,9 @@
char *new2;
retval = pam_prompt (pamh, PAM_PROMPT_ECHO_OFF, &new2,
- AGAIN_PASSWORD_PROMPT, "UNIX", " ");
+ AGAIN_PASSWORD_PROMPT,
+ options.prompt_type,
+ strlen (options.prompt_type) > 0?" ":"");
if (retval != PAM_SUCCESS)
return retval;