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