1 .\" Copyright 2002 walter harms (walter.harms@informatik.uni-oldenburg.de)
2 .\" Distributed under GPL
3 .\" based on glibc infopages
5 .\"*******************************************************************
7 .\" This file was generated with po4a. Translate the source file.
9 .\"*******************************************************************
10 .TH SETNETGRENT 3 2007\-07\-26 GNU "Linux Programmer's Manual"
12 setnetgrent, endnetgrent, getnetgrent, getnetgrent_r, innetgr \-
16 \fB#include <netdb.h>\fP
18 \fBint setnetgrent(const char *\fP\fInetgroup\fP\fB);\fP
20 \fBvoid endnetgrent(void);\fP
22 \fBint getnetgrent(char **\fP\fIhost\fP\fB, char **\fP\fIuser\fP\fB, char **\fP\fIdomain\fP\fB);\fP
24 \fBint getnetgrent_r(char **\fP\fIhost\fP\fB, char **\fP\fIuser\fP\fB,\fP
25 \fB char **\fP\fIdomain\fP\fB, char *\fP\fIbuf\fP\fB, int \fP\fIbuflen\fP\fB);\fP
27 \fBint innetgr(const char *\fP\fInetgroup\fP\fB, const char *\fP\fIhost\fP\fB,\fP
28 \fB const char *\fP\fIuser\fP\fB, const char *\fP\fIdomain\fP\fB);\fP
32 glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7) 参照):
36 \fBsetnetgrent\fP(), \fBendnetgrent\fP(), \fBgetnetgrent\fP(), \fBgetnetgrent_r\fP(),
37 \fBinnetgr\fP(): _BSD_SOURCE || _SVID_SOURCE
40 \fInetgroup\fP は SunOS で考案されたものである。ネットグループのデータベースの エントリは、 3 つの文字列のリスト
41 (\fIhostname\fP, \fIusername\fP, \fIdomainname\fP) もしくはネットグループ名である。
42 前記のリストの各要素は空であってもよい。 空は何とでも一致することを意味する。 本ページで説明する関数を使うことで、ネットグループのデータベースに
43 アクセスすることができる。どのデータベースが検索されるかは \fI/etc/nsswitch.conf\fP ファイルで定義されている。
45 \fBsetnetgrent\fP() コールは、この後で呼ばれる \fBgetnetgrent\fP() コールが検索するネットグループを定める。
46 \fBgetnetgrent\fP() 関数はネットグループの次のエントリを取得し、 \fIhost\fP, \fIuser\fP, \fIdomain\fP
47 にポインタを入れて返る。 NULL ポインタは、対応するエントリがどんな文字列とも一致することを意味する。
48 得られたポインタは、ネットグループ関係の関数のいずれかが呼ばれるまでの 間だけ有効である。この問題を避けるためには GNU 拡張の関数
49 \fBgetnetgrent_r\fP() を使うとよい。この関数は呼び出し側が用意したバッファに 文字列を格納する。割り当て済のバッファを全て解放するには
50 \fBendnetgrent\fP() を使用する。
52 ほとんどの場合、 (\fIhostname\fP, \fIusername\fP, \fIdomainname\fP)
53 の3要素の組がネットグループのメンバーかどうかを確認したいだけであろう。 \fBinnetgr\fP()
54 関数を使うと、上記の3つの関数を呼び出さずにこの目的を達成できる。 もう一度書いておくが、NULL ポインタはワイルドカードであり、
55 あらゆる文字列と一致する。この関数はスレッドセーフである。
57 これらの関数は成功すると 1 を、失敗すると 0 を返す。
61 \fI/etc/nsswitch.conf\fP
63 .\" getnetgrent_r() is on Solaris 8 and AIX 5.1, but not the BSDs.
64 これらの関数は POSIX.1\-2001 にはないが、 setnetgrent (), endnetgrent (), getnetgrent (),
65 innetgr () はほとんどの UNIX システムで利用可能である。 \fBgetnetgrent_r\fP()
66 は広く他のシステムで利用できるわけではない。
68 BSD の実装では \fBsetnetgrent\fP() は void を返す。
70 \fBsethostent\fP(3), \fBsetprotoent\fP(3), \fBsetservent\fP(3)