996d2f02f9
Submitted by: Yuko Sasaki <yuko@veltec.co.jp>
78 lines
2.6 KiB
Groff
78 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.
|
|
.\"
|
|
.\" %FreeBSD: src/lib/libutil/_secure_path.3,v 1.7.2.3 2001/12/17 10:08:32 ru Exp %
|
|
.\"
|
|
.\" $FreeBSD$
|
|
.Dd May 2, 1997
|
|
.Os
|
|
.Dt _SECURE_PATH 3
|
|
.Sh 名称
|
|
.Nm _secure_path
|
|
.Nd ファイルが安全であるように見えるかどうかを判定する
|
|
.Sh ライブラリ
|
|
.Lb libutil
|
|
.Sh 書式
|
|
.In sys/types.h
|
|
.In libutil.h
|
|
.Ft int
|
|
.Fn _secure_path "const char *path" "uid_t uid" "gid_t gid"
|
|
.Sh 解説
|
|
この関数は、指定のパスについて基本的なセキュリティチェックを行います。
|
|
これは root 特権で実行中のプロセスが使用することを意図しています。指定の
|
|
ファイルの内容を信頼するかどうかを判定するためです。この関数は、システムの
|
|
危険性を検出するために使用される方法としてよく使われます。
|
|
ファイルは、次の条件を満たす場合に
|
|
.Sq 安全である
|
|
と考えられます。
|
|
.Bl -enum
|
|
.It
|
|
ファイルが存在し、それが通常のファイルである (シンボリックリンク、
|
|
ファイル、デバイスに固有のファイル、または名前付きのパイプファイル
|
|
でない)。
|
|
.It
|
|
誰もが書き込み可能な属性を持っていない。
|
|
.It
|
|
uid が -1 でない場合は、指定された uid または uid 0 のユーザによって
|
|
所有されている。
|
|
.It
|
|
グループの書き込み属性がない、または
|
|
gid が -1 でない場合は指定の
|
|
gid によるグループ所有権がある。
|
|
.El
|
|
.Sh 戻り値
|
|
この関数は、ファイルが存在し、安全であると考えられる場合は 0 を返します。
|
|
ファイルが存在しない場合は -2 を返します。
|
|
セキュリティ障害を示す場合には -1 を返します。
|
|
.Xr syslog 3
|
|
が、この関数の処理失敗を理由を含めて LOG_ERR 優先順位のログに
|
|
記入するために使用されます。
|
|
.Pp
|
|
.Sh バグ
|
|
実行されるチェックは基本的なものであり、この関数の使用と参照ファイルへの
|
|
アクセスの間の競争状況を除去しようとする試みは行われません。
|
|
.Pp
|
|
.Sh 関連項目
|
|
.Xr lstat 2 ,
|
|
.Xr syslog 3
|
|
.Pp
|
|
.Sh 歴史
|
|
この関数の由来であるコードは、Berkeley Software Design,Inc. によって
|
|
.Fx
|
|
プロジェクトに寄与されたものです。
|