+ dict = CFDictionaryCreateMutable(NULL,
+ 0,
+ &kCFTypeDictionaryKeyCallBacks,
+ &kCFTypeDictionaryValueCallBacks);
+
+ if (user != NULL) {
+ CFNumberRef num;
+
+ consoleUser = CFStringCreateWithCString(NULL, user, kCFStringEncodingMacRoman);
+ CFDictionarySetValue(dict, kSCPropUsersConsoleUserName, consoleUser);
+ CFRelease(consoleUser);
+
+ num = CFNumberCreate(NULL, kCFNumberSInt32Type, (SInt32 *)&uid);
+ CFDictionarySetValue(dict, kSCPropUsersConsoleUserUID, num);
+ CFRelease(num);
+
+ num = CFNumberCreate(NULL, kCFNumberSInt32Type, (SInt32 *)&gid);
+ CFDictionarySetValue(dict, kSCPropUsersConsoleUserGID, num);
+ CFRelease(num);
+ }
+
+ if (sessions != NULL) {
+ CFDictionarySetValue(dict, kSCPropUsersConsoleSessionInfo, sessions);
+ }
+
+ ok = SCDynamicStoreSetValue(store, key, dict);
+
+ done :
+
+ if (dict) CFRelease(dict);
+ if (key) CFRelease(key);
+ return ok;
+}
+
+
+Boolean
+SCDynamicStoreSetConsoleUser(SCDynamicStoreRef store,
+ const char *user,
+ uid_t uid,
+ gid_t gid)
+{
+ CFStringRef consoleUser;
+ CFMutableDictionaryRef dict = NULL;
+ CFStringRef key = SCDynamicStoreKeyCreateConsoleUser(NULL);
+ CFNumberRef num;
+ Boolean ok = FALSE;
+