[PATCH] Fix Segfault when using Credentials object without uninitialized domain/workstation parts

Kamen Mazdrashki kamenim at samba.org
Wed Jan 5 19:08:10 MST 2011


On Thu, Jan 6, 2011 at 03:40, Andrew Bartlett <abartlet at samba.org> wrote:
> On Thu, 2011-01-06 at 03:17 +0200, Kamen Mazdrashki wrote:
>> Hi Andrew,
>>
>> Recently I saw someone having troubles using Py Credentials object.
>> It segfaults if you construct a Credentials object without calling
>> Credentials.guess
>> method, but just set username/password.
>> I've hit same issue recently.
>>
>> Actually the problem is with 'msrpc_gen' which tries to serialize a NULL pointer
>> (such NULL pointers are cli_credentials.domain and cli_credentials.workstation
>> if their are not explicitly set and cli_credentials_guess is not called)
>>
>> I think attached patch should fix this problem I am just not sure if I fixed it
>> on the right spot.
>> Oups, the patch is not attached but is at this address:
>> http://git.samba.org/?p=kamenim/samba.git;a=shortlog;h=refs/heads/py-review
>
> No, I don't think this is the right approach.  The caller must supply a
> initialised credentials structure.
>
Then where the fix should be done?

I thought it is ok for me to do something like:
creds = Credentials();
creds.set_username('username');
creds.set_password('pass');
ldb_connect(..., credentials=creds, ...);

If the above snippet is not desired, then we should validate
supplied credentials for being valid?
-- 
CU,
Kamen Mazdrashki


More information about the samba-technical mailing list