]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/setnetgrent.3
Wrapped long lines, wrapped at sentence boundaries; stripped trailing
[thirdparty/man-pages.git] / man3 / setnetgrent.3
CommitLineData
fea681da
MK
1.\" Copyright 2002 walter harms (walter.harms@informatik.uni-oldenburg.de)
2.\" Distributed under GPL
3.\" based on glibc infopages
4.\" polished - aeb
5.TH SETNETGRENT 3 2002-08-20 "GNU" "Linux Programmer's Manual"
c13182ef 6.SH NAME
fea681da
MK
7setnetgrent, endnetgrent, getnetgrent, getnetgrent_r, innetgr \-
8handle network group entries
9.SH SYNOPSIS
10.B #include <netdb.h>
11.sp
12.BI "int setnetgrent(const char *" netgroup );
13.br
c13182ef 14.BI "void endnetgrent(void);"
fea681da
MK
15.br
16.BI "int getnetgrent(char **" host ", char **" user ", char **" domain );
17.sp
18.BI "int getnetgrent_r(char **" host ", char **" user ","
19.in +18
20.BI "char **" domain ", char *" buf ", int " buflen );
21.in -18
22.sp
23.BI "int innetgr(const char *" netgroup ", const char *" host ","
24.in +12
25.BI "const char *" user ", const char *" domain );
26.in -12
c13182ef
MK
27.SH DESCRIPTION
28The
fea681da 29.B netgroup
c13182ef
MK
30is a SunOS invention.
31A netgroup database is a list of string triples
fea681da 32.BR (hostname "," username "," domainname)
c13182ef
MK
33or other netgroup names.
34Any of the elements in a triple can be empty,
fea681da
MK
35which means that anything matches.
36The functions described here allow access to the netgroup databases.
37The file
38.I /etc/nsswitch.conf
39defines what database is searched.
40.PP
41The
63aa9df0 42.BR setnetgrent ()
fea681da 43call defines the netgroup that will be searched by subsequent
63aa9df0 44.BR getnetgrent ()
c13182ef
MK
45calls.
46The
63aa9df0 47.BR getnetgrent ()
fea681da
MK
48function retrieves the next netgroup entry, and returns pointers in
49.IR host ,
50.IR user ,
51.IR domain .
52A NULL pointer means that the corresponding entry matches any string.
53The pointers are valid only as long as there is no call to other
54netgroup related functions.
55To avoid this problem you can use the GNU function
63aa9df0 56.BR getnetgrent_r ()
fea681da
MK
57that stores the strings in the supplied buffer.
58To free all allocated buffers use
63aa9df0 59.BR endnetgrent ().
fea681da
MK
60.PP
61In most cases you only want to check if the triplet
62.BR (hostname "," username "," domainname)
c13182ef
MK
63is a member of a netgroup.
64The function
63aa9df0 65.BR innetgr ()
fea681da
MK
66can be used for this without calling the above three functions.
67Again, a NULL pointer is a wildcard and matches any string.
68The function is thread-safe.
69.SH FILES
70.I /etc/netgroup
71.br
72.I /etc/nsswitch.conf
73.SH "RETURN VALUES"
74These functions return 1 on success and 0 for failure.
75.SH NOTES
76In the BSD implementation,
63aa9df0 77.BR setnetgrent ()
fea681da
MK
78returns void.
79.SH "SEE ALSO"
80.BR sethostent (3),
81.BR setservent (3),
82.BR setprotoent (3)