=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/skeyinfo/skeyinfo.c,v retrieving revision 1.8 retrieving revision 1.9 diff -c -r1.8 -r1.9 *** src/usr.bin/skeyinfo/skeyinfo.c 2001/06/17 22:54:44 1.8 --- src/usr.bin/skeyinfo/skeyinfo.c 2001/06/19 01:49:45 1.9 *************** *** 1,4 **** ! /* $OpenBSD: skeyinfo.c,v 1.8 2001/06/17 22:54:44 millert Exp $ */ /* * Copyright (c) 1997, 2001 Todd C. Miller --- 1,4 ---- ! /* $OpenBSD: skeyinfo.c,v 1.9 2001/06/19 01:49:45 millert Exp $ */ /* * Copyright (c) 1997, 2001 Todd C. Miller *************** *** 38,57 **** extern char *__progname; ! void usage __P((void)); int ! main(argc, argv) ! int argc; ! char **argv; { struct passwd *pw; ! char *challenge, *cp, *name = NULL; int ch, verbose = 0; auth_session_t *as; ! while ((ch = getopt(argc, argv, "v")) != -1) switch(ch) { case 'v': verbose = 1; break; --- 38,61 ---- extern char *__progname; ! void usage(void); int ! main(int argc, char **argv) { struct passwd *pw; ! char *style, *challenge, *cp, *name; int ch, verbose = 0; + login_cap_t *lc; auth_session_t *as; ! 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,90 **** if ((name = strdup(pw->pw_name)) == NULL) err(1, "cannot allocate memory"); ! as = auth_userchallenge(name, "skey", NULL, &challenge); if (as == NULL || challenge == NULL) { if (as) auth_close(as); ! errx(1, "unable to retrieve S/Key challenge for %s", name); } /* --- 84,100 ---- if ((name = strdup(pw->pw_name)) == NULL) err(1, "cannot allocate memory"); ! 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 challenge for %s", name); } /* *************** *** 107,114 **** } void ! usage() { ! (void)fprintf(stderr, "Usage: %s [-v] [user]\n", __progname); exit(1); } --- 117,126 ---- } void ! usage(void) { ! ! (void)fprintf(stderr, "Usage: %s [-a auth-type] [-v] [user]\n", ! __progname); exit(1); }