Do not begin a line with single quote character. Submitted by: Kazuo Horikawa <k-horik@yk.rim.or.jp>
76 lines
2.6 KiB
Groff
76 lines
2.6 KiB
Groff
.\" Copyright (c) 1997 David Nugent <davidn@blaze.net.au>
|
|
.\" All rights reserved.
|
|
.\"
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
.\" modification, is permitted provided that the following conditions
|
|
.\" are met:
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
.\" notice immediately at the beginning of the file, without modification,
|
|
.\" this list of conditions, and the following disclaimer.
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
.\" 3. This work was done expressly for inclusion into FreeBSD. Other use
|
|
.\" is permitted provided this notation is included.
|
|
.\" 4. Absolutely no warranty of function or purpose is made by the author
|
|
.\" David Nugent.
|
|
.\" 5. Modifications may be freely made to this file providing the above
|
|
.\" conditions are met.
|
|
.\"
|
|
.\" %Id: _secure_path.3,v 1.3 1998/06/06 05:50:42 jkoshy Exp %
|
|
.\"
|
|
.Dd May 2, 1997
|
|
.Os FreeBSD
|
|
.Dt _SECURE_PATH 3
|
|
.Sh 名称
|
|
.Nm _secure_path
|
|
.Nd ファイルが安全であるように見えるかどうかを判定する
|
|
.Sh 書式
|
|
.Fd #include <sys/types.h>
|
|
.Fd #include <libutil.h>
|
|
.Ft int
|
|
.Fn _secure_path "const char *path" "uid_t uid" "gid_t gid"
|
|
.Pp
|
|
.Sh 解説
|
|
この関数は、指定のパスについて基本的なセキュリティチェックを行います。
|
|
これはルート特権で実行中のプロセスが使用することを意図しています。指定の
|
|
ファイルの内容を信頼するかどうかを判定するためです。この関数は、システムの
|
|
危うさを検出するために使用される方法を使うことがよくあります。ファイルは、
|
|
次の条件を満たす場合に安全であると考えられます。
|
|
.Bl -enum
|
|
.It
|
|
ファイルが存在し、それが通常のファイルである (シンボリックリンク、
|
|
ファイル、デバイスに固有のファイル、または名前付きのパイプファイル
|
|
でない)。
|
|
.It
|
|
ワールド書き込み可能でない。
|
|
.It
|
|
uid が -1 でない場合は、指定の uid またはユーザ 0 によって
|
|
所有されている。
|
|
.It
|
|
グループ書き込みでない、または
|
|
gid が -1 でない場合は指定の
|
|
gid によるグループ所有権がある。
|
|
.El
|
|
.Sh 戻り値
|
|
この関数は、ファイルが存在し、安全であると考えられる場合 0 を返します。
|
|
ファイルが存在しない場合は -2 を返します。その他、セキュリティ障害を示す
|
|
場合は -1 を返します。
|
|
.Xr syslog 3
|
|
が、この関数の処理失敗をログ記入するのに
|
|
使用されます。これには、理由
|
|
LOG_ERR
|
|
優先順位が含まれます。
|
|
.Pp
|
|
.Sh バグ
|
|
実行されるチェックは基本的なものであり、この関数の使用と参照ファイルへの
|
|
アクセスの間の競争状況を除去しようとする試みは行われません。
|
|
.Pp
|
|
.Sh 関連項目
|
|
.Xr lstat 3 ,
|
|
.Xr syslog 3
|
|
.Pp
|
|
.Sh 歴史
|
|
この関数の由来であるコードは、Berkeley Software Design,Inc. によって
|
|
FreeBSD プロジェクトに寄与されたものです。
|
|
.\"X kuma
|