Lines Matching refs:sh
56 static int parse_module_headers(semanage_handle_t * sh, char *module_data, in parse_module_headers() argument
64 ERR(sh, "Out of memory!"); in parse_module_headers()
68 sepol_policy_file_set_handle(pf, sh->sepolh); in parse_module_headers()
73 ERR(sh, "Could not parse module data."); in parse_module_headers()
78 …ERR(sh, "Data did not represent a pp module. Please upgrade to the latest version of libsemanage t… in parse_module_headers()
88 int semanage_module_install_pp(semanage_handle_t * sh, in semanage_module_install_pp() argument
95 if ((status = parse_module_headers(sh, module_data, data_len, &name, &version)) != 0) { in semanage_module_install_pp()
99 status = semanage_module_install_hll(sh, module_data, data_len, name, "pp"); in semanage_module_install_pp()
107 int semanage_module_install_hll(semanage_handle_t * sh, in semanage_module_install_hll() argument
110 if (sh->funcs->install == NULL) { in semanage_module_install_hll()
111 ERR(sh, in semanage_module_install_hll()
114 } else if (!sh->is_connected) { in semanage_module_install_hll()
115 ERR(sh, "Not connected."); in semanage_module_install_hll()
117 } else if (!sh->is_in_transaction) { in semanage_module_install_hll()
118 if (semanage_begin_transaction(sh) < 0) { in semanage_module_install_hll()
122 sh->modules_modified = 1; in semanage_module_install_hll()
123 return sh->funcs->install(sh, module_data, data_len, name, ext_lang); in semanage_module_install_hll()
126 int semanage_module_install_file(semanage_handle_t * sh, in semanage_module_install_file() argument
129 if (sh->funcs->install_file == NULL) { in semanage_module_install_file()
130 ERR(sh, in semanage_module_install_file()
133 } else if (!sh->is_connected) { in semanage_module_install_file()
134 ERR(sh, "Not connected."); in semanage_module_install_file()
136 } else if (!sh->is_in_transaction) { in semanage_module_install_file()
137 if (semanage_begin_transaction(sh) < 0) { in semanage_module_install_file()
141 sh->modules_modified = 1; in semanage_module_install_file()
142 return sh->funcs->install_file(sh, module_name); in semanage_module_install_file()
145 int semanage_module_extract(semanage_handle_t * sh, in semanage_module_extract() argument
151 if (sh->funcs->extract == NULL) { in semanage_module_extract()
152 ERR(sh, in semanage_module_extract()
155 } else if (!sh->is_connected) { in semanage_module_extract()
156 ERR(sh, "Not connected."); in semanage_module_extract()
159 return sh->funcs->extract(sh, modkey, extract_cil, mapped_data, data_len, modinfo); in semanage_module_extract()
165 int semanage_module_upgrade(semanage_handle_t * sh, in semanage_module_upgrade() argument
168 return semanage_module_install_pp(sh, module_data, data_len); in semanage_module_upgrade()
175 int semanage_module_upgrade_file(semanage_handle_t * sh, in semanage_module_upgrade_file() argument
178 return semanage_module_install_file(sh, module_name); in semanage_module_upgrade_file()
184 int semanage_module_install_base(semanage_handle_t * sh, in semanage_module_install_base() argument
187 return semanage_module_install_pp(sh, module_data, data_len); in semanage_module_install_base()
193 int semanage_module_install_base_file(semanage_handle_t * sh, in semanage_module_install_base_file() argument
196 return semanage_module_install_file(sh, module_name); in semanage_module_install_base_file()
199 int semanage_module_remove(semanage_handle_t * sh, char *module_name) in semanage_module_remove() argument
201 if (sh->funcs->remove == NULL) { in semanage_module_remove()
202 ERR(sh, "No remove function defined for this connection type."); in semanage_module_remove()
204 } else if (!sh->is_connected) { in semanage_module_remove()
205 ERR(sh, "Not connected."); in semanage_module_remove()
207 } else if (!sh->is_in_transaction) { in semanage_module_remove()
208 if (semanage_begin_transaction(sh) < 0) { in semanage_module_remove()
212 sh->modules_modified = 1; in semanage_module_remove()
213 return sh->funcs->remove(sh, module_name); in semanage_module_remove()
216 int semanage_module_list(semanage_handle_t * sh, in semanage_module_list() argument
219 if (sh->funcs->list == NULL) { in semanage_module_list()
220 ERR(sh, "No list function defined for this connection type."); in semanage_module_list()
222 } else if (!sh->is_connected) { in semanage_module_list()
223 ERR(sh, "Not connected."); in semanage_module_list()
226 return sh->funcs->list(sh, modinfo, num_modules); in semanage_module_list()
270 int semanage_module_info_create(semanage_handle_t *sh, in semanage_module_info_create() argument
273 assert(sh); in semanage_module_info_create()
279 return semanage_module_info_init(sh, *modinfo); in semanage_module_info_create()
284 int semanage_module_info_destroy(semanage_handle_t *sh, in hidden_def()
287 assert(sh); in hidden_def()
296 return semanage_module_info_init(sh, modinfo); in hidden_def()
301 int semanage_module_info_init(semanage_handle_t *sh, in hidden_def()
304 assert(sh); in hidden_def()
315 int semanage_module_info_clone(semanage_handle_t *sh, in semanage_module_info_clone() argument
319 assert(sh); in semanage_module_info_clone()
326 ret = semanage_module_info_destroy(sh, target); in semanage_module_info_clone()
332 ret = semanage_module_info_set_priority(sh, target, source->priority); in semanage_module_info_clone()
338 ret = semanage_module_info_set_name(sh, target, source->name); in semanage_module_info_clone()
344 ret = semanage_module_info_set_lang_ext(sh, target, source->lang_ext); in semanage_module_info_clone()
350 ret = semanage_module_info_set_enabled(sh, target, source->enabled); in semanage_module_info_clone()
357 if (status != 0) semanage_module_info_destroy(sh, target); in semanage_module_info_clone()
361 int semanage_module_info_get_priority(semanage_handle_t *sh, in semanage_module_info_get_priority() argument
365 assert(sh); in semanage_module_info_get_priority()
376 int semanage_module_info_get_name(semanage_handle_t *sh, in hidden_def()
380 assert(sh); in hidden_def()
391 int semanage_module_info_get_lang_ext(semanage_handle_t *sh, in hidden_def()
395 assert(sh); in hidden_def()
406 int semanage_module_info_get_enabled(semanage_handle_t *sh, in hidden_def()
410 assert(sh); in hidden_def()
421 int semanage_module_info_set_priority(semanage_handle_t *sh, in hidden_def()
425 assert(sh); in hidden_def()
431 ERR(sh, "Priority %d is invalid.", priority); in hidden_def()
442 int semanage_module_info_set_name(semanage_handle_t *sh, in hidden_def()
446 assert(sh); in hidden_def()
455 ERR(sh, "Name %s is invalid.", name); in hidden_def()
461 ERR(sh, "No memory available for strdup"); in hidden_def()
473 int semanage_module_info_set_lang_ext(semanage_handle_t *sh, in hidden_def()
477 assert(sh); in hidden_def()
486 ERR(sh, "Language extensions %s is invalid.", lang_ext); in hidden_def()
492 ERR(sh, "No memory available for strdup"); in hidden_def()
504 int semanage_module_info_set_enabled(semanage_handle_t *sh, in hidden_def()
508 assert(sh); in hidden_def()
514 ERR(sh, "Enabled status %d is invalid.", enabled); in hidden_def()
525 int semanage_module_get_path(semanage_handle_t *sh, in hidden_def()
531 assert(sh); in hidden_def()
541 modules_path = sh->is_in_transaction ? in hidden_def()
551 ERR(sh, in hidden_def()
564 ERR(sh, "Unable to compose priority path."); in hidden_def()
574 ERR(sh, in hidden_def()
584 ERR(sh, "Name %s is invalid.", modinfo->name); in hidden_def()
596 ERR(sh, "Unable to compose name path."); in hidden_def()
614 ERR(sh, in hidden_def()
624 ERR(sh, "Name %s is invalid.", modinfo->name); in hidden_def()
637 ERR(sh, in hidden_def()
649 ERR(sh, "Name %s is invalid.", modinfo->name); in hidden_def()
660 ERR(sh, in hidden_def()
667 ERR(sh, "Invalid module path type %d.", type); in hidden_def()
676 int semanage_module_key_create(semanage_handle_t *sh, in semanage_module_key_create() argument
679 assert(sh); in semanage_module_key_create()
685 return semanage_module_key_init(sh, *modkey); in semanage_module_key_create()
690 int semanage_module_key_destroy(semanage_handle_t *sh, in hidden_def()
693 assert(sh); in hidden_def()
701 return semanage_module_key_init(sh, modkey); in hidden_def()
706 int semanage_module_key_init(semanage_handle_t *sh, in hidden_def()
709 assert(sh); in hidden_def()
718 int semanage_module_key_get_name(semanage_handle_t *sh, in semanage_module_key_get_name() argument
722 assert(sh); in semanage_module_key_get_name()
733 int semanage_module_key_get_priority(semanage_handle_t *sh, in hidden_def()
737 assert(sh); in hidden_def()
748 int semanage_module_key_set_name(semanage_handle_t *sh, in hidden_def()
752 assert(sh); in hidden_def()
761 ERR(sh, "Name %s is invalid.", name); in hidden_def()
767 ERR(sh, "No memory available for strdup"); in hidden_def()
781 int semanage_module_key_set_priority(semanage_handle_t *sh, in hidden_def()
785 assert(sh); in hidden_def()
790 ERR(sh, "Priority %d is invalid.", priority); in hidden_def()
801 int semanage_module_get_enabled_1_1(semanage_handle_t *sh, in hidden_def()
805 assert(sh); in hidden_def()
809 if (sh->funcs->get_enabled == NULL) { in hidden_def()
810 ERR(sh, in hidden_def()
813 } else if (!sh->is_connected) { in hidden_def()
814 ERR(sh, "Not connected."); in hidden_def()
818 return sh->funcs->get_enabled(sh, modkey, enabled); in hidden_def()
826 int semanage_module_set_enabled(semanage_handle_t *sh, in semanage_module_set_enabled() argument
830 assert(sh); in semanage_module_set_enabled()
833 if (sh->funcs->set_enabled == NULL) { in semanage_module_set_enabled()
834 ERR(sh, in semanage_module_set_enabled()
837 } else if (!sh->is_connected) { in semanage_module_set_enabled()
838 ERR(sh, "Not connected."); in semanage_module_set_enabled()
840 } else if (!sh->is_in_transaction) { in semanage_module_set_enabled()
841 if (semanage_begin_transaction(sh) < 0) { in semanage_module_set_enabled()
846 sh->modules_modified = 1; in semanage_module_set_enabled()
847 return sh->funcs->set_enabled(sh, modkey, enabled); in semanage_module_set_enabled()
854 int semanage_module_enable(semanage_handle_t *sh, char *module_name) in hidden_def()
859 rc = semanage_module_key_create(sh, &modkey); in hidden_def()
863 rc = semanage_module_key_set_name(sh, modkey, module_name); in hidden_def()
867 rc = semanage_module_set_enabled(sh, modkey, 1); in hidden_def()
874 semanage_module_key_destroy(sh, modkey); in hidden_def()
882 int semanage_module_disable(semanage_handle_t *sh, char *module_name) in semanage_module_disable() argument
887 rc = semanage_module_key_create(sh, &modkey); in semanage_module_disable()
891 rc = semanage_module_key_set_name(sh, modkey, module_name); in semanage_module_disable()
895 rc = semanage_module_set_enabled(sh, modkey, 0); in semanage_module_disable()
902 semanage_module_key_destroy(sh, modkey); in semanage_module_disable()
1069 int semanage_module_get_module_info(semanage_handle_t *sh, in semanage_module_get_module_info() argument
1073 assert(sh); in semanage_module_get_module_info()
1077 if (sh->funcs->get_module_info == NULL) { in semanage_module_get_module_info()
1078 ERR(sh, in semanage_module_get_module_info()
1081 } else if (!sh->is_connected) { in semanage_module_get_module_info()
1082 ERR(sh, "Not connected."); in semanage_module_get_module_info()
1086 return sh->funcs->get_module_info(sh, modkey, modinfo); in semanage_module_get_module_info()
1089 int semanage_module_list_all(semanage_handle_t *sh, in semanage_module_list_all() argument
1093 assert(sh); in semanage_module_list_all()
1097 if (sh->funcs->list_all == NULL) { in semanage_module_list_all()
1098 ERR(sh, in semanage_module_list_all()
1101 } else if (!sh->is_connected) { in semanage_module_list_all()
1102 ERR(sh, "Not connected."); in semanage_module_list_all()
1106 return sh->funcs->list_all(sh, modinfos, modinfos_len); in semanage_module_list_all()
1109 int semanage_module_install_info(semanage_handle_t *sh, in semanage_module_install_info() argument
1114 if (sh->funcs->install_info == NULL) { in semanage_module_install_info()
1115 ERR(sh, in semanage_module_install_info()
1118 } else if (!sh->is_connected) { in semanage_module_install_info()
1119 ERR(sh, "Not connected."); in semanage_module_install_info()
1121 } else if (!sh->is_in_transaction) { in semanage_module_install_info()
1122 if (semanage_begin_transaction(sh) < 0) { in semanage_module_install_info()
1126 sh->modules_modified = 1; in semanage_module_install_info()
1127 return sh->funcs->install_info(sh, modinfo, data, data_len); in semanage_module_install_info()
1130 int semanage_module_remove_key(semanage_handle_t *sh, in semanage_module_remove_key() argument
1133 if (sh->funcs->remove_key == NULL) { in semanage_module_remove_key()
1134 ERR(sh, in semanage_module_remove_key()
1137 } else if (!sh->is_connected) { in semanage_module_remove_key()
1138 ERR(sh, "Not connected."); in semanage_module_remove_key()
1140 } else if (!sh->is_in_transaction) { in semanage_module_remove_key()
1141 if (semanage_begin_transaction(sh) < 0) { in semanage_module_remove_key()
1145 sh->modules_modified = 1; in semanage_module_remove_key()
1146 return sh->funcs->remove_key(sh, modkey); in semanage_module_remove_key()