r3588: Fix bug in converting SIDs containing large unsigned integers from Python.
authorTim Potter <tpot@samba.org>
Sun, 7 Nov 2004 00:41:43 +0000 (00:41 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:05:36 +0000 (13:05 -0500)
(This used to be commit a46aba43549e5221ec0c15d4133444d8ef77a4fb)

source4/scripting/swig/dcerpc.i
source4/scripting/swig/torture/samr.py

index 560345525fbda91a43a2c7ee98705a3a2f4a0815..27afb6471c84e45d6cf5d5ca840fccba41a5c6ed 100644 (file)
@@ -119,9 +119,9 @@ uint32 uint32_from_python(PyObject *obj, char *name)
        }
 
        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)
index 435b3a81db0af008d1902b3ffe11ee3386e7cda9..f7c33baeb3dbdc8a4cac5c94c600aee064d7b811 100755 (executable)
@@ -864,6 +864,18 @@ def test_LongInt(pipe):
 
     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'