[ Next Article | Previous Article | Book Contents | Library Home | Legal | Search ]
Communications Technical Reference, Volume 2

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

Attention: Do not use the innetgr subroutine in a multithreaded environment.

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.

getnetgrent() 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. getnetgrent() uses malloc to allocate space for the name. This space is released when endnetgrent() 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.

setnetgrent() establishes the network group from which getnetgrent() will obtain members, and also restarts calls to getnetgrent() from the beginnning of the list. If the previous setnetgrent() call was to a different netowrk group, an endnetgrent() call is implied. endnetgrent() frees the space allocated during the getnetgrent() calls.

Parameters

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

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

Implementation Specifics

These subroutines are part of Base Operating System (BOS) Runtime.

Files

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

Related Information

Sockets Overview in AIX Version 4.3 Communications Programming Concepts.


[ Next Article | Previous Article | Book Contents | Library Home | Legal | Search ]