[PATCH] libwbclient clear pointer on bad read

Jeremy Allison jra at samba.org
Thu Jan 15 13:28:20 MST 2015

On Thu, Jan 15, 2015 at 09:03:48PM +0100, Volker Lendecke wrote:
> On Thu, Jan 15, 2015 at 05:42:15PM +0000, Matthew Newton wrote:
> > Separating the two layers looks like a good idea, but I can't
> > really commit to looking at that for now.
> Understood. That's a bigger task.
> > > 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.
> This is really great. The patch looks very simple!
> Stylistically I'd do it a bit differently though: I'd not at all use
> macros.
> I'd make it two patches: First convert all access to the global variables
> to a two-step process: First call a function like winbindd_fd_ptr()
> returning an int* and then after that access the fd via that pointer. That
> would be the first patch. Second patch would be to introduce the
> thread-specific piece, just adding a #ifdef HAVE_PTHREAD version of it
> not returning &winbindd_fd but the thread specific space.
> Sounds reasonable?

FYI, If we're gonne just go pthreads directly, which
is looks like we already have - then we should remove
all the work I did inside:


to wrap this stuff based off the ideas in openssl.

Volker, if you want to propose a patch deleting it
all I'll push :-).

(Sad panda. I liked my abstraction layer but it
never got used... :-( ).

More information about the samba-technical mailing list