blob: 191ac5748062dd8af8cd4b08e4e763bec06c2bb2 [file] [log] [blame]
Joshua Brindle13cd4c82008-08-19 15:30:36 -04001#include <stdlib.h>
2#include <assert.h>
3#include "handle.h"
4#include "debug.h"
5
6sepol_handle_t *sepol_handle_create(void)
7{
8
9 sepol_handle_t *sh = malloc(sizeof(sepol_handle_t));
10 if (sh == NULL)
11 return NULL;
12
13 /* Set callback */
14 sh->msg_callback = sepol_msg_default_handler;
15 sh->msg_callback_arg = NULL;
16
17 /* by default do not disable dontaudits */
18 sh->disable_dontaudit = 0;
19 sh->expand_consume_base = 0;
20
21 return sh;
22}
23
Christopher Pardy86a2f892009-07-06 10:42:15 -040024int sepol_get_disable_dontaudit(sepol_handle_t *sh)
25{
26 assert(sh !=NULL);
27 return sh->disable_dontaudit;
28}
29
Joshua Brindle13cd4c82008-08-19 15:30:36 -040030void sepol_set_disable_dontaudit(sepol_handle_t * sh, int disable_dontaudit)
31{
32 assert(sh !=NULL);
33 sh->disable_dontaudit = disable_dontaudit;
34}
35
36void sepol_set_expand_consume_base(sepol_handle_t *sh, int consume_base)
37{
38 assert(sh != NULL);
39 sh->expand_consume_base = consume_base;
40}
41
42void sepol_handle_destroy(sepol_handle_t * sh)
43{
44 free(sh);
45}