| 1 |
.\" Hey Emacs! This file is -*- nroff -*- source. |
| 2 |
.\" |
| 3 |
.\" Author: Eamon Walsh ([email protected]) 2007 |
| 4 |
.TH "selinux_set_callback" "3" "20 Jun 2007" "" "SELinux API documentation" |
| 5 |
.SH "NAME" |
| 6 |
selinux_set_callback \- userspace SELinux callback facilities |
| 7 |
. |
| 8 |
.SH "SYNOPSIS" |
| 9 |
.B #include <selinux/selinux.h> |
| 10 |
.sp |
| 11 |
.BI "void selinux_set_callback(int " type ", union selinux_callback " callback ");" |
| 12 |
. |
| 13 |
.SH "DESCRIPTION" |
| 14 |
.BR selinux_set_callback () |
| 15 |
sets the callback indicated by |
| 16 |
.I type |
| 17 |
to the value of |
| 18 |
.IR callback , |
| 19 |
which should be passed as a function pointer cast to type |
| 20 |
.B union |
| 21 |
.BR selinux_callback . |
| 22 |
|
| 23 |
All callback functions should return a negative value with |
| 24 |
.I errno |
| 25 |
set appropriately on error. |
| 26 |
|
| 27 |
The available values for |
| 28 |
.I type |
| 29 |
are: |
| 30 |
.TP |
| 31 |
.B SELINUX_CB_LOG |
| 32 |
.BI "int (*" func_log ") (int " type ", const char *" fmt ", ...);" |
| 33 |
|
| 34 |
This callback is used for logging and should process the |
| 35 |
.BR printf (3) |
| 36 |
style |
| 37 |
.I fmt |
| 38 |
string and arguments as appropriate. The |
| 39 |
.I type |
| 40 |
argument indicates the type of message and will be set to one of the following: |
| 41 |
|
| 42 |
.B SELINUX_ERROR |
| 43 |
|
| 44 |
.B SELINUX_WARNING |
| 45 |
|
| 46 |
.B SELINUX_INFO |
| 47 |
|
| 48 |
.B SELINUX_AVC |
| 49 |
. |
| 50 |
.TP |
| 51 |
.B SELINUX_CB_AUDIT |
| 52 |
.BI "int (*" func_audit ") (void *" auditdata ", security_class_t " cls , |
| 53 |
.in +\w'int (*func_audit) ('u |
| 54 |
.BI "char *" msgbuf ", size_t " msgbufsize ");" |
| 55 |
.in |
| 56 |
|
| 57 |
This callback is used for supplemental auditing in AVC messages. The |
| 58 |
.I auditdata |
| 59 |
and |
| 60 |
.I cls |
| 61 |
arguments are the values passed to |
| 62 |
.BR avc_has_perm (3). |
| 63 |
A human-readable interpretation should be printed to |
| 64 |
.I msgbuf |
| 65 |
using no more than |
| 66 |
.I msgbufsize |
| 67 |
characters. |
| 68 |
. |
| 69 |
.TP |
| 70 |
.B SELINUX_CB_VALIDATE |
| 71 |
.BI "int (*" func_validate ") (char **" ctx ");" |
| 72 |
|
| 73 |
This callback is used for context validation. The callback may optionally modify the input context by setting the target of the |
| 74 |
.I ctx |
| 75 |
pointer to a new context. In this case, the old value should be freed with |
| 76 |
.BR freecon (3). |
| 77 |
The value of |
| 78 |
.I errno |
| 79 |
should be set to |
| 80 |
.B EINVAL |
| 81 |
to indicate an invalid context. |
| 82 |
. |
| 83 |
.TP |
| 84 |
.B SELINUX_CB_SETENFORCE |
| 85 |
.BI "int (*" func_setenforce ") (int " enforcing ");" |
| 86 |
|
| 87 |
This callback is invoked when the system enforcing state changes. |
| 88 |
The |
| 89 |
.I enforcing |
| 90 |
argument indicates the new value and is set to |
| 91 |
.I 1 |
| 92 |
for enforcing mode, and |
| 93 |
.I 0 |
| 94 |
for permissive mode. |
| 95 |
. |
| 96 |
.TP |
| 97 |
.B SELINUX_CB_POLICYLOAD |
| 98 |
.BI "int (*" func_policyload ") (int " seqno ");" |
| 99 |
|
| 100 |
This callback is invoked when the system security policy is reloaded. |
| 101 |
The |
| 102 |
.I seqno |
| 103 |
argument is the current sequential number of the policy generation in the system. |
| 104 |
. |
| 105 |
.SH "RETURN VALUE" |
| 106 |
None. |
| 107 |
. |
| 108 |
.SH "ERRORS" |
| 109 |
None. |
| 110 |
. |
| 111 |
.SH "AUTHOR" |
| 112 |
Eamon Walsh <[email protected]> |
| 113 |
. |
| 114 |
.SH "SEE ALSO" |
| 115 |
.BR selabel_open (3), |
| 116 |
.BR avc_init (3), |
| 117 |
.BR avc_netlink_open (3), |
| 118 |
.BR selinux (8) |