date and time created 93/06/02 19:11:53 by mckusick
[unix-history] / usr / src / lib / libc / gen / getnetgrent.3
.\" Copyright (c) 1992 The Regents of the University of California.
.\" All rights reserved.
.\"
.\" %sccs.include.redist.man%
.\"
.\" @(#)getnetgrent.3 6.1 (Berkeley) %G%
.\"
.Dd
.Dt GETNETGRENT 3
.Os
.Sh NAME
.Nm getnetgrent ,
.Nm innetgr ,
.Nm setnetgrent ,
.Nm endnetgrent
.Nd netgroup database operations
.Sh SYNOPSIS
.Ft int
.Fn getnetgrent "char **host, char **user, char **domain"
.Ft int
.Fn innetgr "const char *netgroup, const char *host, const char *user, const char *domain"
.Ft void
.Fn setnetgrent "const char *netgroup"
.Ft void
.Fn endnetgrent void
.Sh DESCRIPTION
These functions operate on the netgroup database file
.Pa /etc/netgroup
which is described
in
.Xr netgroup 5 .
The database defines a set of netgroups, each made up of one or more triples:
.Bd -literal -offset indent
(host, user, domain)
.Ed
that defines a combination of host, user and domain.
Any of the three fields may be specified as ``wildcards'' that match any
string.
.Pp
The function
.Fn getnetgrent
sets the three pointer arguments to the strings of the next member of the
current netgroup.
If any of the string pointers are
.Sy (char *)0
that field is considered a wildcard.
.Pp
The functions
.Fn setnetgrent
and
.Fn endnetgrent
set the current netgroup and terminate the current netgroup respectively.
If
.Fn setnetgrent
is called with a different netgroup than the previous call, an implicit
.Fn endnetgrent
is implied.
.Fn Setnetgrent
also sets the offset to the first member of the netgroup.
.Pp
The function
.Fn innetgr
searches for a match of all fields within the specified group.
If any of the
.Sy host ,
.Sy user ,
or
.Sy domain
arguments are
.Sy (char *)0
those fields will match any string value in the netgroup member.
.Sh RETURN VALUES
The function
.Fn getnetgrent
returns 0 for ``no more netgroup members'' and 1 otherwise.
The function
.Fn innetgr
returns 1 for a successful match and 0 otherwise.
The functions
.Fn setnetgrent
and
.Fn endnetgrent
have no return value.
.Sh FILES
.Bl -tag -width /etc/netgroup -compact
.It Pa /etc/netgroup
netgroup database file
.El
.Sh SEE ALSO
.Fn netgroup 5
.Sh COMPATIBILITY
The netgroup members have three string fields to maintain compatibility
with other vendor implementations, however it is not obvious what use the
.Sy domain
string has within BSD.
.Sh BUGS
The function
.Fn getnetgrent
returns pointers to dynamically allocated data areas that are free'd when
the function
.Fn endnetgrent
is called.