Build a usable pam_afs.so
authorBenjamin Kaduk <kaduk@mit.edu>
Fri, 12 Sep 2014 22:07:51 +0000 (18:07 -0400)
committerD Brashear <shadow@your-file-system.com>
Wed, 8 Oct 2014 14:50:03 +0000 (10:50 -0400)
Our use of libtool for building the pam modules resulted in shared
objects which had dependencies on liboafs_auth.so and liboafs_kauth.so,
neither of which are installed.

We still need some way to resolve those dependencies at link time, and
a dependency on libafsauthent.so seems ill-advised to insert into the
pam stack, so we are left with only the option of directly linking in
the requisite functionality.  Fortunately, almost all of the requisite
convenience libraries of PIC objects already exist to meet the
requirements of libafsrpc and libafsauthent; the only exception is
from the auth module.  Here, we require a new convenience library,
because the pam_afs.krb.so module includes its own version of ktc.o,
compiled with AFS_KERBEROS_ENV defined, yet the pam_afs.so module
requiers a ktc.o compiled without AFS_KERBEROS_ENV defined.  The
convenience library from the auth module can only include one version,
and would therefore be wrong for the other.  As such, create the new
libpam_auth.la archive from the BASE_objs in src/auth, and manually
compile ktc.lo and ktc_krb.lo as needed for the pam modules.

As for libafsrpc and libafsauthent, the convenience libraries included
from other parts of the tree belong in LT_objs, not LT_deps, because
they are contributing actual content to be included in the resulting
library; they are not library dependencies of the output of this module.

Change-Id: I5292718a5494710d166043fd08ad07269ff9fdf2
Reviewed-on: http://gerrit.openafs.org/11463
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: D Brashear <shadow@your-file-system.com>
Tested-by: D Brashear <shadow@your-file-system.com>

src/auth/Makefile.in
src/pam/Makefile.in

index 06bccaa..8dec8a6 100644 (file)
@@ -37,7 +37,7 @@ LIBS=libauth.a \
 
 INCLS=cellconfig.h auth.h keys.h internal.h token.h
 
-all: liboafs_auth.la libauth_pic.la \
+all: liboafs_auth.la libauth_pic.la libpam_auth.la \
      ${TOP_LIBDIR}/libauth.a ${TOP_LIBDIR}/libauth.krb.a \
      depinstall
 
@@ -104,6 +104,9 @@ liboafs_auth.la: liboafs_auth.la.sym $(LT_objs) $(LT_deps)
 libauth_pic.la: $(LT_objs)
        $(LT_LDLIB_pic) $(LT_objs)
 
+libpam_auth.la: $(BASE_objs)
+       $(LT_LDLIB_pic) $(BASE_objs)
+
 copyauth: copyauth.o ${LIBS}
        $(AFS_LDRULE) copyauth.o ${LIBS} ${XLIBS}
 
index a0ac933..cfd26e7 100644 (file)
@@ -11,9 +11,23 @@ include @TOP_OBJDIR@/src/config/Makefile.pthread
 include @TOP_OBJDIR@/src/config/Makefile.libtool
 
 LT_objs = afs_account.lo afs_session.lo afs_password.lo \
-         afs_pam_msg.lo afs_message.lo AFS_component_version_number.lo
-LT_deps = $(top_builddir)/src/kauth/liboafs_kauth.la \
-         $(top_builddir)/src/auth/liboafs_auth.la
+         afs_pam_msg.lo afs_message.lo \
+         $(top_builddir)/src/opr/libopr_pic.la \
+         $(top_builddir)/src/comerr/libcomerr_pic.la \
+         $(top_builddir)/src/rx/librx_pic.la \
+         $(top_builddir)/src/rxkad/librxkad_pic.la \
+         $(top_builddir)/src/audit/libaudit_pic.la \
+         $(top_builddir)/src/util/libafsutil_pic.la \
+         $(top_builddir)/src/sys/libsys_pic.la \
+         $(top_builddir)/src/ubik/libauthent_ubik.la \
+         $(top_builddir)/src/ptserver/libprot_pic.la \
+         $(top_builddir)/src/kauth/libkauth_pic.la \
+         $(top_builddir)/src/auth/libpam_auth.la \
+         $(top_builddir)/src/crypto/rfc3961/librfc3961_pic.la
+LT_deps =
+LT_libs = \
+       $(PAM_LIBS) $(LDFLAGS_hcrypto) $(LDFLAGS_roken) \
+       $(LIB_hcrypto) $(LIB_roken) $(LIB_crypt) $(LIB_AFSDB)
 
 MODULE_CFLAGS=${PAM_CFLAGS}
 
