1 /* Copyright (C) 2005 Red Hat, Inc. */
2 
3 struct semanage_seuser;
4 struct semanage_seuser_key;
5 typedef struct semanage_seuser_key record_key_t;
6 typedef struct semanage_seuser record_t;
7 #define DBASE_RECORD_DEFINED
8 
9 #include <sepol/policydb.h>
10 #include <sepol/context.h>
11 #include "user_internal.h"
12 #include "seuser_internal.h"
13 #include "handle.h"
14 #include "database.h"
15 #include "debug.h"
16 
semanage_seuser_query(semanage_handle_t * handle,const semanage_seuser_key_t * key,semanage_seuser_t ** response)17 int semanage_seuser_query(semanage_handle_t * handle,
18 			  const semanage_seuser_key_t * key,
19 			  semanage_seuser_t ** response)
20 {
21 
22 	dbase_config_t *dconfig = semanage_seuser_dbase_policy(handle);
23 	return dbase_query(handle, dconfig, key, response);
24 }
25 
semanage_seuser_exists(semanage_handle_t * handle,const semanage_seuser_key_t * key,int * response)26 int semanage_seuser_exists(semanage_handle_t * handle,
27 			   const semanage_seuser_key_t * key, int *response)
28 {
29 
30 	dbase_config_t *dconfig = semanage_seuser_dbase_policy(handle);
31 	return dbase_exists(handle, dconfig, key, response);
32 }
33 
semanage_seuser_count(semanage_handle_t * handle,unsigned int * response)34 int semanage_seuser_count(semanage_handle_t * handle, unsigned int *response)
35 {
36 
37 	dbase_config_t *dconfig = semanage_seuser_dbase_policy(handle);
38 	return dbase_count(handle, dconfig, response);
39 }
40 
semanage_seuser_iterate(semanage_handle_t * handle,int (* handler)(const semanage_seuser_t * record,void * varg),void * handler_arg)41 int semanage_seuser_iterate(semanage_handle_t * handle,
42 			    int (*handler) (const semanage_seuser_t * record,
43 					    void *varg), void *handler_arg)
44 {
45 
46 	dbase_config_t *dconfig = semanage_seuser_dbase_policy(handle);
47 	return dbase_iterate(handle, dconfig, handler, handler_arg);
48 }
49 
hidden_def(semanage_seuser_iterate)50 hidden_def(semanage_seuser_iterate)
51 
52 int semanage_seuser_list(semanage_handle_t * handle,
53 			 semanage_seuser_t *** records, unsigned int *count)
54 {
55 
56 	dbase_config_t *dconfig = semanage_seuser_dbase_policy(handle);
57 	return dbase_list(handle, dconfig, records, count);
58 }
59