Set an upper limit to the number of codes generated by the calc command.

git-svn-id: svn+ssh://svn.openpam.org/svn/openpam/trunk@882 185d5e19-27fe-0310-9dcf-9bff6b9f3609
This commit is contained in:
Dag-Erling Smørgrav 2016-01-09 18:41:46 +00:00
parent 9ff1a454ce
commit 41a50e0c57
2 changed files with 4 additions and 3 deletions

View File

@ -28,7 +28,7 @@
.\" .\"
.\" $Id$ .\" $Id$
.\" .\"
.Dd October 23, 2015 .Dd January 9, 2016
.Dt OATHKEY 1 .Dt OATHKEY 1
.Os .Os
.Sh NAME .Sh NAME
@ -78,7 +78,8 @@ The commands are:
Compute and display the current code for the given key. Compute and display the current code for the given key.
If a count is specified, compute and display If a count is specified, compute and display
.Ar count .Ar count
codes in total, starting with the current code. codes in total, starting with the current code, up to a maximum of
1,000 codes.
If writeback mode is enabled, the user's keyfile is updated to prevent If writeback mode is enabled, the user's keyfile is updated to prevent
reuse. reuse.
.It Cm genkey Ar hotp | totp .It Cm genkey Ar hotp | totp

View File

@ -297,7 +297,7 @@ oathkey_calc(int argc, char *argv[])
return (RET_USAGE); return (RET_USAGE);
if (argc > 0) { if (argc > 0) {
n = strtoul(argv[0], &end, 10); n = strtoul(argv[0], &end, 10);
if (end == argv[0] || *end != '\0' || n < 1) if (end == argv[0] || *end != '\0' || n < 1 || n > 1000)
return (RET_USAGE); return (RET_USAGE);
} else { } else {
n = 1; n = 1;