Request: please hide or rename set_variable function

Andreas Schneider asn at samba.org
Tue Feb 9 16:05:02 UTC 2016


On Tuesday 09 February 2016 14:23:28 Philipp Klenze wrote:
> Dear all,
> I would like to ask you to change the name of the function set_variable
> in
> https://git.samba.org/samba.git/?p=samba.git;a=blob;f=lib/param/loadparm.c#l
> 1672 to something more unique.
> 
> I have just debugged code by someone who was using the same function
> name in his own code. When he called gethostbyname(),
> libsamba-hostconfig.so.0 was loaded by libc due to a nsswitch setting.
> Rather sooner than later, the library tried to run set_variable.
> Naturally, it ran the wrong one, which expected a very different call
> stack and everything ended with a segfault.
> 
> I think everyone understands naming ones local functions fprintf,
> __libc_malloc or the like is asking for trouble. But set_variable? There
> is no clue at all for the user that function name might be forbidden, no
> manpage entry, nothing. Even using ldd and nm to find out all defined
> symbols in every linked library would not help, as libsamba-hostconfig
> seems to be loaded on demand by libc.
> 
> As this particular function name is one other programmers out there
> might use as well, would you please change it?

The functions is static in 4.4.

https://git.samba.org/?p=samba.git;a=commitdiff;h=eab9417f9e7a6017a5292669cd5b6e5ea92496a8


asn at magrathea:~/workspace/projects/samba> git tag --contains 
eab9417f9e7a6017a5292669cd5b6e5ea92496a8
samba-4.4.0rc1
samba-4.4.0rc2


Cheers,


	-- andreas


-- 
Andreas Schneider                   GPG-ID: CC014E3D
Samba Team                             asn at samba.org
www.samba.org



More information about the samba-technical mailing list