1selabel_lookup(3) SELinux API documentation selabel_lookup(3)
2
3
4
6 selabel_lookup - obtain SELinux security context from a string label
7
9 #include <selinux/selinux.h>
10 #include <selinux/label.h>
11
12 int selabel_lookup(struct selabel_handle *hnd,
13 char **context,
14 const char *key, int type);
15
16 int selabel_lookup_raw(struct selabel_handle *hnd,
17 char **context,
18 const char *key, int type);
19
21 selabel_lookup() performs a lookup operation on the handle hnd, returnā
22 ing the result in the memory pointed to by context, which must be freed
23 by the caller using freecon(3). The key and type parameters are the
24 inputs to the lookup operation and are interpreted according to the
25 specific backend that handle is open on.
26
27 selabel_lookup_raw() behaves identically to selabel_lookup() but does
28 not perform context translation.
29
31 On success, zero is returned. On error, -1 is returned and errno is
32 set appropriately.
33
35 ENOENT No context corresponding to the input key and type was found.
36
37 EINVAL The key and/or type inputs are invalid, or the context being
38 returned failed validation.
39
40 ENOMEM An attempt to allocate memory failed.
41
43 Eamon Walsh <ewalsh@tycho.nsa.gov>
44
46 selabel_open(3), selabel_stats(3), selinux_set_callback(3), selinux(8)
47
48
49
50 18 Jun 2007 selabel_lookup(3)