@@ -23,6 +37,7 @@ CFLAGS_afs_setcred_krb.lo = -DAFS_KERBEROS_ENV
 CFLAGS_afs_auth_krb.lo   = -DAFS_KERBEROS_ENV
 CFLAGS_afs_util_krb.lo   = -DAFS_KERBEROS_ENV
 CFLAGS_ktc_krb.lo        = -DAFS_KERBEROS_ENV -I../auth
+CFLAGS_ktc.lo            = -I../auth
 
 afs_setcred.lo: afs_setcred.c afs_pam_msg.h afs_message.h afs_util.h
 afs_setcred_krb.lo: afs_setcred.c afs_pam_msg.h afs_message.h afs_util.h
@@ -36,19 +51,22 @@ afs_util.lo: afs_util.c afs_pam_msg.h afs_message.h afs_util.h
 afs_util_krb.lo: afs_util.c afs_pam_msg.h afs_message.h afs_util.h
        $(LT_CCRULE) ${srcdir}/afs_util.c
 
+ktc.lo: ${srcdir}/../auth/ktc.c ${TOP_INCDIR}/afs/cellconfig.h \
+               ${TOP_INCDIR}/afs/auth.h ${srcdir}/../auth/keys.h \
+               ${TOP_INCDIR}/afs/vice.h
+       $(LT_CCRULE) $(srcdir)/../auth/ktc.c
 ktc_krb.lo: ${srcdir}/../auth/ktc.c ${TOP_INCDIR}/afs/cellconfig.h \
                ${TOP_INCDIR}/afs/auth.h ${srcdir}/../auth/keys.h \
                ${TOP_INCDIR}/afs/vice.h
        $(LT_CCRULE) $(srcdir)/../auth/ktc.c
 
 pam_afs.la: $(LT_objs) $(LT_deps) \
-               afs_setcred.lo afs_auth.lo afs_util.lo \
+               afs_setcred.lo afs_auth.lo afs_util.lo ktc.lo \
                pam_afs.map
        $(LIBTOOL) --quiet --mode=link --tag=CC $(MT_CC) $(XLDFLAGS) -rpath $(libdir) \
                -module -no-undefined -o pam_afs.la \
-               afs_setcred.lo afs_auth.lo afs_util.lo $(LT_objs) $(LT_deps) \
-               $(PAM_LIBS) $(LDFLAGS_hcrypto) $(LDFLAGS_roken) \
-               $(LIB_hcrypto) $(LIB_roken)
+               afs_setcred.lo afs_auth.lo afs_util.lo ktc.lo \
+               $(LT_objs) $(LT_deps) $(LT_libs)
 
 pam_afs.krb.la: $(LT_objs) $(LT_deps) \
                afs_setcred_krb.lo afs_auth_krb.lo afs_util_krb.lo \
@@ -56,8 +74,7 @@ pam_afs.krb.la: $(LT_objs) $(LT_deps) \
        $(LIBTOOL) --quiet --mode=link --tag=CC $(MT_CC) $(XLDFLAGS) -rpath $(libdir) \
                -module -no-undefined -o pam_afs.krb.la \
                afs_setcred_krb.lo afs_auth_krb.lo afs_util_krb.lo ktc_krb.lo \
-               $(LT_objs) $(LT_deps) $(PAM_LIBS) $(LDFLAGS_hcrypto) $(LDFLAGS_roken) \
-               $(LIB_hcrypto) $(LIB_roken)
+               $(LT_objs) $(LT_deps) $(LT_libs)
 
 test_pam: test_pam.o
        $(Q)set -x; \