Re: Administrator password (Getting list of admins)
Re: Administrator password (Getting list of admins)
- Subject: Re: Administrator password (Getting list of admins)
- From: Jerry Krinock <email@hidden>
- Date: Tue, 14 Nov 2006 06:36:08 -0500
- Thread-topic: Administrator password (Getting list of admins)
on 06/11/14 1:55, Joseph Oreste Bruni at email@hidden wrote:
> Check out nigrep, niutil, nicl, etc. And while you are reading those
> man pages, try "man -k netinfo".
How about: "Jerry, don't wish too hard for what you want, you might get it."
Indeed, I GOT IT, Joe! If I ever get to retire, it looks like I could use
all those to write my own NetInfo Manager. Fun stuff.
For now, though, I'll use Terry's tip with getgrnam(). This seems to work:
#include <grp.h>
NSArray* MacSystemAdminShortNames() {
// Returns the short names of all members of the group "admin"
struct group* groupInfo ;
groupInfo = getgrnam("admin") ;
char* member ;
int iMember = 0 ;
NSMutableArray* admins = [[NSMutableArray alloc] init] ;
while ((member = groupInfo->gr_mem[iMember++])) {
[admins addObject:[NSString stringWithCString:member]] ;
}
NSArray* adminsOut = [NSArray arrayWithArray:admins] ;
[admins release] ;
return adminsOut ;
}
on 06/11/14 3:32, Terry Lambert at email@hidden wrote:
> Be aware that some directory services do not permit enumeration of
> group members,
The only directory service I care about is whatever is used in "grps.c" by
Mac OS X, right? And "whatever that is" seems to work.
> or support the concept of a group being a member of a
> group; if that is the case, then it may not be possible to get a
> complete answer when you ask the question "who are the admin users?".
I understand this to mean that if someone somehow created a group of admins
within the group admin, I'd have to call my function recursively to get all
of them. Is that even possible, to have a group of admins?
Thanks for the help!
Jerry
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden