Subject: Re: CVS and kerberos?
To: Urban Boquist <urban@boquist.net>
From: Assar Westerlund <assar@netbsd.org>
List: tech-pkg
Date: 03/04/2001 00:57:36
--=-=-=

Urban Boquist <urban@boquist.net> writes:
> # XXX KERBEROS 5 SUPPORT BROKEN WITH HEIMDAL
> #.if defined(KERBEROS) && ${KERBEROS} == 5
> #USE_KERBEROS=	yes
> #CONFIGURE_ARGS+=	--with-gssapi
> #CFLAGS+=		-I/usr/include/krb5		# krb5.h
> #.else
> #CONFIGURE_ARGS+=	--with-gssapi=no
> #.endif

With the appended patch the cvs pkgsrc builds with both krb4 and
gssapi (over krb5) support for me.

What I don't understand is how the KERBEROS variable is supposed to be
defined.  What value should it have to enable both v4 and v5?  Could
someone more familiar with pkgsrc tell me how it should work so I
can commit these changes?

/assar


--=-=-=
Content-Disposition: attachment; filename=netbsd-pkgsrc-cvs.diff

Index: Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/devel/cvs/Makefile,v
retrieving revision 1.37
diff -u -w -r1.37 Makefile
--- Makefile	2001/02/16 14:38:21	1.37
+++ Makefile	2001/03/03 23:53:59
@@ -21,21 +21,8 @@
 CFLAGS+=	-I${PREFIX}/include		# zlib.h
 .endif
 
-.if defined(KERBEROS) && ${KERBEROS} == 4
-USE_KERBEROS=	yes
 CONFIGURE_ARGS+=	--with-krb4=/usr --enable-encryption
-.else
-CONFIGURE_ARGS+=	--with-krb4=no
-.endif
-
-# XXX KERBEROS 5 SUPPORT BROKEN WITH HEIMDAL
-#.if defined(KERBEROS) && ${KERBEROS} == 5
-#USE_KERBEROS=	yes
-#CONFIGURE_ARGS+=	--with-gssapi
-#CFLAGS+=		-I/usr/include/krb5		# krb5.h
-#.else
-#CONFIGURE_ARGS+=	--with-gssapi=no
-#.endif
+CONFIGURE_ARGS+=	--with-gssapi=/usr
 
 .if defined(RCS_LOCALID)
 pre-fetch:
Index: files/patch-sum
===================================================================
RCS file: /cvsroot/pkgsrc/devel/cvs/files/patch-sum,v
retrieving revision 1.11
diff -u -w -r1.11 patch-sum
--- files/patch-sum	2001/02/22 17:04:36	1.11
+++ files/patch-sum	2001/03/03 23:53:59
@@ -20,8 +20,8 @@
 MD5 (patch-as) = 57bb4e77f01132eb20d0a66f6141540c
 MD5 (patch-at) = a3a3221012536f04c230f9cb5dabcabe
 MD5 (patch-au) = c8c6999a983456c1e09626c26aecb2bc
-MD5 (patch-av) = 15444411b2beb5b9adca8f9cbb7304d9
-MD5 (patch-aw) = 81e1465f9c46aeee12b25e5452087fc2
+MD5 (patch-av) = 6db3c465306ce160334b763acadb9764
+MD5 (patch-aw) = 62419b18ef25c27ab80a1cc6b01d858b
 MD5 (patch-ax) = d3e9dbd9a7563ebf8419cf77715b3952
 MD5 (patch-ay) = 582a67798f19e25bcfd5d6c6201bdc76
 MD5 (patch-az) = bc7e2eed182940b59bb4a839cc88d05b
Index: patches/patch-av
===================================================================
RCS file: /cvsroot/pkgsrc/devel/cvs/patches/patch-av,v
retrieving revision 1.4
diff -u -w -r1.4 patch-av
--- patches/patch-av	2000/10/18 03:31:17	1.4
+++ patches/patch-av	2001/03/03 23:53:59
@@ -1,7 +1,7 @@
-$NetBSD: patch-av,v 1.4 2000/10/18 03:31:17 hubertf Exp $
+$NetBSD$
 
---- configure.in.orig	Tue Aug  1 18:13:25 2000
-+++ configure.in
+--- configure.in.orig	Sun Mar  4 00:31:29 2001
++++ configure.in	Sun Mar  4 00:47:31 2001
 @@ -110,16 +110,19 @@
  dnl libkrb in the system libraries, so --with-krb4=value needs to
  dnl override the system -lkrb.
@@ -14,9 +14,8 @@
 -  [KRB4=$withval],
 +  [if test X"$withval" != X"no"; then KRB4=$withval; fi],
  )dnl
