Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ innetgr(3C) — HP-UX 10.20

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

netgroup(4)

switch(4)

getnetgrent(3C)

NAME

getnetgrent(), setnetgrent(), endnetgrent(), innetgr(), getnetgrent_r(), setnetgrent_r(), endnetgrent_r() − get network group entry

SYNOPSIS

int innetgr(
char *netgroup,
char *machine,
char *user,
char *domain
);

int setnetgrent(char *netgroup);

int setnetgrent_r(
    char *grp,
    char **ngstate
);

int endnetgrent();

int endnetgrent_r(
    char **ngstaste
);

int getnetgrent(
char **machinep,
char **userp,
char **domainp
);

int getnetgrent_r(
    char **machinep,
    char **namep,
    char **domainp,
    char **ngstate
);

DESCRIPTION

innetgr() Returns 1 if netgroup contains the machine, user, and domain triple as a member.  Otherwise, it returns 0.  If machine, user, or domain is NULL, innetgr interprets NULL to mean, any machine, user, or domain respectively.  Refer to netgroup(4) for a description of netgroup membership criteria. 

getnetgrent() Returns the next member of a network group.  After the call, machinep contains a pointer to a string containing the name of the machine part of the network group member.  Pointers userp and domainp behave in a manner similar to machinep. If any of these pointers are returned with a NULL value, they are interpreted as wild cards.  getnetgrent() allocates space for the names.  This space is released when an endnetgrent() call is made.  getnetgrent() returns 1 if it succeeded in obtaining another network group member, 0 if it reached the end of the group. 

setnetgrent() Establishes the network group from which getnetgrent() obtains members, and also restarts calls to getnetgrent() from the beginning of the list.  If the previous setnetgrent() call was to a different network group, a endnetgrent() call is implied. 

endnetgrent() Frees the space allocated during getnetgrent() calls. 

If the system is running the Network Information Service (NIS) services, setnetgrent() gets the netgroup information from the NIS server (see ypserv(1M) and ypfiles(4)).

Reentrant Interfaces

getnetgrent_r(), setnetgrent_r(), and endnetgrent_r(), expect to be passed a pointer of char **ngstate that will store the result of the lookup at the supplied location.  This structure is used to store data, which the other reentrant (_r) routines use. 

setnetgrent_r() and endnetgrent_r() are to be used only in conjunction with getnetgrent_r() and take the same pointer to a char **ngstate as a parameter. 

The **ngstate pointer must be initialized to NULL before it is passed to setnetgrent_r() for the first time.  Thereafter is should not be modified in any way. 

Name Service Switch-Based Operation

The library routine, innetgr(), setnetgrent() , and setnetgrent_r(), internally call the name service switch to access the "netgroup" database lookup policy configured in the /etc/nsswitch.conf file (see switch(4)).  The lookup policy defines the order and the criteria of the supported name services used to resolve netgroup lookups. 

WARNINGS

In the non-reentrant versions of these routines, all information is contained in a static area so it must be copied if it is to be saved. 

getnetgrent(), setnetgrent(), and endnetgrent() are unsafe in multi-thread applications.  getnetgrent_r(), setnetgrent_r(), and endnetgrent_r() are MT-Safe and should be used instead. 

AUTHOR

getnetgrent() was developed by Sun Microsystems, Inc. 

FILES

/etc/netgroup /etc/nsswitch.conf

SEE ALSO

netgroup(4), switch(4). 
 

Hewlett-Packard Company  —  HP-UX Release 10.20:  July 1996

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026