RE: Security Framework: Authori(s/z)ion Rights
RE: Security Framework: Authori(s/z)ion Rights
- Subject: RE: Security Framework: Authori(s/z)ion Rights
- From: "Huyler, Christopher M" <email@hidden>
- Date: Mon, 10 Nov 2003 11:09:18 -0500
- Thread-topic: Security Framework: Authori(s/z)ion Rights
Thanks for this tip...I actually figured it out last Friday before I got
this email...I just hope Apple sticks with using the "admin" group to
distinguish Administrators.
int groups[MAX_GROUPS];
int size = MAX_GROUPS;
struct group *pgrp;
int i,ret;
ret = getgrouplist((const char *)username, -1, groups, &size);
if (ret == 0)
{
i = 0;
while ( i<size )
{
pgrp = getgrgid(groups[i]);
if (pgrp && strcmp(pgrp->gr_name,"admin") == 0)
return true;
i++;
}
}
return false;
-----Original Message-----
From: Nick Zitzmann [
mailto:email@hidden]
Sent: Saturday, November 08, 2003 12:30 AM
To: Huyler, Christopher M
Cc: email@hidden
Subject: Re: Security Framework: Authori(s/z)ion Rights
On Nov 7, 2003, at 7:49 AM, Huyler, Christopher M wrote:
>
Can anyone answer these questions?????
Sorry, not me. I've only used the default rights with the Authorization
functions...
>
3) If all I have is a user name, is there a way to check to see that
>
the
>
user is an administrator?
But this one I can answer: Call the function "getgrouplist()" with the
user's "short" name as the first parameter, and check to see if the
user belongs to group #80, which is the gid for the "admin" group in OS
X. If the user belongs to that group, then the user is an admin. See
the man page for getgrouplist(3) for details...
Nick Zitzmann
AIM/iChat: dragonsdontsleep
Check out my software page:
http://seiryu.home.comcast.net/
S/MIME signature available upon request
"I have always wished that my computer would be as easy to use as my
telephone. My wish has come true. I no longer know how to use my
telephone." - Bjarne Stroustrup
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.