--echo "default place for krb4 is $KRB4"
 +if test X"$KRB4" != X""; then
-+    echo "default place for krb4 is $KRB4"
+ echo "default place for krb4 is $KRB4"
 +fi
  AC_SUBST(KRB4)])dnl
  WITH_KRB4
@@ -25,14 +24,29 @@
  krb_h=
  AC_MSG_CHECKING([for krb.h])
  if test "$cross_compiling" != yes && test -r $KRB4/include/krb.h; then
-@@ -181,20 +184,27 @@
+@@ -159,7 +162,7 @@
+            [LDFLAGS=$hold_ldflags
+             # Using open here instead of printf so we don't
+             # get confused by the cached value for printf from above.
+-            AC_CHECK_LIB(krb,open,[krb_lib=yes krb_libdir=])])
++            AC_CHECK_LIB(krb,open,[krb_lib=yes krb_libdir=])],[-ldes -lcom_err -lroken -lcrypt])
+        LDFLAGS=$hold_ldflags
+   else
+        AC_CHECK_LIB(krb,printf,[krb_lib=yes krb_libdir=])
+@@ -167,7 +170,7 @@
+   if test -n "$krb_lib"; then
+     AC_DEFINE(HAVE_KERBEROS)
+     test -n "${krb_libdir}" && LIBS="${LIBS} -L${krb_libdir}"
+-    LIBS="${LIBS} -lkrb"
++    LIBS="${LIBS} -lkrb -ldes -lcom_err -lroken -lcrypt"
+     # Put -L${krb_libdir} in LDFLAGS temporarily so that it appears before
+     # -ldes in the command line.  Don't do it permanently so that we honor
+     # the user's setting for LDFLAGS
+@@ -181,22 +184,26 @@
    fi
  fi
  AC_CHECK_FUNCS(krb_get_err_text)
 +fi	# KRB4 empty
-+
-+includeopt=
-+AC_SUBST(includeopt)
  
  dnl
  dnl Use --with-gssapi=DIR to enable GSSAPI support.
@@ -45,18 +59,34 @@
 -  [GSSAPI=$withval],
 +  [if test X"$withval" != X"no"; then GSSAPI=$withval; fi],
  )dnl
--echo "default place for GSSAPI is $GSSAPI"
 +if test X"$GSSAPI" != X""; then
-+    echo "default place for GSSAPI is $GSSAPI"
+ echo "default place for GSSAPI is $GSSAPI"
 +fi
  AC_SUBST(GSSAPI)])dnl
  WITH_GSSAPI
  
 +if test X"$GSSAPI" != X""; then
  hold_cppflags=$CPPFLAGS
- CPPFLAGS="$CPPFLAGS -I$GSSAPI/include "
+-CPPFLAGS="$CPPFLAGS -I$GSSAPI/include "
++CPPFLAGS="$CPPFLAGS -I$GSSAPI/include -I$GSSAPI/include/krb5 "
  AC_CHECK_HEADERS(krb5.h gssapi.h gssapi/gssapi.h gssapi/gssapi_generic.h)
-@@ -223,6 +233,7 @@
+ CPPFLAGS=$hold_cppflags
+ 
+@@ -204,10 +211,10 @@
+    (test "$ac_cv_header_gssapi_h" = "yes" ||
+     test "$ac_cv_header_gssapi_gssapi_h" = "yes"); then
+   AC_DEFINE(HAVE_GSSAPI)
+-  includeopt="${includeopt} -I$GSSAPI/include"
++  includeopt="${includeopt} -I$GSSAPI/include -I$GSSAPI/include/krb5"
+   # FIXME: This is ugly, but these things don't seem to be standardized.
+-  if test "$ac_cv_header_gssapi_h" = "yes"; then
+-    LIBS="$LIBS -L$GSSAPI/lib -lgssapi -lkrb5 -lasn1 -ldes -lroken"
++  if test "$ac_cv_header_gssapi_gssapi_generic_h" = "no"; then
++    LIBS="$LIBS -L$GSSAPI/lib -lgssapi -lkrb5 -lasn1 -lcom_err -ldes -lroken"
+   else
+     LIBS="$LIBS -L$GSSAPI/lib -lgssapi_krb5 -lkrb5 -lcrypto -lcom_err"
+   fi
+@@ -223,6 +230,7 @@
    # there, an_to_ln.o refers to things defined only in -lgen.
    AC_CHECK_LIB(gen, compile)
  fi
Index: patches/patch-aw
===================================================================
RCS file: /cvsroot/pkgsrc/devel/cvs/patches/patch-aw,v
retrieving revision 1.5
diff -u -w -r1.5 patch-aw
--- patches/patch-aw	2000/10/21 19:29:06	1.5
+++ patches/patch-aw	2001/03/03 23:53:59
@@ -1,7 +1,7 @@
-$NetBSD: patch-aw,v 1.5 2000/10/21 19:29:06 wiz Exp $
+$NetBSD$
 
