Get static linking working again, mostly
authorGreg Hudson <ghudson@mit.edu>
Tue, 28 Jun 2011 14:07:07 +0000 (14:07 +0000)
committerGreg Hudson <ghudson@mit.edu>
Tue, 28 Jun 2011 14:07:07 +0000 (14:07 +0000)
Static linking (#6510) broke when lockout support was added because
the DB2 plugin became dependent on libkadm5srv_mit for XDR functions.
Also, static linking was extensively broken in combination with LDAP
support.  Fix these problems.

Afer these fixes, the test suite fails in the FAST tests because
there's no static build support for dynamic preauth plugins, which
means there's no encrypted challenge.  (And unlike the pkinit tests,
the test suite doesn't conditionalize on the presence of the encrypted
challenge plugin, because we always build it.)  This will fix itself
if and when encrypted challenge becomes linked into the consumers, or
static build support is added for preauth plugins.

ticket: 6914

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@24996 dc483132-0cff-0310-8789-dd5450dbe970

src/Makefile.in
src/aclocal.m4
src/config/pre.in
src/configure.in
src/lib/crypto/crypto_tests/Makefile.in
src/lib/kdb/kdb5.c
src/plugins/kdb/ldap/Makefile.in
src/plugins/kdb/ldap/libkdb_ldap/Makefile.in

index 1bf2671a22e4472952334a48e9b3a17203387198..d64e195b9e7cc8f8eca719fc35cea2c2ddd5d648 100644 (file)
@@ -8,10 +8,10 @@ mydir=.
 #      plugins/preauth/cksum_body
 #      plugins/authdata/greet
 SUBDIRS=util include lib \
-       @ldap_plugin_dir@ \
        @sam2_plugin@ \
        plugins/kadm5_hook/test \
        plugins/kdb/db2 \
+       @ldap_plugin_dir@ \
        plugins/preauth/pkinit \
        plugins/preauth/encrypted_challenge \
        kdc kadmin slave clients appl tests \
index 57a0a38d9984825a38906ed2f7abc00cbcedef34..a56e7ec5e843ba0f8f739b8ccb73fee01be6505d 100644 (file)
@@ -1149,9 +1149,13 @@ if test "x$enable_static" = xyes; then
        KDB5_PLUGIN_DEPLIBS='$(TOPLIBD)/libkrb5_db2$(DEPLIBEXT)'
        KDB5_PLUGIN_LIBS='-lkrb5_db2'
        if test "x$OPENLDAP_PLUGIN" = xyes; then
-               KDB5_PLUGIN_DEBLIBS=$KDB5_PLUGIN_DEPLIBS' $(TOPLIBD)/libkrb5_ldap$(DEPLIBEXT)'
-               KDB5_PLUGIN_LIBS=$KDB_LUGIN_LIBS' -lkrb5_ldap'
+               KDB5_PLUGIN_DEBLIBS=$KDB5_PLUGIN_DEPLIBS' $(TOPLIBD)/libkrb5_ldap$(DEPLIBEXT) $(TOPLIBD)/libkdb_ldap$(DEPLIBEXT)'
+               KDB5_PLUGIN_LIBS=$KDB5_PLUGIN_LIBS' -lkrb5_kldap -lkdb_ldap $(LDAP_LIBS)'
        fi
+       # kadm5srv_mit normally comes before kdb on the link line.  Add it
+       # again after the KDB plugins, since they depend on it for XDR stuff.
+       KDB5_PLUGIN_DEPLIBS=$KDB5_PLUGIN_DEPLIBS' $(TOPLIBD)/libkadm5srv_mit$(DEPLIBEXT)'
+       KDB5_PLUGIN_LIBS=$KDB5_PLUGIN_LIBS' -lkadm5srv_mit'
 
        # avoid duplicate rules generation for AIX and such
        SHLIBEXT=.so-nobuild
index a81d150dd48c5cde04b365f903d956ac9919ffe3..7b96ebc7d7aae624763aade5b4fbc33707c7eb55 100644 (file)
@@ -376,6 +376,8 @@ KDB5_LIB    = -lkdb5 $(KDB5_PLUGIN_LIBS)
 
 DL_LIB         = @DL_LIB@
 
