Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ setnetgrent(3N) — SunOS 5.2

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

malloc(3C)

nsswitch.conf(4)

netgroup(4)

getnetgrent(3N)

NAME

getnetgrent, setnetgrent, endnetgrent, innetgr − get network group entry

SYNOPSIS

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

int setnetgrent(const char ∗netgroup);

int endnetgrent(void);

innetgr(const char ∗netgroup, const char ∗machine, char ∗user, const char ∗domain);

MT-LEVEL

Unsafe

DESCRIPTION

getnetgrent() returns the next member of a network group.  This network group information may come from one of the following sources: the netgroup file, the NIS (YP) map "netgroup.byname", and the NIS+ table "netgroup".  After the call, machinep will contain a pointer to a string containing the name of the machine part of the network group member, userp will contain a pointer to a string containing the user name and, domainp will contain a pointer to a string containing the domain name.  If any of machinep, userp or domainp is returned as a NULL pointer, it signifies a wild card.  getnetgrent() will use malloc(3C) to allocate space for the name.  This space is released when an endnetgrent() call is made.  getnetgrent() returns 1 if it succeeded in obtaining another member of the network group, 0 if it has reached the end of the group. 

setnetgrent() establishes the network group from which getnetgrent() will obtain members.  Calls to getnetgrent() start returning entries from the beginning of the list.  If the previous setnetgrent() call was to a different network group, an endnetgrent() call is implied. 

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

innetgr() returns 1 or 0, depending on whether netgroup contains the machine, user, domain triple as a member.  Any of the three strings machinep, userp, or domainp can be NULL, in which case it signifies a wild card. 

WARNINGS

The Network Information Service (NIS) must be running when using getnetgrent(), since it only inspects the NIS netgroup map, never the local files. 

NOTES

These interfaces are unsafe in multithreaded applications.  Unsafe interfaces should be called only from the main thread. 

SEE ALSO

malloc(3C), nsswitch.conf(4), netgroup(4)

SunOS 5.2  —  Last change: 22 Jan 1993

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