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

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

 




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@xxxxxxxxxxxxx>
---

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@xxxxxxxxxxxxx>
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@xxxxxxxxxxxxx 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@xxxxxxxxxxxxx with
the words "unsubscribe selinux" without quotes as the message.

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

  Powered by Linux