GETGRAENT(3)

NAME
getgraent, getgranam, setgraent, endgraent, fgetgraent - get group adjunct file entry

SYNOPSIS
#include <stdio.h>
#include <grpadj.h>

struct group_adjunct *getgraent()

struct group_adjunct *getgranam(name)
char *name;

struct group_adjunct *fgetgraent(f)
FILE *f;

void setgraent()

void endgraent()

DESCRIPTION

getgraent() and getgranam() each return pointers to an object with the following structure containing the broken-out fields of a line in the group adjunct file. Each line contains a group_adjunct structure, defined in the <grpadj.h> header file.

    struct  group_adjunct {
        char    *gra_name;	/* the name of the group */
        char    *gra_passwd;	/* the encrypted group password */
    };

When first called, getgraent() returns a pointer to a group_adjunct structure corresponding to the first line in the file. Thereafter, it returns a pointer to the next group_adjunct structure in the file. So successive calls may be used to traverse the entire file.

For locating a particular group, getgranam() searches through the file until it finds group filename, then returns a pointer to that structure.

A call to getgraent() rewinds the group adjunct file to allow repeated searches. A call to endgraent() closes the group adjunct file when processing is complete.

Because read access is required on /etc/security/group.adjunct, getgraent() and getgranam() will fail unless the calling process has effective UID of root.

FILES
/etc/security/group.adjunct
/var/yp/domainname/group.adjunct

SEE ALSO
getlogin(3V), getgrent(3V), getpwaent(3), getpwent(3V), ypserv(8)

DIAGNOSTICS

A NULL pointer is returned on end-of-file or error.

BUGS

All information is contained in a static area, so it must be copied if it is to be saved.