tcpwrap_check
(PECL)
tcpwrap_check — tcpwrap のチェックを実行する
説明
bool tcpwrap_check ( string daemon, string address [, string user [, bool nodns]] )この関数は /etc/hosts.allow および /etc/hosts.deny の内容をもとに、あるクライアントが daemon サービスへのアクセスを許可されているか 否かを調べます。
パラメータ
- daemon
サービスの名前。
- address
クライアントのリモートアドレス。IP アドレスあるいはドメイン名の どちらでも指定可能。
- user
ユーザ名(オプション)。
- nodns
address がドメイン名の場合、それを IP アドレスに名前解決するために DNS が使用されます。 nodns を TRUE に指定すると、この処理を 禁止します。
返り値
アクセスが許可されている場合に TRUE 、それ以外の場合に FALSE を返します。
例
例 2352. ローカルホストからの全接続を拒否する
/etc/hosts.deny ファイルに以下の行が含まれており、
php: 127.0.0.1
以下のようなコードを実行する
<?php
if (!tcpwrap_check('php', $_SERVER['REMOTE_ADDR'])) {
die('You are not welcome here');
}
?>
参考
詳細な情報は、hosts_access(3) の man ページを参照ください。
tcpwrap_check
There are no user contributed notes for this page.