]>
Commit | Line | Data |
---|---|---|
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 |
7 | setnetgrent, endnetgrent, getnetgrent, getnetgrent_r, innetgr \- |
8 | handle 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 |
28 | The | |
fea681da | 29 | .B netgroup |
c13182ef MK |
30 | is a SunOS invention. |
31 | A netgroup database is a list of string triples | |
fea681da | 32 | .BR (hostname "," username "," domainname) |
c13182ef MK |
33 | or other netgroup names. |
34 | Any of the elements in a triple can be empty, | |
fea681da MK |
35 | which means that anything matches. |
36 | The functions described here allow access to the netgroup databases. | |
37 | The file | |
38 | .I /etc/nsswitch.conf | |
39 | defines what database is searched. | |
40 | .PP | |
41 | The | |
63aa9df0 | 42 | .BR setnetgrent () |
fea681da | 43 | call defines the netgroup that will be searched by subsequent |
63aa9df0 | 44 | .BR getnetgrent () |
c13182ef MK |
45 | calls. |
46 | The | |
63aa9df0 | 47 | .BR getnetgrent () |
fea681da MK |
48 | function retrieves the next netgroup entry, and returns pointers in |
49 | .IR host , | |
50 | .IR user , | |
51 | .IR domain . | |
52 | A NULL pointer means that the corresponding entry matches any string. | |
53 | The pointers are valid only as long as there is no call to other | |
54 | netgroup related functions. | |
55 | To avoid this problem you can use the GNU function | |
63aa9df0 | 56 | .BR getnetgrent_r () |
fea681da MK |
57 | that stores the strings in the supplied buffer. |
58 | To free all allocated buffers use | |
63aa9df0 | 59 | .BR endnetgrent (). |
fea681da MK |
60 | .PP |
61 | In most cases you only want to check if the triplet | |
62 | .BR (hostname "," username "," domainname) | |
c13182ef MK |
63 | is a member of a netgroup. |
64 | The function | |
63aa9df0 | 65 | .BR innetgr () |
fea681da MK |
66 | can be used for this without calling the above three functions. |
67 | Again, a NULL pointer is a wildcard and matches any string. | |
68 | The function is thread-safe. | |
69 | .SH FILES | |
70 | .I /etc/netgroup | |
71 | .br | |
72 | .I /etc/nsswitch.conf | |
73 | .SH "RETURN VALUES" | |
74 | These functions return 1 on success and 0 for failure. | |
75 | .SH NOTES | |
76 | In the BSD implementation, | |
63aa9df0 | 77 | .BR setnetgrent () |
fea681da MK |
78 | returns void. |
79 | .SH "SEE ALSO" | |
80 | .BR sethostent (3), | |
81 | .BR setservent (3), | |
82 | .BR setprotoent (3) |