diff options
author | Florian Best <best@univention.de> | 2019-06-26 23:13:13 +0200 |
---|---|---|
committer | Tomáš Mráz <t8m@users.noreply.github.com> | 2019-06-27 18:23:16 +0200 |
commit | 5154aabe8aac27d569059cad3332cd12c7442a8a (patch) | |
tree | dd628698ea434e85d7f35a7876f1bd9193515c28 /modules/pam_unix/pam_unix_passwd.c | |
parent | 65816326c285c5d5eec51766e1de329f177c28f7 (diff) | |
download | pam-5154aabe8aac27d569059cad3332cd12c7442a8a.tar.gz pam-5154aabe8aac27d569059cad3332cd12c7442a8a.tar.bz2 pam-5154aabe8aac27d569059cad3332cd12c7442a8a.zip |
Restrict password length when changing password
Diffstat (limited to 'modules/pam_unix/pam_unix_passwd.c')
-rw-r--r-- | modules/pam_unix/pam_unix_passwd.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/modules/pam_unix/pam_unix_passwd.c b/modules/pam_unix/pam_unix_passwd.c index df4c1233..4d2f5e2c 100644 --- a/modules/pam_unix/pam_unix_passwd.c +++ b/modules/pam_unix/pam_unix_passwd.c @@ -576,7 +576,11 @@ static int _pam_unix_approve_pass(pam_handle_t * pamh return PAM_AUTHTOK_ERR; } } - if (off(UNIX__IAMROOT, ctrl)) { + + if (strlen(pass_new) > MAX_PASS) { + remark = _("You must choose a shorter password."); + D(("length exceeded [%s]", remark)); + } else if (off(UNIX__IAMROOT, ctrl)) { if (strlen(pass_new) < pass_min_len) remark = _("You must choose a longer password."); D(("length check [%s]", remark)); |