mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-12-26 13:05:18 +01:00
Use err(3). Rewrote man page in mdoc format.
This commit is contained in:
parent
15fc002be8
commit
ca22ec7d08
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=27444
@ -1,24 +1,26 @@
|
||||
.ll 6i
|
||||
.pl 10.5i
|
||||
.\" @(#)key.1 1.0 (Bellcore) 12/2/91
|
||||
.\" from: @(#)key.1 1.0 (Bellcore) 12/2/91
|
||||
.\" $Id$
|
||||
.\"
|
||||
.lt 6.0i
|
||||
.TH KEY 1 "2 December 1991"
|
||||
.AT 3
|
||||
.SH NAME
|
||||
key \- Stand\-alone program for computing responses to S/Key challenges.
|
||||
.SH SYNOPSIS
|
||||
.B key [\-n <count>] <Sequence> <key>
|
||||
.SH DESCRIPTION
|
||||
.I key
|
||||
Takes the optional count of the number of one time access
|
||||
.Dd December 2, 1991
|
||||
.Dt KEY 1
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm key
|
||||
.Nd stand\-alone program for computing responses to S/Key challenges
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl n Ar count
|
||||
.Ar sequence
|
||||
.Ar key
|
||||
.Sh DESCRIPTION
|
||||
.Nm Key
|
||||
takes the optional count of the number of one time access
|
||||
passwords to print
|
||||
along with a (maximum) sequence number and key as command line args,
|
||||
it prompts for the user's secret password, and produces both word
|
||||
and hex format responses.
|
||||
.SH EXAMPLE
|
||||
.sh
|
||||
Usage example:
|
||||
.Sh EXAMPLE
|
||||
Usage example:
|
||||
.sp 0
|
||||
>key \-n 5 99 th91334
|
||||
.sp 0
|
||||
@ -29,21 +31,18 @@ and hex format responses.
|
||||
.... 4 more passwords.
|
||||
.sp 0
|
||||
>
|
||||
.LP
|
||||
.SH OPTIONS
|
||||
.LP
|
||||
.B \-n <count>
|
||||
the number of one time access passwords to print.
|
||||
.Sh OPTIONS
|
||||
.Bl -tag -width indent
|
||||
.It Fl n Ar count
|
||||
The number of one time access passwords to print.
|
||||
The default is one.
|
||||
.SH DIAGNOSTICS
|
||||
.SH BUGS
|
||||
.LP
|
||||
.SH SEE ALSO
|
||||
.BR skey(1),
|
||||
.BR keyinit(1),
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr keyinfo 1 ,
|
||||
.Xr keyinit 1 ,
|
||||
.Xr skey 1
|
||||
.\" .BR keysu(1),
|
||||
.BR keyinfo(1)
|
||||
.SH AUTHOR
|
||||
.Sh AUTHOR
|
||||
Command by Phil Karn, Neil M. Haller, John S. Walden
|
||||
.SH CONTACT
|
||||
.Sh CONTACT
|
||||
staff@thumper.bellcore.com
|
||||
|
@ -9,9 +9,12 @@
|
||||
* C848 666B 6435 0A93
|
||||
* >
|
||||
*/
|
||||
|
||||
#include <err.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifdef __MSDOS__
|
||||
#include <dos.h>
|
||||
@ -21,11 +24,7 @@
|
||||
|
||||
#include <skey.h>
|
||||
|
||||
char *readpass();
|
||||
void usage();
|
||||
int getopt();
|
||||
extern int optind;
|
||||
extern char *optarg;
|
||||
static void usage __P((void));
|
||||
|
||||
int
|
||||
main(argc,argv)
|
||||
@ -33,7 +32,7 @@ int argc;
|
||||
char *argv[];
|
||||
{
|
||||
int n,cnt,i;
|
||||
char passwd[256],passwd2[256];
|
||||
char passwd[256] /* ,passwd2[256] */;
|
||||
char key[8];
|
||||
char *seed;
|
||||
char buf[33];
|
||||
@ -50,31 +49,25 @@ char *argv[];
|
||||
/* could be in the form <number>/<seed> */
|
||||
if(argc <= optind + 1){
|
||||
/*look for / in it */
|
||||
if(argc <= optind){
|
||||
usage(argv[0]);
|
||||
return 1;
|
||||
}
|
||||
if(argc <= optind)
|
||||
usage();
|
||||
|
||||
slash = strchr(argv[optind], '/');
|
||||
if(slash == NULL){
|
||||
usage(argv[0]);
|
||||
return 1;
|
||||
}
|
||||
if(slash == NULL)
|
||||
usage();
|
||||
*slash++ = '\0';
|
||||
seed = slash;
|
||||
|
||||
if((n = atoi(argv[optind])) < 0){
|
||||
fprintf(stderr,"%s not positive\n",argv[optind]);
|
||||
usage(argv[0]);
|
||||
return 1;
|
||||
usage();
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
if((n = atoi(argv[optind])) < 0){
|
||||
fprintf(stderr,"%s not positive\n",argv[optind]);
|
||||
usage(argv[0]);
|
||||
return 1;
|
||||
usage();
|
||||
}
|
||||
seed = argv[++optind];
|
||||
}
|
||||
@ -95,10 +88,8 @@ char *argv[];
|
||||
}
|
||||
|
||||
/* Crunch seed and password into starting key */
|
||||
if(keycrunch(key,seed,passwd) != 0){
|
||||
fprintf(stderr,"%s: key crunch failed\n",argv[0]);
|
||||
return 1;
|
||||
}
|
||||
if(keycrunch(key,seed,passwd) != 0)
|
||||
errx(1, "key crunch failed");
|
||||
if(cnt == 1){
|
||||
while(n-- != 0)
|
||||
f(key);
|
||||
@ -121,9 +112,9 @@ char *argv[];
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
usage(s)
|
||||
char *s;
|
||||
static void
|
||||
usage()
|
||||
{
|
||||
fprintf(stderr,"Usage: %s [-n count] <sequence #>[/] <key> \n",s);
|
||||
fprintf(stderr,"usage: key [-n count] <sequence #>[/] <key>\n");
|
||||
exit(1);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user