[PATCH] Port of samba.security Python module

Lumir Balhar lbalhar at redhat.com
Wed Sep 6 07:33:52 UTC 2017


On 08/27/2017 09:08 AM, Andrew Bartlett wrote:
> On Thu, 2017-08-24 at 14:22 +0200, Andreas Schneider wrote:
>> On Thursday, 24 August 2017 13:21:27 CEST Lumir Balhar via samba-technical
>> wrote:
>>> Hello.
>>>
>>> Because samba.ntstatus module is now available for Python 3 in master, I
>>> tried your suggestion and I replaced integers values with constants from
>>> samba.dcerpc.security and samba.ntstatus.
>>>
>>> Replaced arguments SEC_FLAG_SYSTEM_SECURITY and SEC_STD_READ_CONTROL are
>>> working well but exceptions contain different error numbers than
>>> NT_STATUS_PRIVILEGE_NOT_HELD and NT_STATUS_ACCESS_DENIED and I cannot
>>> find the right ones.
>>>
>>> NT_STATUS_PRIVILEGE_NOT_HELD = 3221225569 but exception contains -1073741727
>>> NT_STATUS_ACCESS_DENIED = 3221225506 but exception contains -1073741790
>> Sounds like the bug. The exception seems to return an int where it should
>> return an unsigned int??
>>
>> i2c -1073741727
>> 18446744072635809889 0xFFFFFFFFC0000061 01777777777770000000141
>>
>> #define NT_STATUS_PRIVILEGE_NOT_HELD NT_STATUS(0xc0000061)
>>
> I think:
>
> #define PyErr_FromNTSTATUS(status) Py_BuildValue("(i,s)", NT_STATUS_V(status), discard_const_p(char, get_friendly_nt_error_msg(status)))
>   
> in pyerrors.h is wrong.
>
> We probably want an unsigned int, not a signed int, for the first
> constant.  We first saw this in some other patches that Gary did, where
> he ended up casting via a C type casting lib to make it work, but
> didn't dig into it properly.
>
> Thanks,
>
> Andrew Bartlett
>
Hello.

Thanks a lot, Andrew. I fixed the bug you mentioned and now everything 
is working.

Patchset rebased and attached.

Have a nice day.
Lumír
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0004-python-Enable-execution-of-samba.tests.security-with.patch
Type: text/x-patch
Size: 1136 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20170906/3b4d44bd/0004-python-Enable-execution-of-samba.tests.security-with.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0003-python-Fix-bad-type-in-conversion-of-NTSTATUS.patch
Type: text/x-patch
Size: 1150 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20170906/3b4d44bd/0003-python-Fix-bad-type-in-conversion-of-NTSTATUS.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-python-Add-tests-for-check_access-function-from-samb.patch
Type: text/x-patch
Size: 1821 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20170906/3b4d44bd/0002-python-Add-tests-for-check_access-function-from-samb.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-python-Port-samba.security-to-Python-3-compatible-fo.patch
Type: text/x-patch
Size: 2602 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20170906/3b4d44bd/0001-python-Port-samba.security-to-Python-3-compatible-fo.bin>


More information about the samba-technical mailing list