1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
|
.\" 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 <amotoki@dd.iij4u.or.jp>
.\"
.TH SETNETGRENT 3 2014\-05\-28 GNU "Linux Programmer's Manual"
.SH 名前
setnetgrent, endnetgrent, getnetgrent, getnetgrent_r, innetgr \-
ネットワークグループのエントリーを操作する
.SH 書式
.nf
\fB#include <netdb.h>\fP
\fBint setnetgrent(const char *\fP\fInetgroup\fP\fB);\fP
\fBvoid endnetgrent(void);\fP
\fBint getnetgrent(char **\fP\fIhost\fP\fB, char **\fP\fIuser\fP\fB, char **\fP\fIdomain\fP\fB);\fP
\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
\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
.sp
.in -4n
glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7) 参照):
.in
.sp
.ad l
\fBsetnetgrent\fP(), \fBendnetgrent\fP(), \fBgetnetgrent\fP(), \fBgetnetgrent_r\fP(),
\fBinnetgr\fP(): _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 準拠
.\" getnetgrent_r() is on Solaris 8 and AIX 5.1, but not the BSDs.
これらの関数は POSIX.1\-2001 にはないが、 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 プロジェクトのリリース 3.79 の一部
である。プロジェクトの説明とバグ報告に関する情報は
http://www.kernel.org/doc/man\-pages/ に書かれている。
|