2 .\" Copyright 2002 walter harms (walter.harms@informatik.uni-oldenburg.de)
4 .\" SPDX-License-Identifier: GPL-1.0-or-later
6 .\" based on glibc infopages
9 .TH setnetgrent 3 (date) "Linux man-pages (unreleased)"
11 setnetgrent, endnetgrent, getnetgrent, getnetgrent_r, innetgr \-
12 handle network group entries
15 .RI ( libc ", " \-lc )
20 .BI "int setnetgrent(const char *" netgroup );
21 .B "void endnetgrent(void);"
23 .BI "int getnetgrent(char **restrict " host ,
24 .BI " char **restrict " user ", char **restrict " domain );
25 .BI "int getnetgrent_r(char **restrict " host ,
26 .BI " char **restrict " user ", char **restrict " domain ,
27 .BI " char " buf "[restrict ." buflen "], size_t " buflen );
29 .BI "int innetgr(const char *" netgroup ", const char *" host ,
30 .BI " const char *" user ", const char *" domain );
34 Feature Test Macro Requirements for glibc (see
35 .BR feature_test_macros (7)):
49 glibc 2.19 and earlier:
50 _BSD_SOURCE || _SVID_SOURCE
57 A netgroup database is a list of string triples
58 .RI ( hostname ", " username ", " domainname )
59 or other netgroup names.
60 Any of the elements in a triple can be empty,
61 which means that anything matches.
62 The functions described here allow access to the netgroup databases.
65 defines what database is searched.
69 call defines the netgroup that will be searched by subsequent
74 function retrieves the next netgroup entry, and returns pointers in
78 A null pointer means that the corresponding entry matches any string.
79 The pointers are valid only as long as there is no call to other
80 netgroup-related functions.
81 To avoid this problem you can use the GNU function
83 that stores the strings in the supplied buffer.
84 To free all allocated buffers use
87 In most cases you want to check only if the triplet
88 .RI ( hostname ", " username ", " domainname )
89 is a member of a netgroup.
92 can be used for this without calling the above three functions.
93 Again, a null pointer is a wildcard and matches any string.
94 The function is thread-safe.
96 These functions return 1 on success and 0 for failure.
100 .I /etc/nsswitch.conf
102 For an explanation of the terms used in this section, see
110 Interface Attribute Value
113 .BR getnetgrent_r (),
116 MT-Unsafe race:netgrent
122 MT-Unsafe race:netgrent
127 MT-Unsafe race:netgrent
128 race:netgrentbuf locale
138 signifies that if any of the functions
140 .BR getnetgrent_r (),
145 are used in parallel in different threads of a program,
146 then data races could occur.
148 These functions are not in POSIX.1, but
154 are available on most UNIX systems.
156 is not widely available on other systems.
157 .\" getnetgrent_r() is on Solaris 8 and AIX 5.1, but not the BSDs.
159 In the BSD implementation,