+LDAP_LIBS      = @LDAP_LIBS@
+
 KRB5_LIB                       = -lkrb5
 K5CRYPTO_LIB                   = -lk5crypto
 COM_ERR_LIB                    = -lcom_err
index 6b69df9091b2521ca9ca2b621b19daa303d3863b..641a0f364de2e6fcb47308a39c866bbb1ea26b68 100644 (file)
@@ -1066,7 +1066,7 @@ if test -n "$OPENLDAP_PLUGIN"; then
   K5_GEN_MAKEFILE(plugins/kdb/ldap)
   K5_GEN_MAKEFILE(plugins/kdb/ldap/ldap_util)
   K5_GEN_MAKEFILE(plugins/kdb/ldap/libkdb_ldap)
-  ldap_plugin_dir=plugins/kdb/ldap
+  ldap_plugin_dir='plugins/kdb/ldap plugins/kdb/ldap/ldap_util'
   LDAP=yes
 else
   LDAP=no
index 555c90c645906cc0e2d6bf408bcbaed991c5ddd9..5aeef54a6e872a42620485c56a763fab1860e44b 100644 (file)
@@ -71,40 +71,40 @@ check-unix:: t_nfold t_encrypt t_decrypt t_prf t_prng t_cmac t_hmac \
        diff t_cf2.output $(srcdir)/t_cf2.expected
 #      $(RUN_SETUP) $(VALGRIND) ./t_pkcs5
 
-t_nfold$(EXEEXT): t_nfold.$(OBJEXT) $(CRYPTO_DEPLIB) $(SUPPORT_DEPLIB)
-       $(CC_LINK) -o $@ t_nfold.$(OBJEXT) -lkrb5 -lk5crypto -lcom_err $(SUPPORT_LIB)
+t_nfold$(EXEEXT): t_nfold.$(OBJEXT) $(KRB5_BASE_DEPLIBS)
+       $(CC_LINK) -o $@ t_nfold.$(OBJEXT) $(KRB5_BASE_LIBS)
 
-t_encrypt$(EXEEXT): t_encrypt.$(OBJEXT) $(CRYPTO_DEPLIB) $(SUPPORT_DEPLIB)
-       $(CC_LINK) -o $@ t_encrypt.$(OBJEXT)  -lkrb5 -lk5crypto -lcom_err $(SUPPORT_LIB)
+t_encrypt$(EXEEXT): t_encrypt.$(OBJEXT) $(KRB5_BASE_DEPLIBS)
+       $(CC_LINK) -o $@ t_encrypt.$(OBJEXT) $(KRB5_BASE_LIBS)
 
-t_decrypt$(EXEEXT): t_decrypt.$(OBJEXT) $(CRYPTO_DEPLIB) $(SUPPORT_DEPLIB)
-       $(CC_LINK) -o $@ t_decrypt.$(OBJEXT)  -lkrb5 -lk5crypto -lcom_err $(SUPPORT_LIB)
+t_decrypt$(EXEEXT): t_decrypt.$(OBJEXT) $(KRB5_BASE_DEPLIBS)
+       $(CC_LINK) -o $@ t_decrypt.$(OBJEXT) $(KRB5_BASE_LIBS)
 
-t_prf$(EXEEXT): t_prf.$(OBJEXT) $(SUPPORT_DEPLIB)
-       $(CC_LINK) -o $@ t_prf.$(OBJEXT)  -lkrb5 -lk5crypto -lcom_err $(SUPPORT_LIB)
+t_prf$(EXEEXT): t_prf.$(OBJEXT) $(KRB5_BASE_DEPLIBS)
+       $(CC_LINK) -o $@ t_prf.$(OBJEXT) $(KRB5_BASE_LIBS)
 
-t_prng$(EXEEXT): t_prng.$(OBJEXT) $(SUPPORT_DEPLIB)
-       $(CC_LINK) -o $@ t_prng.$(OBJEXT)  -lk5crypto -lcom_err $(SUPPORT_LIB)
+t_prng$(EXEEXT): t_prng.$(OBJEXT) $(KRB5_BASE_DEPLIBS)
+       $(CC_LINK) -o $@ t_prng.$(OBJEXT) $(KRB5_BASE_LIBS)
 
