6b0b0c6a breaks using with MIT Kerberos
Summary
Change in 6b0b0c6a passes incorrect args to krb5-config
.
BIND version used
bind-9.16.19
Steps to reproduce
Try compile with Kerberos 5 release 1.19.2 and pass to ./configure
--with-gssapi=$PREFIX/bin/krb5-config
.
What is the current bug behavior?
The linker test fails:
configure:17572: checking krb5-config linking as -L/opt/ports/lib/hpux32 -L/opt/ports/lib/hpux32 -lkrb5 -lk5crypto -lcom_err
configure:17585: /opt/aCC/bin/aCC -Ae -o conftest -g -mt -I/opt/ports/include -L/opt/ports/lib/hpux32 conftest.c -L/opt/ports/lib/hpux32 -L/opt/ports/lib/hpux32 -lkrb5 -lk5crypto -lcom_err >&5
"conftest.c", line 112: warning #2223-D: function "gss_acquire_cred" declared implicitly
gss_acquire_cred();krb5_init_context()
^
"conftest.c", line 112: warning #2223-D: function "krb5_init_context" declared implicitly
gss_acquire_cred();krb5_init_context()
^
ld: Unsatisfied symbol "gss_acquire_cred" in file conftest.o
1 error.
configure:17585: $? = 1
What is the expected correct behavior?
Linker test to pass
Possible fixes
The problem is incorrect understanding of krb5-config
. It does not accept more than one library
request and if more than one is passed, the latter always overrides the former:
# krb5-config --libs gssapi krb5
-L/opt/ports/lib/hpux32 -Wl,+b,/opt/ports/lib/hpux32 -L/opt/ports/lib/hpux32 -lkrb5 -lk5crypto -lcom_err
# # extracted test
# /opt/aCC/bin/aCC -Ae -o conftest -g -mt -I/opt/ports/include -L/opt/ports/lib/hpux32 conftest.c -L/opt/ports/lib/hpux32 -L/opt/ports/lib/hpux32 -lkrb5 -lk5crypto -lcom_err
"conftest.c", line 4: warning #2223-D: function "gss_acquire_cred" declared
implicitly
gss_acquire_cred();krb5_init_context()
^
"conftest.c", line 4: warning #2223-D: function "krb5_init_context" declared
implicitly
gss_acquire_cred();krb5_init_context()
^
ld: Unsatisfied symbol "gss_acquire_cred" in file conftest.o
1 error.
Correct is to pass gssapi
only, it internally depends on krb5
and will add all required libraries, name for GSS-API gss_
AND KRB5 krb5_
:
# krb5-config --libs gssapi
-L/opt/ports/lib/hpux32 -Wl,+b,/opt/ports/lib/hpux32 -L/opt/ports/lib/hpux32 -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err
thus
/opt/aCC/bin/aCC -Ae -o conftest -g -mt -I/opt/ports/include -L/opt/ports/lib/hpux32 conftest.c -L/opt/ports/lib/hpux32 -L/opt/ports/lib/hpux32 -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err
"conftest.c", line 4: warning #2223-D: function "gss_acquire_cred" declared
implicitly
gss_acquire_cred();krb5_init_context()
^
"conftest.c", line 4: warning #2223-D: function "krb5_init_context" declared
implicitly
gss_acquire_cred();krb5_init_context()
# file ./conftest
./conftest: ELF-32 executable object file - IA64
# ldd ./conftest
./conftest:
libgssapi_krb5.2 => /opt/ports/lib/hpux32/libgssapi_krb5.2
libkrb5.3 => /opt/ports/lib/hpux32/libkrb5.3
libk5crypto.3 => /opt/ports/lib/hpux32/libk5crypto.3
libcom_err.3 => /opt/ports/lib/hpux32/libcom_err.3
libpthread.so.1 => /usr/lib/hpux32/libpthread.so.1
libc.so.1 => /usr/lib/hpux32/libc.so.1
libkrb5support.0 => /opt/ports/lib/hpux32/libkrb5support.0
libintl.so.10 => /opt/ports/lib/hpux32/libintl.so.10
libdl.so.1 => /usr/lib/hpux32/libdl.so.1
libiconv.so.8 => /opt/ports/lib/hpux32/libiconv.so.8
libc.so.1 => /usr/lib/hpux32/libc.so.1
libc.so.1 => /usr/lib/hpux32/libc.so.1
fix:
# sed -i"" "s#--libs gssapi krb5#--libs gssapi#g" configure
....
checking for GSSAPI library... trying /opt/ports/bin/krb5-config
checking gssapi.h usability... yes
checking gssapi.h presence... yes
checking for gssapi.h... yes
checking gssapi/gssapi.h usability... yes
checking gssapi/gssapi.h presence... yes
checking for gssapi/gssapi.h... yes
checking krb5/krb5.h usability... yes
checking krb5/krb5.h presence... yes
checking for krb5/krb5.h... yes
checking krb5.h usability... yes
checking krb5.h presence... yes
checking for krb5.h... yes
checking krb5-config linking as -L/opt/ports/lib/hpux32 -Wl,+b,/opt/ports/lib/hpux32 -L/opt/ports/lib/hpux32 -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err... krb5-config: linked
...