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 30
30
struct semanage_handle ;
31
31
typedef struct semanage_handle semanage_handle_t ;
32
32
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.
34
38
The handle is initially in the disconnected state. */
35
39
extern semanage_handle_t * semanage_handle_create (void );
36
40
Original file line number Diff line number Diff line change @@ -59,19 +59,14 @@ const char * semanage_root(void)
59
59
return private_semanage_root ;
60
60
}
61
61
62
-
63
- semanage_handle_t * semanage_handle_create (void )
62
+ semanage_handle_t * semanage_handle_create_with_path (const char * conf_name )
64
63
{
65
64
semanage_handle_t * sh = NULL ;
66
- char * conf_name = NULL ;
67
65
68
66
/* Allocate handle */
69
67
if ((sh = calloc (1 , sizeof (semanage_handle_t ))) == NULL )
70
68
goto err ;
71
69
72
- if ((conf_name = semanage_conf_path ()) == NULL )
73
- goto err ;
74
-
75
70
if ((sh -> conf = semanage_conf_parse (conf_name )) == NULL )
76
71
goto err ;
77
72
@@ -106,13 +101,30 @@ semanage_handle_t *semanage_handle_create(void)
106
101
sh -> msg_callback = semanage_msg_default_handler ;
107
102
sh -> msg_callback_arg = NULL ;
108
103
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
+
109
122
free (conf_name );
110
123
111
124
return sh ;
112
125
113
126
err :
114
127
free (conf_name );
115
- semanage_handle_destroy (sh );
116
128
return NULL ;
117
129
}
118
130
Original file line number Diff line number Diff line change @@ -350,3 +350,7 @@ LIBSEMANAGE_3.4 {
350
350
semanage_module_compute_checksum;
351
351
semanage_set_check_ext_changes;
352
352
} LIBSEMANAGE_1.1;
353
+
354
+ LIBSEMANAGE_3.9 {
355
+ semanage_handle_create_with_path;
356
+ } LIBSEMANAGE_3.4;
You can’t perform that action at this time.
0 commit comments