problems with RODC environment creation

Kamen Mazdrashki kamenim at
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 it is like
            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()
to accept PyLong but check if it has more than 32 bits set?

-------------- 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: <>

More information about the samba-technical mailing list