|
From: <ssm...@us...> - 2008-02-28 20:41:03
|
Revision: 2825
http://selinux.svn.sourceforge.net/selinux/?rev=2825&view=rev
Author: ssmalley
Date: 2008-02-28 12:41:00 -0800 (Thu, 28 Feb 2008)
Log Message:
-----------
Author: Stephen Smalley
Email: sd...@ty...
Subject: libsepol: accept Flask as string identifier in policy
Date: Thu, 28 Feb 2008 14:26:55 -0500
SELinux binary policies presently use "SE Linux" as the string
identifier in the header. Other Flask/TE implementations would like to
use a more general identifier while preserving compatibility with
SELinux policy tools. Thus, extend the libsepol policy reading code to
accept "Flask" as an alternate identifier. This allows checkpolicy and
setools to read such policies when rebuilt against the updated libsepol.
Signed-off-by: Stephen Smalley <sd...@ty...>
Modified Paths:
--------------
trunk/libsepol/include/sepol/policydb/policydb.h
trunk/libsepol/src/policydb.c
Modified: trunk/libsepol/include/sepol/policydb/policydb.h
===================================================================
--- trunk/libsepol/include/sepol/policydb/policydb.h 2008-02-28 20:40:32 UTC (rev 2824)
+++ trunk/libsepol/include/sepol/policydb/policydb.h 2008-02-28 20:41:00 UTC (rev 2825)
@@ -617,6 +617,7 @@
#define POLICYDB_MAGIC SELINUX_MAGIC
#define POLICYDB_STRING "SE Linux"
+#define POLICYDB_ALT_STRING "Flask"
#define POLICYDB_MOD_MAGIC SELINUX_MOD_MAGIC
#define POLICYDB_MOD_STRING "SE Linux Module"
Modified: trunk/libsepol/src/policydb.c
===================================================================
--- trunk/libsepol/src/policydb.c 2008-02-28 20:40:32 UTC (rev 2824)
+++ trunk/libsepol/src/policydb.c 2008-02-28 20:41:00 UTC (rev 2825)
@@ -2980,7 +2980,7 @@
unsigned int i, j, r_policyvers;
uint32_t buf[5], config;
size_t len, nprim, nel;
- char *policydb_str, *target_str = NULL;
+ char *policydb_str, *target_str = NULL, *alt_target_str = NULL;
struct policydb_compat_info *info;
unsigned int policy_type, bufindex;
ebitmap_node_t *tnode;
@@ -2998,6 +2998,7 @@
if (buf[0] == POLICYDB_MAGIC) {
policy_type = POLICY_KERN;
target_str = POLICYDB_STRING;
+ alt_target_str = POLICYDB_ALT_STRING;
} else if (buf[0] == POLICYDB_MOD_MAGIC) {
policy_type = POLICY_MOD;
target_str = POLICYDB_MOD_STRING;
@@ -3009,7 +3010,8 @@
}
len = buf[1];
- if (len != strlen(target_str)) {
+ if (len != strlen(target_str) &&
+ (!alt_target_str || len != strlen(alt_target_str))) {
ERR(fp->handle, "policydb string length %zu does not match "
"expected length %zu", len, strlen(target_str));
return POLICYDB_ERROR;
@@ -3028,7 +3030,8 @@
return POLICYDB_ERROR;
}
policydb_str[len] = 0;
- if (strcmp(policydb_str, target_str)) {
+ if (strcmp(policydb_str, target_str) &&
+ (!alt_target_str || strcmp(policydb_str, alt_target_str))) {
ERR(fp->handle, "policydb string %s does not match "
"my string %s", policydb_str, target_str);
free(policydb_str);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|