Postfix3.3.1
総合概要
データ構造
ファイル
ファイル一覧
大域各種
postfix-3.3.1
src
util
unsafe.c
[詳解]
1
/*++
2
/* NAME
3
/* unsafe 3
4
/* SUMMARY
5
/* are we running at non-user privileges
6
/* SYNOPSIS
7
/* #include <safe.h>
8
/*
9
/* int unsafe()
10
/* DESCRIPTION
11
/* The \fBunsafe()\fR routine attempts to determine if the process
12
/* (runs with privileges or has access to information) that the
13
/* controlling user has no access to. The purpose is to prevent
14
/* misuse of privileges, including access to protected information.
15
/*
16
/* The result is always false when both of the following conditions
17
/* are true:
18
/* .IP \(bu
19
/* The real UID is zero.
20
/* .IP \(bu
21
/* The effective UID is zero.
22
/* .PP
23
/* Otherwise, the result is true if any of the following conditions
24
/* is true:
25
/* .IP \(bu
26
/* The issetuid kernel flag is non-zero (on systems that support
27
/* this concept).
28
/* .IP \(bu
29
/* The real and effective user id differ.
30
/* .IP \(bu
31
/* The real and effective group id differ.
32
/* LICENSE
33
/* .ad
34
/* .fi
35
/* The Secure Mailer license must be distributed with this software.
36
/* AUTHOR(S)
37
/* Wietse Venema
38
/* IBM T.J. Watson Research
39
/* P.O. Box 704
40
/* Yorktown Heights, NY 10598, USA
41
/*
42
/* Wietse Venema
43
/* Google, Inc.
44
/* 111 8th Avenue
45
/* New York, NY 10011, USA
46
/*--*/
47
48
/* System library. */
49
50
#include <
sys_defs.h
>
51
#include <unistd.h>
52
53
/* Utility library. */
54
55
#include "
safe.h
"
56
57
/* unsafe - can we trust user-provided environment, working directory, etc. */
58
59
int
unsafe
(
void
)
60
{
61
62
/*
63
* The super-user is trusted.
64
*/
65
if
(getuid() == 0 && geteuid() == 0)
66
return
(0);
67
68
/*
69
* Danger: don't trust inherited process attributes, and don't leak
70
* privileged info that the parent has no access to.
71
*/
72
return
(geteuid() != getuid()
73
#ifdef HAS_ISSETUGID
74
|| issetugid()
75
#endif
76
|| getgid() != getegid());
77
}
safe.h
sys_defs.h
unsafe
int unsafe(void)
Definition:
unsafe.c:59
2018年11月10日(土) 19時00分00秒作成 - Postfix3.3.1 / 構成:
1.8.9.1