selinux/libselinux/man/man3/security_class_to_string.3
2008-08-19 15:30:36 -04:00

81 lines
2.2 KiB
Groff

.\" Hey Emacs! This file is -*- nroff -*- source.
.\"
.\" Author: Eamon Walsh (ewalsh@tycho.nsa.gov) 2007
.TH "security_class_to_string" "3" "30 Mar 2007" "" "SELinux API documentation"
.SH "NAME"
security_class_to_string, security_av_perm_to_string, string_to_security_class, string_to_av_perm, security_av_string \- convert
between SELinux class and permission values and string names.
.SH "SYNOPSIS"
.B #include <selinux/selinux.h>
.B #include <selinux/flask.h>
.sp
.BI "const char * security_class_to_string(security_class_t " tclass ");"
.sp
.BI "const char * security_av_perm_to_string(security_class_t " tclass ", access_vector_t " av ");"
.sp
.BI "int security_av_string(security_class_t " tclass ", access_vector_t " av ", char **" result ");"
.sp
.BI "security_class_t string_to_security_class(const char *" name ");"
.sp
.BI "access_vector_t string_to_av_perm(security_class_t " tclass ", const char *" name ");"
.SH "DESCRIPTION"
.B security_class_to_string
returns a string name for class
.IR tclass ,
or NULL if the class is invalid. The returned string must not be modified or freed.
.B security_av_perm_to_string
returns a string name for the access vector bit
.I av
of class
.IR tclass ,
or NULL if either argument is invalid. The returned string must not be modified or freed.
.B security_av_string
computes a full access vector string representation using
.I tclass
and
.IR av ,
which may have multiple bits set. The string is returned in the memory pointed to by
.IR result ,
and should be freed by the caller using
.BR free (3).
.B string_to_security_class
returns the class value corresponding to the string name
.IR name ,
or zero if no such class exists.
.B string_to_av_perm
returns the access vector bit corresponding to the string name
.I name
and security class
.IR tclass ,
or zero if no such value exists.
.SH "RETURN VALUE"
.B security_av_string
returns returns zero on success or \-1 on error with
.I errno
set appropriately. All other functions return zero or NULL on error.
.SH "ERRORS"
.TP
.B EINVAL
A class or access vector argument is not recognized by the currently loaded policy.
.TP
.B ENOMEM
An attempt to allocate memory failed.
.SH "AUTHOR"
Eamon Walsh <ewalsh@tycho.nsa.gov>
.SH "SEE ALSO"
.BR selinux (8),
.BR getcon (3),
.BR getfilecon (3)