1*2d543d20SAndroid Build Coastguard Worker /*
2*2d543d20SAndroid Build Coastguard Worker * Copyright (C) 2006 Tresys Technology, LLC
3*2d543d20SAndroid Build Coastguard Worker *
4*2d543d20SAndroid Build Coastguard Worker * This library is free software; you can redistribute it and/or
5*2d543d20SAndroid Build Coastguard Worker * modify it under the terms of the GNU Lesser General Public
6*2d543d20SAndroid Build Coastguard Worker * License as published by the Free Software Foundation; either
7*2d543d20SAndroid Build Coastguard Worker * version 2.1 of the License, or (at your option) any later version.
8*2d543d20SAndroid Build Coastguard Worker *
9*2d543d20SAndroid Build Coastguard Worker * This library is distributed in the hope that it will be useful,
10*2d543d20SAndroid Build Coastguard Worker * but WITHOUT ANY WARRANTY; without even the implied warranty of
11*2d543d20SAndroid Build Coastguard Worker * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12*2d543d20SAndroid Build Coastguard Worker * Lesser General Public License for more details.
13*2d543d20SAndroid Build Coastguard Worker *
14*2d543d20SAndroid Build Coastguard Worker * You should have received a copy of the GNU Lesser General Public
15*2d543d20SAndroid Build Coastguard Worker * License along with this library; if not, write to the Free Software
16*2d543d20SAndroid Build Coastguard Worker * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17*2d543d20SAndroid Build Coastguard Worker */
18*2d543d20SAndroid Build Coastguard Worker
19*2d543d20SAndroid Build Coastguard Worker /* Copyright (C) 2005 Red Hat, Inc. */
20*2d543d20SAndroid Build Coastguard Worker
21*2d543d20SAndroid Build Coastguard Worker struct semanage_iface;
22*2d543d20SAndroid Build Coastguard Worker struct semanage_iface_key;
23*2d543d20SAndroid Build Coastguard Worker typedef struct semanage_iface record_t;
24*2d543d20SAndroid Build Coastguard Worker typedef struct semanage_iface_key record_key_t;
25*2d543d20SAndroid Build Coastguard Worker #define DBASE_RECORD_DEFINED
26*2d543d20SAndroid Build Coastguard Worker
27*2d543d20SAndroid Build Coastguard Worker struct dbase_policydb;
28*2d543d20SAndroid Build Coastguard Worker typedef struct dbase_policydb dbase_t;
29*2d543d20SAndroid Build Coastguard Worker #define DBASE_DEFINED
30*2d543d20SAndroid Build Coastguard Worker
31*2d543d20SAndroid Build Coastguard Worker #include <sepol/interfaces.h>
32*2d543d20SAndroid Build Coastguard Worker #include <semanage/handle.h>
33*2d543d20SAndroid Build Coastguard Worker #include "iface_internal.h"
34*2d543d20SAndroid Build Coastguard Worker #include "debug.h"
35*2d543d20SAndroid Build Coastguard Worker #include "database_policydb.h"
36*2d543d20SAndroid Build Coastguard Worker #include "semanage_store.h"
37*2d543d20SAndroid Build Coastguard Worker
38*2d543d20SAndroid Build Coastguard Worker /* INTERFACE RECRORD (SEPOL): POLICYDB extension: method table */
39*2d543d20SAndroid Build Coastguard Worker record_policydb_table_t SEMANAGE_IFACE_POLICYDB_RTABLE = {
40*2d543d20SAndroid Build Coastguard Worker .add = NULL,
41*2d543d20SAndroid Build Coastguard Worker .modify = (record_policydb_table_modify_t) sepol_iface_modify,
42*2d543d20SAndroid Build Coastguard Worker .set = NULL,
43*2d543d20SAndroid Build Coastguard Worker .query = (record_policydb_table_query_t) sepol_iface_query,
44*2d543d20SAndroid Build Coastguard Worker .count = (record_policydb_table_count_t) sepol_iface_count,
45*2d543d20SAndroid Build Coastguard Worker .exists = (record_policydb_table_exists_t) sepol_iface_exists,
46*2d543d20SAndroid Build Coastguard Worker .iterate = (record_policydb_table_iterate_t) sepol_iface_iterate,
47*2d543d20SAndroid Build Coastguard Worker };
48*2d543d20SAndroid Build Coastguard Worker
iface_policydb_dbase_init(semanage_handle_t * handle,dbase_config_t * dconfig)49*2d543d20SAndroid Build Coastguard Worker int iface_policydb_dbase_init(semanage_handle_t * handle,
50*2d543d20SAndroid Build Coastguard Worker dbase_config_t * dconfig)
51*2d543d20SAndroid Build Coastguard Worker {
52*2d543d20SAndroid Build Coastguard Worker
53*2d543d20SAndroid Build Coastguard Worker if (dbase_policydb_init(handle,
54*2d543d20SAndroid Build Coastguard Worker semanage_path(SEMANAGE_ACTIVE, SEMANAGE_STORE_KERNEL),
55*2d543d20SAndroid Build Coastguard Worker semanage_path(SEMANAGE_TMP, SEMANAGE_STORE_KERNEL),
56*2d543d20SAndroid Build Coastguard Worker &SEMANAGE_IFACE_RTABLE,
57*2d543d20SAndroid Build Coastguard Worker &SEMANAGE_IFACE_POLICYDB_RTABLE,
58*2d543d20SAndroid Build Coastguard Worker &dconfig->dbase) < 0)
59*2d543d20SAndroid Build Coastguard Worker return STATUS_ERR;
60*2d543d20SAndroid Build Coastguard Worker
61*2d543d20SAndroid Build Coastguard Worker dconfig->dtable = &SEMANAGE_POLICYDB_DTABLE;
62*2d543d20SAndroid Build Coastguard Worker return STATUS_SUCCESS;
63*2d543d20SAndroid Build Coastguard Worker }
64*2d543d20SAndroid Build Coastguard Worker
iface_policydb_dbase_release(dbase_config_t * dconfig)65*2d543d20SAndroid Build Coastguard Worker void iface_policydb_dbase_release(dbase_config_t * dconfig)
66*2d543d20SAndroid Build Coastguard Worker {
67*2d543d20SAndroid Build Coastguard Worker
68*2d543d20SAndroid Build Coastguard Worker dbase_policydb_release(dconfig->dbase);
69*2d543d20SAndroid Build Coastguard Worker }
70