diff options
author | Hans Insulander <hin@cvs.openbsd.org> | 2001-06-26 20:16:44 +0000 |
---|---|---|
committer | Hans Insulander <hin@cvs.openbsd.org> | 2001-06-26 20:16:44 +0000 |
commit | 5afc4a66932ab0f245e5512cbe929515bcc108f5 (patch) | |
tree | ead25a0e8e47692d472781c904124adbe8edd996 /usr.bin/passwd | |
parent | cd779a12202556278f6eed9718b9f706329b8a30 (diff) |
Support for changing kerberos 5 passwords.
Diffstat (limited to 'usr.bin/passwd')
-rw-r--r-- | usr.bin/passwd/Makefile | 14 | ||||
-rw-r--r-- | usr.bin/passwd/passwd.c | 19 |
2 files changed, 22 insertions, 11 deletions
diff --git a/usr.bin/passwd/Makefile b/usr.bin/passwd/Makefile index 380aa2548fa..7beb5658556 100644 --- a/usr.bin/passwd/Makefile +++ b/usr.bin/passwd/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.21 2001/05/25 12:20:48 hin Exp $ +# $OpenBSD: Makefile,v 1.22 2001/06/26 20:16:43 hin Exp $ .include <bsd.own.mk> @@ -16,12 +16,12 @@ CFLAGS+=-DYP -I${.CURDIR}/../../lib/libc/yp .include <bsd.own.mk> # For Kerberos -#.if (${KERBEROS5:L} == "yes") -#SRCS+= krb5_passwd.c XXX fix the /tmp/tkt_cpw_%d race first + others -#CFLAGS+= -DKERBEROS5 -#DPADD+= ${LIBKRB5} ${LIBCRYPTO} -#LDADD+= -lkrb5 -lcrypto -#.endif +.if (${KERBEROS5:L} == "yes") +SRCS+= krb5_passwd.c +CFLAGS+= -DKRB5 +DPADD+= ${LIBKRB5} ${LIBCRYPTO} +LDADD+= -lkrb5 -lcrypto -lasn1 +.endif .if (${KERBEROS:L} == "yes") .PATH: ${.CURDIR}/../rlogin diff --git a/usr.bin/passwd/passwd.c b/usr.bin/passwd/passwd.c index 62d0fd24720..f761b903040 100644 --- a/usr.bin/passwd/passwd.c +++ b/usr.bin/passwd/passwd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: passwd.c,v 1.9 2000/12/12 02:19:58 millert Exp $ */ +/* $OpenBSD: passwd.c,v 1.10 2001/06/26 20:16:43 hin Exp $ */ /* * Copyright (c) 1988 The Regents of the University of California. @@ -41,7 +41,7 @@ char copyright[] = #ifndef lint /*static char sccsid[] = "from: @(#)passwd.c 5.5 (Berkeley) 7/6/91";*/ -static char rcsid[] = "$OpenBSD: passwd.c,v 1.9 2000/12/12 02:19:58 millert Exp $"; +static char rcsid[] = "$OpenBSD: passwd.c,v 1.10 2001/06/26 20:16:43 hin Exp $"; #endif /* not lint */ #include <stdio.h> @@ -69,6 +69,7 @@ int force_yp; extern int local_passwd(char *, int); extern int yp_passwd(char *); extern int krb_passwd(int, char **); +extern int krb5_passwd(int, char **); void usage(int value); @@ -92,14 +93,14 @@ main(argc, argv) #endif /* Process args and options */ - while ((ch = getopt(argc, argv, "lyk")) != -1) + while ((ch = getopt(argc, argv, "lykK")) != -1) switch (ch) { case 'l': /* change local password file */ use_kerberos = 0; use_yp = 0; break; case 'k': /* change Kerberos password */ -#if defined(KERBEROS) || defined(KERBEROS5) +#if defined(KERBEROS) use_kerberos = 1; use_yp = 0; exit(krb_passwd(argc, argv)); @@ -108,6 +109,16 @@ main(argc, argv) fprintf(stderr, "passwd: Kerberos not compiled in\n"); exit(1); #endif + case 'K': +#ifdef KRB5 + /* Skip programname and '-K' option */ + argc-=2; + argv+=2; + exit(krb5_passwd(argc, argv)); +#else + errx(1, "KerberosV support not enabled"); + break; +#endif case 'y': /* change YP password */ #ifdef YP if (!use_yp) { |