Report source file and line information for neverallow failures.
Change-Id: I0def97a5f2f6097e2dad7bcd5395b8fa740d7073 Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
This commit is contained in:
parent
ef24ade029
commit
0e00684f69
|
@ -60,6 +60,7 @@ int mlspol = 0;
|
|||
extern unsigned long policydb_lineno;
|
||||
extern unsigned long source_lineno;
|
||||
extern unsigned int policydb_errors;
|
||||
extern char source_file[PATH_MAX];
|
||||
|
||||
extern int yywarn(char *msg);
|
||||
extern int yyerror(char *msg);
|
||||
|
@ -1526,6 +1527,12 @@ int define_compute_type_helper(int which, avrule_t ** rule)
|
|||
avrule_init(avrule);
|
||||
avrule->specified = which;
|
||||
avrule->line = policydb_lineno;
|
||||
avrule->source_line = source_lineno;
|
||||
avrule->source_filename = strdup(source_file);
|
||||
if (!avrule->source_filename) {
|
||||
yyerror("out of memory");
|
||||
return -1;
|
||||
}
|
||||
|
||||
while ((id = queue_remove(id_queue))) {
|
||||
if (set_types(&avrule->stypes, id, &add, 0))
|
||||
|
@ -1739,6 +1746,13 @@ int define_te_avtab_helper(int which, avrule_t ** rule)
|
|||
avrule_init(avrule);
|
||||
avrule->specified = which;
|
||||
avrule->line = policydb_lineno;
|
||||
avrule->source_line = source_lineno;
|
||||
avrule->source_filename = strdup(source_file);
|
||||
if (!avrule->source_filename) {
|
||||
yyerror("out of memory");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
while ((id = queue_remove(id_queue))) {
|
||||
if (set_types
|
||||
|
|
|
@ -308,4 +308,6 @@ void set_source_file(const char *name)
|
|||
source_lineno = 1;
|
||||
strncpy(source_file, name, sizeof(source_file)-1);
|
||||
source_file[sizeof(source_file)-1] = '\0';
|
||||
if (strlen(source_file) && source_file[strlen(source_file)-1] == '"')
|
||||
source_file[strlen(source_file)-1] = '\0';
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue