.\" Copyright 2002 walter harms (walter.harms@informatik.uni-oldenburg.de) .\" .\" %%%LICENSE_START(GPL_NOVERSION_ONELINE) .\" Distributed under GPL .\" %%%LICENSE_END .\" .\" based on glibc infopages .\" polished - aeb .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .\" .\" Japanese Version Copyright (c) 2005 Akihiro MOTOKI .\" all rights reserved. .\" Translated 2005-02-20, Akihiro MOTOKI .\" .TH SETNETGRENT 3 2017\-09\-15 GNU "Linux Programmer's Manual" .SH 名前 setnetgrent, endnetgrent, getnetgrent, getnetgrent_r, innetgr \- ネットワークグループのエントリーを操作する .SH 書式 .nf \fB#include \fP .PP \fBint setnetgrent(const char *\fP\fInetgroup\fP\fB);\fP .PP \fBvoid endnetgrent(void);\fP .PP \fBint getnetgrent(char **\fP\fIhost\fP\fB, char **\fP\fIuser\fP\fB, char **\fP\fIdomain\fP\fB);\fP .PP \fBint getnetgrent_r(char **\fP\fIhost\fP\fB, char **\fP\fIuser\fP\fB,\fP \fB char **\fP\fIdomain\fP\fB, char *\fP\fIbuf\fP\fB, size_t \fP\fIbuflen\fP\fB);\fP .PP \fBint innetgr(const char *\fP\fInetgroup\fP\fB, const char *\fP\fIhost\fP\fB,\fP \fB const char *\fP\fIuser\fP\fB, const char *\fP\fIdomain\fP\fB);\fP .fi .PP .RS -4 glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7) 参照): .RE .PP .ad l \fBsetnetgrent\fP(), \fBendnetgrent\fP(), \fBgetnetgrent\fP(), \fBgetnetgrent_r\fP(), \fBinnetgr\fP(): glibc 2.19 以降: _DEFAULT_SOURCE glibc 2.19 以前: _BSD_SOURCE || _SVID_SOURCE .ad b .SH 説明 \fInetgroup\fP は SunOS で考案されたものである。ネットグループのデータベースの エントリーは、 3 つの文字列のリスト (\fIhostname\fP, \fIusername\fP, \fIdomainname\fP) もしくはネットグループ名である。 前記のリストの各要素は空であってもよい。 空は何とでも一致することを意味する。 本ページで説明する関数を使うことで、ネットグループのデータベースに アクセスすることができる。どのデータベースが検索されるかは \fI/etc/nsswitch.conf\fP ファイルで定義されている。 .PP \fBsetnetgrent\fP() コールは、この後で呼ばれる \fBgetnetgrent\fP() コールが検索するネットグループを定める。 \fBgetnetgrent\fP() 関数はネットグループの次のエントリーを取得し、 \fIhost\fP, \fIuser\fP, \fIdomain\fP にポインターを入れて返る。ヌルポインターは、対応するエントリーがどんな文字列とも一致することを意味する。 得られたポインターは、ネットグループ関係の関数のいずれかが呼ばれるまでの 間だけ有効である。この問題を避けるためには GNU 拡張の関数 \fBgetnetgrent_r\fP() を使うとよい。この関数は呼び出し側が用意したバッファーに 文字列を格納する。割り当て済のバッファーを全て解放するには \fBendnetgrent\fP() を使用する。 .PP ほとんどの場合、 (\fIhostname\fP, \fIusername\fP, \fIdomainname\fP) の3要素の組がネットグループのメンバーかどうかを確認したいだけであろう。 \fBinnetgr\fP() 関数を使うと、上記の3つの関数を呼び出さずにこの目的を達成できる。 もう一度書いておくが、NULL ポインターはワイルドカードであり、 あらゆる文字列と一致する。この関数はスレッドセーフである。 .SH 返り値 これらの関数は成功すると 1 を、失敗すると 0 を返す。 .SH ファイル \fI/etc/netgroup\fP .br \fI/etc/nsswitch.conf\fP .SH 属性 この節で使用されている用語の説明は \fBattributes\fP(7) を参照のこと。 .TS allbox; lbw16 lb lbw23 l l l. Interface Attribute Value T{ \fBsetnetgrent\fP(), .br \fBgetnetgrent_r\fP(), .br \fBinnetgr\fP() T} Thread safety T{ MT\-Unsafe race:netgrent .br locale T} T{ \fBendnetgrent\fP() T} Thread safety MT\-Unsafe race:netgrent T{ \fBgetnetgrent\fP() T} Thread safety T{ MT\-Unsafe race:netgrent .br race:netgrentbuf locale T} .TE .sp 1 In the above table, \fInetgrent\fP in \fIrace:netgrent\fP signifies that if any of the functions \fBsetnetgrent\fP(), \fBgetnetgrent_r\fP(), \fBinnetgr\fP(), \fBgetnetgrent\fP(), or \fBendnetgrent\fP() are used in parallel in different threads of a program, then data races could occur. .SH 準拠 .\" getnetgrent_r() is on Solaris 8 and AIX 5.1, but not the BSDs. これらの関数は POSIX.1 にはないが、 setnetgrent (), endnetgrent (), getnetgrent (), innetgr () はほとんどの UNIX システムで利用可能である。 \fBgetnetgrent_r\fP() は広く他のシステムで利用できるわけではない。 .SH 注意 BSD の実装では \fBsetnetgrent\fP() は void を返す。 .SH 関連項目 \fBsethostent\fP(3), \fBsetprotoent\fP(3), \fBsetservent\fP(3) .SH この文書について この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 5.10 の一部である。プロジェクトの説明とバグ報告に関する情報は \%https://www.kernel.org/doc/man\-pages/ に書かれている。