Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

selinux_set_callback(3) [debian man page]

selinux_set_callback(3) 				     SELinux API documentation					   selinux_set_callback(3)

NAME
selinux_set_callback - userspace SELinux callback facilities. SYNOPSIS
#include <selinux/selinux.h> void selinux_set_callback(int type, union selinux_callback callback); DESCRIPTION
selinux_set_callback sets the callback indicated by type to the value of callback, which should be passed as a function pointer cast to type union selinux_callback. All callback functions should return a negative value with errno set appropriately on error. The available values for type are: SELINUX_CB_LOG int (*func_log) (int type, const char *fmt, ...); This callback is used for logging and should process the printf(3) style fmt string and arguments as appropriate. The type argument indicates the type of message and will be set to one of the following: SELINUX_ERROR SELINUX_WARNING SELINUX_INFO SELINUX_AVC SELINUX_CB_AUDIT int (*func_audit) (void *auditdata, security_class_t cls, char *msgbuf, size_t msgbufsize); This callback is used for supplemental auditing in AVC messages. The auditdata and cls arguments are the values passed to avc_has_perm(3). A human-readable interpretation should be printed to msgbuf using no more than msgbufsize characters. SELINUX_CB_VALIDATE int (*func_validate) (security_context_t *ctx); This callback is used for context validation. The callback may optionally modify the input context by setting the target of the ctx pointer to a new context. In this case, the old value should be freed with freecon(3). The value of errno should be set to EINVAL to indicate an invalid context. SELINUX_CB_SETENFORCE int (*func_setenforce) (int enforcing); This callback is invoked when the system enforcing state changes. The enforcing argument indicates the new value and is set to 1 for enforcing mode, and 0 for permissive mode. SELINUX_CB_POLICYLOAD int (*func_policyload) (int seqno); This callback is invoked when the system security policy is reloaded. The seqno argument is the current sequential number of the policy generation in the system. RETURN VALUE
None. ERRORS
None. AUTHOR
Eamon Walsh <ewalsh@tycho.nsa.gov> SEE ALSO
selabel_open(3), avc_init(3), avc_netlink_open(3), selinux(8) 20 Jun 2007 selinux_set_callback(3)

Check Out this Related Man Page

avc_open(3)						     SELinux API documentation						       avc_open(3)

NAME
avc_open, avc_destroy, avc_reset, avc_cleanup - userspace SELinux AVC setup and teardown. SYNOPSIS
#include <selinux/selinux.h> #include <selinux/avc.h> int avc_open(struct selinux_opt *options, unsigned nopt); void avc_destroy(void); int avc_reset(void); void avc_cleanup(void); DESCRIPTION
avc_open initializes the userspace AVC and must be called before any other AVC operation can be performed. avc_destroy destroys the userspace AVC, freeing all internal memory structures. After this call has been made, avc_open must be called again before any AVC operations can be performed. avc_reset flushes the userspace AVC, causing it to forget any cached access decisions. The userspace AVC normally calls this function automatically when needed, see NETLINK NOTIFICATION below. avc_cleanup attempts to free unused memory within the userspace AVC, but does not flush any cached access decisions. Under normal opera- tion, calling this function should not be necessary. OPTIONS
The userspace AVC obeys callbacks set via selinux_set_callback(3), in particular the logging and audit callbacks. The options which may be passed to avc_open include the following: AVC_OPT_SETENFORCE This option forces the userspace AVC into enforcing mode if the option value is non-NULL; permissive mode otherwise. The system enforcing mode will be ignored. NETLINK NOTIFICATION
Beginning with version 2.6.4, the Linux kernel supports SELinux status change notification via netlink. Two message types are currently implemented, indicating changes to the enforcing mode and to the loaded policy in the kernel, respectively. The userspace AVC listens for these messages and takes the appropriate action, modifying the behavior of avc_has_perm(3) to reflect the current enforcing mode and flush- ing the cache on receipt of a policy load notification. Audit messages are produced when netlink notifications are processed. RETURN VALUE
Functions with a return value return zero on success. On error, -1 is returned and errno is set appropriately. AUTHOR
Eamon Walsh <ewalsh@tycho.nsa.gov> SEE ALSO
selinux(8), avc_has_perm(3), avc_context_to_sid(3), avc_cache_stats(3), avc_add_callback(3), selinux_set_callback(3), security_com- pute_av(3) 12 Jun 2008 avc_open(3)
Man Page