Skip to content

Commit

Permalink
Fix autoupdate_managed table value for MacOS 15 (#1862)
Browse files Browse the repository at this point in the history
  • Loading branch information
Micah-Kolide authored Sep 12, 2024
1 parent e22a96a commit a0fa235
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
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

0 comments on commit a0fa235

Please sign in to comment.