1security_compute_av(3)     SELinux API documentation    security_compute_av(3)
2
3
4

NAME

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

SYNOPSIS

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,  security_class_t
21       tclass, access_vector_t requested, struct av_decision *avd);
22
23       int   security_compute_av_flags_raw(char   *scon,   char  *tcon,  secu‐
24       rity_class_t  tclass,  access_vector_t  requested,  struct  av_decision
25       *avd);
26
27       int  security_compute_create(char  *scon,  char *tcon, security_class_t
28       tclass, char **newcon);
29
30       int   security_compute_create_raw(char   *scon,   char   *tcon,   secu‐
31       rity_class_t tclass, char **newcon);
32
33       int   security_compute_create_name(char   *scon,   char   *tcon,  secu‐
34       rity_class_t tclass, const char *objname, char **newcon);
35
36       int  security_compute_create_name_raw(char  *scon,  char  *tcon,  secu‐
37       rity_class_t tclass, const char *objname, char **newcon);
38
39       int  security_compute_relabel(char  *scon, char *tcon, security_class_t
40       tclass, char **newcon);
41
42       int  security_compute_relabel_raw(char   *scon,   char   *tcon,   secu‐
43       rity_class_t tclass, char **newcon);
44
45       int  security_compute_member(char  *scon,  char *tcon, security_class_t
46       tclass, char **newcon);
47
48       int   security_compute_member_raw(char   *scon,   char   *tcon,   secu‐
49       rity_class_t tclass, char **newcon);
50
51       int   security_compute_user(char  *scon,  const  char  *username,  char
52       ***con);
53
54       int security_compute_user_raw(char *scon, const  char  *username,  char
55       ***con);
56
57       int security_get_initial_context(const char *name, char **con);
58
59       int security_get_initial_context_raw(const char *name, char **con);
60
61       int selinux_check_access(const char *scon, const char *tcon, const char
62       *class, const char *perm, void *auditdata);
63
64       int selinux_check_passwd_access(access_vector_t requested);
65
66       int checkPasswdAccess(access_vector_t requested);
67

DESCRIPTION

69       security_compute_av() queries whether the  policy  permits  the  source
70       context  scon  to  access the target context tcon via class tclass with
71       the requested access vector.  The decision is returned in avd.
72
73       security_compute_av_flags() is  identical  to  security_compute_av  but
74       additionally  sets  the flags field of avd.  Currently one flag is sup‐
75       ported: SELINUX_AVD_FLAGS_PERMISSIVE, which indicates the  decision  is
76       computed on a permissive domain.
77
78       security_compute_create()  is  used  to  compute  a  context to use for
79       labeling a new object in a particular class based on a SID pair.
80
81       security_compute_create_name()         is         identical          to
82       security_compute_create() but also takes name of the new object in cre‐
83       ation as an argument.  When TYPE_TRANSITION rule on the given class and
84       a SID pair has object name extension, we shall be able to obtain a cor‐
85       rect newcon according to the security policy. Note that this  interface
86       is  only  supported on the linux 2.6.40 or later.  In the older kernel,
87       the object name will be simply ignored.
88
89       security_compute_relabel() is used to compute the new  context  to  use
90       when  relabeling an object, it is used in the pam_selinux.so source and
91       the newrole source to determine the correct label for the tty at  login
92       time, but can be used for other things.
93
94       security_compute_member()  is  used  to compute the context to use when
95       labeling a polyinstantiated object instance.
96
97       security_compute_user() is used to determine the set of  user  contexts
98       that  can  be  reached  from  a  source  context.  It is mainly used by
99       get_ordered_context_list().
100
101       security_get_initial_context() is used to get the context of  a  kernel
102       initial security identifier specified by name
103
104       security_compute_av_raw(),             security_compute_av_flags_raw(),
105       security_compute_create_raw(),      security_compute_create_name_raw(),
106       security_compute_relabel_raw(),          security_compute_member_raw(),
107       security_compute_user_raw()   and    security_get_initial_context_raw()
108       behave  identically  to  their  non-raw counterparts but do not perform
109       context translation.
110
111       selinux_check_access() is used to check if the source context  has  the
112       access permission for the specified class on the target context.
113
114       selinux_check_passwd_access()  is used to check for a permission in the
115       passwd class.  selinux_check_passwd_access() uses getprevcon() for  the
116       source and target security contexts.
117
118       checkPasswdAccess()     is     a     deprecated     alias     of    the
119       selinux_check_passwd_access() function.
120

RETURN VALUE

122       Returns zero on success or -1 on error.
123

SEE ALSO

125       selinux(8), getcon(3), getfilecon(3), get_ordered_context_list(3)
126
127
128
129russell@coker.com.au            1 January 2004          security_compute_av(3)
Impressum