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 admin_session = auth.admin_session(self.lp, str(domsid)) auth.session_info_fill_unix(admin_session, lp_ctx=self.lp, user_name="Administrator") return admin_session dn = '<SID={0}-{1}>'.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
def system_session_unix(): """ Return a copy of the system session_info with a valid UNIX token """ session_info = system_session() session_info_unix = copy_session_info(session_info) session_info_fill_unix(session_info_unix, None) return session_info_unix
def system_session_unix(): session_info = system_session() session_info_unix = copy_session_info(session_info) session_info_fill_unix(session_info_unix, None) return session_info_unix