-
Notifications
You must be signed in to change notification settings - Fork 54
/
Copy pathsepol.h
72 lines (56 loc) · 2.26 KB
/
sepol.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
/*
* (C) Copyright rev1si0n <[email protected]>. 2019.
*
* This file is part of bxxt.
*
* bxxt is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
* bxxt is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with bxxt. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef _BXXT_SEPOL_H_
#define _BXXT_SEPOL_H_
#include "bxxt.h"
#ifdef DEBUG
#include <debug.h>
#include <sepol/debug.h>
#endif
#include <sepol/policydb/link.h>
#include <sepol/policydb/expand.h>
#include <sepol/policydb/policydb.h>
#include <sepol/policydb/services.h>
#include <sepol/policydb/avrule_block.h>
#include <sepol/policydb/conditional.h>
#ifndef _SEPOL_INTERNAL_DEBUG_H_
#define STATUS_SUCCESS 0
#define STATUS_NODATA 1
#define STATUS_ERR -1
#endif
#include "util.h"
typedef struct bxxt_sepoldb {
// i don't know how to free memory allocated by create domain
// pdb destory seems not release them,
// so we allocate it ourself with a block memory
bxxt_buffer_t *mm_pool;
policydb_t pdb;
} bxxt_sepoldb_t;
static int bxxt_sepol_save_policy_file(bxxt_sepoldb_t* bpb, char* file);
static int bxxt_sepol_load_policy_file(bxxt_sepoldb_t* bpb, char* file);
static int bxxt_sepol_reload_kernel_policy(bxxt_sepoldb_t* bpb);
static void bxxt_sepol_reload_kernel_policy_from_file(char* file);
static int bxxt_sepol_allow_ext(bxxt_sepoldb_t* bpb, char* src, char* tgt,
char* cls, char* perm, bool disallow);
static int bxxt_sepol_create_domain(bxxt_sepoldb_t* bpb, char* domain);
static int bxxt_sepol_execute_stmt(bxxt_sepoldb_t* bpb, char* stmt);
static int bxxt_sepol_set_permissive(bxxt_sepoldb_t* bpb, char* domain, bool permissive);
static bxxt_sepoldb_t* bxxt_sepol_new();
static void bxxt_sepol_free(bxxt_sepoldb_t* bpb);
int sepol_main(int argc, char **argv);
int sepol_rtexec(char* stmt);
#endif