|
Packit |
366192 |
/*
|
|
Packit |
366192 |
* Copyright (C) 2017 Mellanox Technologies Inc
|
|
Packit |
366192 |
*
|
|
Packit |
366192 |
* This library is free software; you can redistribute it and/or
|
|
Packit |
366192 |
* modify it under the terms of the GNU Lesser General Public
|
|
Packit |
366192 |
* License as published by the Free Software Foundation; either
|
|
Packit |
366192 |
* version 2.1 of the License, or (at your option) any later version.
|
|
Packit |
366192 |
*
|
|
Packit |
366192 |
* This library is distributed in the hope that it will be useful,
|
|
Packit |
366192 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
Packit |
366192 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Packit |
366192 |
* Lesser General Public License for more details.
|
|
Packit |
366192 |
*/
|
|
Packit |
366192 |
|
|
Packit |
366192 |
struct semanage_ibendport;
|
|
Packit |
366192 |
struct semanage_ibendport_key;
|
|
Packit |
366192 |
typedef struct semanage_ibendport record_t;
|
|
Packit |
366192 |
typedef struct semanage_ibendport_key record_key_t;
|
|
Packit |
366192 |
#define DBASE_RECORD_DEFINED
|
|
Packit |
366192 |
|
|
Packit |
366192 |
struct dbase_policydb;
|
|
Packit |
366192 |
typedef struct dbase_policydb dbase_t;
|
|
Packit |
366192 |
#define DBASE_DEFINED
|
|
Packit |
366192 |
|
|
Packit |
366192 |
#include <sepol/ibendports.h>
|
|
Packit |
366192 |
#include <semanage/handle.h>
|
|
Packit |
366192 |
#include "ibendport_internal.h"
|
|
Packit |
366192 |
#include "debug.h"
|
|
Packit |
366192 |
#include "database_policydb.h"
|
|
Packit |
366192 |
#include "semanage_store.h"
|
|
Packit |
366192 |
|
|
Packit |
366192 |
/* IBENDPORT RECORD (SEPOL): POLICYDB extension : method table */
|
|
Packit |
366192 |
record_policydb_table_t SEMANAGE_IBENDPORT_POLICYDB_RTABLE = {
|
|
Packit |
366192 |
.add = NULL,
|
|
Packit |
366192 |
.modify = (record_policydb_table_modify_t)sepol_ibendport_modify,
|
|
Packit |
366192 |
.set = NULL,
|
|
Packit |
366192 |
.query = (record_policydb_table_query_t)sepol_ibendport_query,
|
|
Packit |
366192 |
.count = (record_policydb_table_count_t)sepol_ibendport_count,
|
|
Packit |
366192 |
.exists = (record_policydb_table_exists_t)sepol_ibendport_exists,
|
|
Packit |
366192 |
.iterate = (record_policydb_table_iterate_t)sepol_ibendport_iterate,
|
|
Packit |
366192 |
};
|
|
Packit |
366192 |
|
|
Packit |
366192 |
int ibendport_policydb_dbase_init(semanage_handle_t *handle,
|
|
Packit |
366192 |
dbase_config_t *dconfig)
|
|
Packit |
366192 |
{
|
|
Packit |
366192 |
if (dbase_policydb_init(handle,
|
|
Packit |
366192 |
semanage_path(SEMANAGE_ACTIVE, SEMANAGE_STORE_KERNEL),
|
|
Packit |
366192 |
semanage_path(SEMANAGE_TMP, SEMANAGE_STORE_KERNEL),
|
|
Packit |
366192 |
&SEMANAGE_IBENDPORT_RTABLE,
|
|
Packit |
366192 |
&SEMANAGE_IBENDPORT_POLICYDB_RTABLE,
|
|
Packit |
366192 |
&dconfig->dbase) < 0)
|
|
Packit |
366192 |
return STATUS_ERR;
|
|
Packit |
366192 |
|
|
Packit |
366192 |
dconfig->dtable = &SEMANAGE_POLICYDB_DTABLE;
|
|
Packit |
366192 |
|
|
Packit |
366192 |
return STATUS_SUCCESS;
|
|
Packit |
366192 |
}
|
|
Packit |
366192 |
|
|
Packit |
366192 |
void ibendport_policydb_dbase_release(dbase_config_t *dconfig)
|
|
Packit |
366192 |
{
|
|
Packit |
366192 |
dbase_policydb_release(dconfig->dbase);
|
|
Packit |
366192 |
}
|