Skip to content
This repository was archived by the owner on Feb 5, 2025. It is now read-only.

Commit b824a8e

Browse files
tburginTom Burgin
andauthored
santad: only store events if there is a sync server configured (#721)
* santad: only store events if there is a sync server configured * SNTExecutionControllerTest stub sync server Co-authored-by: Tom Burgin <bur@chromium.org>
1 parent 25bf2a9 commit b824a8e

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

Source/santad/SNTExecutionController.m

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,12 @@ - (void)validateBinaryWithMessage:(santa_message_t)message {
223223
se.quarantineTimestamp = binInfo.quarantineTimestamp;
224224
se.quarantineAgentBundleID = binInfo.quarantineAgentBundleID;
225225

226-
dispatch_async(_eventQueue, ^{
227-
[self.eventTable addStoredEvent:se];
228-
});
226+
// Only store events if there is a sync server configured.
227+
if ([SNTConfigurator configurator].syncBaseURL) {
228+
dispatch_async(_eventQueue, ^{
229+
[self.eventTable addStoredEvent:se];
230+
});
231+
}
229232

230233
// If binary was blocked, do the needful
231234
if (action != ACTION_RESPOND_ALLOW && action != ACTION_RESPOND_ALLOW_COMPILER) {

Source/santad/SNTExecutionControllerTest.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ - (void)setUp {
5353

5454
self.mockConfigurator = OCMClassMock([SNTConfigurator class]);
5555
OCMStub([self.mockConfigurator configurator]).andReturn(self.mockConfigurator);
56+
NSURL *url = [NSURL URLWithString:@"https://localhost/test"];
57+
OCMStub([self.mockConfigurator syncBaseURL]).andReturn(url);
5658

5759
self.mockDriverManager = OCMClassMock([SNTDriverManager class]);
5860

0 commit comments

Comments
 (0)