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_validatetrans,
9       security_get_initial_context - query the SELinux policy database in the
10       kernel
11

SYNOPSIS

13       #include <selinux/selinux.h>
14
15       int   security_compute_av(char   *scon,  char  *tcon,  security_class_t
16       tclass, access_vector_t requested, struct av_decision *avd);
17
18       int security_compute_av_raw(char *scon,  char  *tcon,  security_class_t
19       tclass, access_vector_t requested, struct av_decision *avd);
20
21       int  security_compute_av_flags(char *scon, char *tcon, security_class_t
22       tclass, access_vector_t requested, struct av_decision *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_validatetrans(char  *scon,  const   char   *tcon,   secu‐
59       rity_class_t tclass, char *newcon);
60
61       int  security_validatetrans_raw(char  *scon,  const  char  *tcon, secu‐
62       rity_class_t tclass, char *newcon);
63
64       int security_get_initial_context(const char *name, char **con);
65
66       int security_get_initial_context_raw(const char *name, char **con);
67
68       int selinux_check_access(const char *scon, const char *tcon, const char
69       *class, const char *perm, void *auditdata);
70
71       int selinux_check_passwd_access(access_vector_t requested);
72
73       int checkPasswdAccess(access_vector_t requested);
74

DESCRIPTION

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

RETURN VALUE

135       Returns zero on success or -1 on error.
136

SEE ALSO

138       selinux(8), getcon(3), getfilecon(3), get_ordered_context_list(3)
139
140
141
142russell@coker.com.au            1 January 2004          security_compute_av(3)
Impressum