1 .\" Copyright 2002 walter harms (walter.harms@informatik.uni-oldenburg.de)
3 .\" SPDX-License-Identifier: GPL-1.0-or-later
5 .\" based on glibc infopages
8 .TH setnetgrent 3 (date) "Linux man-pages (unreleased)"
10 setnetgrent, endnetgrent, getnetgrent, getnetgrent_r, innetgr \-
11 handle network group entries
14 .RI ( libc ", " \-lc )
19 .BI "int setnetgrent(const char *" netgroup );
20 .B "void endnetgrent(void);"
22 .BI "int getnetgrent(char **restrict " host ,
23 .BI " char **restrict " user ", char **restrict " domain );
24 .BI "int getnetgrent_r(char **restrict " host ,
25 .BI " char **restrict " user ", char **restrict " domain ,
26 .BI " char *restrict " buf ", size_t " buflen );
28 .BI "int innetgr(const char *" netgroup ", const char *" host ,
29 .BI " const char *" user ", const char *" domain );
33 Feature Test Macro Requirements for glibc (see
34 .BR feature_test_macros (7)):
48 Glibc 2.19 and earlier:
49 _BSD_SOURCE || _SVID_SOURCE
56 A netgroup database is a list of string triples
57 .RI ( hostname ", " username ", " domainname )
58 or other netgroup names.
59 Any of the elements in a triple can be empty,
60 which means that anything matches.
61 The functions described here allow access to the netgroup databases.
64 defines what database is searched.
68 call defines the netgroup that will be searched by subsequent
73 function retrieves the next netgroup entry, and returns pointers in
77 A null pointer means that the corresponding entry matches any string.
78 The pointers are valid only as long as there is no call to other
79 netgroup-related functions.
80 To avoid this problem you can use the GNU function
82 that stores the strings in the supplied buffer.
83 To free all allocated buffers use
86 In most cases you want to check only if the triplet
87 .RI ( hostname ", " username ", " domainname )
88 is a member of a netgroup.
91 can be used for this without calling the above three functions.
92 Again, a null pointer is a wildcard and matches any string.
93 The function is thread-safe.
95 These functions return 1 on success and 0 for failure.
101 For an explanation of the terms used in this section, see
109 Interface Attribute Value
112 .BR getnetgrent_r (),
115 MT-Unsafe race:netgrent
121 MT-Unsafe race:netgrent
126 MT-Unsafe race:netgrent
127 race:netgrentbuf locale
137 signifies that if any of the functions
139 .BR getnetgrent_r (),
144 are used in parallel in different threads of a program,
145 then data races could occur.
147 These functions are not in POSIX.1, but
153 are available on most UNIX systems.
155 is not widely available on other systems.
156 .\" getnetgrent_r() is on Solaris 8 and AIX 5.1, but not the BSDs.
158 In the BSD implementation,