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