[PATCH] libwbclient clear pointer on bad read
mcn4 at leicester.ac.uk
Thu Jan 8 08:59:48 MST 2015
I've been working on trying to get FreeRADIUS to authenticate
using libwbclient rather than calling ntlm_auth. I've come across
a couple of things in libwbclient that don't seem right.
(Background to what I'm doing is here:
In nsswitch/wb_common.c, in winbindd_read_reply: if
winbind_read_sock fails for some reason and returns -1 then it's
possible that some data could have actually been read. Therefore
the extra_data.data pointer can be set. The attached simple patch
moves clearing this pointer to above the return calls so that the
later free in the calling code won't ever crash out trying to free
an invalid pointer.
This patch is against v4-2-test, though I'm testing on Samba 3.6
(in Debian) which also needs the same patch.
The second slightly more major thing (and which triggers the above
really) is that the library isn't thread safe because it has two
global variables, winbindd_fd and is_privileged.
It looks like work was done in 2010 to make it mostly thread-safe (see
I guess the library just needs to somehow keep these two variables
local to the thread if compiled with pthreads?
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...
Size: 1563 bytes
Desc: not available
More information about the samba-technical