summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorajacoutot <ajacoutot@openbsd.org>2013-03-02 09:07:37 +0000
committerajacoutot <ajacoutot@openbsd.org>2013-03-02 09:07:37 +0000
commit7d4d297ffc62e317ed17ce003997624eb35c68a9 (patch)
treecc901d800c403b71fd94fbb3c8b0943f9eb4043e
parentsort options, and avoid line wrap, in usage(); ok guenther (diff)
downloadwireguard-openbsd-7d4d297ffc62e317ed17ce003997624eb35c68a9.tar.xz
wireguard-openbsd-7d4d297ffc62e317ed17ce003997624eb35c68a9.zip
When using an external password quality check program, do not run the
patterns checks which may contradict the rules set by the external helper. ok millert@
-rw-r--r--usr.bin/passwd/pwd_check.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/usr.bin/passwd/pwd_check.c b/usr.bin/passwd/pwd_check.c
index ad38ea4401f..290cba0b99a 100644
--- a/usr.bin/passwd/pwd_check.c
+++ b/usr.bin/passwd/pwd_check.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pwd_check.c,v 1.12 2008/11/06 05:35:56 djm Exp $ */
+/* $OpenBSD: pwd_check.c,v 1.13 2013/03/02 09:07:37 ajacoutot Exp $ */
/*
* Copyright 2000 Niels Provos <provos@citi.umich.edu>
@@ -133,21 +133,21 @@ pwd_check(login_cap_t *lc, char *password)
exit(1);
}
- for (i = 0; i < sizeof(patterns) / sizeof(*patterns); i++) {
- if (regcomp(&rgx, patterns[i].match,
- patterns[i].flags) != 0)
- continue;
- res = regexec(&rgx, password, 0, NULL, 0);
- regfree(&rgx);
- if (res == 0) {
- printf("%s\n", patterns[i].response);
- exit(1);
+ if (checker == NULL) {
+ for (i = 0; i < sizeof(patterns) / sizeof(*patterns); i++) {
+ if (regcomp(&rgx, patterns[i].match,
+ patterns[i].flags) != 0)
+ continue;
+ res = regexec(&rgx, password, 0, NULL, 0);
+ regfree(&rgx);
+ if (res == 0) {
+ printf("%s\n", patterns[i].response);
+ exit(1);
+ }
}
- }
-
- /* If no external checker in use, accept the password */
- if (checker == NULL)
+ /* no external checker in use, accept the password */
exit(0);
+ }
/* Otherwise, pass control to checker program */
argp[2] = checker;