From 2c57dd824a15465f0211b28ca3c01de71e9082d9 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Fri, 17 Mar 2017 23:37:05 -0700 Subject: [PATCH] Update test policy files in src/parser/testfiles to (largely) match current policy language --- src/parser/testfiles/directives.txt | 26 +++++----- src/parser/testfiles/pol.txt | 77 ++++++++++++++-------------- src/parser/testfiles/poleasy.txt | 2 +- src/parser/testfiles/polhard.txt | 77 ++++++++++++++-------------- src/parser/testfiles/polruleattr.txt | 4 +- 5 files changed, 92 insertions(+), 94 deletions(-) diff --git a/src/parser/testfiles/directives.txt b/src/parser/testfiles/directives.txt index 4374975..f9d9f85 100644 --- a/src/parser/testfiles/directives.txt +++ b/src/parser/testfiles/directives.txt @@ -2,16 +2,16 @@ # parser will echo YES1 through YES9 # there's a problem with the parser if it echoes NO -@@ifhost turd +@@ifhost foo @@error NO1 @@else @@echo +YES1; @@endif -@@ifhost crap || your_host||poo +@@ifhost bar || your_host||baz - @@ifhost turd + @@ifhost foo @@ifhost your_host @@error +NO2; @@ -23,7 +23,7 @@ @@else - @@ifhost turd + @@ifhost foo @@error +NO5; @@else @@echo +YES2; @@ -63,29 +63,29 @@ @@error +NO10; @@endif - @@ifhost turd + @@ifhost foo @@error +NO11; @@else @@echo +YES7; @@endif - @@ifhost your_host || poo + @@ifhost your_host || baz @@echo +YES8; @@endif - @@ifhost poo || your_host + @@ifhost baz || your_host @@echo +YES9; @@endif - @@ifhost poo + @@ifhost baz @@error +NO12; @@endif @@else - @@ifhost turd + @@ifhost foo @@ifhost your_host @@error +NO13; @@ -97,7 +97,7 @@ @@else - @@ifhost turd + @@ifhost foo @@error +NO16; @@else @@error +NO17; @@ -107,7 +107,7 @@ @@endif - @@ifhost turd + @@ifhost foo @@error +NO19; @@else @@error +NO20; @@ -120,13 +120,13 @@ @@endif - @@ifhost turd + @@ifhost foo @@error +NO23; @@else @@error +NO24; @@endif - @@ifhost poo + @@ifhost baz @@error +NO25; @@endif diff --git a/src/parser/testfiles/pol.txt b/src/parser/testfiles/pol.txt index 2b0accc..d83eadf 100644 --- a/src/parser/testfiles/pol.txt +++ b/src/parser/testfiles/pol.txt @@ -14,34 +14,32 @@ /simple -> +ppp; # variable -$(poo) = pinug; -/simplevar -> $(poo) ; +FOO = pinug; +/simplevar -> $(FOO) ; -$(turd) = /test6; -$(turd) -> $(poo); +BAR = /test6; +$(BAR) -> $(FOO); # named attributes -/namedattr -> +pinug (name /namedattr ) ; +#/namedattr -> +pinug (name /namedattr ) ; # multiple attributes -/namedattr2 -> +pinug (emailreport on, emailsendto genek, name /namedattr2, name4 val4, name5 val5 ); +#/namedattr2 -> +pinug (emailreport on, emailsendto genek, name /namedattr2, name4 val4, name5 val5 ); # test line continuations -/turd \ +/bar \ ->\ +p ; -@@EnD +#@@EnD -/test -> +p; -"/te\x73t2" -> +p-p ; -"/te\163t3" -> +pinugs-am ; -"c:\\te\163t3\\" -> +pinugs-am ; -"c:\\te\"as\163t3\\" -> +pinugs-am ; -"/te\163t3" -> +pinugs-am ; -"/te\163t3" -> +pinugs-am ; -/test4 -> +pinugs---am ; -/test5 -> $(ReadOnly)s-+-am ; +/test7 -> +p; +"/te\x73t8" -> +p-p ; +"/te\163t9" -> +pinugs-am ; +"/te\163t12" -> +pinugs-am ; +"/te\163t13" -> +pinugs-am ; +/test14 -> +pinugs---am ; +/test15 -> $(ReadOnly)s-+-am ; # test weird file names /lost+found -> +p ; @@ -51,50 +49,51 @@ $(turd) -> $(poo); ; # simple default policy -/simple -> +ppp; +/simple2 -> +ppp; # variable -$(poo) = pinug; -/simplevar -> $(poo) ; -$(turd) = /test6; -$(turd) -> $(poo); +FOO = pinug; +/simplevar2 -> $(FOO) ; +BAR = /test16; +$(BAR) -> $(FOO); # omit with space seperation ! /omit ; # omit with no space separation - !/omit ; + !/omit2 ; # named attributes -/namedattr -> +pinug (name1 value1) ; +#/namedattr -> +pinug (name1 value1) ; # multiple attributes -/namedattr2 -> +pinug (emailreport on; emailsendto genek; name3 val3; name4 val4; name5 val5 ) ; +#/namedattr2 -> +pinug (emailreport on; emailsendto genek; name3 val3; name4 val4; name5 val5 ) ; # test line continuations -/turd \ +/bar2 \ ->\ +p ; -@@END +#@@END # the following isn't implemented yet #########################################3 # attributes on specifers -/conditions { - xxx: +pinug (inside1 name1 ;) ; - yyy: +pinug ; - zzz: +pinug ; - default: +pinug ; - }; +#/conditions2 { +# xxx: +pinug (inside1 name1 ;) ; +# yyy: +pinug ; +# zzz: +pinug ; +# default: +pinug ; +# }; # multiple specmasks -/conditions { - xxx: +pinug ; - yyy: +pinug ; - zzz: +pinug ; - default: +pinug ; - }; \ No newline at end of file +#/conditions3 { +# xxx: +pinug ; +# yyy: +pinug ; +# zzz: +pinug ; +# default: +pinug ; +# }; +# diff --git a/src/parser/testfiles/poleasy.txt b/src/parser/testfiles/poleasy.txt index f88a1f6..d9a11da 100644 --- a/src/parser/testfiles/poleasy.txt +++ b/src/parser/testfiles/poleasy.txt @@ -1 +1 @@ -/etc jj ; +/etc -> $(IgnoreNone); diff --git a/src/parser/testfiles/polhard.txt b/src/parser/testfiles/polhard.txt index 1586dc2..fad96b8 100644 --- a/src/parser/testfiles/polhard.txt +++ b/src/parser/testfiles/polhard.txt @@ -1,17 +1,16 @@ # test weird file names /lost+found -> +p ; -/l-o_st+fo/und -> +ping (l-o_st+fo/und2 l-o_st+fo/und3) ; +/l-o_st+fo/und -> +ping; # test variables -$(ReadOnly) = ping; -/simplevar -> $(ReadOnly) ; -/var -> $(ReadOnly)-p ; +FOO = ping; +/simplevar -> $(FOO) ; +/var -> $(FOO)-p ; # test line continuations -c:/test -> +p ; -/turd \ +/bar \ ->\ +p ; @@ -19,26 +18,25 @@ c:/test -> +p ; # test quoted strings "/qfoo" -> +p ; "/Program Files" -> +p ; -" /lots o' spaces " -> +p ; -" colon: semicolon; quote' " -> +p ; +#" /lots o' spaces " -> +p ; +#" colon: semicolon; quote' " -> +p ; # test attributes -/namedattr2 -> +p ( name1 value1; name2 value2; ) ; -/namedattr -> +p (name1 value1; ) ; +#/namedattr2 -> +p ( name1 value1; name2 value2; ) ; +#/namedattr -> +p (name1 value1; ) ; # test propvector -c:/test -> +p ; -/test -> +p ; -/test -> +p-p ; -/test -> +pinugs-am ; -/test -> +pinugs---am ; -/test -> +pinugs-+-am ; +/test1 -> +p ; +/test2 -> +p-p ; +/test3 -> +pinugs-am ; +/test4 -> +pinugs---am ; +/test5 -> +pinugs-+-am ; # attributes and props -/namedattr3 -> +pinug ( name1 value1; name2 value2; ) ; -/namedattr4 -> +pinug (name1 value1; ) ; +#/namedattr3 -> +pinug ( name1 value1; name2 value2; ) ; +#/namedattr4 -> +pinug (name1 value1; ) ; # simple default policy /simple -> +ppp; @@ -48,38 +46,39 @@ c:/test -> +p ; ! /omit ; # omit with no space separation - !/omit ; + !/omit2 ; # multiple attributes -/namedattr -> +pinug (emailreport on; emailsendto genek; name3 val3; name4 val4; name5 val5; ) ; +#/namedattr -> +pinug (emailreport on; emailsendto genek; name3 val3; name4 val4; name5 val5; ) ; -@@END +#@@END # the following isn't implemented yet #########################################3 # multiple specmasks -/conditions -> { - xxx -> +pinug ; - yyy -> +pinug ; - zzz -> +pinug ; - default -> +pinug ; - }; +#/conditions -> { +# xxx -> +pinug ; +# yyy -> +pinug ; +# zzz -> +pinug ; +# default -> +pinug ; +# }; # attributes on specifers -/conditions -> { - xxx -> +pinug (inside1 name1 ;) ; - yyy -> +pinug ; - zzz -> +pinug ; - default -> +pinug ; - }; +#/conditions -> { +# xxx -> +pinug (inside1 name1 ;) ; +# yyy -> +pinug ; +# zzz -> +pinug ; +# default -> +pinug ; +# }; # hard ones -/conditions -> { - xxx -> +pinug (inside1 name1 ;) ; - yyy -> $(poo)+pinug ; - zzz -> +pinug ( inside1 name1 ; outside name2); - default -> $(turd)-p ; - }; \ No newline at end of file +#/conditions -> { +# xxx -> +pinug (inside1 name1 ;) ; +# yyy -> $(baz)+pinug ; +# zzz -> +pinug ( inside1 name1 ; outside name2); +# default -> $(bar)-p ; +# }; + diff --git a/src/parser/testfiles/polruleattr.txt b/src/parser/testfiles/polruleattr.txt index 468fa36..3f5febc 100644 --- a/src/parser/testfiles/polruleattr.txt +++ b/src/parser/testfiles/polruleattr.txt @@ -1,4 +1,4 @@ -( emailreport on ; ) +(emailto=root@localhost) { /foo -> +pinugs ; -} \ No newline at end of file +}