]> granicus.if.org Git - linux-pam/commitdiff
Relevant BUGIDs: 643357
authorSteve Langasek <vorlon@debian.org>
Sun, 13 Jul 2003 18:41:04 +0000 (18:41 +0000)
committerSteve Langasek <vorlon@debian.org>
Sun, 13 Jul 2003 18:41:04 +0000 (18:41 +0000)
Purpose of commit: bugfix

Commit summary:
---------------
Patch from Sam Hartman to fix handling of module linking on Linux:
modules should be linked against libpam if they call any functions from
the library, since not all platforms will correctly resolve symbol
references otherwise.  Also, make sure we use gcc, not ld, when linking,
since there's additional linker glue that gcc will pull in for us.

Make.Rules.in
Makefile
configure.in
libpam/Makefile
modules/Simple.Rules
modules/pam_access/Makefile
modules/pam_limits/Makefile
modules/pam_tally/Makefile
modules/pam_unix/Makefile

index d7b87be231e4604c866ff84217020e8d0557e047..e42c965bb29ad45baca1ba0d1114842e41946355 100644 (file)
@@ -44,6 +44,7 @@ SHLIBMODE=@SHLIBMODE@
 NEED_LINK_LIB_C=@PAM_NEEDS_LIBC@
 HAVE_LCKPWDF=@HAVE_LCKPWDF@
 HAVE_LIBCRACK=@HAVE_LIBCRACK@
+HAVE_LIBCAP=@HAVE_LIBCAP@
 HAVE_LIBCRYPT=@HAVE_LIBCRYPT@
 HAVE_LIBUTIL=@HAVE_LIBUTIL@
 HAVE_NDBM_H=@HAVE_NDBM_H@
index 47c7bd394b48191ffe4afe261d85f63495375f73..06c162fd8239aad2e687394e4a5eeed0ad57afa2 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -19,6 +19,10 @@ THINGSTOMAKE = modules libpam libpamc libpam_misc doc examples
 
 all: $(THINGSTOMAKE)
 
+ # Let's get a dynamic libpam.so first
+ bootstrap-libpam: _pam_aconf.h prep
+       $(MAKE) -C libpam bootstrap-libpam
+
 prep:
        rm -f security
        ln -sf . security
@@ -52,7 +56,7 @@ configure: configure.in
        @rm -f configure
        @exit 1
 
-$(THINGSTOMAKE): _pam_aconf.h prep
+$(THINGSTOMAKE): _pam_aconf.h prep bootstrap-libpam
        $(MAKE) -C $@ all
 
 install: _pam_aconf.h prep
index 3c498a7c8ae0b486eb6156cd11c2886885a9e693..a7a298c719a5913f8c639369804acf79c8f5816b 100644 (file)
@@ -42,7 +42,7 @@ SHLIBMODE=755                 ; AC_SUBST(SHLIBMODE)
 
 dnl These are most likely platform specific - I think HPUX differs
 USESONAME=yes                  ; AC_SUBST(USESONAME)
-SOSWITCH=-soname               ; AC_SUBST(SOSWITCH)
+SOSWITCH='-Xlinker -soname     -Xlinker '      ; AC_SUBST(SOSWITCH)
 NEEDSONAME=no                  ; AC_SUBST(NEEDSONAME)
 LDCONFIG=/sbin/ldconfig                ; AC_SUBST(LDCONFIG)
 
@@ -282,9 +282,7 @@ AC_SUBST(CRACKLIB_DICTPATH)
 dnl Set FLAGS, linker options etc. depending on C compiler.
 dnl gcc is tested and much preferred; others less so, if at all
 dnl
-dnl If compiling with gcc, linking is also supposed to be done with gcc;
-dnl since we use linker-specific arguments, we may not gain anything by
-dnl switching LD_L over, but I think we can use LD_D as-is.
+dnl If compiling with gcc, linking is also supposed to be done with gcc
 dnl
 dnl For the moment, gcc is enforced above at "CC=gcc".
 dnl
@@ -309,8 +307,8 @@ if test "$GCC" = yes; then
                WARNINGS="$GCC_WARNINGS"
                PIC="-fPIC"
                DYNTYPE=so
-               LD=ld                           
-               LD_L="$LD -x -shared"
+               LD=gcc
+               LD_L="$LD -Xlinker -x -shared"
                RANLIB=ranlib
                STRIP=strip
                CC_STATIC="-Xlinker -export-dynamic"
index cf49f6276ec9d43f9487f92230d7f7b8e8f9c0ca..d87cb028855d0c744fb6d2bf45e797d041b22676 100644 (file)
@@ -10,6 +10,8 @@ MOREFLAGS=-D"DEFAULT_MODULE_PATH=\"$(SECUREDIR)/\""
 
 ifeq ($(WITH_LIBDEBUG),yes)
  LIBNAME=libpamd
