summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTomas Mraz <tmraz@redhat.com>2012-05-23 21:12:32 +0200
committerTomas Mraz <tmraz@redhat.com>2012-05-23 21:12:32 +0200
commitcd4ef315fd0d282ed11bdde17e98fe33625e789c (patch)
tree6dfa8b4c4a82be682f4d14d1497561845b2c178a /src
parent3052ad2b706aafadb76d58747e39fb082d4fda50 (diff)
downloadlibpwquality-cd4ef315fd0d282ed11bdde17e98fe33625e789c.tar.gz
Call the simplicity checks before the cracklib check.
Diffstat (limited to 'src')
-rw-r--r--src/check.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/check.c b/src/check.c
index 1e137de..5303b51 100644
--- a/src/check.c
+++ b/src/check.c
@@ -555,7 +555,7 @@ password_score(pwquality_settings_t *pwq, const char *password)
if ((buf = malloc(len)) == NULL)
/* should get enough memory to obtain a nice score */
- return 0;
+ return PWQ_ERROR_MEM_ALLOC;
score = (len - pwq->min_length) * 2;
@@ -616,6 +616,11 @@ pwquality_check(pwquality_settings_t *pwq, const char *password,
return PWQ_ERROR_SAME_PASSWORD;
}
+ score = password_check(pwq, password, oldpassword, user, auxerror);
+
+ if (score != 0)
+ return score;
+
msg = FascistCheck(password, pwq->dict_path);
if (msg) {
if (auxerror)
@@ -623,10 +628,7 @@ pwquality_check(pwquality_settings_t *pwq, const char *password,
return PWQ_ERROR_CRACKLIB_CHECK;
}
- score = password_check(pwq, password, oldpassword, user, auxerror);
- if (score == 0) {
- score = password_score(pwq, password);
- }
+ score = password_score(pwq, password);
return score;
}