Author: tpot
Date: 2004-11-07 00:41:43 +0000 (Sun, 07 Nov 2004)
New Revision: 3588

WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=3588

Log:
Fix bug in converting SIDs containing large unsigned integers from Python.

Modified:
   branches/SAMBA_4_0/source/scripting/swig/dcerpc.i
   branches/SAMBA_4_0/source/scripting/swig/torture/samr.py


Changeset:
Modified: branches/SAMBA_4_0/source/scripting/swig/dcerpc.i
===================================================================
--- branches/SAMBA_4_0/source/scripting/swig/dcerpc.i   2004-11-07 00:40:41 UTC 
(rev 3587)
+++ branches/SAMBA_4_0/source/scripting/swig/dcerpc.i   2004-11-07 00:41:43 UTC 
(rev 3588)
@@ -119,9 +119,9 @@
        }
 
        if (PyLong_Check(obj))
-               return (uint32)PyLong_AsLong(obj);
-       else
-               return (uint32)PyInt_AsLong(obj);
+               return (uint32)PyLong_AsUnsignedLongMask(obj);
+
+       return (uint32)PyInt_AsLong(obj);
 }
 
 PyObject *uint32_to_python(uint32 obj)

Modified: branches/SAMBA_4_0/source/scripting/swig/torture/samr.py
===================================================================
--- branches/SAMBA_4_0/source/scripting/swig/torture/samr.py    2004-11-07 
00:40:41 UTC (rev 3587)
+++ branches/SAMBA_4_0/source/scripting/swig/torture/samr.py    2004-11-07 
00:41:43 UTC (rev 3588)
@@ -864,6 +864,18 @@
 
     result = dcerpc.samr_Connect(pipe, r)
 
+    # Test that we can parse a SID that contains a sub_auth that can't
+    # be held in a python int.
+
+    r = {}
+    r['connect_handle'] = result['connect_handle']
+    r['access_mask'] = 0x02000000
+    r['sid'] = {'sid_rev_num': 1, 'id_auth': [0, 0, 0, 0, 0, 5],
+                'num_auths': 4,
+                'sub_auths': [21, 737922324, 3002806791L, 1285293260]}
+
+    result = dcerpc.samr_OpenDomain(pipe, r)
+
 def runtests(binding, domain, username, password):
 
     print 'Testing SAMR pipe'

Reply via email to