---- configure.orig	Tue Aug  1 18:13:25 2000
-+++ configure
+--- configure.orig	Sun Mar  4 00:31:24 2001
++++ configure	Sun Mar  4 00:47:23 2001
 @@ -2820,19 +2820,22 @@
    
  fi
@@ -14,11 +14,10 @@
    withval="$with_krb4"
 -  KRB4=$withval
 +  if test X"$withval" != X"no"; then KRB4=$withval; fi
-+fi
-+if test X"$KRB4" != X""; then
-+    echo "default place for krb4 is $KRB4"
  fi
--echo "default place for krb4 is $KRB4"
++if test X"$KRB4" != X""; then
+ echo "default place for krb4 is $KRB4"
++fi
  
  
 +if test X"$KRB4" != X""; then
@@ -29,16 +28,32 @@
  if test "$cross_compiling" != yes && test -r $KRB4/include/krb.h; then
     hold_cflags=$CFLAGS
     CFLAGS="$CFLAGS -I$KRB4/include"
-@@ -3177,17 +3180,24 @@
+@@ -2945,7 +2948,7 @@
+   echo $ac_n "(cached) $ac_c" 1>&6
+ else
+   ac_save_LIBS="$LIBS"
+-LIBS="-lkrb  $LIBS"
++LIBS="-lkrb -ldes -lcom_err -lroken -lcrypt  $LIBS"
+ cat > conftest.$ac_ext <<EOF
+ #line 2951 "configure"
+ #include "confdefs.h"
+@@ -3070,7 +3073,7 @@
+ EOF
+ 
+     test -n "${krb_libdir}" && LIBS="${LIBS} -L${krb_libdir}"
+-    LIBS="${LIBS} -lkrb"
++    LIBS="${LIBS} -lkrb -ldes -lcom_err -lroken -lcrypt"
+     # Put -L${krb_libdir} in LDFLAGS temporarily so that it appears before
+     # -ldes in the command line.  Don't do it permanently so that we honor
+     # the user's setting for LDFLAGS
+@@ -3177,19 +3180,24 @@
  fi
  done
  
 +fi	# KRB4 empty
 +
-+includeopt=
  
 -GSSAPI=/usr/cygnus/kerbnet
-+
 +GSSAPI=
  
  # Check whether --with-gssapi or --without-gssapi was given.
@@ -46,18 +61,34 @@
    withval="$with_gssapi"
 -  GSSAPI=$withval
 +  if test X"$withval" != X"no"; then GSSAPI=$withval; fi
-+fi
-+if test X"$GSSAPI" != X""; then
-+    echo "default place for GSSAPI is $GSSAPI"
  fi
--echo "default place for GSSAPI is $GSSAPI"
++if test X"$GSSAPI" != X""; then
+ echo "default place for GSSAPI is $GSSAPI"
++fi
  
  
 +if test X"$GSSAPI" != X""; then
  hold_cppflags=$CPPFLAGS
- CPPFLAGS="$CPPFLAGS -I$GSSAPI/include "
+-CPPFLAGS="$CPPFLAGS -I$GSSAPI/include "
++CPPFLAGS="$CPPFLAGS -I$GSSAPI/include -I$GSSAPI/include/krb5"
  for ac_hdr in krb5.h gssapi.h gssapi/gssapi.h gssapi/gssapi_generic.h
-@@ -3332,6 +3342,7 @@
+ do
+ ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
+@@ -3239,10 +3247,10 @@
+ #define HAVE_GSSAPI 1
+ EOF
+ 
+-  includeopt="${includeopt} -I$GSSAPI/include"
++  includeopt="${includeopt} -I$GSSAPI/include -I$GSSAPI/include/krb5"
+   # FIXME: This is ugly, but these things don't seem to be standardized.
+-  if test "$ac_cv_header_gssapi_h" = "yes"; then
+-    LIBS="$LIBS -L$GSSAPI/lib -lgssapi -lkrb5 -lasn1 -ldes -lroken"
++  if test "$ac_cv_header_gssapi_gssapi_generic_h" = "no"; then
++    LIBS="$LIBS -L$GSSAPI/lib -lgssapi -lkrb5 -lasn1 -lcom_err -ldes -lroken"
+   else
+     LIBS="$LIBS -L$GSSAPI/lib -lgssapi_krb5 -lkrb5 -lcrypto -lcom_err"
+   fi
+@@ -3332,6 +3340,7 @@
  fi
  
  fi

--=-=-=--