[PATCH] libwbclient clear pointer on bad read
Stefan (metze) Metzmacher
metze at samba.org
Tue Jan 27 13:26:06 MST 2015
Am 27.01.2015 um 21:06 schrieb Volker Lendecke:
> On Fri, Jan 23, 2015 at 12:45:50PM +0000, Matthew Newton wrote:
>> ... at end of usage:
>>
>> wbcFreeContext(ctx);
>>
>> which would mean updating all the public functions in libwbclient
>> to have an extra 'ctx' passed to them?
>>
>> The wbcContext would contain the fd, is_privileged, etc data, so
>> all held in the calling process/thread.
>>
>> Or did you have something else in mind?
>
> Not, that's pretty much what I had in mind. Although I'd not
> change the existing functions but create a complete set of
> new functions with some function name prefix/postfix. Not
> sure about a good suggestion here. The existing functions
> would refence one global context and mutex its use.
Maybe
struct wbcContext *ctx = NULL;
...
ctx = wbcCtxCreate();
...
err = wbcCtxAuthenticateUserEx(ctx, &authparams, &info, &error);
...
wbcCtxFree(ctx);
So the existing wbcExample() will become something like:
wbcErr wbcExample(void)
{
struct wbcContext *ctx = NULL;
wbcErr wbc_status;
ctx = wbcCtxGlobalLock();
wbc_status = wbcCtxExample(ctx);
wbcCtxGlobalUnlock(ctx);
return wbc_status;
}
metze
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20150127/2ed1b5f0/attachment.pgp>
More information about the samba-technical
mailing list