1security_compute_av(3) SELinux API documentation security_compute_av(3)
2
3
4
6 security_compute_av, security_compute_av_flags, security_compute_cre‐
7 ate, security_compute_create_name, security_compute_relabel, secu‐
8 rity_compute_member, security_compute_user, security_get_initial_con‐
9 text - query the SELinux policy database in the kernel
10
12 #include <selinux/selinux.h>
13
14 int security_compute_av(char * scon, char * tcon, security_class_t
15 tclass, access_vector_t requested, struct av_decision *avd);
16
17 int security_compute_av_raw(char * scon, char * tcon, security_class_t
18 tclass, access_vector_t requested, struct av_decision *avd);
19
20 int security_compute_av_flags(char * scon, char * tcon, secu‐
21 rity_class_t tclass, access_vector_t requested, struct av_decision
22 *avd);
23
24 int security_compute_av_flags_raw(char * scon, char * tcon, secu‐
25 rity_class_t tclass, access_vector_t requested, struct av_decision
26 *avd);
27
28 int security_compute_create(char * scon, char * tcon, security_class_t
29 tclass, char **newcon);
30
31 int security_compute_create_raw(char * scon, char * tcon, secu‐
32 rity_class_t tclass, char **newcon);
33
34 int security_compute_create_name(char * scon, char * tcon, secu‐
35 rity_class_t tclass, const char *objname, char **newcon);
36
37 int security_compute_create_name_raw(char * scon, char * tcon, secu‐
38 rity_class_t tclass, const char *objname, char **newcon);
39
40 int security_compute_relabel(char * scon, char * tcon, security_class_t
41 tclass, char **newcon);
42
43 int security_compute_relabel_raw(char * scon, char * tcon, secu‐
44 rity_class_t tclass, char **newcon);
45
46 int security_compute_member(char * scon, char * tcon, security_class_t
47 tclass, char **newcon);
48
49 int security_compute_member_raw(char * scon, char * tcon, secu‐
50 rity_class_t tclass, char **newcon);
51
52 int security_compute_user(char * scon, const char *username, char
53 ***con);
54
55 int security_compute_user_raw(char * scon, const char *username, char
56 ***con);
57
58 int security_get_initial_context(const char *name, char **con);
59
60 int security_get_initial_context_raw(const char *name, char **con);
61
62 int selinux_check_access(const char * scon, const char * tcon, const
63 char *class, const char *perm, void *auditdata);
64
65 int selinux_check_passwd_access(access_vector_t requested);
66
67 int checkPasswdAccess(access_vector_t requested);
68
70 security_compute_av() queries whether the policy permits the source
71 context scon to access the target context tcon via class tclass with
72 the requested access vector. The decision is returned in avd.
73
74 security_compute_av_flags() is identical to security_compute_av but
75 additionally sets the flags field of avd. Currently one flag is sup‐
76 ported: SELINUX_AVD_FLAGS_PERMISSIVE, which indicates the decision is
77 computed on a permissive domain.
78
79 security_compute_create() is used to compute a context to use for
80 labeling a new object in a particular class based on a SID pair.
81
82 security_compute_create_name() is identical to
83 security_compute_create() but also takes name of the new object in cre‐
84 ation as an argument. When TYPE_TRANSITION rule on the given class and
85 a SID pair has object name extension, we shall be able to obtain a cor‐
86 rect newcon according to the security policy. Note that this interface
87 is only supported on the linux 2.6.40 or later. In the older kernel,
88 the object name will be simply ignored.
89
90 security_compute_relabel() is used to compute the new context to use
91 when relabeling an object, it is used in the pam_selinux.so source and
92 the newrole source to determine the correct label for the tty at login
93 time, but can be used for other things.
94
95 security_compute_member() is used to compute the context to use when
96 labeling a polyinstantiated object instance.
97
98 security_compute_user() is used to determine the set of user contexts
99 that can be reached from a source context. It is mainly used by
100 get_ordered_context_list().
101
102 security_get_initial_context() is used to get the context of a kernel
103 initial security identifier specified by name
104
105 security_compute_av_raw(), security_compute_av_flags_raw(),
106 security_compute_create_raw(), security_compute_create_name_raw(),
107 security_compute_relabel_raw(), security_compute_member_raw(),
108 security_compute_user_raw() and security_get_initial_context_raw()
109 behave identically to their non-raw counterparts but do not perform
110 context translation.
111
112 selinux_check_access() is used to check if the source context has the
113 access permission for the specified class on the target context.
114
115 selinux_check_passwd_access() is used to check for a permission in the
116 passwd class. selinux_check_passwd_access() uses getprevcon() for the
117 source and target security contexts.
118
119 checkPasswdAccess() is a deprecated alias of the
120 selinux_check_passwd_access() function.
121
123 Returns zero on success or -1 on error.
124
126 selinux(8), getcon(3), getfilecon(3), get_ordered_context_list(3)
127
128
129
130russell@coker.com.au 1 January 2004 security_compute_av(3)