1context_new(3) SELinux API documentation context_new(3)
2
3
4
6 context_new, context_str, context_free, context_type_get, con‐
7 text_type_set, context_range_get, context_range_set,context_role_get,
8 context_role_set, context_user_get, context_user_set - Routines to
9 manipulate SELinux security contexts
10
11
13 #include <selinux/context.h>
14
15 context_t context_new(const char * context_str );
16
17 const char * context_str(context_t con );
18
19 void context_free(context_t con );
20
21 const char * context_type_get(context_t con );
22
23 const char * context_range_get(context_t con );
24
25 const char * context_role_get(context_t con );
26
27 const char * context_user_get(context_t con );
28
29 const char * context_type_set(context_t con , const char* type);
30
31 const char * context_range_set(context_t con , const char* range);
32
33 const char * context_role_set(context_t con , const char* role );
34
35 const char * context_user_set(context_t con , const char* user );
36
37
39 These functions allow an application to manipulate the fields of a
40 security context string without requiring it to know the format of the
41 string.
42
43 context_new
44 Return a new context initialized to a context string
45
46 context_str Return a pointer to the string value of the context_t Valid
47 until the next call to context_str or context_free for the same con‐
48 text_t*
49
50 context_free Free the storage used by a context
51
52 context_type_get, context_range_get, context_role_get, context_user_get
53 Get a pointer to the string value of a context component
54
55 NOTE: Values returned by the get functions are only valid until the
56 next call to a set function or context_free() for the same context_t
57 structure.
58
59 context_type_set, context_range_set, context_role_set, context_user_set
60 Set a context component
61
62
64 On success, zero is returned. On failure, -1 is returned and errno is
65 set appropriately.
66
67
69 selinux(8)
70
71
72
73
74dwalsh@redhat.com 15 November 2004 context_new(3)