checkpolicy: Expand allowed character set in paths

In order to support paths containing spaces or other characters, allow a
quoted string with these characters to be parsed as a path in addition
to the existing unquoted string.

Signed-off-by: Daniel De Graaf <dgdegra@tycho.nsa.gov>
This commit is contained in:
Daniel De Graaf 2015-03-17 16:43:22 -04:00 committed by Stephen Smalley
parent b6d5805c7a
commit aab2d9f904
2 changed files with 4 additions and 0 deletions

View file

@ -81,6 +81,7 @@ typedef int (* require_func_t)(int pass);
%type <require_func> require_decl_def
%token PATH
%token QPATH
%token FILENAME
%token CLONE
%token COMMON
@ -805,6 +806,8 @@ filesystem : FILESYSTEM
;
path : PATH
{ if (insert_id(yytext,0)) return -1; }
| QPATH
{ yytext[strlen(yytext) - 1] = '\0'; if (insert_id(yytext + 1,0)) return -1; }
;
filename : FILENAME
{ yytext[strlen(yytext) - 1] = '\0'; if (insert_id(yytext + 1,0)) return -1; }

View file

@ -240,6 +240,7 @@ HIGH { return(HIGH); }
low |
LOW { return(LOW); }
"/"({alnum}|[_\.\-/])* { return(PATH); }
\""/"[ !#-~]*\" { return(QPATH); }
\"({alnum}|[_\.\-\+\~\: ])+\" { return(FILENAME); }
{letter}({alnum}|[_\-])*([\.]?({alnum}|[_\-]))* { return(IDENTIFIER); }
{digit}+|0x{hexval}+ { return(NUMBER); }