summaryrefslogtreecommitdiff
path: root/modules/pam_pwhistory/pam_pwhistory.c
diff options
context:
space:
mode:
authorThorsten Kukuk <kukuk@thkukuk.de>2008-11-19 14:24:47 +0000
committerThorsten Kukuk <kukuk@thkukuk.de>2008-11-19 14:24:47 +0000
commitdade683fe1334eccfae157517fa4f8b9a77d36cb (patch)
tree3dbcbb3696a1eb62c3f5f5b8567c02295737da4d /modules/pam_pwhistory/pam_pwhistory.c
parent0a5ee586bed8dbb537ab23080bc19cf6b82812e7 (diff)
Relevant BUGIDs:
Purpose of commit: missing part of new feature Commit summary: --------------- 2008-11-19 Thorsten Kukuk <kukuk@thkukuk.de> * modules/pam_pwhistory/pam_pwhistory.c (pam_sm_chauthtok): Finish implementation of type=STRING option. * modules/pam_pwhistory/pam_pwhistory.8.xml: Document "type=STRING" option.
Diffstat (limited to 'modules/pam_pwhistory/pam_pwhistory.c')
-rw-r--r--modules/pam_pwhistory/pam_pwhistory.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/modules/pam_pwhistory/pam_pwhistory.c b/modules/pam_pwhistory/pam_pwhistory.c
index d3cce728..424be38e 100644
--- a/modules/pam_pwhistory/pam_pwhistory.c
+++ b/modules/pam_pwhistory/pam_pwhistory.c
@@ -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 @@ struct options_t {
int enforce_for_root;
int remember;
int tries;
+ const char *prompt_type;
};
typedef struct options_t options_t;
@@ -101,6 +104,8 @@ parse_option (pam_handle_t *pamh, const char *argv, options_t *options)
}
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 @@ pam_sm_chauthtok (pam_handle_t *pamh, int flags, int argc, const char **argv)
/* 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 @@ pam_sm_chauthtok (pam_handle_t *pamh, int flags, int argc, const char **argv)
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 @@ pam_sm_chauthtok (pam_handle_t *pamh, int flags, int argc, const char **argv)
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;