/*
- * Copyright (c) 2000-2005, 2009 Apple Inc. All rights reserved.
+ * Copyright (c) 2000-2005, 2009, 2011, 2015 Apple Inc. All rights reserved.
*
* @APPLE_LICENSE_HEADER_START@
*
CFStringRef consoleUser = NULL;
CFDictionaryRef dict = NULL;
CFStringRef key;
- Boolean tempSession = FALSE;
-
- if (store == NULL) {
- store = SCDynamicStoreCreate(NULL,
- CFSTR("SCDynamicStoreCopyConsoleUser"),
- NULL,
- NULL);
- if (store == NULL) {
- return NULL;
- }
- tempSession = TRUE;
- }
key = SCDynamicStoreKeyCreateConsoleUser(NULL);
dict = SCDynamicStoreCopyValue(store, key);
done :
- if (tempSession) CFRelease(store);
if (dict) CFRelease(dict);
return consoleUser;
}
CFDictionaryRef dict = NULL;
CFArrayRef info = NULL;
CFStringRef key;
- Boolean tempSession = FALSE;
-
- if (store == NULL) {
- store = SCDynamicStoreCreate(NULL,
- CFSTR("SCDynamicStoreCopyConsoleUser"),
- NULL,
- NULL);
- if (store == NULL) {
- return NULL;
- }
- tempSession = TRUE;
- }
key = SCDynamicStoreKeyCreateConsoleUser(NULL);
dict = SCDynamicStoreCopyValue(store, key);
info = CFDictionaryGetValue(dict, kSCPropUsersConsoleSessionInfo);
info = isA_CFArray(info);
- if (!info) {
+ if (info == NULL) {
_SCErrorSet(kSCStatusNoKey);
goto done;
}
done :
- if (tempSession) CFRelease(store);
if (dict) CFRelease(dict);
return info;
}
CFMutableDictionaryRef dict = NULL;
CFStringRef key = SCDynamicStoreKeyCreateConsoleUser(NULL);
Boolean ok = FALSE;
- Boolean tempSession = FALSE;
-
- if (store == NULL) {
- store = SCDynamicStoreCreate(NULL,
- CFSTR("SCDynamicStoreSetConsoleUser"),
- NULL,
- NULL);
- if (store == NULL) {
- goto done;
- }
- tempSession = TRUE;
- }
if ((user == NULL) && (sessions == NULL)) {
ok = SCDynamicStoreRemoveValue(store, key);
if (dict) CFRelease(dict);
if (key) CFRelease(key);
- if (tempSession) CFRelease(store);
return ok;
}
CFStringRef key = SCDynamicStoreKeyCreateConsoleUser(NULL);
CFNumberRef num;
Boolean ok = FALSE;
- Boolean tempSession = FALSE;
-
- if (store == NULL) {
- store = SCDynamicStoreCreate(NULL,
- CFSTR("SCDynamicStoreSetConsoleUser"),
- NULL,
- NULL);
- if (store == NULL) {
- goto done;
- }
- tempSession = TRUE;
- }
if (user == NULL) {
ok = SCDynamicStoreRemoveValue(store, key);
if (dict) CFRelease(dict);
if (key) CFRelease(key);
- if (tempSession) CFRelease(store);
return ok;
}