All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steve Lawrence <slawrence@tresys.com>
To: Petr Lautrbach <plautrba@redhat.com>, <selinux@tycho.nsa.gov>
Subject: Re: [PATCH] Allow to use compressed modules without a compression extension
Date: Wed, 24 Jun 2015 12:36:22 -0400	[thread overview]
Message-ID: <558ADC86.8090108@tresys.com> (raw)
In-Reply-To: <1435162011-598-1-git-send-email-plautrba@redhat.com>

On 06/24/2015 12:06 PM, Petr Lautrbach wrote:
> 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>

Ack-by: Steve Lawrence <slawrence@tresys.com>

Thanks and applied.

> ---
>  libsemanage/src/direct_api.c | 17 ++++++++++-------
>  1 file changed, 10 insertions(+), 7 deletions(-)
> 
> diff --git a/libsemanage/src/direct_api.c b/libsemanage/src/direct_api.c
> index e4f168e..d57f934 100644
> --- a/libsemanage/src/direct_api.c
> +++ b/libsemanage/src/direct_api.c
> @@ -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);
>  
> 

      reply	other threads:[~2015-06-24 16:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-24 16:06 [PATCH] Allow to use compressed modules without a compression extension Petr Lautrbach
2015-06-24 16:36 ` Steve Lawrence [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=558ADC86.8090108@tresys.com \
    --to=slawrence@tresys.com \
    --cc=plautrba@redhat.com \
    --cc=selinux@tycho.nsa.gov \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.