aboutsummaryrefslogtreecommitdiff
path: root/Linux-PAM/modules/pam_cracklib/pam_cracklib.c
diff options
context:
space:
mode:
authorSteve Langasek <steve.langasek@ubuntu.com>2019-01-03 16:09:38 -0800
committerSteve Langasek <steve.langasek@ubuntu.com>2019-01-03 16:09:38 -0800
commit03398c56c56ed427818d2ce879d45d1009f7d46b (patch)
tree9a7bc0d7d15ac988ac9ad31ad18a769030faced7 /Linux-PAM/modules/pam_cracklib/pam_cracklib.c
parente78677298d54010c3a62b932baefdae152fd0fed (diff)
parent281e859131adad49301befbc50cfc5cd282c6937 (diff)
downloadpam-03398c56c56ed427818d2ce879d45d1009f7d46b.tar.gz
pam-03398c56c56ed427818d2ce879d45d1009f7d46b.tar.bz2
pam-03398c56c56ed427818d2ce879d45d1009f7d46b.zip
merge upstream version 0.99.9.0
Diffstat (limited to 'Linux-PAM/modules/pam_cracklib/pam_cracklib.c')
-rw-r--r--Linux-PAM/modules/pam_cracklib/pam_cracklib.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/Linux-PAM/modules/pam_cracklib/pam_cracklib.c b/Linux-PAM/modules/pam_cracklib/pam_cracklib.c
index 6decf2bf..532a72b2 100644
--- a/Linux-PAM/modules/pam_cracklib/pam_cracklib.c
+++ b/Linux-PAM/modules/pam_cracklib/pam_cracklib.c
@@ -56,6 +56,10 @@
extern char *FascistCheck(char *pw, const char *dictpath);
#endif
+#ifndef CRACKLIB_DICTS
+#define CRACKLIB_DICTS NULL
+#endif
+
/* 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 "". */
@@ -95,7 +99,7 @@ struct cracklib_options {
int min_class;
int use_authtok;
char prompt_type[BUFSIZ];
- char cracklib_dictpath[PATH_MAX];
+ const char *cracklib_dictpath;
};
#define CO_RETRY_TIMES 1
@@ -166,14 +170,15 @@ _pam_parse (pam_handle_t *pamh, struct cracklib_options *opt,
} else if (!strncmp(*argv,"use_authtok",11)) {
opt->use_authtok = 1;
} else if (!strncmp(*argv,"dictpath=",9)) {
- strncpy(opt->cracklib_dictpath, *argv+9,
- sizeof(opt->cracklib_dictpath) - 1);
+ opt->cracklib_dictpath = *argv+9;
+ if (!*(opt->cracklib_dictpath)) {
+ opt->cracklib_dictpath = CRACKLIB_DICTS;
+ }
} else {
pam_syslog(pamh,LOG_ERR,"pam_parse: unknown option; %s",*argv);
}
}
opt->prompt_type[sizeof(opt->prompt_type) - 1] = '\0';
- opt->cracklib_dictpath[sizeof(opt->cracklib_dictpath) - 1] = '\0';
return ctrl;
}
@@ -571,8 +576,7 @@ PAM_EXTERN int pam_sm_chauthtok(pam_handle_t *pamh, int flags,
options.use_authtok = CO_USE_AUTHTOK;
memset(options.prompt_type, 0, BUFSIZ);
strcpy(options.prompt_type,"UNIX");
- memset(options.cracklib_dictpath, 0,
- sizeof (options.cracklib_dictpath));
+ options.cracklib_dictpath = CRACKLIB_DICTS;
ctrl = _pam_parse(pamh, &options, argc, argv);
@@ -666,7 +670,7 @@ PAM_EXTERN int pam_sm_chauthtok(pam_handle_t *pamh, int flags,
const char *crack_msg;
D(("against cracklib"));
- if ((crack_msg = FascistCheck(token1,options.cracklib_dictpath[0] == '\0'?NULL:options.cracklib_dictpath))) {
+ if ((crack_msg = FascistCheck(token1,options.cracklib_dictpath))) {
if (ctrl & PAM_DEBUG_ARG)
pam_syslog(pamh,LOG_DEBUG,"bad password: %s",crack_msg);
pam_error(pamh, _("BAD PASSWORD: %s"), crack_msg);