summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorFlorian Obser <florian@cvs.openbsd.org>2014-03-17 22:39:20 +0000
committerFlorian Obser <florian@cvs.openbsd.org>2014-03-17 22:39:20 +0000
commit3878c6e0a989a8c7f6970e7f39e2dbd1d61655f9 (patch)
treedf042f5e39bf673824fead80d8db80a6a901fcca /usr.bin
parentef4d3da7dae2f59c17bf48064dcf3382c2e6a860 (diff)
Stop nagging after 5 non-bcrypt hashes
OK benno
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/htpasswd/htpasswd.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/usr.bin/htpasswd/htpasswd.c b/usr.bin/htpasswd/htpasswd.c
index f855bce2c40..401dfd3ab48 100644
--- a/usr.bin/htpasswd/htpasswd.c
+++ b/usr.bin/htpasswd/htpasswd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: htpasswd.c,v 1.5 2014/03/17 22:37:53 florian Exp $ */
+/* $OpenBSD: htpasswd.c,v 1.6 2014/03/17 22:39:19 florian Exp $ */
/*
* Copyright (c) 2014 Florian Obser <florian@openbsd.org>
*
@@ -40,6 +40,9 @@ usage(void)
exit(1);
}
+#define MAXNAG 5
+int nagcount;
+
int
main(int argc, char** argv)
{
@@ -159,6 +162,9 @@ main(int argc, char** argv)
if (in != NULL && unlink(tmpl) == -1)
err(1, "cannot delete temp file (%s)", tmpl);
}
+ if (nagcount >= MAXNAG)
+ fprintf(stderr, "%d more logins not using bcryt.\n",
+ nagcount - MAXNAG);
exit(0);
}
@@ -169,7 +175,10 @@ nag(char* line)
if (strtok(line, ":") != NULL)
if ((tok = strtok(NULL, ":")) != NULL)
if (strncmp(tok, "$2a$", 4) != 0 &&
- strncmp(tok, "$2b$", 4) != 0)
- fprintf(stderr, "%s doesn't use bcrypt."
- " Update the password.\n", line);
+ strncmp(tok, "$2b$", 4) != 0) {
+ nagcount++;
+ if (nagcount <= MAXNAG)
+ fprintf(stderr, "%s doesn't use bcrypt."
+ " Update the password.\n", line);
+ }
}