Determine user type and privileges by user id
Determine user type and privileges by user id
- Subject: Determine user type and privileges by user id
- From: Volodymyr Shcherbyna <email@hidden>
- Date: Fri, 14 Dec 2012 20:59:52 +0100
Hello Everyone,
I am trying to determine the user type (local, remote) and privileges (root, admin, user) given it's id. In order to get privileges I am calling getgrnam_r(...) to enumerate users of group "admin" and "wheel", however the function returns me only the user names. I can't use the user id to match a user in the group, and using user names is not very precise, because, for example, I can have users with the same name coming from Active Directory (AD) or Open Directory (OD).
I am also trying to use DirectoryService API in order to determine if user is part of AD or OD or he is local, and I am lost here as well, because I can't find a function which will take a user id and tell me the user type. I can always check for netaccounts and localaccounts groups and fetch user names, but how can I know the type of the user more precisely? If he is part of AD I will be able to fetch SMBSID property, but how to determine if user is part of OD?
I will appreciate any inputs on this topic.
Thank you,
--
with best regards, Volodymyr.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden