2008-08-19 19:30:36 +00:00
|
|
|
.TH "getfscreatecon" "3" "1 January 2004" "russell@coker.com.au" "SELinux API documentation"
|
|
|
|
.SH "NAME"
|
2012-11-13 20:15:34 +00:00
|
|
|
getfscreatecon, setfscreatecon \- get or set the SELinux security context used for creating a new file system object
|
|
|
|
.
|
2008-08-19 19:30:36 +00:00
|
|
|
.SH "SYNOPSIS"
|
|
|
|
.B #include <selinux/selinux.h>
|
|
|
|
.sp
|
2014-02-19 14:16:17 +00:00
|
|
|
.BI "int getfscreatecon(char **" con );
|
2012-11-13 20:15:34 +00:00
|
|
|
.sp
|
2014-02-19 14:16:17 +00:00
|
|
|
.BI "int getfscreatecon_raw(char **" con );
|
2012-11-10 03:32:07 +00:00
|
|
|
.sp
|
2014-02-19 14:16:17 +00:00
|
|
|
.BI "int setfscreatecon(char * "context );
|
2012-11-10 03:32:07 +00:00
|
|
|
.sp
|
2014-02-19 14:16:17 +00:00
|
|
|
.BI "int setfscreatecon_raw(char * "context );
|
2012-11-13 20:15:34 +00:00
|
|
|
.
|
2008-08-19 19:30:36 +00:00
|
|
|
.SH "DESCRIPTION"
|
2012-11-13 20:15:34 +00:00
|
|
|
.BR getfscreatecon ()
|
2008-08-19 19:30:36 +00:00
|
|
|
retrieves the context used for creating a new file system object.
|
2012-11-13 20:15:34 +00:00
|
|
|
This returned context should be freed with
|
|
|
|
.BR freecon (3)
|
|
|
|
if non-NULL.
|
|
|
|
.BR getfscreatecon ()
|
|
|
|
sets *con to NULL if no fscreate context has been explicitly
|
2008-08-19 19:30:36 +00:00
|
|
|
set by the program (i.e. using the default policy behavior).
|
|
|
|
|
2012-11-13 20:15:34 +00:00
|
|
|
.BR setfscreatecon ()
|
2008-08-19 19:30:36 +00:00
|
|
|
sets the context used for creating a new file system object.
|
|
|
|
NULL can be passed to
|
2012-11-13 20:15:34 +00:00
|
|
|
.BR setfscreatecon ()
|
|
|
|
to reset to the default policy behavior.
|
|
|
|
The fscreate context is automatically reset after the next
|
|
|
|
.BR execve (2),
|
|
|
|
so a program doesn't need to explicitly sanitize it upon startup.
|
|
|
|
|
|
|
|
.BR setfscreatecon ()
|
|
|
|
can be applied prior to library
|
2008-08-19 19:30:36 +00:00
|
|
|
functions that internally perform an file creation,
|
|
|
|
in order to set an file context on the objects.
|
|
|
|
|
2012-11-10 03:32:07 +00:00
|
|
|
.BR getfscreatecon_raw ()
|
|
|
|
and
|
|
|
|
.BR setfscreatecon_raw ()
|
|
|
|
behave identically to their non-raw counterparts but do not perform context
|
|
|
|
translation.
|
|
|
|
|
2012-11-13 20:15:34 +00:00
|
|
|
.B Note:
|
|
|
|
Signal handlers that perform a
|
|
|
|
.BR setfscreatecon ()
|
|
|
|
must take care to
|
2008-08-19 19:30:36 +00:00
|
|
|
save, reset, and restore the fscreate context to avoid unexpected behavior.
|
2012-11-13 20:15:34 +00:00
|
|
|
.
|
2008-08-19 19:30:36 +00:00
|
|
|
.SH "RETURN VALUE"
|
2012-11-13 20:15:34 +00:00
|
|
|
On error \-1 is returned.
|
2008-08-19 19:30:36 +00:00
|
|
|
On success 0 is returned.
|
2012-11-13 20:15:34 +00:00
|
|
|
.
|
2008-08-19 19:30:36 +00:00
|
|
|
.SH "SEE ALSO"
|
|
|
|
.BR selinux "(8), " freecon "(3), " getcon "(3), " getexeccon "(3)"
|