Re: [PATCH 3/3] checkpolicy: Warn if module name different than filenames

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 03/25/2016 02:04 PM, James Carter wrote:
> Since the usual convention is for the module name to be same as the
> base filename of the module, provide a warning message if they are
> different. Also warn if the output filename is different than the
> module name.
> 
> Signed-off-by: James Carter <jwcart2@xxxxxxxxxxxxx>
> ---
>  checkpolicy/checkmodule.c | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/checkpolicy/checkmodule.c b/checkpolicy/checkmodule.c
> index 5957d29..5d1e219 100644
> --- a/checkpolicy/checkmodule.c
> +++ b/checkpolicy/checkmodule.c
> @@ -258,6 +258,19 @@ int main(int argc, char **argv)
>  		}
>  	}
>  
> +	if (policy_type != POLICY_BASE) {
> +		sepol_policydb_t *module = (sepol_policydb_t *)&modpolicydb;
> +		if (sepol_module_check_name_matches_filename(module, file)) {
> +			fprintf(stderr,	"Module name %s does not match input file %s\n",
> +				sepol_module_get_name(module), file);
> +		}
> +		if (outfile) {
> +			if (sepol_module_check_name_matches_filename(module, outfile)) {
> +				fprintf(stderr,	"Module name %s does not match output file %s\n", sepol_module_get_name(module), outfile);
> +			}
> +		}
> +	}

Probably want a "Warning:" prefix here as well, and possibly some hint
as to which name is preferred or will be used by the system.

Do we actually care about the input file name?

> +
>  	if (modpolicydb.policy_type == POLICY_BASE && !cil) {
>  		/* Verify that we can successfully expand the base module. */
>  		policydb_t kernpolicydb;
> 

_______________________________________________
Selinux mailing list
Selinux@xxxxxxxxxxxxx
To unsubscribe, send email to Selinux-leave@xxxxxxxxxxxxx.
To get help, send an email containing "help" to Selinux-request@xxxxxxxxxxxxx.



[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux