[PATCH] libwbclient clear pointer on bad read

Volker Lendecke Volker.Lendecke at SerNet.DE
Thu Jan 15 13:03:48 MST 2015

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

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?


SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de, mailto:kontakt at sernet.de

More information about the samba-technical mailing list