From 122c9247d493a97d5caf93de78cd8e59319ba4b9 Mon Sep 17 00:00:00 2001 From: Paul Traina Date: Thu, 29 Sep 1994 20:54:41 +0000 Subject: [PATCH] Add support for s/keys --- usr.bin/su/Makefile | 8 ++++++-- usr.bin/su/su.c | 10 ++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/usr.bin/su/Makefile b/usr.bin/su/Makefile index 4eeb2f689ca5..c353734dd7e8 100644 --- a/usr.bin/su/Makefile +++ b/usr.bin/su/Makefile @@ -1,8 +1,12 @@ # @(#)Makefile 8.1 (Berkeley) 7/19/93 PROG= su -LDADD= -lcrypt -DPADD= ${LIBCRYPT} +LDADD= -lcrypt -lskey +DPADD= ${LIBCRYPT} ${LIBSKEY} +SRCS= su.c login_skey.c +CFLAGS+=-DSKEY + +.PATH: ${.CURDIR}/../login .if exists(${DESTDIR}/usr/lib/libkrb.a) && (defined(MAKE_KERBEROS) \ || defined(MAKE_EBONES)) diff --git a/usr.bin/su/su.c b/usr.bin/su/su.c index f06ef2f0b2e7..1928d1ee4a22 100644 --- a/usr.bin/su/su.c +++ b/usr.bin/su/su.c @@ -68,6 +68,10 @@ int use_kerberos = 1; #define ARGSTR "-flm" #endif +#ifdef SKEY +char *skey_crypt(), *skey_getpass(); +#endif + char *ontty __P((void)); int chshell __P((char *)); @@ -165,8 +169,14 @@ main(argc, argv) } /* if target requires a password, verify it */ if (*pwd->pw_passwd) { +#ifdef SKEY + p = skey_getpass("Password:", pwd, 1); + if (strcmp(pwd->pw_passwd, + skey_crypt(p, pwd->pw_passwd, pwd, 1))) { +#else p = getpass("Password:"); if (strcmp(pwd->pw_passwd, crypt(p, pwd->pw_passwd))) { +#endif fprintf(stderr, "Sorry\n"); syslog(LOG_AUTH|LOG_WARNING, "BAD SU %s to %s%s", username,