diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2001-06-19 01:49:46 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2001-06-19 01:49:46 +0000 |
commit | 729292aaf0b17cb2b1384ede26a43d717e9fe670 (patch) | |
tree | 019423d161e9874116e751d8c8db977189db0e79 /usr.bin | |
parent | 421bb083f0fbff240895632d4beeb36120e87ee9 (diff) |
Add a -a flag to support other authentication types.
Probably only useful in conjunction with a remote S/Key server.
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/skeyinfo/skeyinfo.1 | 12 | ||||
-rw-r--r-- | usr.bin/skeyinfo/skeyinfo.c | 34 |
2 files changed, 33 insertions, 13 deletions
diff --git a/usr.bin/skeyinfo/skeyinfo.1 b/usr.bin/skeyinfo/skeyinfo.1 index 248c87b736c..f0609869829 100644 --- a/usr.bin/skeyinfo/skeyinfo.1 +++ b/usr.bin/skeyinfo/skeyinfo.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: skeyinfo.1,v 1.4 2001/06/17 22:44:51 millert Exp $ +.\" $OpenBSD: skeyinfo.1,v 1.5 2001/06/19 01:49:45 millert Exp $ .\" .Dd 17 June 2001 .Dt SKEYINFO 1 @@ -8,6 +8,7 @@ .Nd obtain the next S/Key challenge for a user .Sh SYNOPSIS .Nm skeyinfo +.Op Fl a Ar auth-type .Op Fl v .Op Ar user .Sh DESCRIPTION @@ -16,7 +17,14 @@ prints out the next S/Key challenge for the specified user or for the current user if no user is specified. .Pp The options are as follows: -.Bl -tag -width Ds +.Bl -tag -width auth-typeXXXX +.It Fl a Ar auth-type +Specify an authentication type instead of the default +.Dq skey . +This can be used to get a challenge for a challenge/response authentication +mechanism other than S/Key, or if a remote S/Key server is in use. +Note that this will cause an error if the selected type +does not support challenge/response style authentication. .It Fl v Print the hash algorithm as well. .El diff --git a/usr.bin/skeyinfo/skeyinfo.c b/usr.bin/skeyinfo/skeyinfo.c index 80050068a69..fb0fc91009b 100644 --- a/usr.bin/skeyinfo/skeyinfo.c +++ b/usr.bin/skeyinfo/skeyinfo.c @@ -1,4 +1,4 @@ -/* $OpenBSD: skeyinfo.c,v 1.8 2001/06/17 22:54:44 millert Exp $ */ +/* $OpenBSD: skeyinfo.c,v 1.9 2001/06/19 01:49:45 millert Exp $ */ /* * Copyright (c) 1997, 2001 Todd C. Miller <Todd.Miller@courtesan.com> @@ -38,20 +38,24 @@ extern char *__progname; -void usage __P((void)); +void usage(void); int -main(argc, argv) - int argc; - char **argv; +main(int argc, char **argv) { struct passwd *pw; - char *challenge, *cp, *name = NULL; + char *style, *challenge, *cp, *name; int ch, verbose = 0; + login_cap_t *lc; auth_session_t *as; - while ((ch = getopt(argc, argv, "v")) != -1) + name = NULL; + style = "skey"; + while ((ch = getopt(argc, argv, "a:v")) != -1) switch(ch) { + case 'a': + style = optarg; + break; case 'v': verbose = 1; break; @@ -80,11 +84,17 @@ main(argc, argv) if ((name = strdup(pw->pw_name)) == NULL) err(1, "cannot allocate memory"); - as = auth_userchallenge(name, "skey", NULL, &challenge); + if ((lc = login_getclass(pw->pw_class)) == NULL) + errx(1, "unable to classify user %s", name); + + if ((cp = login_getstyle(lc, style, NULL)) == NULL) + errx(1, "unknown authentication method %s", style); + + as = auth_userchallenge(name, cp, NULL, &challenge); if (as == NULL || challenge == NULL) { if (as) auth_close(as); - errx(1, "unable to retrieve S/Key challenge for %s", name); + errx(1, "unable to retrieve challenge for %s", name); } /* @@ -107,8 +117,10 @@ main(argc, argv) } void -usage() +usage(void) { - (void)fprintf(stderr, "Usage: %s [-v] [user]\n", __progname); + + (void)fprintf(stderr, "Usage: %s [-a auth-type] [-v] [user]\n", + __progname); exit(1); } |