From c26f3d6f5cb8d0e42289da20c75c03a4e6373eda Mon Sep 17 00:00:00 2001 From: Marcus Watts Date: Fri, 5 Jan 2007 03:21:45 +0000 Subject: [PATCH 1/1] DEVEL15-asetkey-with-heimdal-20070104 FIXES 50973 just make asetkey build with heimdal (cherry picked from commit c8503d73a1d02829bdb23e5403df15844f065478) --- src/aklog/Makefile.in | 10 +++++----- src/aklog/asetkey.c | 32 +++++++++++++++++++++++++++++--- src/cf/kerberos.m4 | 7 ------- 3 files changed, 34 insertions(+), 15 deletions(-) diff --git a/src/aklog/Makefile.in b/src/aklog/Makefile.in index 54a9b93..b50cf4d 100644 --- a/src/aklog/Makefile.in +++ b/src/aklog/Makefile.in @@ -16,7 +16,7 @@ AFSLIBS = ${TOP_LIBDIR}/libprot.a ${TOP_LIBDIR}/libubik.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@ +all: aklog asetkey aklog: ${OBJS} ${AFSLIBS} ${CC} -o $@ ${CFLAGS} ${OBJS} ${AKLIBS} ${AFSLIBS} ${XLIBS} @@ -33,8 +33,8 @@ install: \ ${DESTDIR}${bindir}/aklog: aklog ${INSTALL} $? $@ -${DESTDIR}${afssrvbindir}/asetkey: @ASETKEY@ - if test "x@ASETKEY@" != "x"; then ${INSTALL} $? $@; fi +${DESTDIR}${afssrvbindir}/asetkey: asetkey + ${INSTALL} $? $@ dest: \ ${DEST}/bin/aklog ${DEST}/root.server/usr/afs/bin/asetkey @@ -42,8 +42,8 @@ dest: \ ${DEST}/bin/aklog: aklog ${INSTALL} $? $@ -${DEST}/root.server/usr/afs/bin/asetkey: @ASETKEY@ - if test "x@ASETKEY@" != "x"; then ${INSTALL} $? $@; fi +${DEST}/root.server/usr/afs/bin/asetkey: asetkey + ${INSTALL} $? $@ # # Misc. targets diff --git a/src/aklog/asetkey.c b/src/aklog/asetkey.c index ecf7d68..5e1ca75 100644 --- a/src/aklog/asetkey.c +++ b/src/aklog/asetkey.c @@ -11,6 +11,12 @@ #include #include #include +#ifdef HAVE_UNISTD_H +#include +#endif +#ifdef HAVE_STDLIB_H +#include +#endif #ifdef HAVE_MEMORY_H #include #endif /* HAVE_MEMORY_H */ @@ -30,6 +36,13 @@ #include #include +#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); diff --git a/src/cf/kerberos.m4 b/src/cf/kerberos.m4 index 2212f88..0ee0838 100644 --- a/src/cf/kerberos.m4 +++ b/src/cf/kerberos.m4 @@ -103,15 +103,8 @@ dnl AC_CHECK_MEMBERS([krb5_creds.keyblock, krb5_creds.session],,, [#include