security_compute_av(3)    SELinux API documentation   security_compute_av(3)

NAME         top

       security_compute_av, security_compute_av_flags, security_compute_cre‐
       ate,  security_compute_create_name,  security_compute_relabel,  secu‐
       rity_compute_member, security_compute_user, security_get_initial_con‐
       text - query the SELinux policy database in the kernel

SYNOPSIS         top

       #include <selinux/selinux.h>

       int security_compute_av(char *scon, char *tcon, security_class_t
       tclass, access_vector_t requested, struct av_decision *avd);

       int security_compute_av_raw(char *scon, char *tcon, security_class_t
       tclass, access_vector_t requested, struct av_decision *avd);

       int security_compute_av_flags(char *scon, char *tcon,
       security_class_t tclass, access_vector_t requested, struct
       av_decision *avd);

       int security_compute_av_flags_raw(char *scon, char *tcon,
       security_class_t tclass, access_vector_t requested, struct
       av_decision *avd);

       int security_compute_create(char *scon, char *tcon, security_class_t
       tclass, char **newcon);

       int security_compute_create_raw(char *scon, char *tcon,
       security_class_t tclass, char **newcon);

       int security_compute_create_name(char *scon, char *tcon,
       security_class_t tclass, const char *objname, char **newcon);

       int security_compute_create_name_raw(char *scon, char *tcon,
       security_class_t tclass, const char *objname, char **newcon);

       int security_compute_relabel(char *scon, char *tcon, security_class_t
       tclass, char **newcon);

       int security_compute_relabel_raw(char *scon, char *tcon,
       security_class_t tclass, char **newcon);

       int security_compute_member(char *scon, char *tcon, security_class_t
       tclass, char **newcon);

       int security_compute_member_raw(char *scon, char *tcon,
       security_class_t tclass, char **newcon);

       int security_compute_user(char *scon, const char *username, char

       int security_compute_user_raw(char *scon, const char *username, char

       int security_get_initial_context(const char *name, char **con);

       int security_get_initial_context_raw(const char *name, char **con);

       int selinux_check_access(const char *scon, const char *tcon, const
       char *class, const char *perm, void *auditdata);

       int selinux_check_passwd_access(access_vector_t requested);

       int checkPasswdAccess(access_vector_t requested);

DESCRIPTION         top

       security_compute_av() queries whether the policy permits the source
       context scon to access the target context tcon via class tclass with
       the requested access vector.  The decision is returned in avd.

       security_compute_av_flags() is identical to security_compute_av but
       additionally sets the flags field of avd.  Currently one flag is
       supported: SELINUX_AVD_FLAGS_PERMISSIVE, which indicates the decision
       is computed on a permissive domain.

       security_compute_create() is used to compute a context to use for
       labeling a new object in a particular class based on a SID pair.

       security_compute_create_name() is identical to
       security_compute_create() but also takes name of the new object in
       creation as an argument.  When TYPE_TRANSITION rule on the given
       class and a SID pair has object name extension, we shall be able to
       obtain a correct newcon according to the security policy. Note that
       this interface is only supported on the linux 2.6.40 or later.  In
       the older kernel, the object name will be simply ignored.

       security_compute_relabel() is used to compute the new context to use
       when relabeling an object, it is used in the source
       and the newrole source to determine the correct label for the tty at
       login time, but can be used for other things.

       security_compute_member() is used to compute the context to use when
       labeling a polyinstantiated object instance.

       security_compute_user() is used to determine the set of user contexts
       that can be reached from a source context. It is mainly used by

       security_get_initial_context() is used to get the context of a kernel
       initial security identifier specified by name

       security_compute_av_raw(), security_compute_av_flags_raw(),
       security_compute_create_raw(), security_compute_create_name_raw(),
       security_compute_relabel_raw(), security_compute_member_raw(),
       security_compute_user_raw() and security_get_initial_context_raw()
       behave identically to their non-raw counterparts but do not perform
       context translation.

       selinux_check_access() is used to check if the source context has the
       access permission for the specified class on the target context.

       selinux_check_passwd_access() is used to check for a permission in
       the passwd class.  selinux_check_passwd_access() uses getprevcon()
       for the source and target security contexts.

       checkPasswdAccess() is a deprecated alias of the
       selinux_check_passwd_access() function.

RETURN VALUE         top

       Returns zero on success or -1 on error.

SEE ALSO         top

       selinux(8), getcon(3), getfilecon(3), get_ordered_context_list(3)

COLOPHON         top

       This page is part of the selinux (Security-Enhanced Linux user-space
       libraries and tools) project.  Information about the project can be
       found at ⟨⟩.  If you
       have a bug report for this manual page, see 
       ⟨⟩.  This
       page was obtained from the project's upstream Git repository 
       ⟨⟩ on 2017-03-13.  If you
       discover any rendering problems in this HTML version of the page, or
       you believe there is a better or more up-to-date source for the page,
       or you have corrections or improvements to the information in this
       COLOPHON (which is not part of the original manual page), send a mail
       to           1 January 2004         security_compute_av(3)