diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 1996-10-14 03:09:14 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 1996-10-14 03:09:14 +0000 |
commit | 5a253032c960893f9d045131f51e6dc5775ef61c (patch) | |
tree | 2775f6e69de9e187e29d96d7e0e71637b818b8c2 | |
parent | a5e27f1969cbd566e6d6ecb6f7e5e50a270cc6b2 (diff) |
htoi now takes an int, not char.
Only skey_set_algorithm() for the record that matches target user.
-rw-r--r-- | lib/libskey/skey.h | 4 | ||||
-rw-r--r-- | lib/libskey/skeylogin.c | 28 | ||||
-rw-r--r-- | lib/libskey/skeysubr.c | 4 |
3 files changed, 20 insertions, 16 deletions
diff --git a/lib/libskey/skey.h b/lib/libskey/skey.h index df85d92bfad..fbe648da499 100644 --- a/lib/libskey/skey.h +++ b/lib/libskey/skey.h @@ -11,7 +11,7 @@ * * Main client header * - * $Id: skey.h,v 1.5 1996/09/30 04:10:45 millert Exp $ + * $Id: skey.h,v 1.6 1996/10/14 03:09:12 millert Exp $ */ /* Server-side data structure for reading keys file during login */ @@ -56,6 +56,6 @@ int skey_haskey __P((char *username)); int getskeyprompt __P((struct skey *mp, char *name, char *prompt)); int atob8 __P((char *out, char *in)); int btoa8 __P((char *out, char *in)); -int htoi __P((char c)); +int htoi __P((int c)); const char * skey_get_algorithm __P((void)); char * skey_set_algorithm __P((char *new)); diff --git a/lib/libskey/skeylogin.c b/lib/libskey/skeylogin.c index 8762a31302a..d7f05a9993a 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.8 1996/10/02 03:49:36 millert Exp $ + * $Id: skeylogin.c,v 1.9 1996/10/14 03:09:13 millert Exp $ */ #include <sys/param.h> @@ -21,6 +21,7 @@ #include <stdio.h> #include <stdlib.h> +#include <unistd.h> #include <string.h> #include <ctype.h> #include <sys/types.h> @@ -30,7 +31,9 @@ #include "skey.h" +#ifndef _PATH_KEYFILE #define _PATH_KEYFILE "/etc/skeykeys" +#endif char *skipspace __P((char *)); int skeylookup __P((struct skey *, char *)); @@ -110,7 +113,7 @@ skeylookup(mp, name) { int found = 0; long recstart = 0; - char *cp; + char *cp, *ht; struct stat statbuf; /* See if _PATH_KEYFILE exists, and create it if not */ @@ -129,9 +132,8 @@ skeylookup(mp, name) while (!feof(mp->keyfile)) { recstart = ftell(mp->keyfile); mp->recstart = recstart; - if (fgets(mp->buf, sizeof(mp->buf), mp->keyfile) != mp->buf) { + if (fgets(mp->buf, sizeof(mp->buf), mp->keyfile) != mp->buf) break; - } rip(mp->buf); if (mp->buf[0] == '#') continue; /* Comment */ @@ -139,17 +141,13 @@ skeylookup(mp, name) continue; if ((cp = strtok(NULL, " \t")) == NULL) continue; - /* Set hash type if specified, else use md4 */ + /* Save hash type if specified, else use md4 */ if (isalpha(*cp)) { - if (skey_set_algorithm(cp) == NULL) - warnx("Unknown hash algorithm %s, using %s", - cp, skey_get_algorithm()); + ht = cp; if ((cp = strtok(NULL, " \t")) == NULL) continue; } else { - if (skey_set_algorithm("md4") == NULL) - warnx("Unknown hash algorithm md4, using %s", - skey_get_algorithm()); + ht = "md4"; } mp->n = atoi(cp); if ((mp->seed = strtok(NULL, " \t")) == NULL) @@ -163,9 +161,15 @@ skeylookup(mp, name) } if (found) { (void)fseek(mp->keyfile, recstart, SEEK_SET); + /* Set hash type */ + if (skey_set_algorithm(ht) == NULL) { + warnx("Unknown hash algorithm %s, using %s", ht, + skey_get_algorithm()); + } return 0; - } else + } else { return 1; + } } /* Verify response to a s/key challenge. diff --git a/lib/libskey/skeysubr.c b/lib/libskey/skeysubr.c index 05809a9ec78..70b4093272e 100644 --- a/lib/libskey/skeysubr.c +++ b/lib/libskey/skeysubr.c @@ -10,7 +10,7 @@ * * S/KEY misc routines. * - * $Id: skeysubr.c,v 1.9 1996/09/30 23:54:38 millert Exp $ + * $Id: skeysubr.c,v 1.10 1996/10/14 03:09:13 millert Exp $ */ #include <stdio.h> @@ -366,7 +366,7 @@ btoa8(out, in) /* Convert hex digit to binary integer */ int htoi(c) - register char c; + register int c; { if ('0' <= c && c <= '9') return c - '0'; |