[PATCH] libwbclient clear pointer on bad read

Matthew Newton mcn4 at leicester.ac.uk
Thu Jan 15 10:42:15 MST 2015


On Fri, Jan 09, 2015 at 04:36:33PM +0100, Volker Lendecke wrote:
> A prototype with compiler-specific extension is certainly
> highly interesting, but for upstream I'd rather go with
> something completely standard.

OK, makes sense.

> An alternative approach, which I'd call a long-term goal
> though, would be a separate layer below the current
> libwbclient which takes a context pointer holding the fd and
> all the global variables. This libwbclient layer could be
> completely thread-agnostic and not deal with these issues at
> all, looking only ever at the context. Each context would
> have to be externally serialized, but we would not have to
> deal with threading issues inside that libwbclient layer at
> all. The current published API would hold one such context
> structure (either per thread or globally per process,
> properly mutexed).

Separating the two layers looks like a good idea, but I can't
really commit to looking at that for now.

> This would be my preferred approach, but if you need
> something quicker, probably the pthread_setspecific approach
> might be okay.

I've had success with using pthread_setspecific and friends.  Have
only updated wb_common.c for now (which is where I needed the code
to work) - attached. If this code is acceptable then I can try and
have a look at updating the other global variables in other parts
of the library.

With this patch and FreeRADIUS linked to libwbclient for NTLM
authentications from multiple threads, it's looking perfect with
no errors any more, which is good.



Matthew Newton, Ph.D. <mcn4 at le.ac.uk>

Systems Specialist, Infrastructure Services,
I.T. Services, University of Leicester, Leicester LE1 7RH, United Kingdom

For IT help contact helpdesk extn. 2253, <ithelp at le.ac.uk>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libwbclient-pthread.patch
Type: text/x-diff
Size: 4623 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20150115/578c0e2d/attachment.patch>

More information about the samba-technical mailing list