Lines Matching +full:max +full:- +full:reason
2 * Copyright (c) 2000-2002 by Solar Designer. See LICENSE.
50 x = ((fixed)(charset - 1) << FIXED_BITS) / charset; in expected_different()
52 while (--length > 0) y = (y * x) >> FIXED_BITS; in expected_different()
53 z = (fixed)charset * (((fixed)1 << FIXED_BITS) - y); in expected_different()
94 if (uppers && isascii(c) && isupper(c)) uppers--; in is_simple()
95 c = (unsigned char)newpass[length - 1]; in is_simple()
96 if (digits && isascii(c) && isdigit(c)) digits--; in is_simple()
99 * that there're no non-ASCII characters for digits. */ in is_simple()
107 for (; classes > 0; classes--) in is_simple()
110 if (length >= params->min[0] && in is_simple()
111 chars >= expected_different(10, params->min[0]) - 1) in is_simple()
116 if (length >= params->min[1] && in is_simple()
117 chars >= expected_different(36, params->min[1]) - 1) in is_simple()
119 if (!params->passphrase_words || in is_simple()
120 words < params->passphrase_words) in is_simple()
122 if (length >= params->min[2] && in is_simple()
123 chars >= expected_different(27, params->min[2]) - 1) in is_simple()
128 if (length >= params->min[3] && in is_simple()
129 chars >= expected_different(62, params->min[3]) - 1) in is_simple()
134 if (length >= params->min[4] && in is_simple()
135 chars >= expected_different(95, params->min[4]) - 1) in is_simple()
176 *dptr++ = *--sptr; in reverse()
204 if (!params->match_length) /* disabled */ in is_based()
207 if (params->match_length < 0) /* misconfigured */ in is_based()
216 for (i = 0; i <= length - params->match_length; i++) in is_based()
217 for (j = params->match_length; i + j <= length; j++) { in is_based()
228 length + 1 - (i + j)); in is_based()
246 * passwords (if short passwords are allowed) that are word-based, but
264 if ((int)strlen(word) < params->match_length) continue; in is_word_based()
283 const char *reason; in _passwdqc_check() local
291 reason = NULL; in _passwdqc_check()
294 reason = REASON_SAME; in _passwdqc_check()
298 if (!reason && length < params->min[4]) in _passwdqc_check()
299 reason = REASON_SHORT; in _passwdqc_check()
301 if (!reason && length > params->max) { in _passwdqc_check()
302 if (params->max == 8) { in _passwdqc_check()
307 reason = REASON_SAME; in _passwdqc_check()
309 reason = REASON_LONG; in _passwdqc_check()
312 if (!reason && is_simple(params, newpass)) { in _passwdqc_check()
313 if (length < params->min[1] && params->min[1] <= params->max) in _passwdqc_check()
314 reason = REASON_SIMPLESHORT; in _passwdqc_check()
316 reason = REASON_SIMPLE; in _passwdqc_check()
319 if (!reason) { in _passwdqc_check()
326 u_name = unify(pw->pw_name); in _passwdqc_check()
327 u_gecos = unify(pw->pw_gecos); in _passwdqc_check()
334 reason = REASON_ERROR; in _passwdqc_check()
337 if (!reason && oldpass && params->similar_deny && in _passwdqc_check()
340 reason = REASON_SIMILAR; in _passwdqc_check()
342 if (!reason && pw && in _passwdqc_check()
347 reason = REASON_PERSONAL; in _passwdqc_check()
349 if (!reason && (int)strlen(newpass) < params->min[2] && in _passwdqc_check()
352 reason = REASON_WORD; in _passwdqc_check()
360 return reason; in _passwdqc_check()