Joshua Brindle | 13cd4c8 | 2008-08-19 15:30:36 -0400 | [diff] [blame] | 1 | #include <stdlib.h> |
| 2 | #include <assert.h> |
| 3 | #include "handle.h" |
| 4 | #include "debug.h" |
| 5 | |
| 6 | sepol_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 Pardy | 86a2f89 | 2009-07-06 10:42:15 -0400 | [diff] [blame] | 24 | int sepol_get_disable_dontaudit(sepol_handle_t *sh) |
| 25 | { |
| 26 | assert(sh !=NULL); |
| 27 | return sh->disable_dontaudit; |
| 28 | } |
| 29 | |
Joshua Brindle | 13cd4c8 | 2008-08-19 15:30:36 -0400 | [diff] [blame] | 30 | void sepol_set_disable_dontaudit(sepol_handle_t * sh, int disable_dontaudit) |
| 31 | { |
| 32 | assert(sh !=NULL); |
| 33 | sh->disable_dontaudit = disable_dontaudit; |
| 34 | } |
| 35 | |
| 36 | void 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 | |
| 42 | void sepol_handle_destroy(sepol_handle_t * sh) |
| 43 | { |
| 44 | free(sh); |
| 45 | } |