Skip to contentSkip to conversation

libselinux: add "event" type to X contexts backend

PATCH In review Eamon Walsh 2 participants 3 messages Oct 18, 2007 – Oct 19, 2007 SELinux security module

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libselinux: add "event" type to X contexts backend

This patch adds an event type to the X contexts backend, so that X Flask module can support labeling events based on their protocol name.

---

include/selinux/label.h |    1 +
src/label_x.c           |    4 +++-
2 files changed, 4 insertions(+), 1 deletion(-)
include/selinux/label.h +0 -0
Index: libselinux/include/selinux/label.h
===================================================================
@@ -111,6 +111,7 @@

#define SELABEL_X_PROP 1
#define SELABEL_X_EXT 2
#define SELABEL_X_CLIENT 3
+#define SELABEL_X_EVENT 4

#ifdef __cplusplus

src/label_x.c +0 -0
Index: libselinux/src/label_x.c
===================================================================
@@ -65,9 +65,11 @@
			data->spec_arr[data->nspec].type = SELABEL_X_EXT;
		else if (!strcmp(type, "client"))
			data->spec_arr[data->nspec].type = SELABEL_X_CLIENT;
+		else if (!strcmp(type, "event"))
+			data->spec_arr[data->nspec].type = SELABEL_X_EVENT;
		else {
			selinux_log(SELINUX_WARNING,
-				    "%s:  line %d has invalid file type %s\n",
+				    "%s:  line %d has invalid object type %s\n",
				    path, lineno, type);
			return 0;
		}
Signature · 8 lines
Eamon Walsh <[email protected]>
National Security Agency


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
#1 lore raw

Here is a revised version of the patch that adds not one but two backends, one for X event names and one for X "selections" which are the clipboard objects used in cut & paste.

This is so the X Flask module can support labeling these objects based on their names.

---

include/selinux/label.h |    2 ++
src/label_x.c           |    6 +++++-
2 files changed, 7 insertions(+), 1 deletion(-)
include/selinux/label.h +0 -0
Index: libselinux/include/selinux/label.h
===================================================================
@@ -111,6 +111,8 @@

#define SELABEL_X_PROP 1
#define SELABEL_X_EXT 2
#define SELABEL_X_CLIENT 3
+#define SELABEL_X_EVENT 4
+#define SELABEL_X_SELN 5

#ifdef __cplusplus

src/label_x.c +0 -0
Index: libselinux/src/label_x.c
===================================================================
@@ -65,9 +65,13 @@
			data->spec_arr[data->nspec].type = SELABEL_X_EXT;
		else if (!strcmp(type, "client"))
			data->spec_arr[data->nspec].type = SELABEL_X_CLIENT;
+		else if (!strcmp(type, "event"))
+			data->spec_arr[data->nspec].type = SELABEL_X_EVENT;
+		else if (!strcmp(type, "selection"))
+			data->spec_arr[data->nspec].type = SELABEL_X_SELN;
		else {
			selinux_log(SELINUX_WARNING,
-				    "%s:  line %d has invalid file type %s\n",
+				    "%s:  line %d has invalid object type %s\n",
				    path, lineno, type);
			return 0;
		}
Signature · 8 lines
Eamon Walsh <[email protected]>
National Security Agency


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.
#2 lore raw
Quoted 8 lines · Eamon Walsh

Here is a revised version of the patch that adds not one but two backends, one for X event names and one for X "selections" which are the clipboard objects used in cut & paste.

This is so the X Flask module can support labeling these objects based on their names.

Quoted 40 lines

---

 include/selinux/label.h |    2 ++
 src/label_x.c           |    6 +++++-
 2 files changed, 7 insertions(+), 1 deletion(-)

Index: libselinux/include/selinux/label.h
===================================================================

include/selinux/label.h +2 -0
@@ -111,6 +111,8 @@
 #define SELABEL_X_PROP		1
 #define SELABEL_X_EXT		2
 #define SELABEL_X_CLIENT	3
+#define SELABEL_X_EVENT		4
+#define SELABEL_X_SELN		5
 
 
 #ifdef __cplusplus

Index: libselinux/src/label_x.c
===================================================================

src/label_x.c +5 -1
@@ -65,9 +65,13 @@
 			data->spec_arr[data->nspec].type = SELABEL_X_EXT;
 		else if (!strcmp(type, "client"))
 			data->spec_arr[data->nspec].type = SELABEL_X_CLIENT;
+		else if (!strcmp(type, "event"))
+			data->spec_arr[data->nspec].type = SELABEL_X_EVENT;
+		else if (!strcmp(type, "selection"))
+			data->spec_arr[data->nspec].type = SELABEL_X_SELN;
 		else {
 			selinux_log(SELINUX_WARNING,
-				    "%s:  line %d has invalid file type %s\n",
+				    "%s:  line %d has invalid object type %s\n",
 				    path, lineno, type);
 			return 0;
 		}
Signature · 8 lines
Stephen Smalley
National Security Agency


--
This message was distributed to subscribers of the selinux mailing list.
If you no longer wish to subscribe, send mail to [email protected] with
the words "unsubscribe selinux" without quotes as the message.