1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
|
body common control
{
inputs => { "../plucked.cf.sub" };
}
bundle agent test
{
vars:
"unsafe_functions" slist => {
"execresult",
"execresult_as_data",
"returnszero",
"usemodule"
};
"test_1" string => execresult("touch $(sys.statedir)$(const.dirsep)execresult_safe", useshell),
meta => { "simulate_safe" };
"test_2" string => execresult("touch $(sys.statedir)$(const.dirsep)execresult_unsafe", useshell);
"test_3" data => execresult_as_data("touch $(sys.statedir)$(const.dirsep)execresult_as_data_safe", useshell),
meta => { "simulate_safe" };
"test_4" data => execresult_as_data("touch $(sys.statedir)$(const.dirsep)execresult_as_data_unsafe", useshell);
classes:
"test_5" expression => returnszero("touch $(sys.statedir)$(const.dirsep)returnszero_safe", useshell),
meta => { "simulate_safe" };
"test_6" expression => returnszero("touch $(sys.statedir)$(const.dirsep)returnszero_unsafe", useshell);
"test_7" expression => usemodule("usemodule_safe.sh", useshell),
meta => { "simulate_safe" };
"test_8" expression => usemodule("usemodule_unsafe.sh", useshell);
}
bundle agent check
{
classes:
"pass_$(test.unsafe_functions)" expression => not(fileexists("$(sys.statedir)$(const.dirsep)$(test.unsafe_functions)_unsafe"));
"fail_$(test.unsafe_functions)" expression => fileexists("$(sys.statedir)$(const.dirsep)$(test.unsafe_functions)_unsafe");
reports:
"$(this.promise_filename) FAIL"
if => classmatch("fail_.*");
"$(this.promise_filename) Pass"
if => strcmp(countclassesmatching("fail.*"), 0);
}
bundle agent __main__
{
methods:
"init";
"test";
"check";
}
|