summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1996-09-29 23:35:09 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1996-09-29 23:35:09 +0000
commit3f7b16c739dc62343bb67257b431b8fd3501f740 (patch)
treebc0b9a5498f9f57588ec4365d8de2ceae7cbe0ae /lib
parent103b540ce5dee37aeaef502bab9a84c01cc5aac2 (diff)
check skey_set_algorithm() ret val + pedantry.
Diffstat (limited to 'lib')
-rw-r--r--lib/libskey/skeylogin.c27
-rw-r--r--lib/libskey/skeysubr.c12
2 files changed, 21 insertions, 18 deletions
diff --git a/lib/libskey/skeylogin.c b/lib/libskey/skeylogin.c
index d315bafc5e1..b5972f674a2 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.5 1996/09/29 21:27:01 millert Exp $
+ * $Id: skeylogin.c,v 1.6 1996/09/29 23:35:08 millert Exp $
*/
#include <sys/param.h>
@@ -76,7 +76,7 @@ getskeyprompt(mp, name, prompt)
* record.
*/
int
-skeychallenge(mp,name, ss)
+skeychallenge(mp, name, ss)
struct skey *mp;
char *name;
char *ss;
@@ -105,7 +105,7 @@ skeychallenge(mp,name, ss)
* 1: entry not found, file R/W pointer positioned at EOF
*/
int
-skeylookup(mp,name)
+skeylookup(mp, name)
struct skey *mp;
char *name;
{
@@ -142,12 +142,15 @@ skeylookup(mp,name)
continue;
/* Set hash type if specified, else use md4 */
if (isalpha(*cp)) {
- /* XXX - return val */
- skey_set_algorithm(cp);
+ if (skey_set_algorithm(cp) == NULL)
+ warnx("Unknown hash algorithm %s, using %s",
+ cp, skey_get_algorithm());
if ((cp = strtok(NULL, " \t")) == NULL)
continue;
} else {
- skey_set_algorithm("md4");
+ if (skey_set_algorithm("md4") == NULL)
+ warnx("Unknown hash algorithm md4, using %s",
+ skey_get_algorithm());
}
mp->n = atoi(cp);
if ((mp->seed = strtok(NULL, " \t")) == NULL)
@@ -176,7 +179,7 @@ skeylookup(mp,name)
* The database file is always closed by this call.
*/
int
-skeyverify(mp,response)
+skeyverify(mp, response)
struct skey *mp;
char *response;
{
@@ -206,7 +209,7 @@ skeyverify(mp,response)
}
/* Compute fkey = f(key) */
- (void)memcpy(fkey,key,sizeof(key));
+ (void)memcpy(fkey, key, sizeof(key));
(void)fflush(stdout);
f(fkey);
@@ -227,10 +230,10 @@ skeyverify(mp,response)
}
rip(mp->buf);
mp->logname = strtok(mp->buf, " \t");
- cp = strtok(NULL," \t") ;
- cp = strtok(NULL," \t") ;
- mp->seed = strtok(NULL," \t");
- mp->val = strtok(NULL," \t");
+ cp = strtok(NULL, " \t") ;
+ cp = strtok(NULL, " \t") ;
+ mp->seed = strtok(NULL, " \t");
+ mp->val = strtok(NULL, " \t");
/* And convert file value to hex for comparison */
atob8(filekey, mp->val);
diff --git a/lib/libskey/skeysubr.c b/lib/libskey/skeysubr.c
index 8907592c62f..943978fc5eb 100644
--- a/lib/libskey/skeysubr.c
+++ b/lib/libskey/skeysubr.c
@@ -10,7 +10,7 @@
*
* S/KEY misc routines.
*
- * $Id: skeysubr.c,v 1.4 1996/09/29 21:27:02 millert Exp $
+ * $Id: skeysubr.c,v 1.5 1996/09/29 23:35:07 millert Exp $
*/
#include <stdio.h>
@@ -93,7 +93,7 @@ keycrunch_md4(result, seed, passwd)
sevenbit(buf);
MD4Init(&md);
MD4Update(&md, (unsigned char *)buf, buflen);
- MD4Final((unsigned char *)results ,&md);
+ MD4Final((unsigned char *)results, &md);
(void)free(buf);
/* Fold result from 128 to 64 bits */
@@ -126,7 +126,7 @@ keycrunch_md5(result, seed, passwd)
sevenbit(buf);
MD5Init(&md);
MD5Update(&md, (unsigned char *)buf, buflen);
- MD5Final((unsigned char *)results ,&md);
+ MD5Final((unsigned char *)results, &md);
(void)free(buf);
/* Fold result from 128 to 64 bits */
@@ -423,14 +423,14 @@ skey_set_algorithm(new)
int i;
for (i = 0; i < SKEY_ALGORITH_MAX; i++) {
- /* XXX - should be case *sensitive* */
+ /* XXX - should be case *sensitive* but need to wait a bit. */
if (strcasecmp(new, skey_algorithm_table[i].name) == 0) {
skey_hash_type = i;
- return(new);
+ return new;
}
}
- return(NULL);
+ return NULL;
}
/* Get current hash type */