2012-11-13 21:15:34 +01:00
|
|
|
.TH "getsockcreatecon" "3" "24 September 2008" "dwalsh@redhat.com" "SELinux API documentation"
|
2008-09-29 21:55:18 +02:00
|
|
|
.SH "NAME"
|
2012-11-13 21:15:34 +01:00
|
|
|
getsockcreatecon, setsockcreatecon \- get or set the SELinux security context used for creating a new labeled sockets
|
|
|
|
.
|
2008-09-29 21:55:18 +02:00
|
|
|
.SH "SYNOPSIS"
|
|
|
|
.B #include <selinux/selinux.h>
|
|
|
|
.sp
|
2014-02-19 15:16:17 +01:00
|
|
|
.BI "int getsockcreatecon(char **" con );
|
2012-11-13 21:15:34 +01:00
|
|
|
.sp
|
2014-02-19 15:16:17 +01:00
|
|
|
.BI "int getsockcreatecon_raw(char **" con );
|
2012-11-10 04:32:07 +01:00
|
|
|
.sp
|
2014-02-19 15:16:17 +01:00
|
|
|
.BI "int setsockcreatecon(char * "context );
|
2012-11-10 04:32:07 +01:00
|
|
|
.sp
|
2014-02-19 15:16:17 +01:00
|
|
|
.BI "int setsockcreatecon_raw(char * "context );
|
2012-11-13 21:15:34 +01:00
|
|
|
.
|
2008-09-29 21:55:18 +02:00
|
|
|
.SH "DESCRIPTION"
|
2012-11-13 21:15:34 +01:00
|
|
|
.BR getsockcreatecon ()
|
2008-09-29 21:55:18 +02:00
|
|
|
retrieves the context used for creating a new labeled network socket.
|
2012-11-13 21:15:34 +01:00
|
|
|
This returned context should be freed with
|
|
|
|
.BR freecon (3)
|
|
|
|
if non-NULL.
|
|
|
|
.BR getsockcreatecon ()
|
|
|
|
sets *con to NULL if no sockcreate context has been explicitly
|
2008-09-29 21:55:18 +02:00
|
|
|
set by the program (i.e. using the default policy behavior).
|
|
|
|
|
2012-11-13 21:15:34 +01:00
|
|
|
.BR setsockcreatecon ()
|
2008-09-29 21:55:18 +02:00
|
|
|
sets the context used for creating a new labeled network sockets
|
|
|
|
NULL can be passed to
|
2012-11-13 21:15:34 +01:00
|
|
|
.BR setsockcreatecon ()
|
|
|
|
to reset to the default policy behavior.
|
|
|
|
The sockcreate context is automatically reset after the next
|
|
|
|
.BR execve (2),
|
|
|
|
so a program doesn't need to explicitly sanitize it upon startup.
|
|
|
|
|
|
|
|
.BR setsockcreatecon ()
|
|
|
|
can be applied prior to library
|
2008-09-29 21:55:18 +02:00
|
|
|
functions that internally perform an file creation,
|
|
|
|
in order to set an file context on the objects.
|
|
|
|
|
2012-11-10 04:32:07 +01:00
|
|
|
.BR getsockcreatecon_raw ()
|
|
|
|
and
|
|
|
|
.BR setsockcreatecon_raw ()
|
|
|
|
behave identically to their non-raw counterparts but do not perform context
|
|
|
|
translation.
|
|
|
|
|
2012-11-13 21:15:34 +01:00
|
|
|
.B Note:
|
|
|
|
Signal handlers that perform a
|
|
|
|
.BR setsockcreatecon ()
|
|
|
|
must take care to
|
2008-09-29 21:55:18 +02:00
|
|
|
save, reset, and restore the sockcreate context to avoid unexpected behavior.
|
2012-11-13 21:15:34 +01:00
|
|
|
.
|
2015-12-09 21:52:10 +01:00
|
|
|
|
|
|
|
.br
|
|
|
|
.B Note:
|
|
|
|
Contexts are thread specific.
|
|
|
|
|
2008-09-29 21:55:18 +02:00
|
|
|
.SH "RETURN VALUE"
|
2012-11-13 21:15:34 +01:00
|
|
|
On error \-1 is returned.
|
2008-09-29 21:55:18 +02:00
|
|
|
On success 0 is returned.
|
2012-11-13 21:15:34 +01:00
|
|
|
.
|
2008-09-29 21:55:18 +02:00
|
|
|
.SH "SEE ALSO"
|
|
|
|
.BR selinux "(8), " freecon "(3), " getcon "(3)
|