Skip to contentSkip to conversation

libsemanage: Do not always print a module name warning

PATCH Applied Miroslav Grepl 2 participants 3 messages Sep 27, 2016 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libsemanage: Do not always print a module name warning

From: Miroslav Grep <[email protected]>

7a728e46 commit supposed to add a warning when a module name is different than a filename, but this warning is printed always. This commit fixes it.

Fixes:

$ semodule -X 400 -i testmod.pp
Warning: SELinux userspace will refer to the module from testmod.pp as
testmod rather than testmod
---
 libsemanage/src/direct_api.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
libsemanage/src/direct_api.c +3 -1
index 4320f43..3719cb1 100644
@@ -1619,7 +1619,9 @@ static int semanage_direct_install_file(semanage_handle_t * sh,
 		if ((retval = parse_module_headers(sh, data, data_len, &module_name, &version)) != 0)
 			goto cleanup;
 
-		fprintf(stderr, "Warning: SELinux userspace will refer to the module from %s as %s rather than %s\n", install_filename, module_name, filename);
+		if (strcmp(module_name, filename) != 0)
+			fprintf(stderr, "Warning: SELinux userspace will refer to the module from %s as %s rather than %s\n", install_filename, module_name, filename);
+
 		free(version);
 	}
 	retval = semanage_direct_install(sh, data, data_len, module_name, lang_ext);
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH 1/1 libsemanage: Do not always print a module name warning

From: Miroslav Grep <[email protected]>

7a728e46 commit supposed to add a warning when a module name is different than a filename, but this warning is printed always. This commit fixes it.

Fixes:

$ semodule -X 400 -i testmod.pp
Warning: SELinux userspace will refer to the module from testmod.pp as
testmod rather than testmod
---
 libsemanage/src/direct_api.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
libsemanage/src/direct_api.c +3 -1
index 4320f43..3719cb1 100644
@@ -1619,7 +1619,9 @@ static int semanage_direct_install_file(semanage_handle_t * sh,
 		if ((retval = parse_module_headers(sh, data, data_len, &module_name, &version)) != 0)
 			goto cleanup;
 
-		fprintf(stderr, "Warning: SELinux userspace will refer to the module from %s as %s rather than %s\n", install_filename, module_name, filename);
+		if (strcmp(module_name, filename) != 0)
+			fprintf(stderr, "Warning: SELinux userspace will refer to the module from %s as %s rather than %s\n", install_filename, module_name, filename);
+
 		free(version);
 	}
 	retval = semanage_direct_install(sh, data, data_len, module_name, lang_ext);
Signature · 1 line
1.8.3.1
#2 lore raw
In reply to Miroslav Grepl
Quoted 10 lines · Miroslav Grepl

From: Miroslav Grep <[email protected]>

7a728e46 commit supposed to add a warning when a module name is different than a filename, but this warning is printed always. This commit fixes it.

Fixes:

$ semodule -X 400 -i testmod.pp
Warning: SELinux userspace will refer to the module from testmod.pp as
testmod rather than testmod

Thanks, applied.

Quoted 22 lines
---
 libsemanage/src/direct_api.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
libsemanage/src/direct_api.c +3 -1
index 4320f43..3719cb1 100644
@@ -1619,7 +1619,9 @@ static int semanage_direct_install_file(semanage_handle_t * sh,
 		if ((retval = parse_module_headers(sh, data, data_len, &module_name, &version)) != 0)
 			goto cleanup;
 
-		fprintf(stderr, "Warning: SELinux userspace will refer to the module from %s as %s rather than %s\n", install_filename, module_name, filename);
+		if (strcmp(module_name, filename) != 0)
+			fprintf(stderr, "Warning: SELinux userspace will refer to the module from %s as %s rather than %s\n", install_filename, module_name, filename);
+
 		free(version);
 	}
 	retval = semanage_direct_install(sh, data, data_len, module_name, lang_ext);