| 1 |
.\" Hey Emacs! This file is -*- nroff -*- source. |
| 2 |
.\" |
| 3 |
.\" Author: Eamon Walsh ([email protected]) 2007 |
| 4 |
.TH "selabel_lookup" "3" "18 Jun 2007" "" "SELinux API documentation" |
| 5 |
.SH "NAME" |
| 6 |
selabel_lookup \- obtain SELinux security context from a string label |
| 7 |
. |
| 8 |
.SH "SYNOPSIS" |
| 9 |
.B #include <selinux/selinux.h> |
| 10 |
.br |
| 11 |
.B #include <selinux/label.h> |
| 12 |
.sp |
| 13 |
.BI "int selabel_lookup(struct selabel_handle *" hnd , |
| 14 |
.in +\w'int selabel_lookup('u |
| 15 |
.BI "char **" context , |
| 16 |
.br |
| 17 |
.BI "const char *" key ", int " type ");" |
| 18 |
.in |
| 19 |
.sp |
| 20 |
.BI "int selabel_lookup_raw(struct selabel_handle *" hnd , |
| 21 |
.in +\w'int selabel_lookup_raw('u |
| 22 |
.BI "char **" context , |
| 23 |
.br |
| 24 |
.BI "const char *" key ", int " type ");" |
| 25 |
.in |
| 26 |
. |
| 27 |
.SH "DESCRIPTION" |
| 28 |
.BR selabel_lookup () |
| 29 |
performs a lookup operation on the handle |
| 30 |
.IR hnd , |
| 31 |
returning the result in the memory pointed to by |
| 32 |
.IR context , |
| 33 |
which must be freed by the caller using |
| 34 |
.BR freecon (3). |
| 35 |
The |
| 36 |
.I key |
| 37 |
and |
| 38 |
.I type |
| 39 |
parameters are the inputs to the lookup operation and are interpreted according to the specific backend that |
| 40 |
.I handle |
| 41 |
is open on. |
| 42 |
|
| 43 |
.BR selabel_lookup_raw () |
| 44 |
behaves identically to |
| 45 |
.BR selabel_lookup () |
| 46 |
but does not perform context translation. |
| 47 |
. |
| 48 |
.SH "RETURN VALUE" |
| 49 |
On success, zero is returned. On error, \-1 is returned and |
| 50 |
.I errno |
| 51 |
is set appropriately. |
| 52 |
. |
| 53 |
.SH "ERRORS" |
| 54 |
.TP |
| 55 |
.B ENOENT |
| 56 |
No context corresponding to the input |
| 57 |
.I key |
| 58 |
and |
| 59 |
.I type |
| 60 |
was found. |
| 61 |
.TP |
| 62 |
.B EINVAL |
| 63 |
The |
| 64 |
.I key |
| 65 |
and/or |
| 66 |
.I type |
| 67 |
inputs are invalid, or the context being returned failed validation. |
| 68 |
.TP |
| 69 |
.B ENOMEM |
| 70 |
An attempt to allocate memory failed. |
| 71 |
. |
| 72 |
.SH "AUTHOR" |
| 73 |
Eamon Walsh <[email protected]> |
| 74 |
. |
| 75 |
.SH "SEE ALSO" |
| 76 |
.BR selabel_open (3), |
| 77 |
.BR selabel_stats (3), |
| 78 |
.BR selinux_set_callback (3), |
| 79 |
.BR selinux (8) |