From 8ec4b8159e0e8eea2a40e38b5ba4ef22876344b2 Mon Sep 17 00:00:00 2001 From: Alexander Bokovoy Date: Fri, 24 Nov 2017 16:55:33 +0200 Subject: [PATCH] ipa-kdb: override krb5.conf when testing KDC code in cmocka When testing KDC code in cmocka we rely on libkrb5 defaults. libkrb5 would read /etc/krb5.conf by default and would load a KDB module from there if it is defined for the test realm (EXAMPLE.COM). Since EXAMPLE.COM is a common name used for test realms, make sure to not using /etc/krb5.conf from the system. Instead, force KRB5_CONFIG to /dev/null so that only libkrb5 compiled-in defaults are in use. In such setup libkrb5 will attempt to load KDB driver db2 for our test realm. db2 driver doesn't fail if its database is not available (unlike FreeIPA's one), so it survives initialization. As result, ipa-kdb-tests pass without unexpected breakage. Reviewed-By: Christian Heimes --- daemons/ipa-kdb/Makefile.am | 2 ++ daemons/ipa-kdb/tests/test_setup.sh | 2 ++ 2 files changed, 4 insertions(+) create mode 100755 daemons/ipa-kdb/tests/test_setup.sh diff --git a/daemons/ipa-kdb/Makefile.am b/daemons/ipa-kdb/Makefile.am index 5669349af..d7696fc37 100644 --- a/daemons/ipa-kdb/Makefile.am +++ b/daemons/ipa-kdb/Makefile.am @@ -62,6 +62,8 @@ ipadb_la_LIBADD = \ $(NULL) if HAVE_CMOCKA +TESTS_ENVIRONMENT = . $(srcdir)/tests/test_setup.sh; +dist_ipa_kdb_tests_SOURCES = tests/test_setup.sh TESTS = ipa_kdb_tests check_PROGRAMS = ipa_kdb_tests endif diff --git a/daemons/ipa-kdb/tests/test_setup.sh b/daemons/ipa-kdb/tests/test_setup.sh new file mode 100755 index 000000000..b10fefce0 --- /dev/null +++ b/daemons/ipa-kdb/tests/test_setup.sh @@ -0,0 +1,2 @@ +KRB5_CONFIG=/dev/null +export KRB5_CONFIG