mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Fix mac_assistive tests
Fix for tcc database on newer macos versions
This commit is contained in:
parent
60a9edf235
commit
0ca299cc81
1 changed files with 52 additions and 3 deletions
|
@ -186,6 +186,7 @@ class TccDB:
|
|||
self.connection = None
|
||||
self.ge_mojave_and_catalina = False
|
||||
self.ge_bigsur_and_later = False
|
||||
self.ge_sonoma_and_later = False
|
||||
|
||||
def _check_table_digest(self):
|
||||
# This logic comes from https://github.com/jacobsalmela/tccutil which is
|
||||
|
@ -201,6 +202,8 @@ class TccDB:
|
|||
elif digest in ("3d1c2a0e97", "cef70648de"):
|
||||
# BigSur and later
|
||||
self.ge_bigsur_and_later = True
|
||||
elif digest in ("34abf99d20",):
|
||||
self.ge_sonoma_and_later = True
|
||||
else:
|
||||
raise CommandExecutionError(
|
||||
f"TCC Database structure unknown for digest '{digest}'"
|
||||
|
@ -309,10 +312,56 @@ class TccDB:
|
|||
(app_id, client_type, auth_value),
|
||||
)
|
||||
self.connection.commit()
|
||||
elif self.ge_sonoma_and_later:
|
||||
# CREATE TABLE access (
|
||||
# service TEXT NOT NULL,
|
||||
# client TEXT NOT NULL,
|
||||
# client_type INTEGER NOT NULL,
|
||||
# auth_value INTEGER NOT NULL,
|
||||
# auth_reason INTEGER NOT NULL,
|
||||
# auth_version INTEGER NOT NULL,
|
||||
# csreq BLOB,
|
||||
# policy_id INTEGER,
|
||||
# indirect_object_identifier_type INTEGER,
|
||||
# indirect_object_identifier TEXT NOT NULL DEFAULT 'UNUSED',
|
||||
# indirect_object_code_identity BLOB,
|
||||
# flags INTEGER,
|
||||
# last_modified INTEGER NOT NULL DEFAULT (CAST(strftime('%s','now') AS INTEGER)),
|
||||
# pid INTEGER,
|
||||
# pid_version INTEGER,
|
||||
# boot_uuid TEXT NOT NULL DEFAULT 'UNUSED',
|
||||
# last_reminded INTEGER NOT NULL DEFAULT (CAST(strftime('%s','now') AS INTEGER)),
|
||||
# PRIMARY KEY (service, client, client_type, indirect_object_identifier),
|
||||
# FOREIGN KEY (policy_id)
|
||||
self.connection.execute(
|
||||
"""
|
||||
INSERT or REPLACE INTO access VALUES(
|
||||
'kTCCServiceAccessibility',
|
||||
?,
|
||||
?,
|
||||
?,
|
||||
4,
|
||||
1,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
'UNUSED',
|
||||
NULL,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
'UNUSED',
|
||||
?
|
||||
)
|
||||
""",
|
||||
(app_id, client_type, auth_value, time.time()),
|
||||
)
|
||||
self.connection.commit()
|
||||
return True
|
||||
|
||||
def enabled(self, app_id):
|
||||
if self.ge_bigsur_and_later:
|
||||
if self.ge_bigsur_and_later or self.ge_sonoma_and_later:
|
||||
column = "auth_value"
|
||||
elif self.ge_mojave_and_catalina:
|
||||
column = "allowed"
|
||||
|
@ -328,7 +377,7 @@ class TccDB:
|
|||
def enable(self, app_id):
|
||||
if not self.installed(app_id):
|
||||
return False
|
||||
if self.ge_bigsur_and_later:
|
||||
if self.ge_bigsur_and_later or self.ge_sonoma_and_later:
|
||||
column = "auth_value"
|
||||
elif self.ge_mojave_and_catalina:
|
||||
column = "allowed"
|
||||
|
@ -344,7 +393,7 @@ class TccDB:
|
|||
def disable(self, app_id):
|
||||
if not self.installed(app_id):
|
||||
return False
|
||||
if self.ge_bigsur_and_later:
|
||||
if self.ge_bigsur_and_later or self.ge_sonoma_and_later:
|
||||
column = "auth_value"
|
||||
elif self.ge_mojave_and_catalina:
|
||||
column = "allowed"
|
||||
|
|
Loading…
Add table
Reference in a new issue