Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

More on SCDynamicStoreCopyConsoleUser returning 510184?



On Sunday, March 31, 2002, at 05:44 PM, Finlay Dobbie wrote:

Why is it that (on OS X, haven't tested on Darwin), SCDynamicStoreCopyConsoleUser returns 510184 as the uid when nobody is logged in? Seems a bit of a random number.

This is my code, more investigation below:

----
void myCallout ( SCDynamicStoreRef store,
CFArrayRef changedKeys,
void *info ) {
uid_t newUid;
gid_t newGid;
SCDynamicStoreCopyConsoleUser( store, &newUid, &newGid );
printf("user changed, newUid = %d; newGid = %d\n", newUid, newGid);
}

int main (int argc, const char * argv[]) {
SCDynamicStoreRef myStore = SCDynamicStoreCreate( NULL,
CFSTR("SCFThing"),
myCallout,
NULL );

uid_t myUid;
gid_t myGid;

CFStringRef myConsoleUserKey = SCDynamicStoreKeyCreateConsoleUser
( NULL );
CFArrayRef myKeys = CFArrayCreate( NULL, (void **)&myConsoleUserKey, 1, NULL );

CFRunLoopSourceRef myRunLoopSource = SCDynamicStoreCreateRunLoopSource( NULL,
myStore,
0 );


SCDynamicStoreCopyConsoleUser( myStore, &myUid, &myGid );
SCDynamicStoreSetNotificationKeys( myStore, myKeys, NULL );

printf("UID = %d; GID = %d!\n", myUid, myGid);

CFRunLoopAddSource( CFRunLoopGetCurrent(), myRunLoopSource , kCFRunLoopDefaultMode );
CFRunLoopRun();

CFRelease(myStore);
return 0;
}
----

Running it while I'm logged in (running from ttyp3 over ssh in case you're wondering), then logging out and back in again gives:
UID = 501; GID = 20!
user changed, newUid = 510184; newGid = 0
user changed, newUid = 501; newGid = 20

Arg, now I'm getting (first when I tried with no user, and now after I'm logged in):
bootstrap_look_up() failed (ipc/send) invalid destination port
bootstrap_look_up() failed (ipc/send) invalid destination port
UID = 13; GID = 1!
Bus error

(bus erroring in CFRunLoopAddSource)

This seems to be quite buggy and odd. Not to mention unreliable...

-- Finlay
_______________________________________________
darwin-development mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/darwin-development
Do not post admin requests to the list. They will be ignored.

References: 
 >SCDynamicStoreCopyConsoleUser returning 510184? (From: Finlay Dobbie <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.