| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
struct semanage_port; |
| 21 |
struct semanage_port_key; |
| 22 |
typedef struct semanage_port record_t; |
| 23 |
typedef struct semanage_port_key record_key_t; |
| 24 |
#define DBASE_RECORD_DEFINED |
| 25 |
|
| 26 |
struct dbase_policydb; |
| 27 |
typedef struct dbase_policydb dbase_t; |
| 28 |
#define DBASE_DEFINED |
| 29 |
|
| 30 |
#include <sepol/ports.h> |
| 31 |
#include <semanage/handle.h> |
| 32 |
#include "port_internal.h" |
| 33 |
#include "debug.h" |
| 34 |
#include "database_policydb.h" |
| 35 |
#include "semanage_store.h" |
| 36 |
|
| 37 |
|
| 38 |
record_policydb_table_t SEMANAGE_PORT_POLICYDB_RTABLE = { |
| 39 |
.add = NULL, |
| 40 |
.modify = (record_policydb_table_modify_t) sepol_port_modify, |
| 41 |
.set = NULL, |
| 42 |
.query = (record_policydb_table_query_t) sepol_port_query, |
| 43 |
.count = (record_policydb_table_count_t) sepol_port_count, |
| 44 |
.exists = (record_policydb_table_exists_t) sepol_port_exists, |
| 45 |
.iterate = (record_policydb_table_iterate_t) sepol_port_iterate, |
| 46 |
}; |
| 47 |
|
| 48 |
int port_policydb_dbase_init(semanage_handle_t * handle, |
| 49 |
dbase_config_t * dconfig) |
| 50 |
{ |
| 51 |
|
| 52 |
if (dbase_policydb_init(handle, |
| 53 |
semanage_path(SEMANAGE_ACTIVE, SEMANAGE_STORE_KERNEL), |
| 54 |
semanage_path(SEMANAGE_TMP, SEMANAGE_STORE_KERNEL), |
| 55 |
&SEMANAGE_PORT_RTABLE, |
| 56 |
&SEMANAGE_PORT_POLICYDB_RTABLE, |
| 57 |
&dconfig->dbase) < 0) |
| 58 |
return STATUS_ERR; |
| 59 |
|
| 60 |
dconfig->dtable = &SEMANAGE_POLICYDB_DTABLE; |
| 61 |
|
| 62 |
return STATUS_SUCCESS; |
| 63 |
} |
| 64 |
|
| 65 |
void port_policydb_dbase_release(dbase_config_t * dconfig) |
| 66 |
{ |
| 67 |
|
| 68 |
dbase_policydb_release(dconfig->dbase); |
| 69 |
} |