OSDN Git Service

d8febcd6402186b3155eaa431f721e7986894e01
[linuxjm/LDP_man-pages.git] / draft / man3 / setnetgrent.3
1 .\"  Copyright 2002 walter harms (walter.harms@informatik.uni-oldenburg.de)
2 .\"  Distributed under GPL
3 .\"  based on glibc infopages
4 .\" polished - aeb
5 .\"
6 .\" Japanese Version Copyright (c) 2005  Akihiro MOTOKI
7 .\"         all rights reserved.
8 .\" Translated 2005-02-20, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
9 .\"
10 .TH SETNETGRENT 3 2007-07-26 "GNU" "Linux Programmer's Manual"
11 .\"O .SH NAME
12 .SH 名前
13 .\"O setnetgrent, endnetgrent, getnetgrent, getnetgrent_r, innetgr \-
14 .\"O handle network group entries
15 setnetgrent, endnetgrent, getnetgrent, getnetgrent_r, innetgr \-
16 ネットワーク・グループのエントリを操作する
17 .\"O .SH SYNOPSIS
18 .SH 書式
19 .nf
20 .B #include <netdb.h>
21
22 .BI "int setnetgrent(const char *" netgroup );
23
24 .B "void endnetgrent(void);"
25
26 .BI "int getnetgrent(char **" host ", char **" user ", char **" domain );
27
28 .BI "int getnetgrent_r(char **" host ", char **" user ","
29 .BI "                  char **" domain ", char *" buf ", int " buflen );
30
31 .BI "int innetgr(const char *" netgroup ", const char *" host ","
32 .BI "            const char *" user ", const char *" domain );
33 .fi
34 .sp
35 .in -4n
36 .\"O Feature Test Macro Requirements for glibc (see
37 .\"O .BR feature_test_macros (7)):
38 glibc 向けの機能検査マクロの要件
39 .RB ( feature_test_macros (7)
40 参照):
41 .in
42 .sp
43 .ad l
44 .BR setnetgrent (),
45 .BR endnetgrent (),
46 .BR getnetgrent (),
47 .BR getnetgrent_r (),
48 .BR innetgr ():
49 _BSD_SOURCE || _SVID_SOURCE
50 .ad b
51 .\"O .SH DESCRIPTION
52 .SH 説明
53 .\"O The
54 .\"O .I netgroup
55 .\"O is a SunOS invention.
56 .\"O A netgroup database is a list of string triples
57 .\"O .RI ( hostname ", " username ", " domainname )
58 .\"O or other netgroup names.
59 .\"O Any of the elements in a triple can be empty,
60 .\"O which means that anything matches.
61 .\"O The functions described here allow access to the netgroup databases.
62 .\"O The file
63 .\"O .I /etc/nsswitch.conf
64 .\"O defines what database is searched.
65 .I netgroup
66 は SunOS で考案されたものである。ネットグループのデータベースの
67 エントリは、 3 つの文字列のリスト
68 .RI ( hostname ", " username ", " domainname )
69 もしくはネットグループ名である。
70 前記のリストの各要素は空であってもよい。
71 空は何とでも一致することを意味する。
72 本ページで説明する関数を使うことで、ネットグループのデータベースに
73 アクセスすることができる。どのデータベースが検索されるかは
74 .I /etc/nsswitch.conf
75 ファイルで定義されている。
76 .PP
77 .\"O The
78 .\"O .BR setnetgrent ()
79 .\"O call defines the netgroup that will be searched by subsequent
80 .\"O .BR getnetgrent ()
81 .\"O calls.
82 .\"O The
83 .\"O .BR getnetgrent ()
84 .\"O function retrieves the next netgroup entry, and returns pointers in
85 .\"O .IR host ,
86 .\"O .IR user ,
87 .\"O .IR domain .
88 .BR setnetgrent ()
89 コールは、この後で呼ばれる
90 .BR getnetgrent ()
91 コールが検索するネットグループを定める。
92 .BR getnetgrent ()
93 関数はネットグループの次のエントリを取得し、
94 .IR host ,
95 .IR user ,
96 .I domain
97 にポインタを入れて返る。
98 .\"O A NULL pointer means that the corresponding entry matches any string.
99 .\"O The pointers are valid only as long as there is no call to other
100 .\"O netgroup-related functions.
101 .\"O To avoid this problem you can use the GNU function
102 .\"O .BR getnetgrent_r ()
103 .\"O that stores the strings in the supplied buffer.
104 .\"O To free all allocated buffers use
105 .\"O .BR endnetgrent ().
106 NULL ポインタは、対応するエントリがどんな文字列とも一致することを意味する。
107 得られたポインタは、ネットグループ関係の関数のいずれかが呼ばれるまでの
108 間だけ有効である。この問題を避けるためには GNU 拡張の関数
109 .BR getnetgrent_r ()
110 を使うとよい。この関数は呼び出し側が用意したバッファに
111 文字列を格納する。割り当て済のバッファを全て解放するには
112 .BR endnetgrent ()
113 を使用する。
114 .PP
115 .\"O In most cases you only want to check if the triplet
116 .\"O .RI ( hostname ", " username ", " domainname )
117 .\"O is a member of a netgroup.
118 .\"O The function
119 .\"O .BR innetgr ()
120 .\"O can be used for this without calling the above three functions.
121 .\"O Again, a NULL pointer is a wildcard and matches any string.
122 .\"O The function is thread-safe.
123 ほとんどの場合、
124 .RI ( hostname ", " username ", " domainname )
125 の3要素の組がネットグループのメンバーかどうかを確認したいだけであろう。
126 .BR innetgr ()
127 関数を使うと、上記の3つの関数を呼び出さずにこの目的を達成できる。
128 もう一度書いておくが、NULL ポインタはワイルドカードであり、
129 あらゆる文字列と一致する。この関数はスレッドセーフである。
130 .\"O .SH "RETURN VALUE"
131 .SH 返り値
132 .\"O These functions return 1 on success and 0 for failure.
133 これらの関数は成功すると 1 を、失敗すると 0 を返す。
134 .\"O .SH FILES
135 .SH ファイル
136 .I /etc/netgroup
137 .br
138 .I /etc/nsswitch.conf
139 .\"O .SH CONFORMING TO
140 .SH 準拠
141 .\"O These functions are not in POSIX.1-2001, but
142 .\"O .BR setnetgrent (),
143 .\"O .BR endnetgrent (),
144 .\"O .BR getnetgrent (),
145 .\"O and
146 .\"O .BR innetgr ()
147 .\"O are available on most UNIX systems.
148 .\"O .BR getnetgrent_r ()
149 .\"O is not widely available on other systems.
150 これらの関数は POSIX.1-2001 にはないが、
151 setnetgrent (),
152 endnetgrent (),
153 getnetgrent (),
154 innetgr ()
155 はほとんどの UNIX システムで利用可能である。
156 .BR getnetgrent_r ()
157 は広く他のシステムで利用できるわけではない。
158 .\" getnetgrent_r() is on Solaris 8 and AIX 5.1, but not the BSDs.
159 .\"O .SH NOTES
160 .SH 注意
161 .\"O In the BSD implementation,
162 .\"O .BR setnetgrent ()
163 .\"O returns void.
164 BSD の実装では
165 .BR setnetgrent ()
166 は void を返す。
167 .\"O .SH "SEE ALSO"
168 .SH 関連項目
169 .BR sethostent (3),
170 .BR setprotoent (3),
171 .BR setservent (3)