+ CFLAGS += -D"DEBUG"
+ CFLAGS += -g
 else
  LIBNAME=libpam
 endif
@@ -37,7 +39,7 @@ LIBPAMFULL = $(LIBPAMNAME)$(MODIFICATION)
 LIBPAMSTATIC = $(LIBNAME).a
 
 ifdef STATIC
-@echo Did you mean to set STATIC\?
+#      @echo Did you mean to set STATIC\?
 MODULES = $(shell cat ../modules/_static_module_objects)
 STATICOBJ = pam_static.o
 else
@@ -88,6 +90,9 @@ dynamic/%.o : %.c
 
 static/%.o : %.c
        $(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c $< -o $@
+bootstrap-libpam: bootdir $(LIBPAM)
+bootdir:
+       test -d dynamic || mkdir dynamic
 
 $(LIBPAM): $(DLIBOBJECTS)
 ifeq ($(DYNAMIC_LIBPAM),yes)
index 2d79b00c5078e47a4e0e33c016fb35befcc83082..bb16e48dae497841e53ba5a84fecc8d727e481c4 100644 (file)
@@ -19,7 +19,7 @@ LIBOBJ = $(addsuffix .o,$(LIBFILES))
 LIBOBJD = $(addprefix dynamic/,$(LIBOBJ))
 LIBOBJS = $(addprefix static/,$(LIBOBJ))
 
-LINK_PAMMODUTILS = -L../pammodutil -lpammodutil
+LINK_PAMMODUTILS = -L../pammodutil -lpammodutil -L../../libpam -lpam
 INCLUDE_PAMMODUTILS = -I../pammodutil/include
 
 ifdef DYNAMIC
index d93c9f4062708749d1b5c01cb395a6c8fb49af19..87b2b3e65d1faf9e6a266a669886f45da0b9a219 100644 (file)
@@ -10,6 +10,9 @@ include ../../Make.Rules
 TITLE=pam_access
 LOCAL_CONFILE=./access.conf
 INSTALLED_CONFILE=$(SCONFIGD)/access.conf
+ifeq ($(HAVE_LIBNSL),yes)
+MODULE_SIMPLE_EXTRALIBS=-lnsl
+endif
 
 DEFS=-DDEFAULT_CONF_FILE=\"$(INSTALLED_CONFILE)\"
 CFLAGS += $(DEFS)
index 9473d915847d3fefd9686faa7f4477290f2b43a9..0a481fe809bcef314fca2598b9bcf5737202101a 100644 (file)
@@ -21,6 +21,9 @@ CFLAGS += $(DEFS)
 MODULE_SIMPLE_INSTALL=bash -f ../install_conf "$(FAKEROOT)" "$(SCONFIGD)" "$(INSTALLED_CONFILE)" "$(TITLE)" "$(LOCAL_CONFILE)"
 MODULE_SIMPLE_REMOVE=rm -f $(FAKEROOT)$(INSTALLED_CONFILE)
 MODULE_SIMPLE_CLEAN=rm -f ./.ignore_age
+ifeq ($(HAVE_LIBCAP),yes)
+MODULE_SIMPLE_EXTRALIBS=-lcap
+endif
 
 include ../Simple.Rules
 
index 1c5106e34ce54b4434826e9079f37c943e80a2e8..c39970ddf815ad0cc9407d3de7916307b3c1e1cf 100644 (file)
@@ -65,7 +65,7 @@ ifdef DYNAMIC
 $(LIBOBJD): $(LIBSRC)
 
 $(LIBSHARED):   $(LIBOBJD)
-       $(LD_D) -o $@ $(LIBOBJD)
+       $(LD_D) -o $@ $(LIBOBJD) -L../../libpam -lpam $(NEED_LINK_LIB_C) 
 
 $(APPLICATION): $(APPOBJD) $(TITLE).c
        $(CC) $(CFLAGS) -o $@ $(APPOBJD) $(LOADLIBES)
index 0cab34bc86b6cdba382680a13a8f6d6a5412a524..61c4beaad6d3b2f227df7c3b79e56500caa9beb1 100644 (file)
@@ -109,7 +109,7 @@ ifdef DYNAMIC
 $(LIBOBJD): $(LIBSRC)
 
 $(LIBSHARED):  $(LIBOBJD)
-       $(LD_D) -o $@ $(LIBOBJD) $(PLUS) $(CRACKLIB) $(LDLIBS) $(LIBNSL) $(LIBCRYPT)
+       $(LD_D) -o $@ $(LIBOBJD) $(PLUS) $(CRACKLIB) $(LDLIBS) $(LIBNSL) $(LIBCRYPT) $(NEED_LINK_LIB_C) -L../../libpam -lpam
 endif
 
 ifdef STATIC