|
From: <ssm...@us...> - 2007-03-12 15:33:14
|
Revision: 2287
http://svn.sourceforge.net/selinux/?rev=2287&view=rev
Author: ssmalley
Date: 2007-03-12 08:33:08 -0700 (Mon, 12 Mar 2007)
Log Message:
-----------
Author: Steve G
Email: lin...@ya...
Subject: Dropping compat support for /etc/security policy file paths
Date: Thu, 8 Mar 2007 05:31:19 -0800 (PST)
>> >Are any active distributions still using the old /etc/security/ location
>> >and layout for SELinux policy files? If not, we could drop the compat
>> >file path support from libselinux on the trunk.
>>
>> Here's a patch dropping support.
>
>+#define SECURITYCONFIG "/etc/sysconfig/selinux"
>
>I think we can drop this altogether, along with the use of it
Sure. New patch attached.
-Steve
Modified Paths:
--------------
trunk/libselinux/src/selinux_config.c
Removed Paths:
-------------
trunk/libselinux/src/compat_file_path.h
Deleted: trunk/libselinux/src/compat_file_path.h
===================================================================
--- trunk/libselinux/src/compat_file_path.h 2007-03-12 15:25:34 UTC (rev 2286)
+++ trunk/libselinux/src/compat_file_path.h 2007-03-12 15:33:08 UTC (rev 2287)
@@ -1,12 +0,0 @@
-/* Compatibility file name suffixes. */
-S_(BINPOLICY, SECURITYDIR "/selinux/policy")
- S_(CONTEXTS_DIR, SECURITYDIR)
- S_(FILE_CONTEXTS, SECURITYDIR "/selinux/file_contexts")
- S_(HOMEDIR_CONTEXTS, SECURITYDIR "/homedir_template")
- S_(DEFAULT_CONTEXTS, SECURITYDIR "/default_contexts")
- S_(USER_CONTEXTS, SECURITYDIR "/default_contexts.user/")
- S_(FAILSAFE_CONTEXT, SECURITYDIR "/failsafe_context")
- S_(DEFAULT_TYPE, SECURITYDIR "/default_type")
- S_(BOOLEANS, SECURITYDIR "/booleans")
- S_(MEDIA_CONTEXTS, SECURITYDIR "/default_media")
- S_(REMOVABLE_CONTEXT, SECURITYDIR "/removable_context")
Modified: trunk/libselinux/src/selinux_config.c
===================================================================
--- trunk/libselinux/src/selinux_config.c 2007-03-12 15:25:34 UTC (rev 2286)
+++ trunk/libselinux/src/selinux_config.c 2007-03-12 15:33:08 UTC (rev 2287)
@@ -65,44 +65,16 @@
#undef S_
};
-/* Old layout had fixed locations. */
-#define SECURITYCONFIG "/etc/sysconfig/selinux"
-#define SECURITYDIR "/etc/security"
-static const union compat_file_path_data {
- struct {
-#define S_(n, s) char L1(__LINE__)[sizeof(s)];
-#include "compat_file_path.h"
-#undef S_
- };
- char str[0];
-} compat_file_path_data = {
- {
-#define S_(n, s) s,
-#include "compat_file_path.h"
-#undef S_
- }
-};
-static const uint16_t compat_file_path_idx[NEL] = {
-#define S_(n, s) [n] = offsetof(union compat_file_path_data, L1(__LINE__)),
-#include "compat_file_path.h"
-#undef S_
-};
-
#undef L1
#undef L2
-static int use_compat_file_path;
-
int selinux_getenforcemode(int *enforce)
{
int ret = -1;
FILE *cfg = fopen(SELINUXCONFIG, "r");
- char *buf;
- int len = sizeof(SELINUXTAG) - 1;
- if (!cfg) {
- cfg = fopen(SECURITYCONFIG, "r");
- }
if (cfg) {
+ char *buf;
+ int len = sizeof(SELINUXTAG) - 1;
buf = malloc(selinux_page_size);
if (!buf) {
fclose(cfg);
@@ -167,12 +139,6 @@
if (selinux_policyroot)
return;
- if (access(SELINUXDIR, F_OK) != 0) {
- selinux_policyroot = SECURITYDIR;
- selinux_rootpath = SECURITYDIR;
- use_compat_file_path = 1;
- return;
- }
selinux_rootpath = SELINUXDIR;
fp = fopen(SELINUXCONFIG, "r");
@@ -244,7 +210,6 @@
file_path_suffixes_idx[i])
== -1)
return;
- use_compat_file_path = 0;
}
static void fini_selinux_policyroot(void) __attribute__ ((destructor));
@@ -252,10 +217,6 @@
static void fini_selinux_policyroot(void)
{
int i;
- if (use_compat_file_path) {
- selinux_policyroot = NULL;
- return;
- }
free(selinux_policyroot);
selinux_policyroot = NULL;
for (i = 0; i < NEL; i++) {
@@ -268,10 +229,7 @@
static const char *get_path(int idx)
{
- if (!use_compat_file_path)
- return file_paths[idx];
-
- return compat_file_path_data.str + compat_file_path_idx[idx];
+ return file_paths[idx];
}
const char *selinux_default_type_path()
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|