mirror of
https://github.com/SELinuxProject/selinux
synced 2025-02-01 10:21:52 +00:00
Allow to use compressed modules without a compression extension
When a compressed module doesn't have two extensions with lang and compression, 'semodule -i <module>.<lang>' fails. This changes the language detection to allow to use modules only with .<lang> extension. Fixes: libsemanage.semanage_direct_install_file: Module does not have a valid extension. (No such file or directory). Signed-off-by: Petr Lautrbach <plautrba@redhat.com> Acked-by: Steve Lawrence <slawrence@tresys.com>
This commit is contained in:
parent
b11ffdd290
commit
b9124ecddb
@ -1435,7 +1435,7 @@ static int semanage_direct_install_file(semanage_handle_t * sh,
|
||||
int in_fd = -1;
|
||||
char *path = NULL;
|
||||
char *filename;
|
||||
char *lang_ext;
|
||||
char *lang_ext = NULL;
|
||||
char *separator;
|
||||
|
||||
if ((in_fd = open(install_filename, O_RDONLY)) == -1) {
|
||||
@ -1467,17 +1467,20 @@ static int semanage_direct_install_file(semanage_handle_t * sh,
|
||||
goto cleanup;
|
||||
}
|
||||
*separator = '\0';
|
||||
lang_ext = separator + 1;
|
||||
}
|
||||
|
||||
separator = strrchr(filename, '.');
|
||||
if (separator == NULL) {
|
||||
ERR(sh, "Module does not have a valid extension.");
|
||||
retval = -1;
|
||||
goto cleanup;
|
||||
if (lang_ext == NULL) {
|
||||
ERR(sh, "Module does not have a valid extension.");
|
||||
retval = -1;
|
||||
goto cleanup;
|
||||
}
|
||||
} else {
|
||||
*separator = '\0';
|
||||
lang_ext = separator + 1;
|
||||
}
|
||||
*separator = '\0';
|
||||
|
||||
lang_ext = separator + 1;
|
||||
|
||||
retval = semanage_direct_install(sh, data, data_len, filename, lang_ext);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user