From c92dae9807e890e7b8bdc8f293ef35143ad51ca5 Mon Sep 17 00:00:00 2001
From: William Roberts <william.c.roberts@intel.com>
Date: Fri, 29 Jan 2016 11:03:40 -0800
Subject: [PATCH] checkseapp: remove data types form static map

Data type tracking is no longer needed now that per
key validation routines are supported.

Change-Id: I2f1d0d5b1713e0477996479b0f279a58f43f15c7
Signed-off-by: William Roberts <william.c.roberts@intel.com>
---
 tools/check_seapp.c | 36 ++++++++++++------------------------
 1 file changed, 12 insertions(+), 24 deletions(-)

diff --git a/tools/check_seapp.c b/tools/check_seapp.c
index 50f18374c..aca294fbe 100644
--- a/tools/check_seapp.c
+++ b/tools/check_seapp.c
@@ -80,14 +80,6 @@ enum key_dir {
 	dir_in, dir_out
 };
 
-/**
- * The expected "type" of data the value in the key
- * value pair should be.
- */
-enum data_type {
-	dt_bool, dt_string
-};
-
 struct list_element {
 	list_element *next;
 };
@@ -110,7 +102,6 @@ struct key_map_regex {
 struct key_map {
 	char *name;
 	key_dir dir;
-	data_type type;
 	char *data;
 	key_map_regex regex;
 	bool (*fn_validate)(char *value, char **errmsg);
@@ -210,19 +201,19 @@ static bool validate_selinux_level(char *value, char **errmsg);
  */
 key_map rules[] = {
                 /*Inputs*/
-                { .name = "isSystemServer", .type = dt_bool,   .dir = dir_in,  .data = NULL, .fn_validate = validate_bool },
-                { .name = "isOwner",        .type = dt_bool,   .dir = dir_in,  .data = NULL, .fn_validate = validate_bool },
-                { .name = "user",           .type = dt_string, .dir = dir_in,  .data = NULL                              },
-                { .name = "seinfo",         .type = dt_string, .dir = dir_in,  .data = NULL                              },
-                { .name = "name",           .type = dt_string, .dir = dir_in,  .data = NULL                              },
-                { .name = "path",           .type = dt_string, .dir = dir_in,  .data = NULL                              },
-                { .name = "isPrivApp",      .type = dt_bool,   .dir = dir_in,  .data = NULL, .fn_validate = validate_bool },
+                { .name = "isSystemServer", .dir = dir_in,  .data = NULL, .fn_validate = validate_bool },
+                { .name = "isOwner",        .dir = dir_in,  .data = NULL, .fn_validate = validate_bool },
+                { .name = "user",           .dir = dir_in,  .data = NULL                               },
+                { .name = "seinfo",         .dir = dir_in,  .data = NULL                               },
+                { .name = "name",           .dir = dir_in,  .data = NULL                               },
+                { .name = "path",           .dir = dir_in,  .data = NULL                               },
+                { .name = "isPrivApp",      .dir = dir_in,  .data = NULL, .fn_validate = validate_bool },
                 /*Outputs*/
-                { .name = "domain",         .type = dt_string, .dir = dir_out, .data = NULL, .fn_validate = validate_selinux_type  },
-                { .name = "type",           .type = dt_string, .dir = dir_out, .data = NULL, .fn_validate = validate_selinux_type  },
-                { .name = "levelFromUid",   .type = dt_bool,   .dir = dir_out, .data = NULL, .fn_validate = validate_bool          },
-                { .name = "levelFrom",      .type = dt_string, .dir = dir_out, .data = NULL, .fn_validate = validate_levelFrom     },
-                { .name = "level",          .type = dt_string, .dir = dir_out, .data = NULL, .fn_validate = validate_selinux_level },
+                { .name = "domain",         .dir = dir_out, .data = NULL, .fn_validate = validate_selinux_type  },
+                { .name = "type",           .dir = dir_out, .data = NULL, .fn_validate = validate_selinux_type  },
+                { .name = "levelFromUid",   .dir = dir_out, .data = NULL, .fn_validate = validate_bool          },
+                { .name = "levelFrom",      .dir = dir_out, .data = NULL, .fn_validate = validate_levelFrom     },
+                { .name = "level",          .dir = dir_out, .data = NULL, .fn_validate = validate_selinux_level },
 };
 
 /**
@@ -518,9 +509,6 @@ static map_match rule_map_cmp(rule_map *rmA, rule_map *rmB) {
 			mB = &(rmB->m[j]);
 			input_mode = 0;
 
-			if (mA->type != mB->type)
-				continue;
-
 			if (strcmp(mA->name, mB->name))
 				continue;
 
-- 
GitLab