Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 9 Jul 1998 23:26:44 -0500 (CDT)
From:      "Brent J. Nordquist" <bjn@visi.com>
To:        freebsd-alpha@FreeBSD.ORG
Subject:   Alpha S/Key fixed/verified
Message-ID:  <199807100426.XAA27506@thumper.visi.com>

next in thread | raw e-mail | index | archive | help
I have fixed/verified the following:

   lib/libmd          ?    [MD4 and MD5 seem to work]
   lib/libskey      Green
	usr.bin/key      Green
	usr.bin/keyinfo  Green  [bright green--it's a perl script :-)]
	usr.bin/keyinit  Green

I've tested the S/Key tools, verified that they're interoperable with the
i386 ones (see below), and verified that S/Key authentication works in su.
(I expect login and ftpd to work also; on the list for tomorrow.)

Enclosed are the following:

(1)  A patch to lib/libskey/skeysubr.c -- u_long was used to select a
32-bit quantity, which breaks on the Alpha.  I'm sure we're going to
see a lot of these.  Do we have an agreed-on method of handling them?
(Is there a type that's mapped to 32 bits on all systems, or are we just
going to use unsigned int as that type?)  If there's a type that should
be used, then this patch should change.

(2)  A patch to usr.bin/keyinit/skeyinit.c -- FreeBSD's gethostname()
will give you as many characters as it can, given the limit of the
passed buffer.  NetBSD's gethostname() returns -1 if the full name
won't fit.  This patch solves the problem, and seems like a good idea
in general, apart from the Alpha effort (it's much more consistent with
how gethostname() is handled in su, login, etc.).

(3)  A patch to usr.bin/su/Makefile -- was missing -lmd after -lskey
(non-Alpha-specific, but tripped us up:)

(4)  A patch to lib/libskey/Makefile -- is the comment below because
of the MD4 unresolved links, above?  MD5 was probably being found in
-lcrypt, and that's why it worked whereas MD4 needed -lmd.

   revision 1.12
   date: 1998/05/11 09:15:03;  author: jb;  state: Exp;  lines: +6 -1
   [...]
   And for some reason, alpha needs MD5. Find that out later!

I changed the Makefile back to use MD4 like i386 does, and ended up with
a set of key* tools that are interoperable with my i386 box.  I think
this is a desirable goal.

Index: lib/libskey/skeysubr.c
===================================================================
RCS file: /var/cvs/src/lib/libskey/skeysubr.c,v
retrieving revision 1.8
diff -u -r1.8 skeysubr.c
--- skeysubr.c	1998/02/27 22:36:51	1.8
+++ skeysubr.c	1998/07/10 03:18:39
@@ -21,7 +21,7 @@
 {
 	char *buf;
 	MDX_CTX md;
-	u_long results[4];
+	unsigned int results[4];
 	unsigned int buflen;
 
 	buflen = strlen(seed) + strlen(passwd);
@@ -51,7 +51,7 @@
 char *x;
 {
 	MDX_CTX md;
-	u_long results[4];
+	unsigned int results[4];
 
 	MDXInit(&md);
 	MDXUpdate(&md,(unsigned char *)x,8);

Index: usr.bin/keyinit/skeyinit.c
===================================================================
RCS file: /var/cvs/src/usr.bin/keyinit/skeyinit.c,v
retrieving revision 1.7
diff -u -r1.7 skeyinit.c
--- skeyinit.c	1997/07/17 06:42:26	1.7
+++ skeyinit.c	1998/07/10 03:43:17
@@ -1,6 +1,8 @@
 /*   change password or add user to S/KEY authentication system.
  *   S/KEY is a tradmark of Bellcore  */
 
+#include <sys/param.h>
+
 #include <ctype.h>
 #include <err.h>
 #include <pwd.h>
@@ -24,7 +26,7 @@
 	char seed[18],tmp[80],key[8];
 	struct passwd *ppuser,*pp;
 	char defaultseed[17], passwd[256],passwd2[256] ;
-
+	char localhost[MAXHOSTNAMELEN];
 
 	time_t now;
 	struct tm *tm;
@@ -39,8 +41,10 @@
 #else
 	sprintf(tbuf, "%05ld", (long) (now % 100000));
 #endif
-	gethostname(defaultseed,NAMELEN);
-	strcpy(&defaultseed[NAMELEN],tbuf);
+	gethostname(localhost,sizeof(localhost));
+	strncpy(defaultseed,localhost,NAMELEN);
+	defaultseed[NAMELEN] = '\0';
+	strcat(defaultseed,tbuf);
 
 	pp = ppuser = getpwuid(getuid());
 	strcpy(me,pp->pw_name);

Index: usr.bin/su/Makefile
===================================================================
RCS file: /var/cvs/src/usr.bin/su/Makefile,v
retrieving revision 1.15
diff -u -r1.15 Makefile
--- Makefile	1997/09/28 09:02:15	1.15
+++ Makefile	1998/07/10 03:48:23
@@ -10,7 +10,7 @@
 
 .if !defined(LC_AUTH)
 COPTS+=	-DSKEY
-LDADD+= -lskey -lcrypt
+LDADD+= -lskey -lmd -lcrypt
 DPADD+= ${LIBSKEY} ${LIBCRYPT}
 .endif
 

Index: lib/libskey/Makefile
===================================================================
RCS file: /var/cvs/src/lib/libskey/Makefile,v
retrieving revision 1.12
diff -u -r1.12 Makefile
--- Makefile	1998/05/11 09:15:03	1.12
+++ Makefile	1998/07/10 04:10:55
@@ -13,8 +13,6 @@
 CFLAGS+=-W -Wall
 .if ${MACHINE_ARCH} == "i386"
 CFLAGS+=-Werror
-.else
-CFLAGS+=-DMD5
 .endif
 
 .if ${BINFORMAT} == elf

-- 
Brent J. Nordquist / bjn@visi.com
W: +1 612 905-7806

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-alpha" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199807100426.XAA27506>