2011-12-20 16:50:09 +00:00
|
|
|
.TH "context_new" "3" "20 December 2011" "dwalsh@redhat.com" "SELinux API documentation"
|
2008-08-19 19:30:36 +00:00
|
|
|
.SH "NAME"
|
|
|
|
context_new, context_str, context_free, context_type_get, context_type_set, context_range_get, context_range_set,context_role_get, context_role_set, context_user_get, context_user_set \- Routines to manipulate SELinux security contexts
|
2012-11-13 20:15:34 +00:00
|
|
|
.
|
2008-08-19 19:30:36 +00:00
|
|
|
.SH "SYNOPSIS"
|
|
|
|
.B #include <selinux/context.h>
|
2012-11-13 20:15:34 +00:00
|
|
|
.sp
|
2011-12-20 16:50:09 +00:00
|
|
|
.BI "context_t context_new(const char *" context_str );
|
2012-11-13 20:15:34 +00:00
|
|
|
.sp
|
2011-12-20 16:50:09 +00:00
|
|
|
.BI "const char * context_str(context_t " con );
|
2012-11-13 20:15:34 +00:00
|
|
|
.sp
|
2011-12-20 16:50:09 +00:00
|
|
|
.BI "void context_free(context_t " con );
|
2012-11-13 20:15:34 +00:00
|
|
|
.sp
|
2011-12-20 16:50:09 +00:00
|
|
|
.BI "const char * context_type_get(context_t " con );
|
2012-11-13 20:15:34 +00:00
|
|
|
.sp
|
2011-12-20 16:50:09 +00:00
|
|
|
.BI "const char * context_range_get(context_t " con );
|
2012-11-13 20:15:34 +00:00
|
|
|
.sp
|
2011-12-20 16:50:09 +00:00
|
|
|
.BI "const char * context_role_get(context_t " con );
|
2012-11-13 20:15:34 +00:00
|
|
|
.sp
|
2011-12-20 16:50:09 +00:00
|
|
|
.BI "const char * context_user_get(context_t " con );
|
2012-11-13 20:15:34 +00:00
|
|
|
.sp
|
2011-12-20 16:50:09 +00:00
|
|
|
.BI "int context_type_set(context_t " con ", const char *" type );
|
2012-11-13 20:15:34 +00:00
|
|
|
.sp
|
2011-12-20 16:50:09 +00:00
|
|
|
.BI "int context_range_set(context_t " con ", const char *" range );
|
2012-11-13 20:15:34 +00:00
|
|
|
.sp
|
2011-12-20 16:50:09 +00:00
|
|
|
.BI "int context_role_set(context_t " con ", const char *" role );
|
2012-11-13 20:15:34 +00:00
|
|
|
.sp
|
2011-12-20 16:50:09 +00:00
|
|
|
.BI "int context_user_set(context_t " con ", const char *" user );
|
2012-11-13 20:15:34 +00:00
|
|
|
.
|
2008-08-19 19:30:36 +00:00
|
|
|
.SH "DESCRIPTION"
|
|
|
|
These functions allow an application to manipulate the fields of a
|
|
|
|
security context string without requiring it to know the format of the
|
|
|
|
string.
|
|
|
|
|
2012-11-13 20:15:34 +00:00
|
|
|
.BR context_new ()
|
|
|
|
returns a new context initialized to a context string.
|
|
|
|
|
|
|
|
.BR context_str ()
|
|
|
|
returns a pointer to the string value of the
|
|
|
|
.BR context_t ,
|
|
|
|
valid until the next call to
|
|
|
|
.BR context_str ()
|
|
|
|
or
|
|
|
|
.BR context_free ()
|
|
|
|
for the same
|
|
|
|
.BR context_t* .
|
|
|
|
|
|
|
|
.BR context_free ()
|
|
|
|
frees the storage used by a context.
|
|
|
|
|
|
|
|
.BR context_type_get (),
|
|
|
|
.BR context_range_get (),
|
|
|
|
.BR context_role_get (),
|
|
|
|
.BR \%context_user_get ()
|
|
|
|
get a pointer to the string value of a context component.
|
|
|
|
|
|
|
|
.B Note:
|
2011-12-20 16:50:09 +00:00
|
|
|
Values returned by the get functions are only valid until the next call
|
2012-11-13 20:15:34 +00:00
|
|
|
to a set function or
|
|
|
|
.BR context_free ()
|
|
|
|
for the same
|
|
|
|
.B context_t
|
|
|
|
structure.
|
|
|
|
|
|
|
|
.BR context_type_set (),
|
|
|
|
.BR context_range_set (),
|
|
|
|
.BR context_role_set (),
|
|
|
|
.BR \%context_user_set ()
|
|
|
|
set a context component.
|
|
|
|
.
|
2008-08-19 19:30:36 +00:00
|
|
|
.SH "RETURN VALUE"
|
2012-12-04 02:33:02 +00:00
|
|
|
On failure
|
|
|
|
.BR context_*_set ()
|
|
|
|
functions return non-zero and 0 on success.
|
|
|
|
|
|
|
|
The other functions return NULL on failure and non-NULL on success.
|
|
|
|
|
|
|
|
On failure
|
2012-11-13 20:15:34 +00:00
|
|
|
.I errno
|
|
|
|
is set appropriately.
|
|
|
|
.
|
2008-08-19 19:30:36 +00:00
|
|
|
.SH "SEE ALSO"
|
|
|
|
.BR selinux "(8)"
|