]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/setnetgrent.3
user_namespaces.7: Minor rewordings of recently added text
[thirdparty/man-pages.git] / man3 / setnetgrent.3
CommitLineData
fea681da 1.\" Copyright 2002 walter harms (walter.harms@informatik.uni-oldenburg.de)
2297bf0e 2.\"
38f20bb9 3.\" %%%LICENSE_START(GPL_NOVERSION_ONELINE)
b18188c5 4.\" Distributed under GPL
38f20bb9 5.\" %%%LICENSE_END
a5e73dd4 6.\"
fea681da
MK
7.\" based on glibc infopages
8.\" polished - aeb
a5e73dd4 9.\"
4b8c67d9 10.TH SETNETGRENT 3 2017-09-15 "GNU" "Linux Programmer's Manual"
c13182ef 11.SH NAME
fea681da
MK
12setnetgrent, endnetgrent, getnetgrent, getnetgrent_r, innetgr \-
13handle network group entries
14.SH SYNOPSIS
088a639b 15.nf
fea681da 16.B #include <netdb.h>
dbfe9c70 17.PP
fea681da 18.BI "int setnetgrent(const char *" netgroup );
dbfe9c70 19.PP
0daa9e92 20.B "void endnetgrent(void);"
dbfe9c70 21.PP
fea681da 22.BI "int getnetgrent(char **" host ", char **" user ", char **" domain );
dbfe9c70 23.PP
fea681da 24.BI "int getnetgrent_r(char **" host ", char **" user ","
d7f5fd1b 25.BI " char **" domain ", char *" buf ", size_t " buflen );
dbfe9c70 26.PP
fea681da 27.BI "int innetgr(const char *" netgroup ", const char *" host ","
088a639b
MK
28.BI " const char *" user ", const char *" domain );
29.fi
68e4db0a 30.PP
cc4615cc
MK
31.in -4n
32Feature Test Macro Requirements for glibc (see
33.BR feature_test_macros (7)):
34.in
68e4db0a 35.PP
cc4615cc
MK
36.ad l
37.BR setnetgrent (),
38.BR endnetgrent (),
39.BR getnetgrent (),
40.BR getnetgrent_r (),
41.BR innetgr ():
51c612fb
MK
42 Since glibc 2.19:
43 _DEFAULT_SOURCE
44 Glibc 2.19 and earlier:
45 _BSD_SOURCE || _SVID_SOURCE
cc4615cc 46.ad b
c13182ef
MK
47.SH DESCRIPTION
48The
f19a0f03 49.I netgroup
c13182ef
MK
50is a SunOS invention.
51A netgroup database is a list of string triples
74d32233 52.RI ( hostname ", " username ", " domainname )
c13182ef
MK
53or other netgroup names.
54Any of the elements in a triple can be empty,
fea681da
MK
55which means that anything matches.
56The functions described here allow access to the netgroup databases.
57The file
58.I /etc/nsswitch.conf
59defines what database is searched.
60.PP
61The
63aa9df0 62.BR setnetgrent ()
fea681da 63call defines the netgroup that will be searched by subsequent
63aa9df0 64.BR getnetgrent ()
c13182ef
MK
65calls.
66The
63aa9df0 67.BR getnetgrent ()
fea681da
MK
68function retrieves the next netgroup entry, and returns pointers in
69.IR host ,
70.IR user ,
71.IR domain .
b437fdd9 72A null pointer means that the corresponding entry matches any string.
fea681da 73The pointers are valid only as long as there is no call to other
28442c8f 74netgroup-related functions.
fea681da 75To avoid this problem you can use the GNU function
63aa9df0 76.BR getnetgrent_r ()
fea681da
MK
77that stores the strings in the supplied buffer.
78To free all allocated buffers use
63aa9df0 79.BR endnetgrent ().
fea681da 80.PP
33a0ccb2 81In most cases you want to check only if the triplet
74d32233 82.RI ( hostname ", " username ", " domainname )
c13182ef
MK
83is a member of a netgroup.
84The function
63aa9df0 85.BR innetgr ()
fea681da 86can be used for this without calling the above three functions.
b437fdd9 87Again, a null pointer is a wildcard and matches any string.
fea681da 88The function is thread-safe.
47297adb 89.SH RETURN VALUE
2b2581ee 90These functions return 1 on success and 0 for failure.
fea681da
MK
91.SH FILES
92.I /etc/netgroup
93.br
94.I /etc/nsswitch.conf
ff446578
ZL
95.SH ATTRIBUTES
96For an explanation of the terms used in this section, see
97.BR attributes (7).
98.TS
99allbox;
100lbw16 lb lbw23
101l l l.
102Interface Attribute Value
103T{
104.BR setnetgrent (),
105.br
106.BR getnetgrent_r (),
107.br
108.BR innetgr ()
109T} Thread safety T{
110MT-Unsafe race:netgrent
111.br
112locale
113T}
114T{
115.BR endnetgrent ()
116T} Thread safety MT-Unsafe race:netgrent
117T{
118.BR getnetgrent ()
119T} Thread safety T{
120MT-Unsafe race:netgrent
121.br
122race:netgrentbuf locale
123T}
124.TE
847e0d88 125.sp 1
ff446578
ZL
126In the above table,
127.I netgrent
128in
129.I race:netgrent
130signifies that if any of the functions
bf7bc8b8
MK
131.BR setnetgrent (),
132.BR getnetgrent_r (),
133.BR innetgr (),
134.BR getnetgrent (),
ff446578 135or
bf7bc8b8 136.BR endnetgrent ()
ff446578
ZL
137are used in parallel in different threads of a program,
138then data races could occur.
fd9d7bd6 139.SH CONFORMING TO
9afbac85 140These functions are not in POSIX.1, but
fd9d7bd6
MK
141.BR setnetgrent (),
142.BR endnetgrent (),
143.BR getnetgrent (),
144and
145.BR innetgr ()
008f1ecc 146are available on most UNIX systems.
fd9d7bd6
MK
147.BR getnetgrent_r ()
148is not widely available on other systems.
149.\" getnetgrent_r() is on Solaris 8 and AIX 5.1, but not the BSDs.
fea681da
MK
150.SH NOTES
151In the BSD implementation,
63aa9df0 152.BR setnetgrent ()
fea681da 153returns void.
47297adb 154.SH SEE ALSO
fea681da 155.BR sethostent (3),
f0c34053
MK
156.BR setprotoent (3),
157.BR setservent (3)