1SETNETGRENT(3)             Linux Programmer's Manual            SETNETGRENT(3)
2
3
4

NAME

6       setnetgrent,  endnetgrent, getnetgrent, getnetgrent_r, innetgr - handle
7       network group entries
8

SYNOPSIS

10       #include <netdb.h>
11
12       int setnetgrent(const char *netgroup);
13       void endnetgrent(void);
14       int getnetgrent(char **host, char **user, char **domain);
15
16       int getnetgrent_r(char **host, char **user,
17                         char **domain, char *buf, int buflen);
18
19       int innetgr(const char *netgroup, const char *host,
20                   const char *user, const char *domain);
21

DESCRIPTION

23       The netgroup is a SunOS invention. A netgroup database  is  a  list  of
24       string  triples (hostname,username,domainname) or other netgroup names.
25       Any of the elements in a triple can be empty, which means that anything
26       matches.   The  functions  described  here allow access to the netgroup
27       databases.   The  file  /etc/nsswitch.conf  defines  what  database  is
28       searched.
29
30       The  setnetgrent()  call  defines the netgroup that will be searched by
31       subsequent getnetgrent() calls. The  getnetgrent()  function  retrieves
32       the next netgroup entry, and returns pointers in host, user, domain.  A
33       NULL pointer means that the corresponding  entry  matches  any  string.
34       The  pointers  are valid only as long as there is no call to other net‐
35       group related functions.  To avoid this problem you  can  use  the  GNU
36       function  getnetgrent_r()  that stores the strings in the supplied buf‐
37       fer.  To free all allocated buffers use endnetgrent().
38
39       In most cases you only want to check  if  the  triplet  (hostname,user‐
40       name,domainname)  is a member of a netgroup. The function innetgr() can
41       be used for this without calling the above three functions.   Again,  a
42       NULL  pointer  is  a  wildcard and matches any string.  The function is
43       thread-safe.
44

FILES

46       /etc/netgroup
47       /etc/nsswitch.conf
48

RETURN VALUES

50       These functions return 1 on success and 0 for failure.
51

NOTES

53       In the BSD implementation, setnetgrent() returns void.
54

SEE ALSO

56       sethostent(3), setservent(3), setprotoent(3)
57
58
59
60GNU                               2002-08-20                    SETNETGRENT(3)
Impressum