1 /* Copyright (C) 2005 Red Hat, Inc. */
2 
3 struct semanage_user;
4 struct semanage_user_key;
5 typedef struct semanage_user record_t;
6 typedef struct semanage_user_key record_key_t;
7 #define DBASE_RECORD_DEFINED
8 
9 struct semanage_user_base;
10 struct semanage_user_extra;
11 typedef struct semanage_user_base record1_t;
12 typedef struct semanage_user_extra record2_t;
13 #define DBASE_RECORD_JOIN_DEFINED
14 
15 struct dbase_join;
16 typedef struct dbase_join dbase_t;
17 #define DBASE_DEFINED
18 
19 #include <semanage/handle.h>
20 #include "user_internal.h"
21 #include "database_join.h"
22 #include "debug.h"
23 
24 /* USER record: JOIN extension: method table */
25 record_join_table_t SEMANAGE_USER_JOIN_RTABLE = {
26 	.join = semanage_user_join,
27 	.split = semanage_user_split,
28 };
29 
user_join_dbase_init(semanage_handle_t * handle,dbase_config_t * join1,dbase_config_t * join2,dbase_config_t * dconfig)30 int user_join_dbase_init(semanage_handle_t * handle,
31 			 dbase_config_t * join1,
32 			 dbase_config_t * join2, dbase_config_t * dconfig)
33 {
34 
35 	if (dbase_join_init(handle,
36 			    &SEMANAGE_USER_RTABLE,
37 			    &SEMANAGE_USER_JOIN_RTABLE,
38 			    join1, join2, &dconfig->dbase) < 0)
39 		return STATUS_ERR;
40 
41 	dconfig->dtable = &SEMANAGE_JOIN_DTABLE;
42 	return STATUS_SUCCESS;
43 }
44 
user_join_dbase_release(dbase_config_t * dconfig)45 void user_join_dbase_release(dbase_config_t * dconfig)
46 {
47 
48 	dbase_join_release(dconfig->dbase);
49 }
50