asetkey-with-heimdal-20070104
authorMarcus Watts <mdw@umich.edu>
Fri, 5 Jan 2007 03:21:34 +0000 (03:21 +0000)
committerDerrick Brashear <shadow@dementia.org>
Fri, 5 Jan 2007 03:21:34 +0000 (03:21 +0000)
FIXES 50973

just make asetkey build with heimdal

src/aklog/Makefile.in
src/aklog/asetkey.c
src/cf/kerberos.m4

index 19086bc..3a9f2dd 100644 (file)
@@ -20,7 +20,7 @@ AFSLIBS = ${TOP_LIBDIR}/libprot.a ${TOP_LIBDIR}/libauth.a \
 SRCS=  aklog.c aklog_main.c  krb_util.c linked_list.c
 OBJS=   aklog.o aklog_main.o krb_util.o linked_list.o
 
-all: aklog @ASETKEY@ klog
+all: aklog asetkey klog
 
 aklog: ${OBJS} ${AFSLIBS}
        ${CC} -o $@ ${CFLAGS} ${OBJS} ${AKLIBS} ${AFSLIBS} ${XLIBS}
@@ -34,21 +34,17 @@ klog:       klog.o skipwrap.o ${AFSLIBS}
 #
 # Installation targets
 #
-install: aklog @ASETKEY@
+install: aklog asetkey
        ${INSTALL} -d ${DESTDIR}${bindir}
        ${INSTALL_PROGRAM} aklog ${DESTDIR}${bindir}/aklog
-       set -e ; if test "x@ASETKEY@" != "x"; then \
-               ${INSTALL} -d ${DESTDIR}${afssrvbindir} ; \
-               ${INSTALL_PROGRAM} asetkey ${DESTDIR}${afssrvbindir}/asetkey ; \
-       fi
+       ${INSTALL} -d ${DESTDIR}${afssrvbindir}
+       ${INSTALL_PROGRAM} asetkey ${DESTDIR}${afssrvbindir}/asetkey 
 
-dest: aklog @ASETKEY@
+dest: aklog asetkey
        ${INSTALL} -d ${DEST}/bin
        ${INSTALL_PROGRAM} aklog ${DEST}/bin/aklog
-       set -e ; if test "x@ASETKEY@" != "x"; then \
-               ${INSTALL} -d ${DEST}/root.server/usr/afs/bin ; \
-               ${INSTALL_PROGRAM} asetkey ${DEST}/root.server/usr/afs/bin/asetkey ; \
-       fi
+       ${INSTALL} -d ${DEST}/root.server/usr/afs/bin
+       ${INSTALL_PROGRAM} asetkey ${DEST}/root.server/usr/afs/bin/asetkey
 
 #
 # Misc. targets
index ecf7d68..5e1ca75 100644 (file)
 #include <sys/types.h>
 #include <netinet/in.h>
 #include <netdb.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
 #ifdef HAVE_MEMORY_H
 #include <memory.h>
 #endif /* HAVE_MEMORY_H */
 #include <afs/keys.h>
 #include <afs/dirpath.h>
 
+#ifdef HAVE_KRB5_CREDS_KEYBLOCK
+#define USING_MIT 1
+#endif
+#ifdef HAVE_KRB5_CREDS_SESSION
+#define USING_HEIMDAL 1
+#endif
+
 int
 main(int argc, char *argv[])
 {
@@ -82,13 +95,26 @@ main(int argc, char *argv[])
                exit(1);
        }
 
-       if (key->length != 8) {
+#ifdef USING_HEIMDAL
+#define deref_key_length(key) \
+         key->keyvalue.length
+
+#define deref_key_contents(key) \
+       key->keyvalue.data
+#else
+#define deref_key_length(key) \
+         key->length
+
+#define deref_key_contents(key) \
+       key->contents
+#endif
+       if (deref_key_length(key) != 8) {
                fprintf(stderr, "Key length should be 8, but is really %d!\n",
-                      key->length);
+                       deref_key_length(key));
                exit(1);
        }
 
-       code = afsconf_AddKey(tdir, kvno, (char *) key->contents, 1);
+       code = afsconf_AddKey(tdir, kvno, (char *) deref_key_contents(key), 1);
        if (code) {
            fprintf(stderr, "%s: failed to set key, code %d.\n", argv[0], code);
            exit(1);
index 2212f88..0ee0838 100644 (file)
@@ -103,15 +103,8 @@ dnl        AC_CHECK_MEMBERS([krb5_creds.keyblock, krb5_creds.session],,, [#include <krb
        LIBS="$save_LIBS"
 fi
 
-if test "$ac_cv_header_kerberosV_heim_err_h" = "yes"; then
-    ASETKEY=
-else
-    ASETKEY=asetkey
-fi
-
 AC_SUBST(BUILD_KRB5)
 AC_SUBST(KRB5CFLAGS)
 AC_SUBST(KRB5LIBS)
-AC_SUBST(ASETKEY)
 
 ])dnl