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$
.\"
.Dd October 23, 2015
.Dd January 9, 2016
.Dt OATHKEY 1
.Os
.Sh NAME
@ -78,7 +78,8 @@ The commands are:
Compute and display the current code for the given key.
If a count is specified, compute and display
.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
reuse.
.It Cm genkey Ar hotp | totp

View File

@ -297,7 +297,7 @@ oathkey_calc(int argc, char *argv[])
return (RET_USAGE);
if (argc > 0) {
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);
} else {
n = 1;