[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[patch] statically linking with mechglue-branch



This isn't a patch really, it's just a manually edited diff -r (inlined
below) and as such the line numbers may be slightly wrong.

These changes should allow static linking against mechglue-branch. I
have made a number of other changes not shown here but I believe they
are irrelevant.

Note that if you have an /etc/mech.conf you may get runtime warnings:

  gssserver: Cannot open '/usr/heimdal/lib/gss/libmech_krb5.so': \
    /usr/heimdal/lib/gss/libmech_krb5.so: undefined symbol: \
    GSS_C_PEER_HAS_UPDATED_SPNEGO
  gssserver: Cannot open '/usr/heimdal/lib/gss/libmech_spnego.so': \
    /usr/heimdal/lib/gss/libmech_krb5.so.1: undefined symbol: \
    krb5_rd_cred2

The GSS_C_PEER_HAS_UPDATED_SPNEGO symbol is exported in libgssapi.so and
krb5_rd_cred2 is exported in libkrb5.so. There's some kind of problem
when dlopen tries to resolve external symbols. From looking at objdump
output it's not entirely clear what the problem is. But if I remove
the libmech_krb5.so and libmech_spnego.so entries from /etc/mech.conf
or remove /etc/mech.conf alltogether the warnings go away. In the end
I suppose there should just be some logic that prevents dlopen-ing
mechs that have already been manually added in g_initialize.c.

Finally, if we assume that code in the .a archives will only be used
for static linking it would be better if the condition for including
the gss_spnego_initialize() call was somehow based on that. Otherwise
if the gss_spnego_initialize() call is included, an alternative spnego
mechanism cannot be dynamically loaded.

Mike

--8<--

diff -r mechglue.orig/appl/ftp/ftp/Makefile.am mechglue/appl/ftp/ftp/Makefile.am
47c47,48
< 	$(LIB_readline)
---
> 	$(LIB_readline) \
> 	$(LIB_spnego)
diff -r mechglue.orig/appl/ftp/ftpd/Makefile.am mechglue/appl/ftp/ftpd/Makefile.am
56c56,57
< 	$(LIB_roken)
---
> 	$(LIB_roken) \
> 	$(LIB_spnego)
diff -r mechglue.orig/appl/popper/Makefile.am mechglue/appl/popper/Makefile.am
49a50
> 	$(LIB_spnego) \
diff -r mechglue.orig/cf/Makefile.am.common mechglue/cf/Makefile.am.common
6c8
< AM_CPPFLAGS = -I$(top_builddir)/include $(INCLUDES_roken)
---
> AM_CPPFLAGS = -I$(top_builddir)/include $(INCLUDES_roken) -DENABLE_STATIC_SPNEGO
diff -r mechglue.orig/lib/mechglue/g_glue.c mechglue/lib/mechglue/g_glue.c
49a50,53
>     if (__gss_mechs_array == NULL) {
>         return NULL;
>     }
> 
diff -r mechglue.orig/lib/mechglue/g_initialize.c mechglue/lib/mechglue/g_initialize.c
47a48
> extern gss_mechanism gss_spnego_initialize();
146c147,155
< 
---
> #ifdef ENABLE_STATIC_SPNEGO
>     {
>         gss_mechanism spnego_mech;
>         spnego_mech = (gss_mechanism)gss_spnego_initialize();
>         if (spnego_mech != NULL) {
>             add_mechanism (spnego_mech, 1);
>         }
>     }
> #endif
diff -r mechglue.orig/lib/mechglue/gssapi.h mechglue/lib/mechglue/gssapi.h
691a692
> #include <gssapi_spnego.h>
diff -r mechglue.orig/lib/mechglue/Makefile.am mechglue/lib/mechglue/Makefile.am
74c76
< noinst_PROGRAMS = test_cred
---
> #noinst_PROGRAMS = test_cred