Bug 950 - smbwrapper.so symbol collisions
smbwrapper.so symbol collisions
Product: Samba 3.0
Classification: Unclassified
Component: Client Tools
All other
: P4 normal
: none
Assigned To: Gerald (Jerry) Carter
Depends on:
  Show dependency treegraph
Reported: 2004-01-08 04:50 UTC by James R Grinter
Modified: 2005-02-17 09:35 UTC (History)
0 users

See Also:

Proposed diff to Makefile.in (616 bytes, patch)
2004-01-08 05:13 UTC, James R Grinter
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description James R Grinter 2004-01-08 04:50:01 UTC
[There's no component defined in bugzilla for smbwrapper..]

smbwrapper.so and smbsh will not work with some applications because symbols it 
uses will clash, leading to mysterious core dumps.

(rsync is a great example, as it shares a common author who names functions in 
very similar ways... it will crash when the smbwrapper code calls 
open_socket_out() - itself a clash - and ends up executing rsync's own 
vsnprintf routine and then smbwrapper's dopr())

One way to fix this is to prefix colliding symbols, within the Samba code, but 
to be safe this really requires every function and global variable to be 
changed and that is messy.

I think the *correct* way to solve this, on platforms that permit it, is to 
link the smbwrapper.so shared object explicitly specifying which symbols are to 
be global.

For Solaris, this can be done with the following patch to Makefile.in (this 
will probably need some autoconf work for portability):

[This problem also appears to be present in Samba 3.x]

--- Makefile.in.orig	Thu Jan  8 10:34:40 2004
+++ Makefile.in	Thu Jan  8 12:40:13 2004
@@ -639,7 +639,8 @@
 bin/smbwrapper.@SHLIBEXT@: $(PICOBJS) bin/.dummy
 	@echo Linking shared library $@
-	@$(SHLD) @LDSHFLAGS@ -B local -o $@ $(PICOBJS) $(LDFLAGS) $(LIBS) \
+	@nm smbwrapper/wrapped.po | $(AWK) -F\| 'BEGIN { 
printf "{\nglobal:\n" } $$5 ~ /GLOB/ { if ( $$7 !~ /UNDEF/ ) { printf "%s;\n", 
$$NF }} END { printf "local: *;\n};\n" }' > smbwrapper/mapfile
+	@$(SHLD) @LDSHFLAGS@ -M smbwrapper/mapfile -o $@ $(PICOBJS) $(LDFLAGS) 
$(LIBS) \
 		@SONAMEFLAG@`basename $@`
 bin/smbwrapper.32.@SHLIBEXT@: $(PICOBJS32) bin/.dummy
Comment 1 James R Grinter 2004-01-08 05:13:22 UTC
Created attachment 352 [details]
Proposed diff to Makefile.in

That diff was slightly mangled from an earlier test attempt. Try this one.
Comment 2 Gerald (Jerry) Carter 2004-02-17 08:45:45 UTC
Sorry, but the 2.2 is not under development any longer.
If you can reproduce this bug against the latest 3.0 release, 
please reopen this bug and change the version in the report.
Comment 3 James R Grinter 2004-03-08 02:20:27 UTC
Checked against Samba 3.0.2a on Solaris. Problem still present.
Comment 4 Gerald (Jerry) Carter 2005-02-17 09:35:39 UTC
smbwrapper is not being maintained currently.  Marking as fix 
later (if anyone wants to come back to this and run all the 
necessary regression tests).