1 .\" Copyright 2002 walter harms (walter.harms@informatik.uni-oldenburg.de)
2 .\" Distributed under GPL
3 .\" based on glibc infopages
6 .\" Japanese Version Copyright (c) 2005 Akihiro MOTOKI
7 .\" all rights reserved.
8 .\" Translated 2005-02-20, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
10 .TH SETNETGRENT 3 2007-07-26 "GNU" "Linux Programmer's Manual"
13 .\"O setnetgrent, endnetgrent, getnetgrent, getnetgrent_r, innetgr \-
14 .\"O handle network group entries
15 setnetgrent, endnetgrent, getnetgrent, getnetgrent_r, innetgr \-
22 .BI "int setnetgrent(const char *" netgroup );
24 .B "void endnetgrent(void);"
26 .BI "int getnetgrent(char **" host ", char **" user ", char **" domain );
28 .BI "int getnetgrent_r(char **" host ", char **" user ","
29 .BI " char **" domain ", char *" buf ", int " buflen );
31 .BI "int innetgr(const char *" netgroup ", const char *" host ","
32 .BI " const char *" user ", const char *" domain );
36 .\"O Feature Test Macro Requirements for glibc (see
37 .\"O .BR feature_test_macros (7)):
39 .RB ( feature_test_macros (7)
49 _BSD_SOURCE || _SVID_SOURCE
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.
63 .\"O .I /etc/nsswitch.conf
64 .\"O defines what database is searched.
66 は SunOS で考案されたものである。ネットグループのデータベースの
68 .RI ( hostname ", " username ", " domainname )
72 本ページで説明する関数を使うことで、ネットグループのデータベースに
73 アクセスすることができる。どのデータベースが検索されるかは
78 .\"O .BR setnetgrent ()
79 .\"O call defines the netgroup that will be searched by subsequent
80 .\"O .BR getnetgrent ()
83 .\"O .BR getnetgrent ()
84 .\"O function retrieves the next netgroup entry, and returns pointers in
93 関数はネットグループの次のエントリを取得し、
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 拡張の関数
110 を使うとよい。この関数は呼び出し側が用意したバッファに
111 文字列を格納する。割り当て済のバッファを全て解放するには
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.
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.
124 .RI ( hostname ", " username ", " domainname )
125 の3要素の組がネットグループのメンバーかどうかを確認したいだけであろう。
127 関数を使うと、上記の3つの関数を呼び出さずにこの目的を達成できる。
128 もう一度書いておくが、NULL ポインタはワイルドカードであり、
129 あらゆる文字列と一致する。この関数はスレッドセーフである。
130 .\"O .SH "RETURN VALUE"
132 .\"O These functions return 1 on success and 0 for failure.
133 これらの関数は成功すると 1 を、失敗すると 0 を返す。
138 .I /etc/nsswitch.conf
139 .\"O .SH CONFORMING TO
141 .\"O These functions are not in POSIX.1-2001, but
142 .\"O .BR setnetgrent (),
143 .\"O .BR endnetgrent (),
144 .\"O .BR getnetgrent (),
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 にはないが、
155 はほとんどの UNIX システムで利用可能である。
157 は広く他のシステムで利用できるわけではない。
158 .\" getnetgrent_r() is on Solaris 8 and AIX 5.1, but not the BSDs.
161 .\"O In the BSD implementation,
162 .\"O .BR setnetgrent ()