|
Packit Service |
102278 |
/*
|
|
Packit Service |
102278 |
* Copyright (C) 2006 Tresys Technology, LLC
|
|
Packit Service |
102278 |
*
|
|
Packit Service |
102278 |
* This library is free software; you can redistribute it and/or
|
|
Packit Service |
102278 |
* modify it under the terms of the GNU Lesser General Public
|
|
Packit Service |
102278 |
* License as published by the Free Software Foundation; either
|
|
Packit Service |
102278 |
* version 2.1 of the License, or (at your option) any later version.
|
|
Packit Service |
102278 |
*
|
|
Packit Service |
102278 |
* This library is distributed in the hope that it will be useful,
|
|
Packit Service |
102278 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit Service |
102278 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit Service |
102278 |
* Lesser General Public License for more details.
|
|
Packit Service |
102278 |
*
|
|
Packit Service |
102278 |
* You should have received a copy of the GNU Lesser General Public
|
|
Packit Service |
102278 |
* License along with this library; if not, write to the Free Software
|
|
Packit Service |
102278 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
Packit Service |
102278 |
*/
|
|
Packit Service |
102278 |
/* Copyright (C) 2005 Red Hat, Inc. */
|
|
Packit Service |
102278 |
|
|
Packit Service |
102278 |
struct semanage_port;
|
|
Packit Service |
102278 |
struct semanage_port_key;
|
|
Packit Service |
102278 |
typedef struct semanage_port record_t;
|
|
Packit Service |
102278 |
typedef struct semanage_port_key record_key_t;
|
|
Packit Service |
102278 |
#define DBASE_RECORD_DEFINED
|
|
Packit Service |
102278 |
|
|
Packit Service |
102278 |
struct dbase_policydb;
|
|
Packit Service |
102278 |
typedef struct dbase_policydb dbase_t;
|
|
Packit Service |
102278 |
#define DBASE_DEFINED
|
|
Packit Service |
102278 |
|
|
Packit Service |
102278 |
#include <sepol/ports.h>
|
|
Packit Service |
102278 |
#include <semanage/handle.h>
|
|
Packit Service |
102278 |
#include "port_internal.h"
|
|
Packit Service |
102278 |
#include "debug.h"
|
|
Packit Service |
102278 |
#include "database_policydb.h"
|
|
Packit Service |
102278 |
#include "semanage_store.h"
|
|
Packit Service |
102278 |
|
|
Packit Service |
102278 |
/* PORT RECORD (SEPOL): POLICYDB extension : method table */
|
|
Packit Service |
102278 |
record_policydb_table_t SEMANAGE_PORT_POLICYDB_RTABLE = {
|
|
Packit Service |
102278 |
.add = NULL,
|
|
Packit Service |
102278 |
.modify = (record_policydb_table_modify_t) sepol_port_modify,
|
|
Packit Service |
102278 |
.set = NULL,
|
|
Packit Service |
102278 |
.query = (record_policydb_table_query_t) sepol_port_query,
|
|
Packit Service |
102278 |
.count = (record_policydb_table_count_t) sepol_port_count,
|
|
Packit Service |
102278 |
.exists = (record_policydb_table_exists_t) sepol_port_exists,
|
|
Packit Service |
102278 |
.iterate = (record_policydb_table_iterate_t) sepol_port_iterate,
|
|
Packit Service |
102278 |
};
|
|
Packit Service |
102278 |
|
|
Packit Service |
102278 |
int port_policydb_dbase_init(semanage_handle_t * handle,
|
|
Packit Service |
102278 |
dbase_config_t * dconfig)
|
|
Packit Service |
102278 |
{
|
|
Packit Service |
102278 |
|
|
Packit Service |
102278 |
if (dbase_policydb_init(handle,
|
|
Packit Service |
102278 |
semanage_path(SEMANAGE_ACTIVE, SEMANAGE_STORE_KERNEL),
|
|
Packit Service |
102278 |
semanage_path(SEMANAGE_TMP, SEMANAGE_STORE_KERNEL),
|
|
Packit Service |
102278 |
&SEMANAGE_PORT_RTABLE,
|
|
Packit Service |
102278 |
&SEMANAGE_PORT_POLICYDB_RTABLE,
|
|
Packit Service |
102278 |
&dconfig->dbase) < 0)
|
|
Packit Service |
102278 |
return STATUS_ERR;
|
|
Packit Service |
102278 |
|
|
Packit Service |
102278 |
dconfig->dtable = &SEMANAGE_POLICYDB_DTABLE;
|
|
Packit Service |
102278 |
|
|
Packit Service |
102278 |
return STATUS_SUCCESS;
|
|
Packit Service |
102278 |
}
|
|
Packit Service |
102278 |
|
|
Packit Service |
102278 |
void port_policydb_dbase_release(dbase_config_t * dconfig)
|
|
Packit Service |
102278 |
{
|
|
Packit Service |
102278 |
|
|
Packit Service |
102278 |
dbase_policydb_release(dconfig->dbase);
|
|
Packit Service |
102278 |
}
|