Re: How to get a group id from its name in kernel extension?
Re: How to get a group id from its name in kernel extension?
- Subject: Re: How to get a group id from its name in kernel extension?
- From: Michael Smith <email@hidden>
- Date: Thu, 30 Jun 2011 23:55:29 -0700
On Jun 30, 2011, at 5:16 PM, Anatol Pomozov wrote: I my kernel extension I need to check that a user is a member of some group ('admin' in my case). To check it I use kauth_cred_ismember_gid() function. This function accepts group_id as a parameter. So now I need to get the id of the group by its name. We cannot rely on the fact that id of the 'admin' group is always 80, right?
If it was userspace I would use getgrnam() function, but it is not available in the kernel.
What is the best way to get id of the 'admin' group in kext?
Someone in userspace needs to send it to you.
In general, the kernel doesn't have any absolute knowledge about group or user IDs (zero and some of the well-known UUIDs notwithstanding); it just makes comparisons between them according to some specific rules.
The same should apply to your code - the association between GIDs and their meaning is maintained outside the kernel.
= Mike
-- Ars longa, vita brevis, occasio praeceps, experimentum periculosum, iudicium difficile -- Hippocrates
|
_______________________________________________
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