apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From William R Speirs <bill.spe...@gmail.com>
Subject Getting the groups a user belongs to
Date Fri, 10 Dec 2010 02:37:24 GMT
I was looking through the APR and noticed that no function exists to get the 
groups (gid or char*) that a user belongs to.

I started investigating how to implement such a thing on Unix/Linux and it 
doesn't seem hard; getgrouplist will return a gid list given a user.

On Windows things are bit more tricky because the computer can either be a 
member of a domain, or on its own. I think the following basic flow will work, 
but I'd like a second opinion:

- Call GetNetworkParams to see if there is a domain name
- If no domain name, then call NetUserGetLocalGroups
- If there is a domain name, then call NetUserGetGroups

Does that seem right?

The other issue is that on Windows I get back a char* for the groups; whereas, 
on Unix/Linux I get back a gid list. Is there a preference? Would people rather 
a function that returns a gid list or a char* list?



View raw message