From: Andrew Bartlett Date: Wed, 11 Jul 2018 05:08:34 +0000 (+1200) Subject: tests/posixacl: Test with and without filling in the unix_token X-Git-Tag: tdb-1.3.16~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7422df43bbe0b09f6e7cf57984ea523f4e10249b;p=thirdparty%2Fsamba.git tests/posixacl: Test with and without filling in the unix_token Sadly the unix token cannot be created without a running winbindd, which is not available during provision and a domain restore. (Internally in smbd a backup API via passdb is used, but this is not connected to this function at this time) Signed-off-by: Andrew Bartlett Reviewed-by: Douglas Bagnall --- diff --git a/python/samba/tests/posixacl.py b/python/samba/tests/posixacl.py index 4261ef36544..8b48825fc6f 100644 --- a/python/samba/tests/posixacl.py +++ b/python/samba/tests/posixacl.py @@ -840,3 +840,28 @@ class SessionedPosixAclMappingTests(PosixAclMappingTests): auth.AUTH_SESSION_INFO_SIMPLE_PRIVILEGES) return auth.user_session(self.samdb, lp_ctx=self.lp, dn=dn, session_info_flags=flags) + +class UnixSessionedPosixAclMappingTests(PosixAclMappingTests): + """ + Run same test suite with session enabled. + """ + + def get_session_info(self, domsid=DOM_SID): + """ + Get session_info for setntacl. + """ + if str(domsid) != str(self.samdb.get_domain_sid()): + # fake it with admin session as domsid is not in local db + return auth.admin_session(self.lp, str(domsid)) + + dn = ''.format(domsid, security.DOMAIN_RID_ADMINISTRATOR) + flags = (auth.AUTH_SESSION_INFO_DEFAULT_GROUPS | + auth.AUTH_SESSION_INFO_AUTHENTICATED | + auth.AUTH_SESSION_INFO_SIMPLE_PRIVILEGES) + + session = auth.user_session(self.samdb, lp_ctx=self.lp, dn=dn, + session_info_flags=flags) + auth.session_info_fill_unix(session, + lp_ctx=self.lp, + user_name="Administrator") + return session