summaryrefslogtreecommitdiff
path: root/source4/scripting/python
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2012-09-07 15:49:47 +1000
committerAndrew Bartlett <abartlet@samba.org>2012-09-12 05:26:16 +0200
commitac804f0d7f5a93ff2710e213d9213ad9960a15d6 (patch)
tree938a8c734adc57e168459001135e3cfdf1302af5 /source4/scripting/python
parentbd2f1604d73f05f3b2f151a81f09824c7bb99ab5 (diff)
downloadsamba-ac804f0d7f5a93ff2710e213d9213ad9960a15d6.tar.gz
samba-ac804f0d7f5a93ff2710e213d9213ad9960a15d6.tar.bz2
samba-ac804f0d7f5a93ff2710e213d9213ad9960a15d6.zip
smbd-posix_acls: Use a IDL union to store the ACL entry
This is a clearer, long-term-stable structure we can hash without risking it changing. Andrew Bartlett
Diffstat (limited to 'source4/scripting/python')
-rw-r--r--source4/scripting/python/samba/tests/posixacl.py52
1 files changed, 11 insertions, 41 deletions
diff --git a/source4/scripting/python/samba/tests/posixacl.py b/source4/scripting/python/samba/tests/posixacl.py
index ba0911d78c..b323f91f1a 100644
--- a/source4/scripting/python/samba/tests/posixacl.py
+++ b/source4/scripting/python/samba/tests/posixacl.py
@@ -35,9 +35,6 @@ from samba.samba3 import param as s3param
# print "uid: %d" % entry.uid
# print "gid: %d" % entry.gid
-def is_minus_one(val):
- return (val == -1 or val == 4294967295)
-
class PosixAclMappingTests(TestCase):
def test_setntacl(self):
@@ -162,48 +159,35 @@ class PosixAclMappingTests(TestCase):
self.assertEquals(posix_acl.acl[0].a_type, smb_acl.SMB_ACL_GROUP)
self.assertEquals(posix_acl.acl[0].a_perm, 7)
- self.assertEquals(posix_acl.acl[0].gid, BA_gid)
- self.assertTrue(is_minus_one(posix_acl.acl[0].uid))
+ self.assertEquals(posix_acl.acl[0].info.gid, BA_gid)
self.assertEquals(posix_acl.acl[1].a_type, smb_acl.SMB_ACL_USER)
self.assertEquals(posix_acl.acl[1].a_perm, 6)
- self.assertEquals(posix_acl.acl[1].uid, LA_uid)
- self.assertTrue(is_minus_one(posix_acl.acl[1].gid))
+ self.assertEquals(posix_acl.acl[1].info.uid, LA_uid)
self.assertEquals(posix_acl.acl[2].a_type, smb_acl.SMB_ACL_OTHER)
self.assertEquals(posix_acl.acl[2].a_perm, 0)
- self.assertTrue(is_minus_one(posix_acl.acl[2].uid))
- self.assertTrue(is_minus_one(posix_acl.acl[2].gid))
self.assertEquals(posix_acl.acl[3].a_type, smb_acl.SMB_ACL_USER_OBJ)
self.assertEquals(posix_acl.acl[3].a_perm, 6)
- self.assertTrue(is_minus_one(posix_acl.acl[3].uid))
- self.assertTrue(is_minus_one(posix_acl.acl[3].gid))
self.assertEquals(posix_acl.acl[4].a_type, smb_acl.SMB_ACL_GROUP_OBJ)
self.assertEquals(posix_acl.acl[4].a_perm, 7)
- self.assertTrue(is_minus_one(posix_acl.acl[4].uid))
- self.assertTrue(is_minus_one(posix_acl.acl[4].gid))
self.assertEquals(posix_acl.acl[5].a_type, smb_acl.SMB_ACL_GROUP)
self.assertEquals(posix_acl.acl[5].a_perm, 5)
- self.assertEquals(posix_acl.acl[5].gid, SO_gid)
- self.assertTrue(is_minus_one(posix_acl.acl[5].uid))
+ self.assertEquals(posix_acl.acl[5].info.gid, SO_gid)
self.assertEquals(posix_acl.acl[6].a_type, smb_acl.SMB_ACL_GROUP)
self.assertEquals(posix_acl.acl[6].a_perm, 7)
- self.assertEquals(posix_acl.acl[6].gid, SY_gid)
- self.assertTrue(is_minus_one(posix_acl.acl[6].uid))
+ self.assertEquals(posix_acl.acl[6].info.gid, SY_gid)
self.assertEquals(posix_acl.acl[7].a_type, smb_acl.SMB_ACL_GROUP)
self.assertEquals(posix_acl.acl[7].a_perm, 5)
- self.assertEquals(posix_acl.acl[7].gid, AU_gid)
- self.assertTrue(is_minus_one(posix_acl.acl[7].uid))
+ self.assertEquals(posix_acl.acl[7].info.gid, AU_gid)
self.assertEquals(posix_acl.acl[8].a_type, smb_acl.SMB_ACL_MASK)
self.assertEquals(posix_acl.acl[8].a_perm, 7)
- self.assertTrue(is_minus_one(posix_acl.acl[8].uid))
- self.assertTrue(is_minus_one(posix_acl.acl[8].gid))
# check that it matches:
@@ -304,53 +288,39 @@ class PosixAclMappingTests(TestCase):
self.assertEquals(posix_acl.acl[0].a_type, smb_acl.SMB_ACL_GROUP)
self.assertEquals(posix_acl.acl[0].a_perm, 7)
- self.assertEquals(posix_acl.acl[0].gid, BA_gid)
- self.assertTrue(is_minus_one(posix_acl.acl[0].uid))
+ self.assertEquals(posix_acl.acl[0].info.gid, BA_gid)
self.assertEquals(posix_acl.acl[1].a_type, smb_acl.SMB_ACL_USER)
self.assertEquals(posix_acl.acl[1].a_perm, 6)
- self.assertEquals(posix_acl.acl[1].uid, LA_uid)
- self.assertTrue(is_minus_one(posix_acl.acl[1].gid))
+ self.assertEquals(posix_acl.acl[1].info.uid, LA_uid)
self.assertEquals(posix_acl.acl[2].a_type, smb_acl.SMB_ACL_OTHER)
self.assertEquals(posix_acl.acl[2].a_perm, 0)
- self.assertTrue(is_minus_one(posix_acl.acl[2].uid))
- self.assertTrue(is_minus_one(posix_acl.acl[2].gid))
self.assertEquals(posix_acl.acl[3].a_type, smb_acl.SMB_ACL_USER_OBJ)
self.assertEquals(posix_acl.acl[3].a_perm, 6)
- self.assertTrue(is_minus_one(posix_acl.acl[3].uid))
- self.assertTrue(is_minus_one(posix_acl.acl[3].gid))
self.assertEquals(posix_acl.acl[4].a_type, smb_acl.SMB_ACL_GROUP_OBJ)
self.assertEquals(posix_acl.acl[4].a_perm, 7)
- self.assertTrue(is_minus_one(posix_acl.acl[4].uid))
- self.assertTrue(is_minus_one(posix_acl.acl[4].gid))
self.assertEquals(posix_acl.acl[5].a_type, smb_acl.SMB_ACL_GROUP)
self.assertEquals(posix_acl.acl[5].a_perm, 5)
- self.assertEquals(posix_acl.acl[5].gid, SO_gid)
- self.assertTrue(is_minus_one(posix_acl.acl[5].uid))
+ self.assertEquals(posix_acl.acl[5].info.gid, SO_gid)
self.assertEquals(posix_acl.acl[6].a_type, smb_acl.SMB_ACL_GROUP)
self.assertEquals(posix_acl.acl[6].a_perm, 7)
- self.assertEquals(posix_acl.acl[6].gid, SY_gid)
- self.assertTrue(is_minus_one(posix_acl.acl[6].uid))
+ self.assertEquals(posix_acl.acl[6].info.gid, SY_gid)
self.assertEquals(posix_acl.acl[7].a_type, smb_acl.SMB_ACL_GROUP)
self.assertEquals(posix_acl.acl[7].a_perm, 5)
- self.assertEquals(posix_acl.acl[7].gid, AU_gid)
- self.assertTrue(is_minus_one(posix_acl.acl[7].uid))
+ self.assertEquals(posix_acl.acl[7].info.gid, AU_gid)
self.assertEquals(posix_acl.acl[8].a_type, smb_acl.SMB_ACL_GROUP)
self.assertEquals(posix_acl.acl[8].a_perm, 7)
- self.assertEquals(posix_acl.acl[8].gid, PA_gid)
- self.assertTrue(is_minus_one(posix_acl.acl[8].uid))
+ self.assertEquals(posix_acl.acl[8].info.gid, PA_gid)
self.assertEquals(posix_acl.acl[9].a_type, smb_acl.SMB_ACL_MASK)
self.assertEquals(posix_acl.acl[9].a_perm, 7)
- self.assertTrue(is_minus_one(posix_acl.acl[9].uid))
- self.assertTrue(is_minus_one(posix_acl.acl[9].gid))
# check that it matches: