xattr_get
(PECL)
xattr_get --
Get an extended attribute
説明
string
xattr_get ( string filename, string name [, int flags] )
This function gets the value of an extended attribute of a file.
拡張属性には二種類の異なる名前空間、つまり、ユーザとルートがあります。
ユーザ名前空間は、全てのユーザで利用可能ですが、ルート名前空間は、ルート権限を有するユーザのみ利用可能です。
xattrはデフォルトでユーザ名前空間で処理を行いますが、 flags 引数によりこれを変更することができます。
パラメータ
- filename
The file from which we get the attribute.
- name
The name of the attribute.
- flags
表 1. Supported xattr flags
XATTR_DONTFOLLOW | Do not follow the symbolic link but operate on symbolic link itself. |
XATTR_ROOT | Set attribute in root (trusted) namespace. Requires root privileges. |
戻り値
Returns a string containing the value or FALSE if the attribute doesn't
exist.
例
例 1. Checks if system administrator has signed the file
<?php $file = '/usr/local/sbin/some_binary'; $signature = xattr_get($file, 'Root signature', XATTR_ROOT);
/* ... check if $signature is valid ... */
?>
|
|