All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steve Lawrence <slawrence@tresys.com>
To: Stephen Smalley <sds@tycho.nsa.gov>, <selinux@tycho.nsa.gov>
Subject: Re: [PATCH] libselinux:  label_file:  handle newlines in file names
Date: Tue, 24 Feb 2015 11:45:07 -0500	[thread overview]
Message-ID: <54ECAA93.50602@tresys.com> (raw)
In-Reply-To: <1424792581-17675-1-git-send-email-sds@tycho.nsa.gov>

On 02/24/2015 10:43 AM, Stephen Smalley wrote:
> From: Nick Kralevich <nnk@google.com>
> 
> restorecon on file names with newlines are not handled properly.
> Use PCRE_DOTALL so that dots in regular expressions match all
> characters, and don't exclude the newline character.
> 
> See https://www.mail-archive.com/seandroid-list@tycho.nsa.gov/msg02001.html
> for background.
> 
> Change-Id: I0dde8f2567305f746d19ebd75a9e2add7406eb9a
> Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
> ---
>  libselinux/src/label_file.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libselinux/src/label_file.c b/libselinux/src/label_file.c
> index 71b085a..9d116eb 100644
> --- a/libselinux/src/label_file.c
> +++ b/libselinux/src/label_file.c
> @@ -129,7 +129,7 @@ static int compile_regex(struct saved_data *data, struct spec *spec, const char
>  	*cp = '\0';
>  
>  	/* Compile the regular expression. */
> -	spec->regex = pcre_compile(anchored_regex, 0, &tmperrbuf, &erroff, NULL);
> +	spec->regex = pcre_compile(anchored_regex, PCRE_DOTALL, &tmperrbuf, &erroff, NULL);
>  	free(anchored_regex);
>  	if (!spec->regex) {
>  		if (errbuf)
> 

Do we need a similar change in sefcontext_compile.c? It also looks like
mcstrans compiles regular expressions, but I don't think those are
related to matching paths.

- Steve

  reply	other threads:[~2015-02-24 16:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-24 15:43 [PATCH] libselinux: label_file: handle newlines in file names Stephen Smalley
2015-02-24 16:45 ` Steve Lawrence [this message]
2015-02-24 16:54   ` Stephen Smalley

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=54ECAA93.50602@tresys.com \
    --to=slawrence@tresys.com \
    --cc=sds@tycho.nsa.gov \
    --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.