svn commit: samba r21736 - in branches/SAMBA_4_0: source/auth/credentials source/lib/ldb/common testprogs/blackbox

Jelmer Vernooij jelmer at samba.org
Sat Mar 10 14:43:27 GMT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

simo wrote:
> On Sat, 2007-03-10 at 08:14 +1100, Andrew Bartlett wrote:
>> On Fri, 2007-03-09 at 15:43 -0500, simo wrote:
>>> On Sat, 2007-03-10 at 07:39 +1100, Andrew Bartlett wrote:
>>>> On Fri, 2007-03-09 at 09:16 -0500, simo wrote:
>>>>> On Wed, 2007-03-07 at 04:20 +0000, abartlet at samba.org wrote:
>>>>>> Author: abartlet
>>>>>> Date: 2007-03-07 04:20:10 +0000 (Wed, 07 Mar 2007)
>>>>>> New Revision: 21736
>>>>>>
>>>>>> WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=21736
>>>>>>
>>>>>> Log:
>>>>>> Fix the smbclient test to do something more interesting with the last
>>>>>> few authentication tests.  Now that the tests correctly 'fail', I was
>>>>>> able to fix the credentials subsystem to honour USER and PASSWD.
>>>>>>
>>>>>> To get --machine-pass working, I needed ldb to always load it's static
>>>>>> modules, so I put this in ldb_connect().
>>>>> [..]
>>>>>
>>>>>> Modified: branches/SAMBA_4_0/source/lib/ldb/common/ldb.c
>>>>>> ===================================================================
>>>>>> --- branches/SAMBA_4_0/source/lib/ldb/common/ldb.c	2007-03-07 03:10:30 UTC (rev 21735)
>>>>>> +++ branches/SAMBA_4_0/source/lib/ldb/common/ldb.c	2007-03-07 04:20:10 UTC (rev 21736)
>>>>>> @@ -232,6 +232,9 @@
>>>>>>  {
>>>>>>  	int ret;
>>>>>>  
>>>>>> +	/* We seem to need to do this here, or else some utilities don't get ldb backends */
>>>>>> +	ldb_global_init();
>>>>>> +
>>>>>>  	ldb->flags = flags;
>>>>>>  
>>>>>>  	ret = ldb_connect_backend(ldb, url, options, &ldb->modules);
>>>>>>
>>>>> Andrew I think this is wrong, can you revert?
>>>>> the init must be done in the client application, it is how it has been
>>>>> architected, moving it into ldb.c is not the right thing to do.
>>>> Why is it wrong?  Where would you suggest putting the init, particularly
>>>> in apps that don't event know they are using ldb?
>>> What kind of apps don't know they are using ldb?
>>> Surely there is something calling into ldb.
>> Both ntlm_auth and smbclient got caught because they call credentials
>> code, which calls ldb.  Neither app 'knows' that the credentials code
>> happens to be implemented in terms of ldb, and so doesn't do anything
>> special.
>>
>> Should I be calling ldb_global_init() on every ldb-related credentials
>> operation, just in case?  What harm does having ldb initialise it's own
>> statically compiled back-ends cause?
> 
> I have to recheck the code, I remember we didn't put the init code in
> ldb.c for a reason, but I forgot the reason :-)
> It may even be that the original reason is not true anymore, but that
> have to be assessed before doing the change.
IIRC the reason was thread safety. The init code makes use of static
variables. Calling ldb_connect() from two separate threads can  cause
weird issues if it calls out to the init code.

The idea is that the init code gets called before any sort of threading
is being used.

Cheers,

Jelmer
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iQCVAwUBRfLECgy0JeEGD2blAQI0vAP/WLQPpcA9BCPoIEwuvq0W7Czf1QguH0ML
7LkBMMUoFLoNqY8/zGFCOfNC05wivR2nWlm87NB7FvLgi5Ur6IpruMQJ7iCAN+iM
kd5KvQdsN8R06neaHBHkiRerdZZpi8RC0hdWR4vgWKrFrZ5yk8+/MfAFq+WI3e5j
ijAvoXXJ+L0=
=69GD
-----END PGP SIGNATURE-----


More information about the samba-technical mailing list