diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 1996-09-29 21:27:03 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 1996-09-29 21:27:03 +0000 |
commit | bb9ee0bcdd99d1c4c105b4f7c7680a8035934681 (patch) | |
tree | c69d0411d9016c2b32190f8095bf920d5963e531 /lib/libskey/skeylogin.c | |
parent | 4466be9850425b8bec29fd728495340174337699 (diff) |
Towards RFC 1938 compliance. Also, now supports SHA (secure hash algorithm).
Diffstat (limited to 'lib/libskey/skeylogin.c')
-rw-r--r-- | lib/libskey/skeylogin.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/lib/libskey/skeylogin.c b/lib/libskey/skeylogin.c index 760faa6ab09..d315bafc5e1 100644 --- a/lib/libskey/skeylogin.c +++ b/lib/libskey/skeylogin.c @@ -8,7 +8,7 @@ * * S/KEY verification check, lookups, and authentication. * - * $Id: skeylogin.c,v 1.4 1996/09/29 04:30:39 millert Exp $ + * $Id: skeylogin.c,v 1.5 1996/09/29 21:27:01 millert Exp $ */ #include <sys/param.h> @@ -23,6 +23,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <ctype.h> #include <sys/types.h> #include <sys/stat.h> #include <time.h> @@ -52,12 +53,12 @@ getskeyprompt(mp, name, prompt) sevenbit(name); rval = skeylookup(mp, name); - (void)strcpy(prompt, "skey MD0 55 latour1\n"); + (void)strcpy(prompt, "otp-md0 55 latour1\n"); switch (rval) { case -1: /* File error */ return -1; case 0: /* Lookup succeeded, return challenge */ - (void)sprintf(prompt, "skey MD%d %d %s\n", skey_get_MDX(), + (void)sprintf(prompt, "otp-%s %d %s\n", skey_get_algorithm(), mp->n - 1, mp->seed); return 0; case 1: /* User not found */ @@ -87,7 +88,7 @@ skeychallenge(mp,name, ss) case -1: /* File error */ return -1; case 0: /* Lookup succeeded, issue challenge */ - (void)sprintf(ss, "skey MD%d %d %s", skey_get_MDX(), + (void)sprintf(ss, "otp-%s %d %s", skey_get_algorithm(), mp->n - 1, mp->seed); return 0; case 1: /* User not found */ @@ -139,13 +140,14 @@ skeylookup(mp,name) continue; if ((cp = strtok(NULL, " \t")) == NULL) continue; - /* Set MDX if specified, else use MD4 */ - if (cp[0] == 'M' && cp[1] == 'D') { - skey_set_MDX(atoi(&cp[2])); + /* Set hash type if specified, else use md4 */ + if (isalpha(*cp)) { + /* XXX - return val */ + skey_set_algorithm(cp); if ((cp = strtok(NULL, " \t")) == NULL) continue; } else { - skey_set_MDX(4); + skey_set_algorithm("md4"); } mp->n = atoi(cp); if ((mp->seed = strtok(NULL, " \t")) == NULL) @@ -248,8 +250,8 @@ skeyverify(mp,response) btoa8(mp->val,key); mp->n--; (void)fseek(mp->keyfile, mp->recstart, SEEK_SET); - (void)fprintf(mp->keyfile, "%s MD%d %04d %-16s %s %-21s\n", - mp->logname, skey_get_MDX(), mp->n, mp->seed, mp->val, tbuf); + (void)fprintf(mp->keyfile, "%s %s %04d %-16s %s %-21s\n", + mp->logname, skey_get_algorithm(), mp->n, mp->seed, mp->val, tbuf); (void)fclose(mp->keyfile); |