Re: Group Identity Programming
Re: Group Identity Programming
- Subject: Re: Group Identity Programming
- From: Keary Suska <email@hidden>
- Date: Wed, 29 Apr 2009 14:03:02 -0600
On Apr 29, 2009, at 7:36 AM, Jessica Billings wrote:
The third thing I tried is getting the gid using:
gid_t curGroupID = getgid(); OR
int curGroupID = getgid();
CBGroupIdentity *groupIdentity = [CBGroupIdentity
groupIdentityWithPosixGID:curGroupID authority:[CBIdentityAuthority
defaultIdentityAuthority]];
When I try to show the gid using NSLog, it hangs the program. When I
show
the groupIdentity object, it returns (null).
The above is better. What does the debugger show for curGroupID?
There
is no reason to hang on NSLog if for curGroupID, as it is really juts
an unsigned int. What is the NSLog code you are using?
Thank you for your help!
The reason NSLog was hanging is that I was using the wrong
formatting token.
When I use:
NSLog(@"current group id: %i", curGroupID);
I get "current group id: 1612776775", which I'm assuming is right.
However,
I am still getting "Current group info: (null)" when I do:
That is certainly an odd GID, but I suppose it could be. Leopard
changed everything again, so who knows. Anyway, remember that there is
no correspondence between the Unix user/group management and the Mac
OS X system user management. It is possible that the Unix-based means
of acquiring UIDs and GIDs doesn't work with the Mac's way of doing
things.
Check your values against what you expect them to be. To get the UID
and GID for a user, right-click on the user in the system accounts
pane (system prefs), choosing "advanced options". I would also check
the getuid() call and see if it returns the expected UID. This will
tell you whether the C calls know about Mac user handling.
CBGroupIdentity *groupIdentity = [CBGroupIdentity
groupIdentityWithPosixGID:curGroupID authority:[CBIdentityAuthority
defaultIdentityAuthority]];
NSLog(@"Current group info: %@", groupIdenditity);
Unfortunately, I don't know if solving this problem will solve my
ultimate
problem (although I'm sure it will help!). My ultimate problem is
that I
have a number of group identities chosen by the identity picker. I
need to
look at their member lists and see if the logged-in user is in any
of those
lists. What I can't figure out is how to get access to the member
lists of
the groups that I get using the identity picker. I think this has to
do with
the fact that the identity picker returns CBIdentity objects, but
how would
one make a CBGroupIdentity object using the information from the
CBIdentity
object for a particular group identity? The only way I can see to
make a
CBGroupIdentity object is using the above code, but as the
documentation
If the getgid/getuid functions don't work, I don't know what to tell
you. You could try digging into the new user management system (man
dscl), or NSTask to the "id" utility (man id).
HTH,
Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden