Debian Codegraph @

libselinux/man/man3/avc_context_to_sid.3

raw
1 .\" Hey Emacs! This file is -*- nroff -*- source.
2 .\"
3 .\" Author: Eamon Walsh ([email protected]) 2004
4 .TH "avc_context_to_sid" "3" "27 May 2004" "" "SELinux API documentation"
5 .SH "NAME"
6 avc_context_to_sid, avc_sid_to_context, avc_get_initial_sid \- obtain and manipulate SELinux security ID's
7 .
8 .SH "SYNOPSIS"
9 .B #include <selinux/selinux.h>
10 .br
11 .B #include <selinux/avc.h>
12 .sp
13 .BI "int avc_context_to_sid(char *" ctx ", security_id_t *" sid ");"
14 .sp
15 .BI "int avc_sid_to_context(security_id_t " sid ", char **" ctx ");"
16 .sp
17 .BI "int avc_get_initial_sid(const char *" name ", security_id_t *" sid ");"
18 .
19 .SH "DESCRIPTION"
20 Security ID's (SID's) are opaque representations of security contexts, managed by the userspace AVC.
21
22 .BR avc_context_to_sid ()
23 returns a SID for the given
24 .I context
25 in the memory referenced by
26 .IR sid .
27
28 .BR avc_sid_to_context ()
29 returns a copy of the context represented by
30 .I sid
31 in the memory referenced by
32 .IR ctx .
33 The user must free the copy with
34 .BR freecon (3).
35
36 .BR avc_get_initial_sid ()
37 returns a SID for the kernel initial security identifier specified by
38 .IR name .
39 .
40 .SH "RETURN VALUE"
41 .BR avc_context_to_sid ()
42 and
43 .BR avc_sid_to_context ()
44 return zero on success. On error, \-1 is returned and
45 .I errno
46 is set appropriately.
47 .
48 .SH "ERRORS"
49 .TP
50 .B ENOMEM
51 An attempt to allocate memory failed.
52 .SH "NOTES"
53 As of libselinux version 2.0.86, SID's are no longer reference counted. A SID will be valid from the time it is first obtained until the next call to
54 .BR avc_destroy (3).
55 The
56 .BR sidget (3)
57 and
58 .BR sidput (3)
59 functions, formerly used to adjust the reference count, are no-ops and are deprecated.
60 .
61 .SH "AUTHOR"
62 Eamon Walsh <[email protected]>
63 .
64 .SH "SEE ALSO"
65 .ad l
66 .nh
67 .BR avc_init (3),
68 .BR avc_has_perm (3),
69 .BR avc_cache_stats (3),
70 .BR avc_add_callback (3),
71 .BR getcon (3),
72 .BR freecon (3),
73 .BR selinux (8)