Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix autoupdate_managed table value for MacOS 15 #1862

Merged
merged 2 commits into from
Sep 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ee/tables/macos_software_update/SUSharedPrefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
- (BOOL)bridgeOSUpdatesEnabled;
- (BOOL)skipAPFSSnapshotting;
- (BOOL)doesAllowBGStageWithoutInactivity;
- (BOOL)isMacOSAutoUpdateManaged;
- (BOOL)isAutomaticallyCheckForUpdatesManaged;
- (BOOL)isAutomaticallyCheckForUpdatesEnabled;
- (BOOL)adminDeferredInstallEnabled;
Expand Down Expand Up @@ -108,4 +109,3 @@
- (void)reloadPreferences;

@end

4 changes: 3 additions & 1 deletion ee/tables/macos_software_update/software_update_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ func (table *osUpdateTable) generateMacUpdate(ctx context.Context, queryContext
}
var (
version = C.int(table.macOSBuildVersionPrefix)
isMacOSAutoUpdateManaged = C.int(0)
isAutomaticallyCheckForUpdatesManaged = C.int(0)
isAutomaticallyCheckForUpdatesEnabled = C.int(0)
doesBackgroundDownload = C.int(0)
Expand All @@ -59,6 +60,7 @@ func (table *osUpdateTable) generateMacUpdate(ctx context.Context, queryContext
)
C.getSoftwareUpdateConfiguration(
version,
&isMacOSAutoUpdateManaged,
&isAutomaticallyCheckForUpdatesManaged,
&isAutomaticallyCheckForUpdatesEnabled,
&doesBackgroundDownload,
Expand All @@ -70,7 +72,7 @@ func (table *osUpdateTable) generateMacUpdate(ctx context.Context, queryContext

resp := []map[string]string{
{
"autoupdate_managed": fmt.Sprintf("%d", isAutomaticallyCheckForUpdatesManaged),
"autoupdate_managed": fmt.Sprintf("%d", max(isMacOSAutoUpdateManaged, isAutomaticallyCheckForUpdatesManaged)),
"autoupdate_enabled": fmt.Sprintf("%d", isAutomaticallyCheckForUpdatesEnabled),
"download": fmt.Sprintf("%d", doesBackgroundDownload),
"app_updates": fmt.Sprintf("%d", doesAppStoreAutoUpdates),
Expand Down
1 change: 1 addition & 0 deletions ee/tables/macos_software_update/sus.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ extern void productNestedKeyValueFound(unsigned int, char*, char*, char*);

// Gets software update config flags from SUSharedPrefs API
void getSoftwareUpdateConfiguration(int os_version,
int* isMacOSAutoUpdateManaged,
int* isAutomaticallyCheckForUpdatesManaged,
int* isAutomaticallyCheckForUpdatesEnabled,
int* doesBackgroundDownload,
Expand Down
8 changes: 7 additions & 1 deletion ee/tables/macos_software_update/sus.m
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#import <SUUpdateProduct.h>

void getSoftwareUpdateConfiguration(int os_version,
int* isMacOSAutoUpdateManaged,
int* isAutomaticallyCheckForUpdatesManaged,
int* isAutomaticallyCheckForUpdatesEnabled,
int* doesBackgroundDownload,
Expand All @@ -22,7 +23,12 @@ void getSoftwareUpdateConfiguration(int os_version,
Class SUSharedPrefs = [bundle classNamed:@"SUSharedPrefs"];
id manager = [SUSharedPrefs sharedPrefManager];

BOOL val = [manager isAutomaticallyCheckForUpdatesManaged];
BOOL val = [manager isMacOSAutoUpdateManaged];
if (val) {
*isMacOSAutoUpdateManaged = 1;
}

val = [manager isAutomaticallyCheckForUpdatesManaged];
if (val) {
*isAutomaticallyCheckForUpdatesManaged = 1;
}
Expand Down
Loading