summaryrefslogtreecommitdiffstats
path: root/usr.bin/su
diff options
context:
space:
mode:
authorpst <pst@FreeBSD.org>1994-09-29 20:54:41 +0000
committerpst <pst@FreeBSD.org>1994-09-29 20:54:41 +0000
commitdef775d41d9008a9bd6b2b65d1bdbaf8d448a2e7 (patch)
treeaeb02a1f808fc1f87069d86a8409da5de4b1e0a7 /usr.bin/su
parent167c7cd1cdd0ef263ed5546ca3e8a41b2cc2e0ea (diff)
downloadFreeBSD-src-def775d41d9008a9bd6b2b65d1bdbaf8d448a2e7.zip
FreeBSD-src-def775d41d9008a9bd6b2b65d1bdbaf8d448a2e7.tar.gz
Add support for s/keys
Diffstat (limited to 'usr.bin/su')
-rw-r--r--usr.bin/su/Makefile8
-rw-r--r--usr.bin/su/su.c10
2 files changed, 16 insertions, 2 deletions
diff --git a/usr.bin/su/Makefile b/usr.bin/su/Makefile
index 4eeb2f6..c353734 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 f06ef2f..1928d1e 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,
OpenPOWER on IntegriCloud