| 
      
      
      From: <ew...@us...> - 2007-08-02 19:30:41
      
     | 
| Revision: 2508
          http://selinux.svn.sourceforge.net/selinux/?rev=2508&view=rev
Author:   ewalsh
Date:     2007-08-02 12:29:50 -0700 (Thu, 02 Aug 2007)
Log Message:
-----------
Author: Eamon Walsh
Email: ew...@ty...
Subject: libselinux: add x_contexts path lookup function
Date: Wed, 20 Jun 2007 16:10:53 -0400
This patch adds an selinux_x_context_path() function identical to
selinux_media_context_path(), fixing a hardcoded path in the X label
backend.
I'm bothered that some of these pathnames are exposed in the interface.
I assume that this done so libsemanage knows where to look.  But
having them in the interface could encourage users to depend on them
instead of libsemanage.
There are also a lot of these functions, maybe we should just expose 
the internal function that takes a type code.
Signed-off-by: Eamon Walsh <ew...@ty...>
Acked-by: Joshua Brindle <me...@ma...>
Modified Paths:
--------------
    trunk/libselinux/include/selinux/selinux.h
    trunk/libselinux/src/file_path_suffixes.h
    trunk/libselinux/src/label_x.c
    trunk/libselinux/src/selinux_config.c
    trunk/libselinux/src/selinux_internal.h
Modified: trunk/libselinux/include/selinux/selinux.h
===================================================================
--- trunk/libselinux/include/selinux/selinux.h	2007-08-01 19:38:34 UTC (rev 2507)
+++ trunk/libselinux/include/selinux/selinux.h	2007-08-02 19:29:50 UTC (rev 2508)
@@ -454,6 +454,7 @@
 extern const char *selinux_file_context_local_path(void);
 extern const char *selinux_homedir_context_path(void);
 extern const char *selinux_media_context_path(void);
+extern const char *selinux_x_context_path(void);
 extern const char *selinux_contexts_path(void);
 extern const char *selinux_securetty_types_path(void);
 extern const char *selinux_booleans_path(void);
Modified: trunk/libselinux/src/file_path_suffixes.h
===================================================================
--- trunk/libselinux/src/file_path_suffixes.h	2007-08-01 19:38:34 UTC (rev 2507)
+++ trunk/libselinux/src/file_path_suffixes.h	2007-08-02 19:29:50 UTC (rev 2508)
@@ -18,3 +18,4 @@
     S_(NETFILTER_CONTEXTS, "/contexts/netfilter_contexts")
     S_(FILE_CONTEXTS_HOMEDIR, "/contexts/files/file_contexts.homedir")
     S_(FILE_CONTEXTS_LOCAL, "/contexts/files/file_contexts.local")
+    S_(X_CONTEXTS, "/contexts/x_contexts")
Modified: trunk/libselinux/src/label_x.c
===================================================================
--- trunk/libselinux/src/label_x.c	2007-08-01 19:38:34 UTC (rev 2507)
+++ trunk/libselinux/src/label_x.c	2007-08-02 19:29:50 UTC (rev 2508)
@@ -107,7 +107,7 @@
 
 	/* Open the specification file. */
 	if (!path)
-		path = "/etc/selinux/refpolicy/contexts/x_contexts";
+		path = selinux_x_context_path();
 	if ((fp = fopen(path, "r")) == NULL)
 		return -1;
 	__fsetlocking(fp, FSETLOCKING_BYCALLER);
Modified: trunk/libselinux/src/selinux_config.c
===================================================================
--- trunk/libselinux/src/selinux_config.c	2007-08-01 19:38:34 UTC (rev 2507)
+++ trunk/libselinux/src/selinux_config.c	2007-08-02 19:29:50 UTC (rev 2508)
@@ -38,7 +38,8 @@
 #define FILE_CONTEXTS_HOMEDIR 16
 #define FILE_CONTEXTS_LOCAL 17
 #define SECURETTY_TYPES   18
-#define NEL               19
+#define X_CONTEXTS        19
+#define NEL               20
 
 /* New layout is relative to SELINUXDIR/policytype. */
 static char *file_paths[NEL];
@@ -369,3 +370,10 @@
 }
 
 hidden_def(selinux_file_context_local_path)
+
+const char *selinux_x_context_path()
+{
+	return get_path(X_CONTEXTS);
+}
+
+hidden_def(selinux_x_context_path)
Modified: trunk/libselinux/src/selinux_internal.h
===================================================================
--- trunk/libselinux/src/selinux_internal.h	2007-08-01 19:38:34 UTC (rev 2507)
+++ trunk/libselinux/src/selinux_internal.h	2007-08-02 19:29:50 UTC (rev 2508)
@@ -65,6 +65,7 @@
     hidden_proto(selinux_booleans_path)
     hidden_proto(selinux_customizable_types_path)
     hidden_proto(selinux_media_context_path)
+    hidden_proto(selinux_x_context_path)
     hidden_proto(selinux_path)
     hidden_proto(selinux_check_passwd_access)
     hidden_proto(selinux_check_securetty_context)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
 |