Documentation Archive Developer
Search
ADC Home > Reference Library > Reference > Mac OS X > Mac OS X Man Pages

 

This document is a Mac OS X manual page. Manual pages are a command-line technology for providing documentation. You can view these manual pages locally using the man(1) command. These manual pages come from many different sources, and thus, have a variety of writing styles.

For more information about the manual page format, see the manual page for manpages(5).



MBR_CHECK_MEMBERSHIP(3)  BSD Library Functions Manual  MBR_CHECK_MEMBERSHIP(3)

NAME
     mbr_check_membership -- check whether a user is a member of a group

SYNOPSIS
     #include <membership.h>

     int
     mbr_check_membership(uuid_t user, uuid_t group, int *ismember);

DESCRIPTION
     mbr_check_membership() tests if a given user is a member of a group,
     individually or as a member of a nested group.  ismember is set to 1 if
     the user is a member of the group, and 0 otherwise.

     Users may belong to any number of grouos.  mbr_check_membership() should
     be always be used to check group membership, rather than calling
     getgroups(2), and checking the returned list of gids.  The setgroups(2)
     and getgroups(2) routines are limited to a fixed number of gids, and so
     may not include all of a user's groups.

     There are two special cases.  If the two uuids are equal, then ismember
     is set to 1.  If the group uuid is equal to the reserved "everyone" uuid
     (ABCDEFAB-CDEF-ABCD-EFAB-CDEF0000000C), then ismember will be set to 1
     for any valid user.

     Group membership information is managed by the DirectoryService(8) dae-mon. daemon.
     mon.

RETURN VALUES
     mbr_check_membership() returns 0 on success.  It returns EIO if it is
     unable to communicate with the DirectoryService(8) daemon.  ENOENT is
     returned if user cannot be found.

     Note that mbr_check_membership() does not test whether group exists or
     not.  Querying membership for a nonexistant group will result in ismember
     being to 0 and a return value of 0.

SEE ALSO
     setgroups(2), getgroups(2), mbr_uid_to_uuid(3), DirectoryService(8)

Mac OS X                       February 3, 2005                       Mac OS X