[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 4/4] 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@xxxxxxxxxxxxx>
---
 checkpolicy/policy_parse.y | 3 +++
 checkpolicy/policy_scan.l  | 1 +
 2 files changed, 4 insertions(+)

diff --git a/checkpolicy/policy_parse.y b/checkpolicy/policy_parse.y
index 889df57..8b81f04 100644
--- a/checkpolicy/policy_parse.y
+++ b/checkpolicy/policy_parse.y
@@ -83,6 +83,7 @@ typedef int (* require_func_t)(int pass);
 %type <require_func> require_decl_def
 
 %token PATH
+%token QPATH
 %token FILENAME
 %token CLONE
 %token COMMON
@@ -811,6 +812,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; }
diff --git a/checkpolicy/policy_scan.l b/checkpolicy/policy_scan.l
index d0ba13a..108edbc 100644
--- a/checkpolicy/policy_scan.l
+++ b/checkpolicy/policy_scan.l
@@ -242,6 +242,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); }
-- 
2.1.0


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.