problems with RODC environment creation

Kamen Mazdrashki kamenim at samba.org
Thu Sep 16 06:40:08 MDT 2010


So the problem is with 'int' type in Python as it seems.
'int' type in Python is signed, but we use it C as unsigned.
For instance this value 0x8A7E84B5 is used as uint32_t in C,
but when we return it to Python, it becomes 2323547317L ('long' in Python)
Thus when we get it back in C, PY_CHECK_TYPE() macro fails.

It all starts from py_dsdb_get_attid_from_lDAPDisplayName() function.
It returns the unsigned value for ATTID as PyLong to Python script.
Then we cast it in Python like (int)attid - I have no idea why this cast
passes without exception. Doing the same thing in Python console
is not possible - (int) cast fails.
Example snippet:

attid = 0x8A7E84B5L

v = (int)attid

In drs_utils.py it is like
            attid =
self.samdb.get_attid_from_lDAPDisplayName(ldap_display_name)
            attids.append(int(attid))
which is essentially the same (but doesn't fail).

With the attached patch, everything is fine with RODC on my boxes.
Except that in sorted array, big ATTIDs comes first as they
are negative 'int's.

Perhaps we should extend py_drsuapi_DsPartialAttributeSet_set_attids()
function
to accept PyLong but check if it has more than 32 bits set?

-- 
CU,
Kamen
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-WIP-Return-ATTIDs-as-PyInt-rather-than-PyLong.patch
Type: application/octet-stream
Size: 776 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20100916/f06e2598/attachment.obj>


More information about the samba-technical mailing list