innetgr, getnetgrent, setnetgrent, or endnetgrent Subroutine

Purpose

Handles the group network entries.

Library

Standard C Library (libc.a)

Syntax

#include <netdb.h>

innetgr (NetGroup, Machine, User, Domain)
char * NetGroup, * Machine, * User, * Domain;

getnetgrent (MachinePointer, UserPointer, DomainPointer)
char ** MachinePointer, ** UserPointer, ** DomainPointer;

void setnetgrent (NetGroup)
char *NetGroup
void endnetgrent ()

Description

The innetgr subroutine is threadsafe in AIX® 4.3 and later. However, the return value points to static data that is overwritten by subsequent calls. This data must be copied to be saved for use by subsequent calls.

The innetgr subroutine returns 1 or 0, depending on if netgroup contains the machine, user, domain triple as a member. Any of these three strings; machine, user, or domain, can be NULL, in which case it signifies a wild card.

The getnetgrent subroutine returns the next member of a network group. After the call, machinepointer will contain a pointer to a string containing the name of the machine part of the network group member, and similarly for userpointer and domainpointer. If any of machinepointer, userpointer, or domainpointer is returned as a NULL pointer, it signifies a wild card. The getnetgrent subroutine uses malloc to allocate space for the name. This space is released when the endnetgrent subroutine is called. getnetgrent returns 1 if it succeeded in obtaining another member of the network group or 0 when it has reached the end of the group.

The setnetgrent subroutine establishes the network group from which the getnetgrent subroutine will obtain members, and also restarts calls to the getnetgrent subroutine from the beginnning 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.

Parameters

Item Description
Domain Specifies the domain.
DomainPointer Points to the string containing Domain part of the network group.
Machine Specifies the machine.
MachinePointer Points to the string containing Machine part of the network group.
NetGroup Points to a network group.
User Specifies a user.
UserPointer Points to the string containing User part of the network group.

Return Values

Item Description
1 Indicates that the subroutine was successful in obtaining a member.
0 Indicates that the subroutine was not successful in obtaining a member.

Files

Item Description
/etc/netgroup Contains network groups recognized by the system.
/usr/include/netdb.h Contains the network database structures.