/*
- * Copyright (c) 2000-2006, 2009-2011, 2015 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2006, 2009-2011, 2015, 2018, 2019 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
#define SNAPSHOT_PATH_STATE _PATH_VARTMP "configd-state"
#define SNAPSHOT_PATH_STORE _PATH_VARTMP "configd-store.plist"
#define SNAPSHOT_PATH_PATTERN _PATH_VARTMP "configd-pattern.plist"
-#define SNAPSHOT_PATH_SESSION _PATH_VARTMP "configd-session.plist"
#define N_QUICK 100
oValues = CFAllocatorAllocate(NULL, nElements * sizeof(CFTypeRef), 0);
nValues = CFAllocatorAllocate(NULL, nElements * sizeof(CFTypeRef), 0);
}
- bzero(nValues, nElements * sizeof(CFTypeRef));
+ memset(nValues, 0, nElements * sizeof(CFTypeRef));
CFDictionaryGetKeysAndValues(storeData, keys, oValues);
for (i = 0; i < nElements; i++) {
nValues[i] = CFDictionaryCreateMutableCopy(NULL, 0, oValues[i]);
- _SCUnserialize(&plist, data, NULL, 0);
+ if (!_SCUnserialize(&plist, data, NULL, 0)) {
+ SC_log(LOG_NOTICE, "_SCUnserialize() failed, key=%@", keys[i]);
+ continue;
+ }
+
CFDictionarySetValue((CFMutableDictionaryRef)nValues[i],
kSCDData,
plist);
int
__SCDynamicStoreSnapshot(SCDynamicStoreRef store)
{
+#pragma unused(store)
CFDictionaryRef expandedStoreData;
FILE *f;
int fd;
if (f == NULL) {
return kSCStatusFailed;
}
- SCPrint(TRUE, f, CFSTR("Main thread :\n\n"));
+ SCPrint(TRUE, f, CFSTR("Main [plug-in] thread :\n\n"));
SCPrint(TRUE, f, CFSTR("%@\n"), CFRunLoopGetCurrent());
- if (plugin_runLoop != NULL) {
- SCPrint(TRUE, f, CFSTR("Plug-in thread :\n\n"));
- SCPrint(TRUE, f, CFSTR("%@\n"), plugin_runLoop);
- }
listSessions(f);
(void) fclose(f);
(void) close(fd);
CFRelease(xmlData);
- /* Save a snapshot of the "session" data */
-
- (void) unlink(SNAPSHOT_PATH_SESSION);
- fd = open(SNAPSHOT_PATH_SESSION, O_WRONLY|O_CREAT|O_TRUNC|O_EXCL, 0644);
- if (fd == -1) {
- return kSCStatusFailed;
- }
-
- xmlData = CFPropertyListCreateData(NULL, sessionData, kCFPropertyListXMLFormat_v1_0, 0, NULL);
- if (xmlData == NULL) {
- SC_log(LOG_NOTICE, "CFPropertyListCreateData() failed");
- close(fd);
- return kSCStatusFailed;
- }
- (void) write(fd, CFDataGetBytePtr(xmlData), CFDataGetLength(xmlData));
- (void) close(fd);
- CFRelease(xmlData);
-
return kSCStatusOK;
}