This manual page is for Mac OS X version 10.6

If you are running a different version of Mac OS X, view the documentation locally:

  • In Terminal, using the man(1) command

Reading manual pages

Manual pages are intended as a quick reference for people who already understand a technology.

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

  • For more information about this technology, look for other documentation in the Apple Reference Library.

  • For general information about writing shell scripts, read Shell Scripting Primer.



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 groups.  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) daemon.

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
     nonexistent 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

Reporting Problems

The way to report a problem with this manual page depends on the type of problem:

Content errors
Report errors in the content of this documentation with the feedback links below.
Bug reports
Report bugs in the functionality of the described tool or API through Bug Reporter.
Formatting problems
Report formatting mistakes in the online version of these pages with the feedback links below.