cf: Add --with-mitdb=PATH option

OS X builds started thinking they have the mitdb backend and started
failing the tests/kdc/check-mitdb test.  This commit fixes that by
requiring explicit enablement of the mitdb HDB backend.
This commit is contained in:
Nicolas Williams 2024-01-16 12:25:38 -06:00
parent 2e94b7855c
commit 408a62a7b4
4 changed files with 29 additions and 6 deletions

@ -196,6 +196,24 @@ AM_CONDITIONAL([HAVE_CAPNG], [test "$with_capng" != "no"])
AC_SUBST([CAPNG_CFLAGS])
AC_SUBST([CAPNG_LIBS])
dnl mitdb
AC_ARG_WITH([mitdb],
AC_HELP_STRING([--with-mitdb], [Path to MIT Kerberos DB include header and shared object]),
[],
[with_mitdb=no])
if test -n "$with_mitdb" -a -d "$with_mitdb"; then
AC_DEFINE_UNQUOTED([HAVE_MITDB], 1, [Define if building with MIT Kerberos DB driver])
AC_DEFINE(HAVE_DB1, 1, [define if you have a berkeley db1/2 library])
mitdb=$with_mitdb
elif test "$with_mitdb" = no; then
with_mitdb=
mitdb=
elif test "$with_mitdb" = yes; then
AC_MSG_ERROR([Need path to MIT Kerberos DB include header and shared object])
fi
AM_CONDITIONAL([HAVE_MITDB], [test -n "$with_mitdb"])
AC_SUBST([MITDB], ["$with_mitdb"])
dnl libmicrohttpd
AC_ARG_WITH([microhttpd],
AC_HELP_STRING([--with-microhttpd], [use microhttpd to serve KDC REST API @<:@default=check@:>@]),

@ -84,6 +84,11 @@ if versionscript
libhdb_la_LDFLAGS += $(LDFLAGS_VERSION_SCRIPT)$(srcdir)/version-script.map
endif
if HAVE_MITDB
libhdb_la_LDFLAGS += -L$(MITDB)/lib -Wl,-rpath,$(MITDB)/lib -ldb
AM_CPPFLAGS += -I$(MITDB)/include
endif
# test_hdbkeys and test_mkey are not tests -- they are manual test utils
noinst_PROGRAMS = test_dbinfo test_hdbkeys test_mkey test_namespace test_concurrency
TESTS = test_dbinfo test_namespace test_concurrency

@ -118,7 +118,7 @@ attr_to_flags(unsigned attr, HDBFlags *flags)
#define CHECK(x) do { if ((x)) goto out; } while(0)
#ifdef HAVE_DB1
#ifdef HAVE_MITDB
static krb5_error_code
mdb_principal2key(krb5_context context,
krb5_const_principal principal,
@ -134,7 +134,7 @@ mdb_principal2key(krb5_context context,
key->length = strlen(str) + 1;
return 0;
}
#endif /* HAVE_DB1 */
#endif /* HAVE_MITDB */
#define KRB5_KDB_SALTTYPE_NORMAL 0
#define KRB5_KDB_SALTTYPE_V4 1
@ -675,11 +675,11 @@ mdb_entry2value(krb5_context context, hdb_entry *entry, krb5_data *data)
}
#endif
#if HAVE_DB1
#ifdef HAVE_MITDB
#if defined(HAVE_DB_185_H)
#include <db_185.h>
#elif defined(HAVE_DB_H)
#else
#include <db.h>
#endif
@ -1154,7 +1154,7 @@ hdb_mitdb_create(krb5_context context, HDB **db,
return 0;
}
#endif /* HAVE_DB1 */
#endif /* HAVE_MITDB */
/*
can have any number of princ stanzas.

@ -77,7 +77,7 @@ static struct hdb_method methods[] = {
#if HAVE_DB3
{ HDB_INTERFACE_VERSION, NULL, NULL, 1, 1, "db3:", hdb_db3_create},
#endif
#if HAVE_DB1
#if HAVE_MITDB
{ HDB_INTERFACE_VERSION, NULL, NULL, 1, 1, "mit-db:", hdb_mitdb_create},
#endif
#if HAVE_LMDB