Add a -f option to turn off the strict length checking for passphrases.

Also discourage its use in the manpage (and fix a couple of formatting nits).
This commit is contained in:
mjl 2000-09-14 19:18:24 +00:00
parent 03810b147f
commit 32f69fdac5
2 changed files with 22 additions and 10 deletions

View File

@ -1,4 +1,4 @@
.\" $NetBSD: skey.1,v 1.13 2000/07/07 15:18:14 mjl Exp $
.\" $NetBSD: skey.1,v 1.14 2000/09/14 19:18:24 mjl Exp $
.\"
.\" from: @(#)skey.1 1.1 10/28/93
.\"
@ -10,6 +10,7 @@
.Nd respond to an OTP challenge
.Sh SYNOPSIS
.Nm
.Op Fl f
.Op Fl n Ar count
.Op Fl p Ar password
.Op Fl t Ar hash
@ -104,10 +105,17 @@ The
allows the user to specify the
.Em S/Key
password on the command line.
To output the S/Key list in hexadecimal in addition to words,
.Pp
To output the S/Key list in hexadecimal instead of words,
use the
.Fl x
option.
.Pp
The
.Fl f
option can be used to override the
strict length checking for passwords. Do not use this option until you have
very good reason to do so, as shorter passwords violate RFC2289.
.Sh EXAMPLE
Initialize generation of one time passwords:
.Bd -literal -offset indent

View File

@ -1,4 +1,4 @@
/* $NetBSD: skey.c,v 1.12 2000/09/14 15:26:42 mjl Exp $ */
/* $NetBSD: skey.c,v 1.13 2000/09/14 19:18:24 mjl Exp $ */
/*
* S/KEY v1.1b (skey.c)
@ -23,7 +23,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: skey.c,v 1.12 2000/09/14 15:26:42 mjl Exp $");
__RCSID("$NetBSD: skey.c,v 1.13 2000/09/14 19:18:24 mjl Exp $");
#endif
#include <ctype.h>
@ -35,20 +35,24 @@ __RCSID("$NetBSD: skey.c,v 1.12 2000/09/14 15:26:42 mjl Exp $");
#include <string.h>
#include <unistd.h>
int main __P((int, char **));
void usage __P((char *));
int main(int, char **);
void usage(char *);
int
main(int argc, char **argv)
{
int n, cnt, i, pass = 0, hexmode = 0;
int n, cnt, i, pass = 0, hexmode = 0, force = 0;
char passwd[SKEY_MAX_PW_LEN+1], key[SKEY_BINKEY_SIZE];
char buf[33], *seed, *slash, *t;
cnt = 1;
while ((i = getopt(argc, argv, "n:p:t:x")) != -1) {
while ((i = getopt(argc, argv, "fn:p:t:x")) != -1) {
switch (i) {
case 'f':
force = 1;
break;
case 'n':
cnt = atoi(optarg);
break;
@ -120,7 +124,7 @@ main(int argc, char **argv)
exit(1);
}
if(strlen(passwd) < SKEY_MIN_PW_LEN)
if(strlen(passwd) < SKEY_MIN_PW_LEN && !force)
errx(1, "password must be at least %d long", SKEY_MIN_PW_LEN);
/* Crunch seed and password into starting key */
@ -150,7 +154,7 @@ usage(char *s)
{
fprintf(stderr,
"Usage: %s [-n count] [-p password ] [-t hash] [-x] sequence#"
"Usage: %s [-f] [-n count] [-p password ] [-t hash] [-x] sequence#"
"[/] key\n", s);
exit(1);
}