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