summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>1996-10-02 03:49:34 +0000
committermillert <millert@openbsd.org>1996-10-02 03:49:34 +0000
commitde689b2811a90ec3686e532e5efdb2bbadeb6005 (patch)
tree7ff7e633191097918b3e1e2c21522c7a5547aff2
parentSupport for call graph detection using the -c options on i386 (diff)
downloadwireguard-openbsd-de689b2811a90ec3686e532e5efdb2bbadeb6005.tar.xz
wireguard-openbsd-de689b2811a90ec3686e532e5efdb2bbadeb6005.zip
Fix a bug wrt handling of old md4 entries. Now don't save a type with md4
so we don't go over the record size and munge other entries. Don't export symbols we don't need to in put.c.
-rw-r--r--lib/libskey/put.c4
-rw-r--r--lib/libskey/skeylogin.c16
-rw-r--r--usr.bin/skeyinit/skeyinit.c17
3 files changed, 25 insertions, 12 deletions
diff --git a/lib/libskey/put.c b/lib/libskey/put.c
index fe05e160a05..6b2636225b5 100644
--- a/lib/libskey/put.c
+++ b/lib/libskey/put.c
@@ -8,7 +8,7 @@
*
* Dictionary lookup and extraction.
*
- * $Id: put.c,v 1.3 1996/09/30 04:10:43 millert Exp $
+ * $Id: put.c,v 1.4 1996/10/02 03:49:37 millert Exp $
*/
#include <stdio.h>
@@ -23,7 +23,7 @@ static void insert __P ((char *s, int x, int start, int length));
static int wsrch __P ((char *w, int low, int high));
/* Dictionary for integer-word translations */
-char Wp[2048][4] = {
+static char Wp[2048][4] = {
"A",
"ABE",
"ACE",
diff --git a/lib/libskey/skeylogin.c b/lib/libskey/skeylogin.c
index 38cd82c5df9..8762a31302a 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.7 1996/09/30 04:10:46 millert Exp $
+ * $Id: skeylogin.c,v 1.8 1996/10/02 03:49:36 millert Exp $
*/
#include <sys/param.h>
@@ -17,7 +17,6 @@
#endif
#include <sys/stat.h>
#include <sys/time.h>
-#include <sys/timeb.h>
#include <sys/resource.h>
#include <stdio.h>
@@ -231,7 +230,8 @@ skeyverify(mp, response)
rip(mp->buf);
mp->logname = strtok(mp->buf, " \t");
cp = strtok(NULL, " \t") ;
- cp = strtok(NULL, " \t") ;
+ if (isalpha(*cp))
+ cp = strtok(NULL, " \t") ;
mp->seed = strtok(NULL, " \t");
mp->val = strtok(NULL, " \t");
/* And convert file value to hex for comparison */
@@ -253,8 +253,14 @@ skeyverify(mp, response)
btoa8(mp->val,key);
mp->n--;
(void)fseek(mp->keyfile, mp->recstart, SEEK_SET);
- (void)fprintf(mp->keyfile, "%s %s %04d %-16s %s %-21s\n",
- mp->logname, skey_get_algorithm(), mp->n, mp->seed, mp->val, tbuf);
+ /* Don't save algorithm type for md4 (keep record length same) */
+ if (strcmp(skey_get_algorithm(), "md4") == 0)
+ (void)fprintf(mp->keyfile, "%s %04d %-16s %s %-21s\n",
+ mp->logname, mp->n, mp->seed, mp->val, tbuf);
+ else
+ (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);
diff --git a/usr.bin/skeyinit/skeyinit.c b/usr.bin/skeyinit/skeyinit.c
index eb4271489f9..421c97a7a1c 100644
--- a/usr.bin/skeyinit/skeyinit.c
+++ b/usr.bin/skeyinit/skeyinit.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: skeyinit.c,v 1.11 1996/09/30 18:49:55 millert Exp $ */
+/* $OpenBSD: skeyinit.c,v 1.12 1996/10/02 03:49:34 millert Exp $ */
/* $NetBSD: skeyinit.c,v 1.6 1995/06/05 19:50:48 pk Exp $ */
/* S/KEY v1.1b (skeyinit.c)
@@ -141,7 +141,8 @@ main(argc, argv)
exit(skeyzero(&skey, pp->pw_name));
(void)printf("[Updating %s]\n", pp->pw_name);
- (void)printf("Old key: %s\n", skey.seed);
+ (void)printf("Old key: [%s] %s\n", skey_get_algorithm(),
+ skey.seed);
/*
* Lets be nice if they have a skey.seed that
@@ -284,13 +285,19 @@ main(argc, argv)
btoa8(skey.val, key);
- (void)fprintf(skey.keyfile, "%s %s %04d %-16s %s %-21s\n",
- pp->pw_name, skey_get_algorithm(), n, seed, skey.val, tbuf);
+ /* Don't save algorithm type for md4 (keep record length same) */
+ if (strcmp(skey_get_algorithm(), "md4") == 0)
+ (void)fprintf(skey.keyfile, "%s s %04d %-16s %s %-21s\n",
+ pp->pw_name, n, seed, skey.val, tbuf);
+ else
+ (void)fprintf(skey.keyfile, "%s %s %04d %-16s %s %-21s\n",
+ pp->pw_name, skey_get_algorithm(), n, seed, skey.val, tbuf);
(void)fclose(skey.keyfile);
(void)setpriority(PRIO_PROCESS, 0, 0);
- (void)printf("\nID %s skey is %d %s\n", pp->pw_name, n, seed);
+ (void)printf("\nID %s skey is otp-%s %d %s\n", pp->pw_name,
+ skey_get_algorithm(), n, seed);
(void)printf("Next login password: %s\n\n",
hexmode ? put8(buf, key) : btoe(buf, key));
exit(0);