[PATCH] libwbclient clear pointer on bad read

Matthew Newton mcn4 at leicester.ac.uk
Fri Jan 16 18:44:45 MST 2015


Hi,

On Thu, Jan 15, 2015 at 09:03:48PM +0100, Volker Lendecke wrote:
> 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.

OK, I did it first with two patches, but it seemed a bit clunky
because there's duplicated functionality for both the winbindd_fd
and is_privileged variables. They're both related, and it seemed
better to just put them in a struct together which saves
duplication.

So three patches attached. First converts to struct. Second adds
the function to return the pointer to that struct, third adds the
pthread code.

I realised half way through that winbind_nss_irix.c also refers to
winbindd_fd (hence it's not static), so I've also added code to
that, however I've got no easy way to actually compile or test
that file, so not sure if what I've done in there is correct or
not.

Aside from that these patches compile fine, but I haven't tested
yet - will likely be a few days before I can do that (will have to
backport to 3.6 first before I can test under load).

Cheers,

Matthew


-- 
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: 0001-Convert-wb_common.c-global-variables-into-a-struct.patch
Type: text/x-diff
Size: 4313 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20150117/6b328b36/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Get-pointers-to-winbind-fd-global-from-function.patch
Type: text/x-diff
Size: 4764 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20150117/6b328b36/attachment-0001.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-Add-thread-support-to-wb_common.c.patch
Type: text/x-diff
Size: 2698 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20150117/6b328b36/attachment-0002.patch>


More information about the samba-technical mailing list