Commits

Stephen Smalley  committed 0311c4f

Apply context validation when loading file_contexts.

Change-Id: I7c0bdca5c9a1ffe428200a830c1b706fc8ed9675
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>

  • Participants
  • Parent commits 81e3a43
  • Branches seandroid-4.0.4

Comments (0)

Files changed (1)

File src/label_file.c

 	skip_type:
 		spec_arr[nspec].lr.ctx_raw = strdup(context);
 
+		if (strcmp(context, "<<none>>") && rec->validating) {
+			if (selabel_validate(rec, &spec_arr[nspec].lr) < 0) {
+				selinux_log(SELINUX_WARNING,
+					    "%s:  line %d has invalid context %s\n",
+					    path, lineno, spec_arr[nspec].lr.ctx_raw);
+			}
+		}
+
 		/* Determine if specification has 
 		 * any meta characters in the RE */
 		spec_hasMetaChars(&spec_arr[nspec]);