summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-06-07 07:22:25 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:17:45 -0500
commitbce8cda06123648c377fbef92526f1f56121e513 (patch)
tree75e4b2a190c8e3a5efd7c41433d36766ea189179 /source4
parent6eae7eb3c446e26d8003846a79471e6232b1b92e (diff)
downloadsamba-bce8cda06123648c377fbef92526f1f56121e513.tar.gz
samba-bce8cda06123648c377fbef92526f1f56121e513.tar.bz2
samba-bce8cda06123648c377fbef92526f1f56121e513.zip
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)
Diffstat (limited to 'source4')
-rw-r--r--source4/auth/gensec/config.m42
-rw-r--r--source4/auth/gensec/config.mk5
-rw-r--r--source4/auth/kerberos/config.m42
-rw-r--r--source4/config.list3
-rw-r--r--source4/configure.in7
-rwxr-xr-xsource4/heimdal_build/build_external.sh53
-rw-r--r--source4/heimdal_build/config.h47
-rw-r--r--source4/heimdal_build/config.m415
-rw-r--r--source4/heimdal_build/config.mk37
-rw-r--r--source4/heimdal_build/krb5-types.h17
-rw-r--r--source4/include/includes.h91
-rw-r--r--source4/include/system/kerberos.h30
-rw-r--r--source4/kdc/config.m42
-rw-r--r--source4/kdc/config.mk2
-rw-r--r--source4/kdc/kdc.h2
-rw-r--r--source4/lib/basic.mk9
-rw-r--r--source4/lib/replace/config.mk9
-rw-r--r--source4/lib/replace/replace.h114
-rw-r--r--source4/smbd/service.c4
19 files changed, 296 insertions, 155 deletions
diff --git a/source4/auth/gensec/config.m4 b/source4/auth/gensec/config.m4
index 4565ce0b97..af17e896a4 100644
--- a/source4/auth/gensec/config.m4
+++ b/source4/auth/gensec/config.m4
@@ -1,7 +1,7 @@
SMB_MODULE_DEFAULT(gensec_krb5, NOT)
SMB_MODULE_DEFAULT(gensec_gssapi, NOT)
-if test x"$SMB_EXT_LIB_ENABLE_KRB5" = x"YES"; then
+if test x"$HAVE_KRB5" = x"YES"; then
# krb5 is now disabled at runtime, not build time
SMB_MODULE_DEFAULT(gensec_krb5, STATIC)
SMB_MODULE_DEFAULT(gensec_gssapi, STATIC)
diff --git a/source4/auth/gensec/config.mk b/source4/auth/gensec/config.mk
index f8d1928585..34587e2e45 100644
--- a/source4/auth/gensec/config.mk
+++ b/source4/auth/gensec/config.mk
@@ -14,8 +14,7 @@ REQUIRED_SUBSYSTEMS = \
SUBSYSTEM = GENSEC
INIT_FUNCTION = gensec_krb5_init
INIT_OBJ_FILES = auth/gensec/gensec_krb5.o
-REQUIRED_SUBSYSTEMS = NDR_KRB5PAC KERBEROS EXT_LIB_KRB5 AUTH
-
+REQUIRED_SUBSYSTEMS = NDR_KRB5PAC KERBEROS KERBEROS_LIB AUTH
# End MODULE gensec_krb5
################################################
@@ -25,7 +24,7 @@ REQUIRED_SUBSYSTEMS = NDR_KRB5PAC KERBEROS EXT_LIB_KRB5 AUTH
SUBSYSTEM = GENSEC
INIT_FUNCTION = gensec_gssapi_init
INIT_OBJ_FILES = auth/gensec/gensec_gssapi.o
-REQUIRED_SUBSYSTEMS = EXT_LIB_KRB5 AUTH
+REQUIRED_SUBSYSTEMS = KERBEROS_LIB AUTH
# End MODULE gensec_gssapi
################################################
diff --git a/source4/auth/kerberos/config.m4 b/source4/auth/kerberos/config.m4
index d88fc78554..bbb57bdd47 100644
--- a/source4/auth/kerberos/config.m4
+++ b/source4/auth/kerberos/config.m4
@@ -1,3 +1,5 @@
+# NOTE! this whole m4 file is disabled in configure.in for now
+
#################################################
# KRB5 support
KRB5_CFLAGS=""
diff --git a/source4/config.list b/source4/config.list
index d2184731bb..cc8262314c 100644
--- a/source4/config.list
+++ b/source4/config.list
@@ -1,4 +1,5 @@
# master list of build config files for Samba4
+heimdal_build/config.mk
dsdb/config.mk
gtk/config.mk
smbd/config.mk
@@ -45,4 +46,4 @@ libcli/security/config.mk
lib/com/config.mk
scripting/config.mk
kdc/config.mk
-#heimdal/config.mk
+lib/replace/config.mk
diff --git a/source4/configure.in b/source4/configure.in
index a2a85c2885..57816d566a 100644
--- a/source4/configure.in
+++ b/source4/configure.in
@@ -9,7 +9,7 @@ AC_CONFIG_HEADER(include/config.h)
sinclude(build/m4/env.m4)
sinclude(build/m4/rewrite.m4)
-
+sinclude(heimdal_build/config.m4)
sinclude(lib/popt/config.m4)
sinclude(lib/iconv.m4)
sinclude(lib/socket/config.m4)
@@ -20,7 +20,10 @@ sinclude(lib/ldb/sqlite3.m4)
sinclude(lib/ldb/config.m4)
sinclude(lib/events/config.m4)
sinclude(lib/cmdline/config.m4)
-sinclude(auth/kerberos/config.m4)
+
+dnl disabled until we support external heimdal again
+dnl sinclude(auth/kerberos/config.m4)
+
sinclude(auth/gensec/config.m4)
sinclude(libcli/config.m4)
sinclude(smbd/process_model.m4)
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 <sys/types.h>
+#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,13 +325,38 @@ 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]
CMD = heimdal_build/build_external.sh
@@ -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 <inttypes.h>
+#include <sys/types.h>
+#include <sys/bitypes.h>
+#include <sys/socket.h>
+
+
+typedef socklen_t krb5_socklen_t;
+#include <unistd.h>
+typedef ssize_t krb5_ssize_t;
+
+#endif /* __krb5_types_h__ */
diff --git a/source4/include/includes.h b/source4/include/includes.h
index a72a961495..9ecfd20422 100644
--- a/source4/include/includes.h
+++ b/source4/include/includes.h
@@ -87,12 +87,6 @@
* Define VOLATILE if needed.
*/
-#if defined(HAVE_VOLATILE)
-#define VOLATILE volatile
-#else
-#define VOLATILE
-#endif
-
#define False (0)
#define True (1)
#define Auto (2)
@@ -143,14 +137,13 @@ extern int errno;
#include "lib/com/com.h"
#include "credentials.h"
+#include "lib/replace/replace.h"
+
+
#define malloc_p(type) (type *)malloc(sizeof(type))
#define malloc_array_p(type, count) (type *)realloc_array(NULL, sizeof(type), count)
#define realloc_p(p, type, count) (type *)realloc_array(p, sizeof(type), count)
-#ifndef HAVE_COMPARISON_FN_T
-typedef int (*comparison_fn_t)(const void *, const void *);
-#endif
-
/***** automatically generated prototypes *****/
#define _PRINTF_ATTRIBUTE(a1, a2) PRINTF_ATTRIBUTE(a1, a2)
#include "proto.h"
@@ -161,86 +154,12 @@ typedef int (*comparison_fn_t)(const void *, const void *);
#include "safe_string.h"
-#ifdef __COMPAR_FN_T
-#define QSORT_CAST (__compar_fn_t)
-#endif
-
-#ifndef QSORT_CAST
-#define QSORT_CAST (int (*)(const void *, const void *))
-#endif
-
#ifndef HAVE_PIPE
#define SYNC_DNS 1
#endif
-#ifndef HAVE_STRDUP
-char *strdup(const char *s);
-#endif
-
-#ifndef HAVE_MEMMOVE
-void *memmove(void *dest,const void *src,int size);
-#endif
-
-#ifndef HAVE_MKTIME
-time_t mktime(struct tm *t);
-#endif
-
-#ifndef HAVE_STRLCPY
-size_t strlcpy(char *d, const char *s, size_t bufsize);
-#endif
-
-#ifndef HAVE_STRLCAT
-size_t strlcat(char *d, const char *s, size_t bufsize);
-#endif
-
-#ifndef HAVE_STRNDUP
-char *strndup(const char *s, size_t n);
-#endif
-
-#ifndef HAVE_STRNLEN
-size_t strnlen(const char *s, size_t n);
-#endif
-
-#ifndef HAVE_STRTOUL
-unsigned long strtoul(const char *nptr, char **endptr, int base);
-#endif
-
-#ifndef HAVE_SETENV
-int setenv(const char *name, const char *value, int overwrite);
-#endif
-
-#ifndef HAVE_VASPRINTF_DECL
-int vasprintf(char **ptr, const char *format, va_list ap);
-#endif
-
-#if !defined(HAVE_BZERO) && defined(HAVE_MEMSET)
-#define bzero(a,b) memset((a),'\0',(b))
-#endif
-
extern int DEBUGLEVEL;
-/* add varargs prototypes with printf checking */
-#ifndef HAVE_SNPRINTF_DECL
-int snprintf(char *,size_t ,const char *, ...) PRINTF_ATTRIBUTE(3,4);
-#endif
-#ifndef HAVE_ASPRINTF_DECL
-int asprintf(char **,const char *, ...) PRINTF_ATTRIBUTE(2,3);
-#endif
-
-
-/* we used to use these fns, but now we have good replacements
- for snprintf and vsnprintf */
-#define slprintf snprintf
-
-
-#ifdef HAVE_VA_COPY
-#define VA_COPY(dest, src) va_copy(dest, src)
-#elif defined(HAVE___VA_COPY)
-#define VA_COPY(dest, src) __va_copy(dest, src)
-#else
-#define VA_COPY(dest, src) (dest) = (src)
-#endif
-
#if defined(VALGRIND)
#define strlen(x) valgrind_strlen(x)
#endif
@@ -275,10 +194,6 @@ int asprintf(char **,const char *, ...) PRINTF_ATTRIBUTE(2,3);
#endif
#define discard_const_p(type, ptr) ((type *)discard_const(ptr))
-#ifndef UINT16_MAX
-#define UINT16_MAX 65535
-#endif
-
/*
type safe varient of smb_xmalloc()
*/
diff --git a/source4/include/system/kerberos.h b/source4/include/system/kerberos.h
index e0a926300f..98457688f8 100644
--- a/source4/include/system/kerberos.h
+++ b/source4/include/system/kerberos.h
@@ -20,30 +20,10 @@
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include "heimdal_build/config.h"
-#ifdef HAVE_KRB5_H
-#include <krb5.h>
-#else
-#undef HAVE_KRB5
-#endif
-
-#if defined(HAVE_GSSAPI_H)
-# include <gssapi.h>
-# ifdef HAVE_GSSAPI_KRB5_H
-# include <gssapi_krb5.h>
-# endif
-#elif defined(HAVE_GSSAPI_GSSAPI_H)
-# include <gssapi/gssapi.h>
-# if defined(HAVE_GSSAPI_GSSAPI_KRB5_H)
-# include <gssapi/gssapi_krb5.h>
-# endif
-#elif defined(HAVE_GSSAPI_GSSAPI_GENERIC_H)
-# include <gssapi/gssapi_generic.h>
-# if defined(HAVE_GSSAPI_GSSAPI_KRB5_H)
-# include <gssapi/gssapi_krb5.h>
-# endif
-#endif
-
-#ifdef HAVE_COM_ERR_H
-#include <com_err.h>
+#ifdef HAVE_KRB5
+#include "heimdal/lib/krb5/krb5.h"
+#include "heimdal/lib/gssapi/gssapi.h"
+#include "heimdal/lib/com_err/com_err.h"
#endif
diff --git a/source4/kdc/config.m4 b/source4/kdc/config.m4
index 1408a858f4..c086b27936 100644
--- a/source4/kdc/config.m4
+++ b/source4/kdc/config.m4
@@ -1,5 +1,5 @@
SMB_MODULE_DEFAULT(server_service_kdc, NOT)
-if test t$SMB_EXT_LIB_ENABLE_KDC = tYES; then
+if test t$HAVE_KRB5 = tYES; then
SMB_MODULE_DEFAULT(server_service_kdc, STATIC)
fi
diff --git a/source4/kdc/config.mk b/source4/kdc/config.mk
index 3b227584ff..b1de650faa 100644
--- a/source4/kdc/config.mk
+++ b/source4/kdc/config.mk
@@ -7,6 +7,6 @@ INIT_OBJ_FILES = \
kdc/kdc.o \
kdc/hdb-ldb.o
REQUIRED_SUBSYSTEMS = \
- LIBLDB EXT_LIB_KRB5 EXT_LIB_KDC
+ LIBLDB KERBEROS_LIB
# End SUBSYSTEM KDC
#######################
diff --git a/source4/kdc/kdc.h b/source4/kdc/kdc.h
index d766e21e6e..25f643eadd 100644
--- a/source4/kdc/kdc.h
+++ b/source4/kdc/kdc.h
@@ -23,7 +23,7 @@
#include "system/kerberos.h"
#include "auth/kerberos/kerberos.h"
-#include <kdc.h>
+#include "heimdal/kdc/kdc.h"
krb5_error_code hdb_ldb_create(krb5_context context, struct HDB **db, const char *arg);
diff --git a/source4/lib/basic.mk b/source4/lib/basic.mk
index 02783366ca..6a463b8ec6 100644
--- a/source4/lib/basic.mk
+++ b/source4/lib/basic.mk
@@ -1,15 +1,6 @@
# LIB BASIC subsystem
##############################
-# Start SUBSYSTEM LIBREPLACE
-[SUBSYSTEM::LIBREPLACE]
-INIT_OBJ_FILES = lib/replace/replace.o
-ADD_OBJ_FILES = \
- lib/replace/snprintf.o
-# End SUBSYSTEM LIBREPLACE
-##############################
-
-##############################
# Start SUBSYSTEM LIBNETIF
[SUBSYSTEM::LIBNETIF]
INIT_OBJ_FILES = \
diff --git a/source4/lib/replace/config.mk b/source4/lib/replace/config.mk
new file mode 100644
index 0000000000..bd60402ba3
--- /dev/null
+++ b/source4/lib/replace/config.mk
@@ -0,0 +1,9 @@
+##############################
+# Start SUBSYSTEM LIBREPLACE
+[SUBSYSTEM::LIBREPLACE]
+INIT_OBJ_FILES = lib/replace/replace.o
+ADD_OBJ_FILES = \
+ lib/replace/snprintf.o
+# End SUBSYSTEM LIBREPLACE
+##############################
+
diff --git a/source4/lib/replace/replace.h b/source4/lib/replace/replace.h
new file mode 100644
index 0000000000..e0cb1420ec
--- /dev/null
+++ b/source4/lib/replace/replace.h
@@ -0,0 +1,114 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ macros to go along with the lib/replace/ portability layer code
+
+ Copyright (C) Andrew Tridgell 2005
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#ifndef _replace_h
+#define _replace_h
+
+#ifdef __COMPAR_FN_T
+#define QSORT_CAST (__compar_fn_t)
+#endif
+
+#ifndef QSORT_CAST
+#define QSORT_CAST (int (*)(const void *, const void *))
+#endif
+
+#ifndef HAVE_STRDUP
+char *strdup(const char *s);
+#endif
+
+#ifndef HAVE_MEMMOVE
+void *memmove(void *dest,const void *src,int size);
+#endif
+
+#ifndef HAVE_MKTIME
+time_t mktime(struct tm *t);
+#endif
+
+#ifndef HAVE_STRLCPY
+size_t strlcpy(char *d, const char *s, size_t bufsize);
+#endif
+
+#ifndef HAVE_STRLCAT
+size_t strlcat(char *d, const char *s, size_t bufsize);
+#endif
+
+#ifndef HAVE_STRNDUP
+char *strndup(const char *s, size_t n);
+#endif
+
+#ifndef HAVE_STRNLEN
+size_t strnlen(const char *s, size_t n);
+#endif
+
+#ifndef HAVE_STRTOUL
+unsigned long strtoul(const char *nptr, char **endptr, int base);
+#endif
+
+#ifndef HAVE_SETENV
+int setenv(const char *name, const char *value, int overwrite);
+#endif
+
+#ifndef HAVE_VASPRINTF_DECL
+int vasprintf(char **ptr, const char *format, va_list ap);
+#endif
+
+#if !defined(HAVE_BZERO) && defined(HAVE_MEMSET)
+#define bzero(a,b) memset((a),'\0',(b))
+#endif
+
+/* add varargs prototypes with printf checking */
+#ifndef HAVE_SNPRINTF_DECL
+int snprintf(char *,size_t ,const char *, ...) PRINTF_ATTRIBUTE(3,4);
+#endif
+#ifndef HAVE_ASPRINTF_DECL
+int asprintf(char **,const char *, ...) PRINTF_ATTRIBUTE(2,3);
+#endif
+
+
+/* we used to use these fns, but now we have good replacements
+ for snprintf and vsnprintf */
+#define slprintf snprintf
+
+
+#ifdef HAVE_VA_COPY
+#define VA_COPY(dest, src) va_copy(dest, src)
+#elif defined(HAVE___VA_COPY)
+#define VA_COPY(dest, src) __va_copy(dest, src)
+#else
+#define VA_COPY(dest, src) (dest) = (src)
+#endif
+
+#ifndef UINT16_MAX
+#define UINT16_MAX 65535
+#endif
+
+#if defined(HAVE_VOLATILE)
+#define VOLATILE volatile
+#else
+#define VOLATILE
+#endif
+
+#ifndef HAVE_COMPARISON_FN_T
+typedef int (*comparison_fn_t)(const void *, const void *);
+#endif
+
+#endif
diff --git a/source4/smbd/service.c b/source4/smbd/service.c
index ab377dc29b..09f7a63fe7 100644
--- a/source4/smbd/service.c
+++ b/source4/smbd/service.c
@@ -91,6 +91,10 @@ NTSTATUS server_service_startup(struct event_context *event_ctx,
NTSTATUS status;
status = server_service_init(server_services[i], event_ctx, model_ops);
+ if (!NT_STATUS_IS_OK(status)) {
+ DEBUG(0,("Failed to start service '%s' - %s\n",
+ server_services[i], nt_errstr(status)));
+ }
NT_STATUS_NOT_OK_RETURN(status);
}