-t_cmac$(EXEEXT): t_cmac.$(OBJEXT) $(CRYPTO_DEPLIB) $(SUPPORT_DEPLIB)
-       $(CC_LINK) -o $@ t_cmac.$(OBJEXT) $(K5CRYPTO_LIB) $(COM_ERR_LIB) $(SUPPORT_LIB)
+t_cmac$(EXEEXT): t_cmac.$(OBJEXT) $(KRB5_BASE_DEPLIBS)
+       $(CC_LINK) -o $@ t_cmac.$(OBJEXT) $(KRB5_BASE_LIBS)
 
-t_hmac$(EXEEXT): t_hmac.$(OBJEXT) $(CRYPTO_DEPLIB) $(SUPPORT_DEPLIB)
-       $(CC_LINK) -o $@ t_hmac.$(OBJEXT) $(K5CRYPTO_LIB) $(COM_ERR_LIB) $(SUPPORT_LIB)
+t_hmac$(EXEEXT): t_hmac.$(OBJEXT) $(KRB5_BASE_DEPLIBS)
+       $(CC_LINK) -o $@ t_hmac.$(OBJEXT) $(KRB5_BASE_LIBS)
 
-#t_pkcs5$(EXEEXT): t_pkcs5.$(OBJEXT) $(CRYPTO_DEPLIB) $(SUPPORT_DEPLIB)
-#      $(CC_LINK) -o $@ t_pkcs5.$(OBJEXT) $(K5CRYPTO_LIB) $(COM_ERR_LIB) $(SUPPORT_LIB)
+#t_pkcs5$(EXEEXT): t_pkcs5.$(OBJEXT) $(KRB5_BASE_DEPLIBS)
+#      $(CC_LINK) -o $@ t_pkcs5.$(OBJEXT) $(KRB5_BASE_LIBS)
 
-vectors$(EXEEXT): vectors.$(OBJEXT) $(CRYPTO_DEPLIB) $(SUPPORT_DEPLIB)
-       $(CC_LINK) -o $@ vectors.$(OBJEXT) $(K5CRYPTO_LIB) $(COM_ERR_LIB) $(SUPPORT_LIB)
+vectors$(EXEEXT): vectors.$(OBJEXT) $(KRB5_BASE_DEPLIBS)
+       $(CC_LINK) -o $@ vectors.$(OBJEXT) $(KRB5_BASE_LIBS)
 
- t_cts$(EXEEXT): t_cts.$(OBJEXT) $(CRYPTO_DEPLIB) $(SUPPORT_DEPLIB)
+t_cts$(EXEEXT): t_cts.$(OBJEXT) $(KRB5_BASE_DEPLIBS)
        $(CC_LINK) -o $@ t_cts.$(OBJEXT) \
-               $(K5CRYPTO_LIB) $(COM_ERR_LIB) $(SUPPORT_LIB)
+               $(KRB5_BASE_LIBS)
 
-t_short$(EXEEXT): t_short.$(OBJEXT) $(CRYPTO_DEPLIB) $(SUPPORT_DEPLIB)
+t_short$(EXEEXT): t_short.$(OBJEXT) $(KRB5_BASE_DEPLIBS)
        $(CC_LINK) -o $@ t_short.$(OBJEXT) \
-               $(K5CRYPTO_LIB) $(COM_ERR_LIB) $(SUPPORT_LIB)
+               $(KRB5_BASE_LIBS)
 
 t_cksum4.o: $(srcdir)/t_cksum.c
        $(CC) -DMD=4 $(ALL_CFLAGS) -o t_cksum4.o -c $(srcdir)/t_cksum.c
@@ -113,46 +113,46 @@ t_cksum5.o: $(srcdir)/t_cksum.c
        $(CC) -DMD=5 $(ALL_CFLAGS) -o t_cksum5.o -c $(srcdir)/t_cksum.c
 
 t_cksum4: t_cksum4.o $(CRYTPO_DEPLIB)
-       $(CC_LINK) -o t_cksum4 t_cksum4.o $(K5CRYPTO_LIB) $(COM_ERR_LIB) $(SUPPORT_LIB) $(LIBS)
+       $(CC_LINK) -o t_cksum4 t_cksum4.o $(KRB5_BASE_LIBS)
 
 t_cksum5: t_cksum5.o $(CRYPTO_DEPLIB)
