| 1 |
.\" Hey Emacs! This file is -*- nroff -*- source. |
| 2 |
.\" |
| 3 |
.\" Author: Eamon Walsh ([email protected]) 2007 |
| 4 |
.TH "security_class_to_string" "3" "30 Mar 2007" "" "SELinux API documentation" |
| 5 |
.SH "NAME" |
| 6 |
security_class_to_string, security_av_perm_to_string, string_to_security_class, string_to_av_perm, security_av_string, mode_to_security_class \- convert |
| 7 |
between SELinux class and permission values and string names. |
| 8 |
. |
| 9 |
print_access_vector \- display an access vector in human-readable form. |
| 10 |
. |
| 11 |
.SH "SYNOPSIS" |
| 12 |
.B #include <selinux/selinux.h> |
| 13 |
.sp |
| 14 |
.BI "const char *security_class_to_string(security_class_t " tclass ");" |
| 15 |
.sp |
| 16 |
.BI "const char *security_av_perm_to_string(security_class_t " tclass ", access_vector_t " av ");" |
| 17 |
.sp |
| 18 |
.BI "int security_av_string(security_class_t " tclass ", access_vector_t " av ", char **" result ");" |
| 19 |
.sp |
| 20 |
.BI "security_class_t string_to_security_class(const char *" name ");" |
| 21 |
.sp |
| 22 |
.BI "security_class_t mode_to_security_class(mode_t " mode ");" |
| 23 |
.sp |
| 24 |
.BI "access_vector_t string_to_av_perm(security_class_t " tclass ", const char *" name ");" |
| 25 |
.sp |
| 26 |
.BI "void print_access_vector(security_class_t " tclass ", access_vector_t " av ");" |
| 27 |
. |
| 28 |
.SH "DESCRIPTION" |
| 29 |
.BR security_class_to_string () |
| 30 |
returns a string name for class |
| 31 |
.IR tclass , |
| 32 |
or NULL if the class is invalid. The returned string must not be modified or freed. |
| 33 |
|
| 34 |
.BR security_av_perm_to_string () |
| 35 |
returns a string name for the access vector bit |
| 36 |
.I av |
| 37 |
of class |
| 38 |
.IR tclass , |
| 39 |
or NULL if either argument is invalid. The returned string must not be modified or freed. |
| 40 |
|
| 41 |
.BR security_av_string () |
| 42 |
computes a full access vector string representation using |
| 43 |
.I tclass |
| 44 |
and |
| 45 |
.IR av , |
| 46 |
which may have multiple bits set. The string is returned in the memory pointed to by |
| 47 |
.IR result , |
| 48 |
and should be freed by the caller using |
| 49 |
.BR free (3). |
| 50 |
|
| 51 |
.BR string_to_security_class () |
| 52 |
returns the class value corresponding to the string name |
| 53 |
.IR name , |
| 54 |
or zero if no such class exists. |
| 55 |
|
| 56 |
.BR mode_to_security_class () |
| 57 |
returns the class value corresponding to the specified |
| 58 |
.IR mode , |
| 59 |
or zero if no such class exists. |
| 60 |
|
| 61 |
.BR string_to_av_perm () |
| 62 |
returns the access vector bit corresponding to the string name |
| 63 |
.I name |
| 64 |
and security class |
| 65 |
.IR tclass , |
| 66 |
or zero if no such value exists. |
| 67 |
|
| 68 |
.BR print_access_vector () |
| 69 |
displays an access vector in human-readable form on the standard output |
| 70 |
stream. |
| 71 |
. |
| 72 |
.SH "RETURN VALUE" |
| 73 |
.BR security_av_string () |
| 74 |
returns zero on success or \-1 on error with |
| 75 |
.I errno |
| 76 |
set appropriately. |
| 77 |
.BR print_access_vector () |
| 78 |
does not return a value. All other functions return zero or NULL on error. |
| 79 |
. |
| 80 |
.SH "ERRORS" |
| 81 |
.TP |
| 82 |
.B EINVAL |
| 83 |
A class or access vector argument is not recognized by the currently loaded policy. |
| 84 |
|
| 85 |
.TP |
| 86 |
.B ENOMEM |
| 87 |
An attempt to allocate memory failed. |
| 88 |
. |
| 89 |
.SH "AUTHOR" |
| 90 |
Eamon Walsh <[email protected]> |
| 91 |
. |
| 92 |
.SH "SEE ALSO" |
| 93 |
.BR selinux (8), |
| 94 |
.BR getcon (3), |
| 95 |
.BR getfilecon (3) |
| 96 |
.BR stat (3) |