Subject: pkg/14985: Hesiod, Kerberos support for Zephyr package (plus more).
To: None <gnats-bugs@gnats.netbsd.org>
From: None <kpneal@pobox.com>
List: netbsd-bugs
Date: 12/17/2001 21:48:32
>Number:         14985
>Category:       pkg
>Synopsis:       Our Zephyr package doesn't support Hesiod or Kerberos.
>Confidential:   no
>Severity:       critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Mon Dec 17 18:49:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator:     Kevin P. Neal
>Release:        NetBSD 1.5.2
>Organization:
-- 
Kevin P. Neal                                http://www.pobox.com/~kpn/

"You know, I think I can hear the machine screaming from here...  \
'help me! hellpp meeee!'"  - Heather Flanagan, 14:52:23 Wed Jun 10 1998
>Environment:

Reasonably current pkgsrc.

>Description:

Our Zephyr package as is does not support Hesiod or Kerberos IV. The
following sharchive adds this support, better rc scripts, and a zwho
example utility for providing a pretty table of Zephyr users.

The zwho and mkzwhodb utilities were inspired by the zwho used at NCSU.EDU. 
	
>How-To-Repeat:

Visual inspection. 

>Fix:

# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	Makefile
#	INSTALL
#	plist.diff
#	distinfo.diff
#	bsd.pkg.defaults.mk.diff
#	patches/patch-ba
#	patches/patch-bb
#	patches/patch-bc
#	patches/patch-bd
#	files/mkzwhodb.sh
#	files/zephyrd.sh
#	files/zhm.sh
#	files/zwho.sh
#
echo x - Makefile
sed 's/^X//' >Makefile << 'END-of-Makefile'
X# $NetBSD: Makefile,v 1.21 2001/03/04 03:26:51 assar Exp $
X#
X
XDISTNAME=	zephyr-2.0.4
XCATEGORIES=	net athena
XMASTER_SITES=	ftp://athena-dist.mit.edu/pub/ATHENA/zephyr/dist/
X
XMAINTAINER=	mycroft@netbsd.org
XHOMEPAGE=	http://web.mit.edu/olh/Zephyr/index.html
XCOMMENT=	Zephyr Messaging Service
X
X.include "../../mk/bsd.prefs.mk"
X
X.if ${ZEPHYR_USE_KERBEROS} == "krb4"
XUSE_KERBEROS=	yes
XCONFIGURE_ARGS+= --with-krb4 
XCPPFLAGS+=	-I/usr/include/kerberosIV -I/usr/include/krb5
XZKRB_FLAG=krb4
X.else
XCONFIGURE_ARGS+= --without-krb4 
XZKRB_FLAG=no
X.endif
X
XZHES_FLAG=no
X.if ${ZEPHYR_USE_HESIOD} == "YES"
XUSE_HESIOD=	yes
XCONFIGURE_ARGS+= --with-hesiod="${BUILDLINK_DIR}"
XZHES_FLAG=yes
X
X.include "../../net/hesiod/buildlink.mk"
X.endif
X
XUSE_X11=	yes
XGNU_CONFIGURE=	yes
X
XZEPHYR_RCDIR=		${PREFIX}/etc/rc.d
XZEPHYR_DOCDIR=		${PREFIX}/share/doc/zephyr
XZEPHYR_EXAMPLEDIR=	${PREFIX}/share/examples/zephyr
XZEPHYR_DOCS=		INSTALL NOTES OPERATING README USING
X
Xpost-install:
X	${INSTALL_DATA_DIR} ${ZEPHYR_RCDIR}
X	${SED} -e 's|@prefix@|'${PREFIX}'|g' < ${FILESDIR}/zhm.sh | \
X		${SED} -e 's|@zkrb@|'$ZKRB_FLAG'|g' | \
X		${SED} -e 's|@zhes@|'$ZHES_FLAG'|g' > ${WRKDIR}/zhm.sh
X	${SED} -e 's|@prefix@|'${PREFIX}'|g' < ${FILESDIR}/zephyrd.sh | \
X		${SED} -e 's|@zkrb@|'$ZKRB_FLAG'|g' > ${WRKDIR}/zephyrd.sh
X	${SED} -e 's|@prefix@|'${PREFIX}'|g' < ${FILESDIR}/mkzwhodb.sh \
X		> ${WRKDIR}/mkzwhodb.sh
X	${INSTALL_SCRIPT} ${WRKDIR}/zhm.sh ${ZEPHYR_RCDIR}/zhm
X	${INSTALL_SCRIPT} ${WRKDIR}/zephyrd.sh ${ZEPHYR_RCDIR}/zephyrd
X	${INSTALL_SCRIPT} ${WRKDIR}/mkzwhodb.sh ${ZEPHYR_EXAMPLEDIR}/mkzwhodb
X	${INSTALL_SCRIPT} ${FILESDIR}/zwho.sh ${ZEPHYR_EXAMPLEDIR}/zwho
X	${INSTALL_DATA_DIR} ${ZEPHYR_DOCDIR}
X	for file in ${ZEPHYR_DOCS} ; do \
X	    ${INSTALL_DATA} ${WRKSRC}/$$file ${ZEPHYR_DOCDIR} ; \
X	    done
X
X.include "../../mk/bsd.pkg.mk"
END-of-Makefile
echo x - INSTALL
sed 's/^X//' >INSTALL << 'END-of-INSTALL'
X#! /bin/sh
X#
X# $NetBSD: INSTALL,v 1.2 1998/08/07 11:11:07 agc Exp $
X#
X
Xcase "$2" in
X  ""|POST-INSTALL) cat <<EOF
X=============================================================
X
XZephyr requires a single master server, and then a host server for
Xevery host that supports zephyr.   You must start these out of your
Xrc script.
X
XIf you are using Kerberos IV with Zephyr then you must have
Xa srvtab on each Zephyr server. The principal in the srvtab must
Xbe zephyr.zephyr. If you like, you can create a Kerberos V principal 
Xwith Heimdal with the name zephyr.zephyr, save the principal to a
Xkeytab, and then use ktutil to convert the keytab to a srvtab.
X
X=============================================================
XEOF
X  ;;
Xesac
END-of-INSTALL
echo x - plist.diff
sed 's/^X//' >plist.diff << 'END-of-plist.diff'
X+++ ./PLIST	Mon Dec 17 21:29:37 2001
X@@ -9,6 +9,7 @@
X bin/zwgc
X bin/zwrite
X etc/rc.d/zhm
X+etc/rc.d/zephyrd
X etc/zephyr/acl/class-registry.acl
X etc/zephyr/acl/iui-filsrv.acl
X etc/zephyr/acl/iui-hm_ctl.acl
X@@ -94,7 +95,10 @@
X share/doc/zephyr/OPERATING
X share/doc/zephyr/README
X share/doc/zephyr/USING
X+share/examples/zephyr/zwho
X+share/examples/zephyr/mkzwhodb
X @dirrm etc/zephyr/acl
X @dirrm etc/zephyr
X @dirrm include/zephyr
X @dirrm share/doc/zephyr
X+@dirrm share/examples/zephyr
END-of-plist.diff
echo x - distinfo.diff
sed 's/^X//' >distinfo.diff << 'END-of-distinfo.diff'
X+++ ./distinfo	Sat Dec 15 00:44:57 2001
X@@ -28,3 +28,7 @@
X SHA1 (patch-ax) = 3b66feaf74e5c97d880d7ea8eb6cf2b3acced06b
X SHA1 (patch-ay) = 160065ba97a074af47e9047fc03a9912259e326f
X SHA1 (patch-az) = 3f7aa8ed9f891777809063e7b9875240a8c84a09
X+SHA1 (patch-ba) = e4c288f6fdc5936c784cd6d90b13f6a2f7090b27
X+SHA1 (patch-bb) = 6950989725c239584d9ab718636a4fbeed71df85
X+SHA1 (patch-bc) = 42364871cee0d869607cebf0a60fd9024fea0085
X+SHA1 (patch-bd) = 0b4d99aa9984217335598d1b9cde1a5dc1386fa5
END-of-distinfo.diff
echo x - bsd.pkg.defaults.mk.diff
sed 's/^X//' >bsd.pkg.defaults.mk.diff << 'END-of-bsd.pkg.defaults.mk.diff'
X+++ ./bsd.pkg.defaults.mk	Mon Dec 17 21:37:11 2001
X@@ -1228,6 +1228,16 @@
X # Possible: YES, NO
X # Default: YES
X 
X+ZEPHYR_USE_HESIOD?= NO
X+# Enable Hesiod support in Zephyr (for clients locating Zephyr servers).
X+# Possible: YES, NO
X+# Default: NO
X+
X+ZEPHYR_USE_KERBEROS?= NO
X+# Enable Kerberos support in Zephyr.
X+# Possible: NO, krb4
X+# Default: NO
X+
X #ZIP_ENCRYPTION=
X # Add encryption code to zip1
X # Possible: defined, not defined
END-of-bsd.pkg.defaults.mk.diff
echo x - patches/patch-ba
sed 's/^X//' >patches/patch-ba << 'END-of-patches/patch-ba'
Xdiff -urN ./configure-prekpn ./configure
X+++ ./configure	Sat Dec  8 23:11:19 2001
X@@ -2422,7 +2422,7 @@
X   echo $ac_n "(cached) $ac_c" 1>&6
X else
X   ac_save_LIBS="$LIBS"
X-LIBS="-lkrb -ldes $LIBS"
X+LIBS="-lkrb -ldes -lcom_err -lroken /usr/lib/libcom_err.a $LIBS"
X cat > conftest.$ac_ext <<EOF
X #line 2428 "configure"
X #include "confdefs.h"
X@@ -2457,7 +2457,7 @@
X { echo "configure: error: Kerberos library not found" 1>&2; exit 1; }
X fi
X 
X-	LIBS="-lkrb -ldes ${LIBS}"
X+	LIBS="-lkrb -ldes -lcom_err -lroken /usr/lib/libcom_err.a ${LIBS}"
X else
X 	echo "configure: warning: compiling without Kerberos support; Zephyr will be insecure." 1>&2
X fi
END-of-patches/patch-ba
echo x - patches/patch-bb
sed 's/^X//' >patches/patch-bb << 'END-of-patches/patch-bb'
Xdiff -urN ./lib/et/error_table.h.orig ./lib/et/error_table.h
X+++ ./lib/et/error_table.h	Sat Dec  8 23:15:32 2001
X@@ -6,6 +6,7 @@
X  */
X 
X #ifndef _ET_H
X+/*
X struct error_table {
X     char const * const * msgs;
X     long base;
X@@ -15,6 +16,7 @@
X     struct et_list *next;
X     const struct error_table *table;
X };
X+*/
X extern struct et_list * _et_list;
X 
X #define	ERRCODE_RANGE	8	/* # of bits to shift table number */
END-of-patches/patch-bb
echo x - patches/patch-bc
sed 's/^X//' >patches/patch-bc << 'END-of-patches/patch-bc'
Xdiff -urN ./server/kopt.c.orig ./server/kopt.c
X+++ ./server/kopt.c	Sat Dec  8 23:41:59 2001
X@@ -158,7 +158,7 @@
X  * the key set by krb_set_key() is available in private storage for
X  * krb_rd_req().
X  */
X-
X+#if 0
X int
X krb_set_key(key,cvt)
X     char *key;
X@@ -186,7 +186,7 @@
X     return ret;
X #endif /* NOENCRYPTION */
X }
X-
X+#endif
X 
X /*
X  * krb_rd_req() takes an AUTH_MSG_APPL_REQUEST or
X@@ -229,6 +229,7 @@
X  * Mutual authentication is not implemented.
X  */
X 
X+#if 0
X int
X krb_rd_req(authent,service,instance,from_addr,ad,fn)
X     KTEXT authent;			/* The received message */
X@@ -456,6 +457,7 @@
X     return RD_AP_OK;
X }
X #endif /* NOENCRYPTION */
X+#endif /* 0 */
X 
X int
X krb_find_ticket(authent, ticket)
X@@ -496,6 +498,7 @@
X 
X static char local_realm_buffer[REALM_SZ+1];
X 
X+#if 0
X int
X krb_get_lrealm(r,n)
X     char *r;
X@@ -528,6 +531,6 @@
X     fclose(cnffile);
X     return KSUCCESS;
X }
X-
X+#endif /* 0 */
X #endif /* ZEPHYR_USES_KERBEROS */
X 
END-of-patches/patch-bc
echo x - patches/patch-bd
sed 's/^X//' >patches/patch-bd << 'END-of-patches/patch-bd'
Xdiff -urN ./server/zserver.h.orig ./server/zserver.h
X+++ ./server/zserver.h	Sat Dec  8 23:36:37 2001
X@@ -207,11 +207,7 @@
X #ifndef NOENCRYPTION
X Sched *check_key_sched_cache __P((des_cblock key));
X void add_to_key_sched_cache __P((des_cblock key, Sched *sched));
X-int krb_set_key __P((char *key, int cvt));
X-int krb_rd_req __P((KTEXT authent, char *service, char *instance,
X-		    KRB_INT32 from_addr, AUTH_DAT *ad, char *fn));
X int krb_find_ticket __P((KTEXT authent, KTEXT ticket));
X-int krb_get_lrealm __P((char *r, int n));
X #endif
X #endif
X 
END-of-patches/patch-bd
echo x - files/mkzwhodb.sh
sed 's/^X//' >files/mkzwhodb.sh << 'END-of-files/mkzwhodb.sh'
X#! /bin/ksh
X
XDOMAIN="pkgsrc"
XHEAD="Currently active $DOMAIN users as of `date +'%H:%M'` on `date +'%m/%d'`:"
X
XPREFIX=${PREFIX-/usr/pkg}
X
Xrm -f /var/tmp/zephyr.db
X@prefix@/etc/rc.d/zephyrd dumpdb
Xsleep 5
X
Xcat /var/tmp/zephyr.db | grep @local-realm/ | \
X   ( IFS=/ 
X     NUMUSERS=0
X     echo "$HEAD on `date +'%m/%d'`:" > $1
X     echo "" >> $1
X     while read user host date rest
X     do
X       username="`echo $user | cut -d@ -f1`"
X       userstr=`echo "$username        " | cut -c1-10`
X       usernamestr=`finger $username | grep Name: | cut -d: -f3 | cut -c2-100`
X       usernamestr=`echo "$usernamestr                          " | cut -c1-27`
X       hoststr=`echo "$host                          " | cut -c1-27`
X       datestr=`echo $date | cut -d\  -f2,3,4 | cut -d: -f1,2`
X       datestr=`echo $date | awk '{ print $2, $3, $4; }' | cut -d: -f1,2`
X       echo "$userstr $usernamestr $hoststr $datestr" >> $1
X       NUMUSERS=$((NUMUSERS + 1))
X     done  
X
X     echo "" >> $1
X     echo "Total of $NUMUSERS users were listed." >> $1
X   )
END-of-files/mkzwhodb.sh
echo x - files/zephyrd.sh
sed 's/^X//' >files/zephyrd.sh << 'END-of-files/zephyrd.sh'
X#!/bin/sh
X#
X# $NetBSD: zephyrd,v 1.4.4.2 2000/10/02 01:10:11 lukem Exp $
X#
X
X# PROVIDE: zephyrd
X# REQUIRE: network
X# BEFORE: zhm
X
X. /etc/rc.subr
X
XPREFIX=${PREFIX-/usr/pkg}
X
Xname="zephyrd"
Xrcvar=$name
Xcommand="@prefix@/sbin/${name}"
Xextra_commands="reload debugon debugoff dumpdb"
Xdebugon_cmd="zephyrd_debugon"
Xdebugoff_cmd="zephyrd_debugff"
Xdumpdb_cmd="zephyrd_dumpdb"
X
XZEPHYR_USES_KERBEROS=@zkrb@
X
Xif [ "$ZEPHYR_USES_KERBEROS" = "krb4" ]; then
X	required_files="@prefix@/etc/zephyr/srvtab \
X                        /etc/krb.conf /etc/krb.realms"
Xfi
X
Xzephyrd_check ()
X{
X	if [ -z "$_pid" ]; then
X		if [ -n "$pidfile" ]; then
X			echo \
X		    "${name} not running? (check $pidfile)."
X		else
X			echo "${name} not running?"
X		fi
X		exit 1
X	fi
X}
X
Xzephyrd_debugon ()
X{
X	zephyrd_check
X	echo "Enabling ${name} debug mode."
X	_doit="${_user:+su -m $_user -c '}kill -USR1 $_pid${_user:+'}"
X	eval $_doit
X}
X
Xzephyrd_debugoff ()
X{
X	zephyrd_check
X	echo "Disabling ${name} debug mode."
X	_doit="${_user:+su -m $_user -c '}kill -USR2 $_pid${_user:+'}"
X	eval $_doit
X}
X
Xzephyrd_dumpdb ()
X{
X	zephyrd_check
X	echo "Dumping ${name} database to /var/tmp/zephyr.db now."
X	_doit="${_user:+su -m $_user -c '}kill -FPE $_pid${_user:+'}"
X	eval $_doit
X}
X
Xload_rc_config $name
Xrun_rc_command "$1"
END-of-files/zephyrd.sh
echo x - files/zhm.sh
sed 's/^X//' >files/zhm.sh << 'END-of-files/zhm.sh'
X#!/bin/sh
X#
X# $NetBSD: zhm,v 1.4.4.2 2000/10/02 01:10:11 lukem Exp $
X#
X
X# PROVIDE: zhm
X# REQUIRE: network 
X
X. /etc/rc.subr
X
XPREFIX=${PREFIX-/usr/pkg}
X
Xname="zhm"
Xrcvar=$name
Xcommand="@prefix@/sbin/${name}"
Xpidfile="/var/run/${name}.pid"
Xextra_commands="reload"
X
XZEPHYR_USES_HESIOD=@zhes@
XZEPHYR_USES_KERBERS=@zkrb@
X
Xif [ "$ZEPHYR_USES_HESIOD" = "yes" ]; then
X	if [ -z "$zephyr_servers" ]; then
X		zephyr_servers=`cat @prefix@/etc/zephyr/server.list`
X	fi
Xelse
X	zephyr_servers=""
Xfi
X
Xif [ "$ZEPHYR_USES_KERBEROS" = "krb4" ]; then
X	required_files="/etc/krb.conf /etc/krb.realms" 
Xfi
X
Xload_rc_config $name
X
Xzhm_flags="$zhm_flags $zephyr_servers"
X
Xrun_rc_command "$1"
END-of-files/zhm.sh
echo x - files/zwho.sh
sed 's/^X//' >files/zwho.sh << 'END-of-files/zwho.sh'
X#!/bin/sh
X#
X# Simple script to display the zwho database.
X#
X
XZWHODB=/var/run/zwho.db
XPAGER=/usr/bin/more
X
Xif [ -f $ZWHODB ]; then
X        $PAGER $ZWHODB
Xelse
X        echo 1>&2 "$0: zwho database not found!"
X	exit 1
Xfi
X
END-of-files/zwho.sh
exit

>Release-Note:
>Audit-Trail:
>Unformatted: