Debian Codegraph @

libselinux/man/man3/security_compute_av.3

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