Chris PeBenito 473ea7
.TH "getfscreatecon" "3" "1 January 2004" "russell@coker.com.au" "SE Linux API documentation"
Chris PeBenito 473ea7
.SH "NAME"
Chris PeBenito 473ea7
getfscreatecon, setfscreatecon \- get or set the SE Linux security context used for creating a new file system object.
Chris PeBenito 473ea7
Chris PeBenito 473ea7
.SH "SYNOPSIS"
Chris PeBenito 473ea7
.B #include <selinux/selinux.h>
Chris PeBenito 473ea7
.sp
Chris PeBenito 473ea7
.BI "int getfscreatecon(security_context_t *" con );
Chris PeBenito 473ea7
.br 
Chris PeBenito 473ea7
.BI "int setfscreatecon(security_context_t "context );
Chris PeBenito 473ea7
Chris PeBenito 473ea7
.SH "DESCRIPTION"
Chris PeBenito 473ea7
.B getfscreatecon
Chris PeBenito 473ea7
retrieves the context used for creating a new file system object.
Chris PeBenito 473ea7
This returned context should be freed with freecon if non-NULL.  
Chris PeBenito 473ea7
getfscreatecon sets *con to NULL if no fscreate context has been explicitly 
Chris PeBenito 473ea7
set by the program (i.e. using the default policy behavior).
Chris PeBenito 473ea7
Chris PeBenito 473ea7
.B setfscreatecon
Chris PeBenito 473ea7
sets the context used for creating a new file system object.
Chris PeBenito 473ea7
NULL can be passed to
Chris PeBenito 473ea7
setfscreatecon to reset to the default policy behavior.  
Chris PeBenito 473ea7
The fscreate context is automatically reset after the next execve, so a
Chris PeBenito 473ea7
program doesn't need to explicitly sanitize it upon startup.  
Chris PeBenito 473ea7
.br
Chris PeBenito 473ea7
setfscreatecon can be applied prior to library
Chris PeBenito 473ea7
functions that internally perform an file creation,
Chris PeBenito 473ea7
in order to set an file context on the objects.
Chris PeBenito 473ea7
.br
Chris PeBenito 473ea7
Chris PeBenito 473ea7
Note: Signal handlers that perform an setfscreate must take care to
Chris PeBenito 473ea7
save, reset, and restore the fscreate context to avoid unexpected behaviors.
Chris PeBenito 473ea7
.SH "RETURN VALUE"
Chris PeBenito 473ea7
On error -1 is returned.
Chris PeBenito 473ea7
Chris PeBenito 473ea7
On success getfscreatecon returns the length of the context (not including
Chris PeBenito 473ea7
the trailing zero byte).  On success setfscreatecon returns 0.
Chris PeBenito 473ea7
Chris PeBenito 473ea7
.SH "SEE ALSO"
Chris PeBenito 473ea7
.BR freecon "(3), " getcon "(3), " getexeccon "(3)"