-       $(CC_LINK) -o t_cksum5 t_cksum5.o $(K5CRYPTO_LIB) $(COM_ERR_LIB) $(SUPPORT_LIB) $(LIBS)
+       $(CC_LINK) -o t_cksum5 t_cksum5.o $(KRB5_BASE_LIBS)
 
 t_cksums: t_cksums.o $(CRYTPO_DEPLIB)
-       $(CC_LINK) -o t_cksums t_cksums.o -lkrb5 $(K5CRYPTO_LIB) $(COM_ERR_LIB) $(SUPPORT_LIB) $(LIBS)
+       $(CC_LINK) -o t_cksums t_cksums.o -lkrb5 $(KRB5_BASE_LIBS)
 
-t_crc: t_crc.o $(CRYPTO_DEPLIB) $(SUPPORT_DEPLIB)
-       $(CC_LINK) -o $@ t_crc.o $(K5CRYPTO_LIB) $(SUPPORT_LIB)
+t_crc: t_crc.o $(KRB5_BASE_DEPLIBS)
+       $(CC_LINK) -o $@ t_crc.o $(KRB5_BASE_LIBS)
 
-aes-test: aes-test.$(OBJEXT) $(CRYPTO_DEPLIB)
-       $(CC_LINK) -o aes-test aes-test.$(OBJEXT) $(K5CRYPTO_LIB) $(COM_ERR_LIB) $(SUPPORT_LIB)
+aes-test: aes-test.$(OBJEXT) $(KRB5_BASE_DEPLIBS)
+       $(CC_LINK) -o aes-test aes-test.$(OBJEXT) $(KRB5_BASE_LIBS)
 
 camellia-test: camellia-test.$(OBJEXT) $(CRYPTO_DEPLIB)
-       $(CC_LINK) -o camellia-test camellia-test.$(OBJEXT) $(K5CRYPTO_LIB) $(COM_ERR_LIB) $(SUPPORT_LIB)
+       $(CC_LINK) -o camellia-test camellia-test.$(OBJEXT) $(KRB5_BASE_LIBS)
 
 t_mddriver4.o: $(srcdir)/t_mddriver.c
        $(CC) -DMD=4 $(ALL_CFLAGS) -o t_mddriver4.o -c $(srcdir)/t_mddriver.c
 
-t_mddriver4: t_mddriver4.o  $(SUPPORT_DEPLIB) $(CRYPTO_DEPLIB)
-       $(CC_LINK) -DMD4  -o t_mddriver4 t_mddriver4.o -lk5crypto $(SUPPORT_LIB)
+t_mddriver4: t_mddriver4.o $(KRB5_BASE_DEPLIBS)
+       $(CC_LINK) -DMD4  -o t_mddriver4 t_mddriver4.o $(KRB5_BASE_LIBS)
 
-t_mddriver: t_mddriver.o  $(SUPPORT_DEPLIB) $(CRYPTO_DEPLIB)
-       $(CC_LINK) -o t_mddriver t_mddriver.o -lk5crypto $(SUPPORT_LIB)
+t_mddriver: t_mddriver.o $(KRB5_BASE_DEPLIBS)
+       $(CC_LINK) -o t_mddriver t_mddriver.o $(KRB5_BASE_LIBS)
 
-t_kperf: t_kperf.o $(SUPPORT_DEPLIB) $(CRYPTO_DEPLIB)
-       $(CC_LINK) -o t_kperf t_kperf.o  $(SUPPORT_LIB) $(CRYPTO_DEPLIB)
+t_kperf: t_kperf.o $(KRB5_BASE_DEPLIBS)
+       $(CC_LINK) -o t_kperf t_kperf.o $(KRB5_BASE_LIBS)
 
-t_str2key$(EXEEXT): t_str2key.$(OBJEXT) $(SUPPORT_DEPLIB)
-       $(CC_LINK) -o $@ t_str2key.$(OBJEXT)  -lkrb5 -lk5crypto -lcom_err $(SUPPORT_LIB)
+t_str2key$(EXEEXT): t_str2key.$(OBJEXT) $(KRB5_BASE_DEPLIBS)
+       $(CC_LINK) -o $@ t_str2key.$(OBJEXT) $(KRB5_BASE_LIBS)
 
