File tree Expand file tree Collapse file tree 3 files changed +28
-8
lines changed Expand file tree Collapse file tree 3 files changed +28
-8
lines changed Original file line number Diff line number Diff line change 3030struct semanage_handle ;
3131typedef struct semanage_handle semanage_handle_t ;
3232
33- /* Create and return a semanage handle.
33+ /* Create and return a semanage handle with a specific config path.
34+ The handle is initially in the disconnected state. */
35+ semanage_handle_t * semanage_handle_create_with_path (const char * conf_name );
36+
37+ /* Create and return a semanage handle with the default config path.
3438 The handle is initially in the disconnected state. */
3539extern semanage_handle_t * semanage_handle_create (void );
3640
Original file line number Diff line number Diff line change @@ -59,19 +59,14 @@ const char * semanage_root(void)
5959 return private_semanage_root ;
6060}
6161
62-
63- semanage_handle_t * semanage_handle_create (void )
62+ semanage_handle_t * semanage_handle_create_with_path (const char * conf_name )
6463{
6564 semanage_handle_t * sh = NULL ;
66- char * conf_name = NULL ;
6765
6866 /* Allocate handle */
6967 if ((sh = calloc (1 , sizeof (semanage_handle_t ))) == NULL )
7068 goto err ;
7169
72- if ((conf_name = semanage_conf_path ()) == NULL )
73- goto err ;
74-
7570 if ((sh -> conf = semanage_conf_parse (conf_name )) == NULL )
7671 goto err ;
7772
@@ -106,13 +101,30 @@ semanage_handle_t *semanage_handle_create(void)
106101 sh -> msg_callback = semanage_msg_default_handler ;
107102 sh -> msg_callback_arg = NULL ;
108103
104+ return sh ;
105+
106+ err :
107+ semanage_handle_destroy (sh );
108+ return NULL ;
109+ }
110+
111+ semanage_handle_t * semanage_handle_create (void )
112+ {
113+ semanage_handle_t * sh = NULL ;
114+ char * conf_name = NULL ;
115+
116+ if ((conf_name = semanage_conf_path ()) == NULL )
117+ goto err ;
118+
119+ if ((sh = semanage_handle_create_with_path (conf_name )) == NULL )
120+ goto err ;
121+
109122 free (conf_name );
110123
111124 return sh ;
112125
113126 err :
114127 free (conf_name );
115- semanage_handle_destroy (sh );
116128 return NULL ;
117129}
118130
Original file line number Diff line number Diff line change @@ -350,3 +350,7 @@ LIBSEMANAGE_3.4 {
350350 semanage_module_compute_checksum;
351351 semanage_set_check_ext_changes;
352352} LIBSEMANAGE_1.1;
353+
354+ LIBSEMANAGE_3.5 {
355+ semanage_handle_create_with_path;
356+ } LIBSEMANAGE_3.4;
You can’t perform that action at this time.
0 commit comments