1context_new(3)             SELinux API documentation            context_new(3)
2
3
4

NAME

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

SYNOPSIS

12       #include <selinux/context.h>
13
14       context_t context_new(const char *context_str);
15
16       const char * context_str(context_t con);
17
18       void context_free(context_t con);
19
20       const char * context_type_get(context_t con);
21
22       const char * context_range_get(context_t con);
23
24       const char * context_role_get(context_t con);
25
26       const char * context_user_get(context_t con);
27
28       int context_type_set(context_t con, const char *type);
29
30       int context_range_set(context_t con, const char *range);
31
32       int context_role_set(context_t con, const char *role);
33
34       int context_user_set(context_t con, const char *user);
35

DESCRIPTION

37       These functions allow an application to  manipulate  the  fields  of  a
38       security  context string without requiring it to know the format of the
39       string.
40
41       context_new() returns a new context initialized to a context string.
42
43       context_str() returns a pointer to the string value of  the  context_t,
44       valid  until  the  next call to context_str() or context_free() for the
45       same context_t*.
46
47       context_free() frees the storage used by a context.
48
49       context_type_get(),      context_range_get(),       context_role_get(),
50       context_user_get()  get a pointer to the string value of a context com‐
51       ponent.
52
53       Note: Values returned by the get functions are  only  valid  until  the
54       next  call  to  a set function or context_free() for the same context_t
55       structure.
56
57       context_type_set(),      context_range_set(),       context_role_set(),
58       context_user_set() set a context component.
59

RETURN VALUE

61       On failure context_*_set() functions return non-zero and 0 on success.
62
63       The other functions return NULL on failure and non-NULL on success.
64
65       On failure errno is set appropriately.
66

SEE ALSO

68       selinux(8)
69
70
71
72dwalsh@redhat.com              20 December 2011                 context_new(3)
Impressum