patch for samba-2.2.2 with PAM on Solaris 8

Steve Langasek vorlon at netexpress.net
Mon Nov 26 11:54:47 GMT 2001


Hi Harald,

On Mon, Nov 26, 2001 at 07:17:45PM +0100, Harald Koenig wrote:

> first: I'm not subscribed to samba-technical, so please reply with Cc:.  
> thanks!

> trying to build samba-2.2.2 with gcc-2.95.3 on Solaris 8 using

> 	configure --with-pam_smbpass --with-pam

> I needed the patch below to fix the following problems:

> - tdb/tdbutil.o needs lib/snprintf.o for symbol vasprintf when linking 
>   bin/pam_smbpass.so  (changes to TDB_OBJ and LIB_OBJ).

> - bin/pam_smbpass.so needs libgcc for symbol __floatdidf.
>   fixed by introducing "LIBC".

The real bug here is using ld for linking instead of letting gcc do the
linking for us.  I've been hesitant to submit a patch for this, because
I'm not sure how well other compilers besides gcc handle being invoked
as the linker.  However, it looks like someone has already dealt with
this problem by creating an $(SHLD) variable, which means you should get
by with doing:

@@ -619,11 +620,11 @@
 
 bin/pam_smbpass. at SHLIBEXT@: $(PAM_SMBPASS_OBJ)
 	@echo Linking shared library $@
-	$(LD) @LDSHFLAGS@ -symbolic -o $@ $(PAM_SMBPASS_OBJ) -lpam $(LIBS) -lc
+	$(SHLD) @LDSHFLAGS@ -o $@ $(PAM_SMBPASS_OBJ) -lpam $(LIBS)
 
 nsswitch/libnss_wins.so: $(NSS_OBJ)
 	@echo "Linking $@"
-	@$(LD) @LDSHFLAGS@ -o $@ $(NSS_OBJ) -lc
+	@$(SHLD) @LDSHFLAGS@ -o $@ $(NSS_OBJ)
 
 bin/winbindd: $(WINBINDD_OBJ) bin/.dummy
 	@echo Linking $@

--- and then you don't need to mess with configure.in at all, except to
specify any solaris-specific options to the linker.  (Note that this
would only apply if using the native Solaris compiler/linker: anything
that tries to pass other options to the linker should make sure the
linker isn't gcc!)

As for adding lib/snprintf.o to the object list, this is probably best
added to the 'PAM_SMBPASS_OBJ_0' line.  In an effort to keep pam_smbpass
from becoming the world's largest PAM module, I tried to pick and choose
which library objects are included -- whereas everything else in Samba
includes $(LIB_OBJ) in its entirety.  This seems to have resulted in an
ongoing maintenance hassle, so maybe it's time to do the same for
pam_smbpass as well?

> please check/fix usage of "-symbolic" for bin/pam_smbpass.so on other
> platforms.

I think that "-symbolic" isn't even usable on Linux anymore.  GCC and 
GNU ld have changed a bit since that Makefile rule was first written.

Cheers,
Steve Langasek
postmodern programmer

> -------------------------------------------------------------------------------
> diff -u orig/Makefile.in samba-2.2.2/source/Makefile.in
> --- orig/Makefile.in	Sat Oct 13 23:09:06 2001
> +++ samba-2.2.2/source/Makefile.in	Mon Nov 26 18:32:06 2001
> @@ -9,6 +9,7 @@
>  sysconfdir=@sysconfdir@
>  
>  LIBS=@LIBS@
> +LIBC=@LIBC@
>  CC=@CC@
>  SHLD=@SHLD@ 
>  CFLAGS=@CFLAGS@
> @@ -105,14 +106,14 @@
>  # object file lists
>  ######################################################################
>  
> -TDB_OBJ = tdb/tdb.o tdb/spinlock.o tdb/tdbutil.o 
> +TDB_OBJ = tdb/tdb.o tdb/spinlock.o tdb/tdbutil.o lib/snprintf.o 
>  
>  LIB_OBJ = lib/charcnv.o lib/charset.o lib/debug.o lib/fault.o \
>            lib/getsmbpass.o lib/interface.o lib/kanji.o lib/md4.o \
>            lib/interfaces.o lib/pidfile.o lib/replace.o \
>            lib/signal.o lib/system.o lib/time.o \
>  	  lib/ufc.o lib/genrand.o lib/username.o lib/access.o lib/smbrun.o \
> -	  lib/bitmap.o lib/crc32.o lib/snprintf.o lib/wins_srv.o \
> +	  lib/bitmap.o lib/crc32.o lib/wins_srv.o \
>  	  lib/util_array.o lib/util_str.o lib/util_sid.o \
>  	  lib/util_unistr.o lib/util_file.o lib/sysacls.o \
>  	  lib/util.o lib/util_sock.o lib/util_sec.o smbd/ssl.o \
> @@ -619,11 +620,12 @@
>  
>  bin/pam_smbpass. at SHLIBEXT@: $(PAM_SMBPASS_OBJ)
>  	@echo Linking shared library $@
> -	$(LD) @LDSHFLAGS@ -symbolic -o $@ $(PAM_SMBPASS_OBJ) -lpam $(LIBS) -lc
> +	# $(LD) @LDSHFLAGS@ -symbolic -o $@ $(PAM_SMBPASS_OBJ) -lpam $(LIBS) $(LIBC)
> +	$(LD) @LDSHFLAGS@ -o $@ $(PAM_SMBPASS_OBJ) -lpam $(LIBS) $(LIBC)
>  
>  nsswitch/libnss_wins.so: $(NSS_OBJ)
>  	@echo "Linking $@"
> -	@$(LD) @LDSHFLAGS@ -o $@ $(NSS_OBJ) -lc
> +	@$(LD) @LDSHFLAGS@ -o $@ $(NSS_OBJ) $(LIBC)
>  
>  bin/winbindd: $(WINBINDD_OBJ) bin/.dummy
>  	@echo Linking $@
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.samba.org/archive/samba-technical/attachments/20011126/a477f734/attachment.bin


More information about the samba-technical mailing list