org.apache.hadoop.security
Class JniBasedUnixGroupsNetgroupMapping

java.lang.Object
  extended by org.apache.hadoop.security.JniBasedUnixGroupsMapping
      extended by org.apache.hadoop.security.JniBasedUnixGroupsNetgroupMapping

public class JniBasedUnixGroupsNetgroupMapping
extends JniBasedUnixGroupsMapping

A JNI-based implementation of GroupMappingServiceProvider that invokes libC calls to get the group memberships of a given user.


Constructor Summary
JniBasedUnixGroupsNetgroupMapping()
           
 
Method Summary
 void cacheGroupsAdd(List<String> groups)
          Caches the group user information
 void cacheGroupsRefresh()
          Refresh the cache of groups and user mapping
 List<String> getGroups(String user)
          Gets unix groups and netgroups for the user.
protected  List<String> getUsersForNetgroup(String netgroup)
          Calls JNI function to get users for a netgroup, since C functions are not reentrant we need to make this synchronized (see documentation for setnetgrent, getnetgrent and endnetgrent)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JniBasedUnixGroupsNetgroupMapping

public JniBasedUnixGroupsNetgroupMapping()
Method Detail

getGroups

public List<String> getGroups(String user)
                       throws IOException
Gets unix groups and netgroups for the user. It gets all unix groups as returned by id -Gn but it only returns netgroups that are used in ACLs (there is no way to get all netgroups for a given user, see documentation for getent netgroup)

Overrides:
getGroups in class JniBasedUnixGroupsMapping
Parameters:
user - User's name
Returns:
group memberships of user
Throws:
IOException

cacheGroupsRefresh

public void cacheGroupsRefresh()
                        throws IOException
Refresh the cache of groups and user mapping

Overrides:
cacheGroupsRefresh in class JniBasedUnixGroupsMapping
Throws:
IOException

cacheGroupsAdd

public void cacheGroupsAdd(List<String> groups)
                    throws IOException
Caches the group user information

Overrides:
cacheGroupsAdd in class JniBasedUnixGroupsMapping
Parameters:
groups - list of groups to add to cache
Throws:
IOException

getUsersForNetgroup

protected List<String> getUsersForNetgroup(String netgroup)
Calls JNI function to get users for a netgroup, since C functions are not reentrant we need to make this synchronized (see documentation for setnetgrent, getnetgrent and endnetgrent)



Copyright © 2009 The Apache Software Foundation