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
14       void endnetgrent(void);
15
16       int getnetgrent(char **host, char **user, char **domain);
17
18       int getnetgrent_r(char **host, char **user,
19                         char **domain, char *buf, int buflen);
20
21       int innetgr(const char *netgroup, const char *host,
22                   const char *user, const char *domain);
23
24   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
25
26       setnetgrent(), endnetgrent(), getnetgrent(), getnetgrent_r(),
27       innetgr(): _BSD_SOURCE || _SVID_SOURCE
28

DESCRIPTION

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

RETURN VALUE

53       These functions return 1 on success and 0 for failure.
54

FILES

56       /etc/netgroup
57       /etc/nsswitch.conf
58

CONFORMING TO

60       These  functions  are  not  in POSIX.1-2001, but setnetgrent(), endnet‐
61       grent(), getnetgrent(), and innetgr() are available on most  UNIX  sys‐
62       tems.  getnetgrent_r() is not widely available on other systems.
63

NOTES

65       In the BSD implementation, setnetgrent() returns void.
66

SEE ALSO

68       sethostent(3), setprotoent(3), setservent(3)
69

COLOPHON

71       This  page  is  part of release 3.53 of the Linux man-pages project.  A
72       description of the project, and information about reporting  bugs,  can
73       be found at http://www.kernel.org/doc/man-pages/.
74
75
76
77GNU                               2007-07-26                    SETNETGRENT(3)
Impressum