Research Menu

.
Skip Search Box

SELinux Mailing List

Re: [PATCH] libselinux: allow shell-style wildcarding in X names

From: Joe Nall <joe_at_nall.com>
Date: Fri, 14 Nov 2008 18:34:18 -0600

On Nov 14, 2008, at 4:26 PM, Eamon Walsh wrote:

> This patch replaces the exact strcmp/single fixed wildcard in the X
> contexts code with a call to fnmatch(3) which will allow shell-style
> matching constructions (*, ?, and []) in the x_contexts file,

Most appreciated

joe

> such as:
>
> property XT_SELECTION* system_u:object_r:clipboard_xproperty_t:s0
>
> Signed-off-by: Eamon Walsh <ewalsh@tycho.nsa.gov>
> ---
>
> label_x.c | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
>
> diff --git a/libselinux/src/label_x.c b/libselinux/src/label_x.c
> index 6a190f5..a9bfaa5 100644
> --- a/libselinux/src/label_x.c
> +++ b/libselinux/src/label_x.c
> @@ -11,6 +11,7 @@
> #include <ctype.h>
> #include <errno.h>
> #include <limits.h>
> +#include <fnmatch.h>
> #include "callbacks.h"
> #include "label_internal.h"
>
> @@ -199,9 +200,7 @@ static struct selabel_lookup_rec *lookup(struct
> selabel_handle *rec,
> for (i = 0; i < data->nspec; i++) {
> if (spec_arr[i].type != type)
> continue;
> - if (!strncmp(spec_arr[i].key, "*", 2))
> - break;
> - if (!strncmp(spec_arr[i].key, key, strlen(key) + 1))
> + if (!fnmatch(spec_arr[i].key, key, 0))
> break;
> }
>
>
>
>
> --
> Eamon Walsh <ewalsh@tycho.nsa.gov>
> National Security Agency
>
>
> --
> This message was distributed to subscribers of the selinux mailing
> list.
> If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov
> with
> the words "unsubscribe selinux" without quotes as the message.

--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to majordomo@tycho.nsa.gov with
the words "unsubscribe selinux" without quotes as the message.
Received on Fri 14 Nov 2008 - 19:34:25 EST
 

Date Posted: Jan 15, 2009 | Last Modified: Jan 15, 2009 | Last Reviewed: Jan 15, 2009

 
bottom

National Security Agency / Central Security Service