summaryrefslogtreecommitdiff
path: root/support/dktools/dk4fopt.h
blob: 14d9b58dc9d28bd0116fab0570869d3defeab8cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71

#ifndef DK4FOPT_H_INCLUDED
#define	DK4FOPT_H_INCLUDED 1

/**	@file	dk4fopt.h	File open tests.
*/

#ifndef DK4NUMCO_H_INCLUDED
#include "dk4numco.h"
#endif

/**	Skip one ore more security checks when opening files.
*/
enum {
				/**	Deny write operation if the path does
					not refer to a regular file.
				*/
  DK4_FOPEN_SC_IS_REGULAR	=	1,

				/**	Deny write operation if any path
					component is a symbolic link.
					Ignored on Windows and on systems
					without symbolic links.
				*/
  DK4_FOPEN_SC_WR_SYMLINK_IN_PATH	=	2,

				/**	Deny write operation if the path
					is a symbolic link (complete path).
					Ignored on Windows and on systems
					without symbolic links.
				*/
  DK4_FOPEN_SC_WR_PATH_IS_SYMLINK	=	4,

				/**	Deny write operation if the path is
					a symbolic link and the link owner
					is not the link destination owner.
					Ignored on Windows, on systems without
					symbolic links and on systems where
					the st_uid member of the
					stat structure has no meaning.
				*/
  DK4_FOPEN_SC_WR_SYMLINK_OWNER	=	8,


				/**	Apply security checks recommended
					for non-privileged users.
				*/
  DK4_FOPEN_SC_USER		=	(
    DK4_FOPEN_SC_IS_REGULAR
    | DK4_FOPEN_SC_WR_SYMLINK_OWNER
  ),

				/**	Apply security checks recommended
					for privileged users.
				*/
  DK4_FOPEN_SC_PRIVILEGED	=	(
    DK4_FOPEN_SC_IS_REGULAR
    | DK4_FOPEN_SC_WR_SYMLINK_IN_PATH
    | DK4_FOPEN_SC_WR_PATH_IS_SYMLINK
    | DK4_FOPEN_SC_WR_SYMLINK_OWNER
  ),

				/**	Apply all security checks
					(recommended if process is running 
					with administrative privileges).
				*/
  DK4_FOPEN_SC_ALL		=	INT_MAX
};

#endif