1 .\" Copyright 2002 walter harms (walter.harms@informatik.uni-oldenburg.de)
3 .\" %%%LICENSE_START(GPL_NOVERSION_ONELINE)
4 .\" Distributed under GPL
7 .\" based on glibc infopages
10 .TH SETNETGRENT 3 2021-03-22 "GNU" "Linux Programmer's Manual"
12 setnetgrent, endnetgrent, getnetgrent, getnetgrent_r, innetgr \-
13 handle network group entries
18 .BI "int setnetgrent(const char *" netgroup );
19 .B "void endnetgrent(void);"
21 .BI "int getnetgrent(char **restrict " host ,
22 .BI " char **restrict " user ", char **restrict " domain );
23 .BI "int getnetgrent_r(char **restrict " host ,
24 .BI " char **restrict " user ", char **restrict " domain ,
25 .BI " char *restrict " buf ", size_t " buflen );
27 .BI "int innetgr(const char *" netgroup ", const char *" host ,
28 .BI " const char *" user ", const char *" domain );
32 Feature Test Macro Requirements for glibc (see
33 .BR feature_test_macros (7)):
47 Glibc 2.19 and earlier:
48 _BSD_SOURCE || _SVID_SOURCE
55 A netgroup database is a list of string triples
56 .RI ( hostname ", " username ", " domainname )
57 or other netgroup names.
58 Any of the elements in a triple can be empty,
59 which means that anything matches.
60 The functions described here allow access to the netgroup databases.
63 defines what database is searched.
67 call defines the netgroup that will be searched by subsequent
72 function retrieves the next netgroup entry, and returns pointers in
76 A null pointer means that the corresponding entry matches any string.
77 The pointers are valid only as long as there is no call to other
78 netgroup-related functions.
79 To avoid this problem you can use the GNU function
81 that stores the strings in the supplied buffer.
82 To free all allocated buffers use
85 In most cases you want to check only if the triplet
86 .RI ( hostname ", " username ", " domainname )
87 is a member of a netgroup.
90 can be used for this without calling the above three functions.
91 Again, a null pointer is a wildcard and matches any string.
92 The function is thread-safe.
94 These functions return 1 on success and 0 for failure.
100 For an explanation of the terms used in this section, see
108 Interface Attribute Value
111 .BR getnetgrent_r (),
114 MT-Unsafe race:netgrent
120 MT-Unsafe race:netgrent
125 MT-Unsafe race:netgrent
126 race:netgrentbuf locale
136 signifies that if any of the functions
138 .BR getnetgrent_r (),
143 are used in parallel in different threads of a program,
144 then data races could occur.
146 These functions are not in POSIX.1, but
152 are available on most UNIX systems.
154 is not widely available on other systems.
155 .\" getnetgrent_r() is on Solaris 8 and AIX 5.1, but not the BSDs.
157 In the BSD implementation,