From bce8cda06123648c377fbef92526f1f56121e513 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 7 Jun 2005 07:22:25 +0000 Subject: r7352: the internal heimdal build change. This changes quite a few things: - if you want kerberos now, you need to unpack a lorikeet heimdal tree in source/heimdal/. If source/heimdal/ does not exist at configure time then all kerberos features are disabled. You cannot use an external kerberos library for now. That may change later. - moved lib/replace/ config stuff to lib/replace/ and create a lib/replace/replace.h. That allows the heimdal build to use our portability layer, and prevenets duplicate definitions of functions like strlcat() - if you do enable heimdal, then you will need to do 'make HEIMDAL_EXTERNAL' before you build Samba. That should be fixed once I explain the problem to jelmer (the problem is the inability to set a depend without also dragging in the object list of the dependency. We need this for building the heimdal asn1 compiler and et compiler. - disabled all of the m4 checks for external kerberos libraries. I left them in place in auth/kerberos/, but disabled it in configure.in some of the heimdal_build/ code is still very rough, for example I don't correctly detect the correct awk, flex, bison replacements for heimdal_build/build_external.sh. I expect to fix that stuff up over the next few days. (This used to be commit d4648249b2c7fc8b5e7c0fc8d8f92ae043b5691f) --- source4/heimdal_build/build_external.sh | 53 ++++++++++++++++++++++++++------- source4/heimdal_build/config.h | 47 +++++++++++++++++++++++++---- source4/heimdal_build/config.m4 | 15 ++++++++++ source4/heimdal_build/config.mk | 37 ++++++++++++++++++----- source4/heimdal_build/krb5-types.h | 17 +++++++++++ 5 files changed, 146 insertions(+), 23 deletions(-) create mode 100644 source4/heimdal_build/krb5-types.h (limited to 'source4/heimdal_build') diff --git a/source4/heimdal_build/build_external.sh b/source4/heimdal_build/build_external.sh index 571298b1b3..5ee2de27f9 100755 --- a/source4/heimdal_build/build_external.sh +++ b/source4/heimdal_build/build_external.sh @@ -5,10 +5,13 @@ TOP=`pwd` ASN1_COMPILE=$TOP/bin/asn1_compile -ET_COMPILE=compile_et +ET_COMPILE=$TOP/bin/compile_et + +# we need to substitute these correctly based on configure output FLEX=flex BISON=bison - +AWK=gawk +CC=gcc build_asn1() { f=$1 @@ -16,7 +19,7 @@ build_asn1() { dir=`dirname $f` file=`basename $f` - echo Compiling $f + echo Building $f cd $dir && $ASN1_COMPILE $file $name || exit 1 for f in *.x; do base=`basename $f .x` @@ -29,7 +32,7 @@ build_et() { f=$1 dir=`dirname $f` file=`basename $f` - echo Compiling $f + echo Building $f cd $dir && $ET_COMPILE $file || exit 1 cd $TOP || exit 1 } @@ -39,7 +42,7 @@ build_lex() { dir=`dirname $f` file=`basename $f` base=`basename $f .l` - echo Compiling $f + echo Building $f cd $dir && $FLEX $file sed '/^#/ s|$base.yy\.c|$base.c|' $base.yy.c > $base.c cd $TOP || exit 1 @@ -50,24 +53,52 @@ build_bison() { dir=`dirname $f` file=`basename $f` base=`basename $f .y` - echo Compiling $f + echo Building $f cd $dir && $BISON -y -d $file sed -e "/^#/!b" -e "s|y\.tab\.h|$base.h|" y.tab.h > $base.h sed '/^#/ s|y\.tab\.c|$base.c|' y.tab.c > $base.c cd $TOP || exit 1 } +build_awk() { + f=$1 + dir=`dirname $f` + file=`basename $f` + base=`basename $f .h.in` + echo Building $f + cd $dir && $AWK -f $base.awk $base.h.in > gen.c + $CC -I$TOP/heimdal_build -I$TOP -Iheimdal/lib/roken -DHAVE_CONFIG_H -o gen gen.c || exit 1 + ./gen > $base.h || exit 1 + rm -f gen gen.c + cd $TOP || exit 1 +} + +build_cp() { + f=$1 + dir=`dirname $f` + file=`basename $f` + base=`basename $f in` + echo Building $f + echo cp $base"in" $base + cd $dir && cp $base"in" $base + cd $TOP || exit 1 +} + +build_cp heimdal/lib/roken/vis.hin +build_lex heimdal/lib/asn1/lex.l +build_lex heimdal/lib/com_err/lex.l +build_bison heimdal/lib/com_err/parse.y +build_bison heimdal/lib/asn1/parse.y +build_awk heimdal/lib/roken/roken.h.in + +make bin/asn1_compile || exit 1 build_asn1 heimdal/lib/hdb/hdb.asn1 hdb_asn1 build_asn1 heimdal/lib/gssapi/spnego.asn1 spnego_asn1 build_asn1 heimdal/lib/asn1/k5.asn1 krb5_asn1 - +make bin/compile_et || exit 1 build_et heimdal/lib/hdb/hdb_err.et build_et heimdal/lib/krb5/krb5_err.et build_et heimdal/lib/krb5/heim_err.et build_et heimdal/lib/krb5/k524_err.et build_et heimdal/lib/asn1/asn1_err.et - -build_lex heimdal/lib/asn1/lex.l - -build_bison heimdal/lib/asn1/parse.y diff --git a/source4/heimdal_build/config.h b/source4/heimdal_build/config.h index 375239c459..ba6da4b35d 100644 --- a/source4/heimdal_build/config.h +++ b/source4/heimdal_build/config.h @@ -6,6 +6,8 @@ /* bring in the samba4 config.h */ #include "include/config.h" +#ifdef HAVE_KRB5 + #define RCSID(msg) \ static /**/const char *const rcsid[] = { (const char *)rcsid, "\100(#)" msg } @@ -22,17 +24,52 @@ static /**/const char *const rcsid[] = { (const char *)rcsid, "\100(#)" msg } /* path to sysconf - should we force this to samba LIBDIR ? */ #define SYSCONFDIR "/etc" -#define KRB5 /* Maximum values on all known systems */ #define MaxHostNameLen (64+4) #define MaxPathLen (1024+4) -#define HAVE_H_ERRNO +#define VERSIONLIST {"Lorikeet-Heimdal, Modified for Samba4 0.7rc1"} -#define HAVE_LONG_LONG 1 +/* even if we do have dlopen, we don't want heimdal using it */ +#undef HAVE_DLOPEN -#define VERSIONLIST {"Lorikeet-Heimdal, Modified for Samba4 0.7rc1"} +#define VERSION "Samba" +#define ROKEN_LIB_FUNCTION -#undef HAVE_DLOPEN +/* these should be done with configure tests */ +#define HAVE_H_ERRNO +#define HAVE_INET_ATON +#define HAVE_LONG_LONG +#define HAVE_GETHOSTNAME +#define HAVE_SOCKLEN_T +#define HAVE_GETNAMEINFO +#define HAVE_STRUCT_WINSIZE +#define HAVE_STRUCT_SOCKADDR_STORAGE +#define HAVE_STRUCT_ADDRINFO +#define HAVE_GAI_STRERROR + +/* setup correct defines for capabilities of our version of heimdal */ +#define KRB5 +#define HAVE_KRB5_SET_REAL_TIME +#define HAVE_KRB5_LOG_CONTROL +#define HAVE_KRB5_INITLOG +#define HAVE_KRB5_ADDLOG_FUNC +#define HAVE_KRB5_FREELOG +#define HAVE_KRB5_SET_WARN_DEST +#define HAVE_KRB5_LOG_FACILITY +#define HAVE_KRB5_AUTH_CON_SETKEY +#define HAVE_ADDR_TYPE_IN_KRB5_ADDRESS +#define HAVE_KRB5_GET_PW_SALT +#define HAVE_KRB5_STRING_TO_KEY_SALT +#define HAVE_KRB5_GET_DEFAULT_IN_TKT_ETYPES +#define HAVE_KRB5_SESSION_IN_CREDS +#define HAVE_KRB5_KEYBLOCK_KEYVALUE +#define HAVE_KRB5_C_ENCTYPE_COMPARE +#define HAVE_KRB5_KT_FREE_ENTRY +#define HAVE_KRB5_PRINCIPAL_GET_COMP_STRING + +#include +#include "lib/replace/replace.h" +#endif diff --git a/source4/heimdal_build/config.m4 b/source4/heimdal_build/config.m4 index 7bdcbdb030..3b32d9b22e 100644 --- a/source4/heimdal_build/config.m4 +++ b/source4/heimdal_build/config.m4 @@ -4,3 +4,18 @@ AC_CHECK_HEADERS(sys/utsname.h termcap.h term.h timezone.h time.h ttyname.h) AC_CHECK_FUNCS(setitimer uname umask unsetenv socket sendmsg putenv atexit) +# these are disabled unless heimdal is found below +SMB_MODULE_DEFAULT(KERBEROS_LIB, NOT) +SMB_BINARY_ENABLE(asn1_compile, NO) +SMB_BINARY_ENABLE(compile_et, NO) + +# to enable kerberos, unpack a heimdal source tree in the heimdal directory +# of the samba source tree +if test -d heimdal; then + AC_DEFINE(HAVE_KRB5,1,[Whether kerberos is available]) + CFLAGS="${CFLAGS} -Iheimdal_build -Iheimdal/lib/krb5 -Iheimdal/lib/gssapi -Iheimdal/lib/asn1 -Iheimdal/lib/com_err -Iheimdal/lib/hdb" + HAVE_KRB5=YES + SMB_MODULE_DEFAULT(KERBEROS_LIB, STATIC) + SMB_BINARY_ENABLE(asn1_compile, YES) + SMB_BINARY_ENABLE(compile_et, YES) +fi diff --git a/source4/heimdal_build/config.mk b/source4/heimdal_build/config.mk index 4ce95f26db..4d7e63877a 100644 --- a/source4/heimdal_build/config.mk +++ b/source4/heimdal_build/config.mk @@ -311,15 +311,13 @@ ADD_OBJ_FILES = \ heimdal/lib/asn1/hash.o \ heimdal/lib/asn1/lex.o \ heimdal/lib/asn1/parse.o \ - heimdal/lib/roken/strlcat.o \ - heimdal/lib/roken/strlcpy.o \ heimdal/lib/roken/emalloc.o \ heimdal/lib/roken/getarg.o \ heimdal/lib/roken/print_version.o \ heimdal/lib/roken/setprogname.o \ heimdal/lib/asn1/symbol.o -TARGET_CFLAGS = -Iheimdal_build -Iheimdal/lib/krb5 -Iheimdal/kdc -Iheimdal/lib/asn1 -Iheimdal/lib/des -Iheimdal/lib/com_err -Iheimdal/include REQUIRED_SUBSYSTEMS = HEIMDAL_ROKEN +TARGET_CFLAGS = -Iheimdal_build -Iheimdal/lib/roken NOPROTO = YES # End SUBSYSTEM ASN1_COMPILER ####################### @@ -327,12 +325,37 @@ NOPROTO = YES ####################### # Start BINARY asn1_compile [BINARY::asn1_compile] -REQUIRED_SUBSYSTEMS = ASN1_COMPILER -TARGET_CFLAGS = -Iheimdal/lib/krb5 -Iheimdal/kdc -Iheimdal/lib/asn1 -Iheimdal/lib/des -Iheimdal/lib/com_err -Iheimdal_build -Iheimdal/include +REQUIRED_SUBSYSTEMS = ASN1_COMPILER LIBREPLACE # End BINARY asn1_compile ####################### +####################### +# Start SUBSYSTEM COMPILE_ET +[SUBSYSTEM::COMPILE_ET] +ADD_OBJ_FILES = \ + heimdal/lib/com_err/lex.o \ + heimdal/lib/com_err/parse.o \ + heimdal/lib/com_err/compile_et.o \ + heimdal/lib/roken/getarg.o \ + heimdal/lib/roken/get_window_size.o \ + heimdal/lib/roken/getprogname.o \ + heimdal/lib/roken/strupr.o \ + heimdal/lib/roken/print_version.o \ + heimdal/lib/roken/setprogname.o +TARGET_CFLAGS = -Iheimdal_build -Iheimdal/lib/roken +NOPROTO = YES +# End SUBSYSTEM COMPILE_ET +####################### + +####################### +# Start BINARY compile_et +[BINARY::compile_et] +REQUIRED_SUBSYSTEMS = COMPILE_ET LIBREPLACE +# End BINARY compile_et +####################### + + ####################### # Start TARGET HEIMDAL_EXTERNAL [TARGET::HEIMDAL_EXTERNAL] @@ -346,7 +369,7 @@ REQUIRED_SUBSYSTEMS = ASN1_COMPILER # Start SUBSYSTEM HEIMDAL [SUBSYSTEM::HEIMDAL] NOPROTO = YES -TARGET_CFLAGS = -Iheimdal_build -Iheimdal/lib/krb5 -Iheimdal/lib/hdb -Iheimdal/lib/gssapi -Iheimdal/kdc -Iheimdal/lib/asn1 -Iheimdal/lib/des -Iheimdal/lib/com_err -Iheimdal/include +TARGET_CFLAGS = -Iheimdal_build -Iheimdal/kdc -Iheimdal/lib/des -Iheimdal/lib/roken -Iheimdal/include REQUIRED_SUBSYSTEMS = \ HEIMDAL_KDC HEIMDAL_HDB HEIMDAL_GSSAPI HEIMDAL_KRB5 \ HEIMDAL_ASN1 HEIMDAL_DES HEIMDAL_ROKEN HEIMDAL_COM_ERR @@ -357,6 +380,6 @@ REQUIRED_SUBSYSTEMS = \ # Start SUBSYSTEM KERBEROS_LIB [SUBSYSTEM::KERBEROS_LIB] #REQUIRED_SUBSYSTEMS = EXT_LIB_KRB5 -REQUIRED_SUBSYSTEMS = HEIMDAL +REQUIRED_SUBSYSTEMS = HEIMDAL LIBREPLACE # End SUBSYSTEM KERBEROS_LIB ####################### diff --git a/source4/heimdal_build/krb5-types.h b/source4/heimdal_build/krb5-types.h new file mode 100644 index 0000000000..68a8bc0da4 --- /dev/null +++ b/source4/heimdal_build/krb5-types.h @@ -0,0 +1,17 @@ +/* krb5-types.h -- this file was generated for i686-pc-linux-gnu by + $Id: bits.c,v 1.23 2005/01/05 15:22:02 lha Exp $ */ + +#ifndef __krb5_types_h__ +#define __krb5_types_h__ + +#include +#include +#include +#include + + +typedef socklen_t krb5_socklen_t; +#include +typedef ssize_t krb5_ssize_t; + +#endif /* __krb5_types_h__ */ -- cgit