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

NAME

6       getsockcreatecon,  setsockcreatecon  -  get or set the SELinux security
7       context used for creating a new labeled sockets.
8
9

SYNOPSIS

11       #include <selinux/selinux.h>
12
13       int getsockcreatecon(security_context_t *con);
14
15       int setsockcreatecon(security_context_t context);
16
17

DESCRIPTION

19       getsockcreatecon retrieves the context used for creating a new  labeled
20       network  socket.  This returned context should be freed with freecon if
21       non-NULL.  getsockcreatecon sets *con to NULL if no sockcreate  context
22       has  been  explicitly set by the program (i.e. using the default policy
23       behavior).
24
25       setsockcreatecon sets the context used for creating a new labeled  net‐
26       work  sockets  NULL  can  be passed to setsockcreatecon to reset to the
27       default policy behavior.  The sockcreate context is automatically reset
28       after the next execve, so a program doesn't need to explicitly sanitize
29       it upon startup.
30
31       setsockcreatecon can be applied prior to library functions that  inter‐
32       nally  perform an file creation, in order to set an file context on the
33       objects.
34
35
36       Note: Signal handlers that perform an setsockcreate must take  care  to
37       save,  reset,  and  restore  the sockcreate context to avoid unexpected
38       behavior.
39

RETURN VALUE

41       On error -1 is returned.  On success 0 is returned.
42
43

SEE ALSO

45       selinux(8), freecon(3), getcon(3)
46
47
48
49dwalsh@redhat.com from russell@c2o4keSre.pctoemm.baeur 2008           getsockcreatecon(3)
Impressum