-t_derive$(EXEEXT): t_derive.$(OBJEXT) $(SUPPORT_DEPLIB)
-       $(CC_LINK) -o $@ t_derive.$(OBJEXT)  -lkrb5 -lk5crypto -lcom_err $(SUPPORT_LIB)
+t_derive$(EXEEXT): t_derive.$(OBJEXT) $(KRB5_BASE_DEPLIBS)
+       $(CC_LINK) -o $@ t_derive.$(OBJEXT) $(KRB5_BASE_LIBS)
 
-t_fork$(EXEEXT): t_fork.$(OBJEXT) $(SUPPORT_DEPLIB)
-       $(CC_LINK) -o $@ t_fork.$(OBJEXT) -lkrb5 -lk5crypto -lcom_err $(SUPPORT_LIB)
+t_fork$(EXEEXT): t_fork.$(OBJEXT) $(KRB5_BASE_DEPLIBS)
+       $(CC_LINK) -o $@ t_fork.$(OBJEXT) $(KRB5_BASE_LIBS)
 
-t_cf2$(EXEEXT): t_cf2.$(OBJEXT) $(SUPPORT_DEPLIB)
-       $(CC_LINK) -o $@ t_cf2.$(OBJEXT)  -lkrb5 -lk5crypto -lcom_err $(SUPPORT_LIB)
+t_cf2$(EXEEXT): t_cf2.$(OBJEXT) $(KRB5_BASE_DEPLIBS)
+       $(CC_LINK) -o $@ t_cf2.$(OBJEXT) $(KRB5_BASE_LIBS)
 
 clean::
        $(RM) t_nfold.o t_nfold t_encrypt t_encrypt.o \
index e18b99e8b2b6e2e576e15ba5b0bdbe88c39f0b3e..62d7139362b775dcba39aaf49ab821b81930d267 100644 (file)
@@ -265,7 +265,7 @@ kdb_setup_opt_functions(db_library lib)
 
 extern kdb_vftabl krb5_db2_kdb_function_table;
 #ifdef ENABLE_LDAP
-extern kdb_vftabl krb5_db2_ldap_function_table;
+extern kdb_vftabl krb5_ldap_kdb_function_table;
 #endif
 
 static krb5_error_code
index 490c3ecfd39d2c6949d6ad2ddcec311fa2e7024b..dffb60f47e33509d55dd6c15d31853c330eb818c 100644 (file)
@@ -7,7 +7,7 @@ PROG_RPATH=$(KRB5_LIBDIR)
 DEFS =
 MODULE_INSTALL_DIR = $(KRB5_DB_MODULE_DIR)
 
-SUBDIRS= libkdb_ldap ldap_util
+SUBDIRS= libkdb_ldap
 
 LOCALINCLUDES = -I../../../lib/kdb -I$(srcdir)/../../../lib/kdb \
        -I$(srcdir)/libkdb_ldap
@@ -29,8 +29,6 @@ SHLIB_EXPLIBS= -lkdb_ldap $(GSSRPC_LIBS) -lkrb5 -lcom_err -lk5crypto -lkrb5suppo
 SHLIB_DIRS=-L$(TOPLIBD)
 SHLIB_RDIRS=$(KRB5_LIBDIR)
 
-$(TOPLIBD)/libkdb_ldap$(SHLIBEXT): all-recurse
-
 SRCS=  $(srcdir)/ldap_exp.c
 
 STOBJLISTS=OBJS.ST
index cadc1bfe0fbe5c6057fce282068553f9f042590b..2126df61670699f70f63f5e7eb5ab7cba4cafa83 100644 (file)
@@ -29,7 +29,7 @@ SHLIB_EXPDEPS = \
        $(TOPLIBD)/libk5crypto$(SHLIBEXT) \
        $(SUPPORT_DEPLIB) \
        $(TOPLIBD)/libkrb5$(SHLIBEXT)
-SHLIB_EXPLIBS= $(KADMSRV_LIBS) -lkrb5 -lk5crypto $(COM_ERR_LIB) $(SUPPORT_LIB) @LDAP_LIBS@ $(LIBS)
+SHLIB_EXPLIBS= $(KADMSRV_LIBS) -lkrb5 -lk5crypto $(COM_ERR_LIB) $(SUPPORT_LIB) $(LDAP_LIBS) $(LIBS)
 SHLIB_DIRS=-L$(TOPLIBD)
 SHLIB_RDIRS=$(KRB5_LIBDIR)