diff mbox

libsemanage: Do not always print a module name warning

Message ID 20160927155113.19322-1-mgrepl@redhat.com (mailing list archive)
State Not Applicable
Headers show

Commit Message

Miroslav Grepl Sept. 27, 2016, 3:51 p.m. UTC
From: Miroslav Grep <mgrepl@redhat.com>

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

Signed-off-by: Miroslav Grepl <mgrepl@redhat.com>
---
 libsemanage/src/direct_api.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Stephen Smalley Sept. 27, 2016, 4:15 p.m. UTC | #1
On 09/27/2016 11:51 AM, Miroslav Grepl wrote:
> From: Miroslav Grep <mgrepl@redhat.com>
> 
> 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.

> 
> Signed-off-by: Miroslav Grepl <mgrepl@redhat.com>
> ---
>  libsemanage/src/direct_api.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/libsemanage/src/direct_api.c b/libsemanage/src/direct_api.c
> index 4320f43..3719cb1 100644
> --- a/libsemanage/src/direct_api.c
> +++ b/libsemanage/src/direct_api.c
> @@ -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);
>
diff mbox

Patch

diff --git a/libsemanage/src/direct_api.c b/libsemanage/src/direct_api.c
index 4320f43..3719cb1 100644
--- a/libsemanage/src/direct_api.c
+++ b/libsemanage/src/direct_api.c
@@ -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);