diff --git a/ncm-sudo/src/main/pan/components/sudo/validation.pan b/ncm-sudo/src/main/pan/components/sudo/validation.pan index e76e25725c..470d73d8a4 100644 --- a/ncm-sudo/src/main/pan/components/sudo/validation.pan +++ b/ncm-sudo/src/main/pan/components/sudo/validation.pan @@ -35,11 +35,11 @@ function sudo_check_aliases_list = { function sudo_check_default_options_list = { if (exists(ARGV[0][ARGV[1]])) { foreach(idx; v; ARGV[0][ARGV[1]]) { - if ((exists (v["user"]) && (exists (v["run_as"]) || - exists (v["host"]))) || - (exists (v["run_as"]) && exists (v["host"]))) { - error ("Only one of user, run_as or host may be " + - "specified for default options"); + if ( + (exists (v["user"]) && (exists (v["run_as"]) || exists (v["host"]))) || + (exists (v["run_as"]) && exists (v["host"])) + ) { + error ("Only one of user, run_as or host may be specified for default options"); }; }; }; diff --git a/ncm-sudo/src/test/resources/1line.pan b/ncm-sudo/src/test/resources/1line.pan index d5b78d3b97..f166cb5521 100644 --- a/ncm-sudo/src/test/resources/1line.pan +++ b/ncm-sudo/src/test/resources/1line.pan @@ -2,13 +2,17 @@ object template 1line; prefix "/software/components/sudo"; -"privilege_lines/0" = dict("user", "u", +"privilege_lines/0" = dict( + "user", "u", "run_as", "r", "host", "h", "cmd", "c", - "options", "opts"); + "options", "opts", +); -"privilege_lines/1" = dict("user", "u", +"privilege_lines/1" = dict( + "user", "u", "run_as", "r", "host", "h", - "cmd", "c"); + "cmd", "c", +); diff --git a/ncm-sudo/src/test/resources/all_aliases.pan b/ncm-sudo/src/test/resources/all_aliases.pan index dd32565c79..7aae08e87a 100644 --- a/ncm-sudo/src/test/resources/all_aliases.pan +++ b/ncm-sudo/src/test/resources/all_aliases.pan @@ -4,9 +4,9 @@ object template all_aliases; prefix "/software/components/sudo"; -"user_aliases" = dict ( - "USER", list ("u") - ); +"user_aliases" = dict( + "USER", list("u"), +); "cmd_aliases" = dict("CMD", list("c")); "run_as_aliases" = dict("RUN", list("r")); "host_aliases" = dict("HOST", list("h", "h2")); diff --git a/ncm-sudo/src/test/resources/new_opts.pan b/ncm-sudo/src/test/resources/new_opts.pan index ee7db19b2a..faadd43a0e 100644 --- a/ncm-sudo/src/test/resources/new_opts.pan +++ b/ncm-sudo/src/test/resources/new_opts.pan @@ -2,8 +2,10 @@ object template new_opts; prefix "/software/components/sudo"; -"privilege_lines/0" = dict("user", "u", +"privilege_lines/0" = dict( + "user", "u", "run_as", "r", "host", "h", "cmd", "c", - "options", "NOPASSWD:EXEC:"); + "options", "NOPASSWD:EXEC:", +); diff --git a/ncm-sudo/src/test/resources/test0aliases.pan b/ncm-sudo/src/test/resources/test0aliases.pan index 3bb8e30664..9bbbc29686 100644 --- a/ncm-sudo/src/test/resources/test0aliases.pan +++ b/ncm-sudo/src/test/resources/test0aliases.pan @@ -2,12 +2,13 @@ # No aliases defined, just one silly command. object template test0aliases; -"/software/components/sudo/privilege_lines" = list ( - dict ( "user", "ALL", +"/software/components/sudo/privilege_lines" = list( + dict( + "user", "ALL", "run_as", "ALL", "host", "ALL", - "cmd", "ALL" - ) - ); + "cmd", "ALL", + ), +); "/software/components/sudo/active" = true; "/software/components/sudo/dispatch" = true; diff --git a/ncm-sudo/src/test/resources/test1aliases.pan b/ncm-sudo/src/test/resources/test1aliases.pan index 601705fe80..404d73c690 100644 --- a/ncm-sudo/src/test/resources/test1aliases.pan +++ b/ncm-sudo/src/test/resources/test1aliases.pan @@ -3,16 +3,17 @@ object template test1aliases; -"/software/components/sudo/privilege_lines" = list ( - dict ( "user", "ALL", +"/software/components/sudo/privilege_lines" = list( + dict( + "user", "ALL", "run_as", "ALL", "host", "ALL", "cmd", "ALL" - ) - ); + ), +); -"/software/components/sudo/user_aliases" = dict ( - "FOO", list ("bar") - ); +"/software/components/sudo/user_aliases" = dict( + "FOO", list("bar"), +); "/software/components/sudo/active" = true; "/software/components/sudo/dispatch" = true; diff --git a/ncm-sudo/src/test/resources/test1aliases_cmd.pan b/ncm-sudo/src/test/resources/test1aliases_cmd.pan index 1757a3b4b5..201e954397 100644 --- a/ncm-sudo/src/test/resources/test1aliases_cmd.pan +++ b/ncm-sudo/src/test/resources/test1aliases_cmd.pan @@ -3,16 +3,17 @@ object template test1aliases_cmd; -"/software/components/sudo/privilege_lines" = list ( - dict ( "user", "ALL", +"/software/components/sudo/privilege_lines" = list( + dict( + "user", "ALL", "run_as", "ALL", "host", "ALL", - "cmd", "ALL" - ) - ); + "cmd", "ALL", + ), +); -"/software/components/sudo/cmd_aliases" = dict ( - "FOO", list ("bar") - ); +"/software/components/sudo/cmd_aliases" = dict( + "FOO", list("bar"), +); "/software/components/sudo/active" = true; "/software/components/sudo/dispatch" = true; diff --git a/ncm-sudo/src/test/resources/test1aliases_cmderr.pan b/ncm-sudo/src/test/resources/test1aliases_cmderr.pan index afaf606958..65d8eba236 100644 --- a/ncm-sudo/src/test/resources/test1aliases_cmderr.pan +++ b/ncm-sudo/src/test/resources/test1aliases_cmderr.pan @@ -3,16 +3,17 @@ object template test1aliases_cmderr; -"/software/components/sudo/privilege_lines" = list ( - dict ( "user", "ALL", +"/software/components/sudo/privilege_lines" = list( + dict( + "user", "ALL", "run_as", "ALL", "host", "ALL", - "cmd", "ALL" - ) - ); + "cmd", "ALL", + ), +); -"/software/components/sudo/cmd_aliases" = dict ( - "foo", list ("bar") - ); +"/software/components/sudo/cmd_aliases" = dict( + "foo", list("bar"), +); "/software/components/sudo/active" = true; "/software/components/sudo/dispatch" = true; diff --git a/ncm-sudo/src/test/resources/test1aliases_runas.pan b/ncm-sudo/src/test/resources/test1aliases_runas.pan index bfa2dc5947..a4dbd44065 100644 --- a/ncm-sudo/src/test/resources/test1aliases_runas.pan +++ b/ncm-sudo/src/test/resources/test1aliases_runas.pan @@ -3,16 +3,17 @@ object template test1aliases_runas; -"/software/components/sudo/privilege_lines" = list ( - dict ( "user", "ALL", +"/software/components/sudo/privilege_lines" = list( + dict( + "user", "ALL", "run_as", "ALL", "host", "ALL", "cmd", "ALL" - ) - ); + ), +); -"/software/components/sudo/run_as_aliases" = dict ( - "FOO", list ("bar") - ); +"/software/components/sudo/run_as_aliases" = dict( + "FOO", list("bar"), +); "/software/components/sudo/active" = true; "/software/components/sudo/dispatch" = true; diff --git a/ncm-sudo/src/test/resources/test1aliases_runaserr.pan b/ncm-sudo/src/test/resources/test1aliases_runaserr.pan index 021b7788f3..f56c690cf5 100644 --- a/ncm-sudo/src/test/resources/test1aliases_runaserr.pan +++ b/ncm-sudo/src/test/resources/test1aliases_runaserr.pan @@ -5,16 +5,17 @@ include pro_declaration_types; include pro_declaration_component_sudo; include pro_declaration_functions_sudo; -"/software/components/sudo/privilege_lines" = list ( - dict ( "user", "ALL", +"/software/components/sudo/privilege_lines" = list( + dict( + "user", "ALL", "run_as", "ALL", "host", "ALL", "cmd", "ALL" - ) - ); + ), +); -"/software/components/sudo/run_as_aliases" = dict ( - "foo", list ("bar") - ); +"/software/components/sudo/run_as_aliases" = dict( + "foo", list("bar") +); "/software/components/sudo/active" = true; "/software/components/sudo/dispatch" = true; diff --git a/ncm-sudo/src/test/resources/test1aliaseserr.pan b/ncm-sudo/src/test/resources/test1aliaseserr.pan index b8d683c3e3..43e67e25e7 100644 --- a/ncm-sudo/src/test/resources/test1aliaseserr.pan +++ b/ncm-sudo/src/test/resources/test1aliaseserr.pan @@ -5,16 +5,17 @@ include pro_declaration_types; include pro_declaration_component_sudo; include pro_declaration_functions_sudo; -"/software/components/sudo/privilege_lines" = list ( - dict ( "user", "ALL", +"/software/components/sudo/privilege_lines" = list( + dict( + "user", "ALL", "run_as", "ALL", "host", "ALL", - "cmd", "ALL" - ) - ); + "cmd", "ALL", + ), +); -"/software/components/sudo/user_aliases" = dict ( - "foo", list ("bar") - ); +"/software/components/sudo/user_aliases" = dict( + "foo", list("bar"), +); "/software/components/sudo/active" = true; "/software/components/sudo/dispatch" = true; diff --git a/ncm-sudo/src/test/resources/test1option.pan b/ncm-sudo/src/test/resources/test1option.pan index 976ac3ab80..4eca8e96a1 100644 --- a/ncm-sudo/src/test/resources/test1option.pan +++ b/ncm-sudo/src/test/resources/test1option.pan @@ -6,17 +6,18 @@ include pro_declaration_types; include pro_declaration_component_sudo; include pro_declaration_functions_sudo; -"/software/components/sudo/privilege_lines" = list ( - dict ( "user", "mejias", +"/software/components/sudo/privilege_lines" = list( + dict( + "user", "mejias", "run_as", "munoz", "host", "localhost", "cmd", "/bin/ls", "options", "NOPASSWD" - ) - ); + ), +); -"/software/components/sudo/user_aliases" = dict ( - "FOO", list ("bar") - ); +"/software/components/sudo/user_aliases" = dict( + "FOO", list("bar"), +); "/software/components/sudo/active" = true; "/software/components/sudo/dispatch" = true; diff --git a/ncm-sudo/src/test/resources/test2options.pan b/ncm-sudo/src/test/resources/test2options.pan index f8026d77c9..72811e267e 100644 --- a/ncm-sudo/src/test/resources/test2options.pan +++ b/ncm-sudo/src/test/resources/test2options.pan @@ -6,17 +6,18 @@ include pro_declaration_types; include pro_declaration_component_sudo; include pro_declaration_functions_sudo; -"/software/components/sudo/privilege_lines" = list ( - dict ( "user", "mejias", +"/software/components/sudo/privilege_lines" = list( + dict( + "user", "mejias", "run_as", "munoz", "host", "localhost", "cmd", "/bin/ls", - "options", "PASSWD" - ) - ); + "options", "PASSWD", + ), +); -"/software/components/sudo/user_aliases" = dict ( - "FOO", list ("bar") - ); +"/software/components/sudo/user_aliases" = dict( + "FOO", list("bar"), +); "/software/components/sudo/active" = true; "/software/components/sudo/dispatch" = true; diff --git a/ncm-sudo/src/test/resources/test_2_general_options_errru.pan b/ncm-sudo/src/test/resources/test_2_general_options_errru.pan index f7210cf663..7fd6f8e28a 100644 --- a/ncm-sudo/src/test/resources/test_2_general_options_errru.pan +++ b/ncm-sudo/src/test/resources/test_2_general_options_errru.pan @@ -26,7 +26,7 @@ include pro_declaration_functions_sudo; "/software/components/sudo/active" = true; "/software/components/sudo/dispatch" = true; -"/software/components/sudo/general_options/" = list( +"/software/components/sudo/general_options" = list( dict( "user", "mejias", "options", dict( diff --git a/ncm-sudo/src/test/resources/test_2_general_options_valid_types.pan b/ncm-sudo/src/test/resources/test_2_general_options_valid_types.pan index 2e357cfda5..0d6d2a7804 100644 --- a/ncm-sudo/src/test/resources/test_2_general_options_valid_types.pan +++ b/ncm-sudo/src/test/resources/test_2_general_options_valid_types.pan @@ -26,7 +26,7 @@ include pro_declaration_functions_sudo; "/software/components/sudo/active" = true; "/software/components/sudo/dispatch" = true; -"/software/components/sudo/general_options/" = list( +"/software/components/sudo/general_options" = list( dict( "user", "mejias", "options", dict( diff --git a/ncm-sudo/src/test/resources/test_2_general_options_validuh.pan b/ncm-sudo/src/test/resources/test_2_general_options_validuh.pan index 9020570d03..e238f73210 100644 --- a/ncm-sudo/src/test/resources/test_2_general_options_validuh.pan +++ b/ncm-sudo/src/test/resources/test_2_general_options_validuh.pan @@ -25,7 +25,7 @@ include pro_declaration_functions_sudo; "/software/components/sudo/active" = true; "/software/components/sudo/dispatch" = true; -"/software/components/sudo/general_options/" = list( +"/software/components/sudo/general_options" = list( dict( "user", "mejias", "options", dict( diff --git a/ncm-sudo/src/test/resources/test_general_options_errru.pan b/ncm-sudo/src/test/resources/test_general_options_errru.pan index af47ec8b85..143c2cfb5e 100644 --- a/ncm-sudo/src/test/resources/test_general_options_errru.pan +++ b/ncm-sudo/src/test/resources/test_general_options_errru.pan @@ -7,25 +7,26 @@ include pro_declaration_types; include pro_declaration_component_sudo; include pro_declaration_functions_sudo; -"/software/components/sudo/privilege_lines" = list ( - dict ( "user", "mejias", +"/software/components/sudo/privilege_lines" = list( + dict( + "user", "mejias", "run_as", "munoz", "host", "localhost", "cmd", "/bin/ls", - "options", "NOPASSWD" - ) - ); + "options", "NOPASSWD", + ), +); -"/software/components/sudo/user_aliases" = dict ( - "FOO", list ("bar") - ); +"/software/components/sudo/user_aliases" = dict( + "FOO", list("bar"), +); "/software/components/sudo/active" = true; "/software/components/sudo/dispatch" = true; -"/software/components/sudo/general_options/" = list ( - dict ( +"/software/components/sudo/general_options" = list( + dict( "user", "munoz", "host", "192.168.0.1", - "options", dict ("insults", true) - ) - ); + "options", dict("insults", true), + ), +); diff --git a/ncm-sudo/src/test/resources/test_general_options_valid.pan b/ncm-sudo/src/test/resources/test_general_options_valid.pan index 2159f8b391..62d04c0e17 100644 --- a/ncm-sudo/src/test/resources/test_general_options_valid.pan +++ b/ncm-sudo/src/test/resources/test_general_options_valid.pan @@ -7,23 +7,24 @@ include pro_declaration_types; include pro_declaration_component_sudo; include pro_declaration_functions_sudo; -"/software/components/sudo/privilege_lines" = list ( - dict ( "user", "mejias", +"/software/components/sudo/privilege_lines" = list( + dict( + "user", "mejias", "run_as", "munoz", "host", "localhost", "cmd", "/bin/ls", - "options", "NOPASSWD" - ) - ); + "options", "NOPASSWD", + ), +); -"/software/components/sudo/user_aliases" = dict ( - "FOO", list ("bar") - ); +"/software/components/sudo/user_aliases" = dict( + "FOO", list("bar"), +); "/software/components/sudo/active" = true; "/software/components/sudo/dispatch" = true; -"/software/components/sudo/general_options/" = list ( - dict ( - "options", dict ("insults", true) - ) - ); +"/software/components/sudo/general_options" = list( + dict( + "options", dict("insults", true), + ), +); diff --git a/ncm-sudo/src/test/resources/test_general_options_validh.pan b/ncm-sudo/src/test/resources/test_general_options_validh.pan index 88ec286043..3489dc49a5 100644 --- a/ncm-sudo/src/test/resources/test_general_options_validh.pan +++ b/ncm-sudo/src/test/resources/test_general_options_validh.pan @@ -7,24 +7,25 @@ include pro_declaration_types; include pro_declaration_component_sudo; include pro_declaration_functions_sudo; -"/software/components/sudo/privilege_lines" = list ( - dict ( "user", "mejias", +"/software/components/sudo/privilege_lines" = list( + dict( + "user", "mejias", "run_as", "munoz", "host", "localhost", "cmd", "/bin/ls", "options", "NOPASSWD" - ) - ); + ), +); -"/software/components/sudo/user_aliases" = dict ( - "FOO", list ("bar") - ); +"/software/components/sudo/user_aliases" = dict( + "FOO", list("bar"), +); "/software/components/sudo/active" = true; "/software/components/sudo/dispatch" = true; -"/software/components/sudo/general_options/" = list ( - dict ( +"/software/components/sudo/general_options" = list( + dict( "host", "192.168.0.1", - "options", dict ("insults", true) - ) - ); + "options", dict("insults", true), + ), +); diff --git a/ncm-sudo/src/test/resources/test_general_options_validr.pan b/ncm-sudo/src/test/resources/test_general_options_validr.pan index 723008e391..a47c576bb2 100644 --- a/ncm-sudo/src/test/resources/test_general_options_validr.pan +++ b/ncm-sudo/src/test/resources/test_general_options_validr.pan @@ -7,24 +7,25 @@ include pro_declaration_types; include pro_declaration_component_sudo; include pro_declaration_functions_sudo; -"/software/components/sudo/privilege_lines" = list ( - dict ( "user", "mejias", +"/software/components/sudo/privilege_lines" = list( + dict( + "user", "mejias", "run_as", "munoz", "host", "localhost", "cmd", "/bin/ls", - "options", "NOPASSWD" - ) - ); + "options", "NOPASSWD", + ), +); -"/software/components/sudo/user_aliases" = dict ( - "FOO", list ("bar") - ); +"/software/components/sudo/user_aliases" = dict( + "FOO", list("bar"), +); "/software/components/sudo/active" = true; "/software/components/sudo/dispatch" = true; -"/software/components/sudo/general_options/" = list ( - dict ( +"/software/components/sudo/general_options" = list( + dict( "run_as", "munoz", - "options", dict ("insults", true) - ) - ); + "options", dict("insults", true), + ), +); diff --git a/ncm-sudo/src/test/resources/test_general_options_validu.pan b/ncm-sudo/src/test/resources/test_general_options_validu.pan index fa95ea1468..095e4db22e 100644 --- a/ncm-sudo/src/test/resources/test_general_options_validu.pan +++ b/ncm-sudo/src/test/resources/test_general_options_validu.pan @@ -8,24 +8,25 @@ include pro_declaration_types; include pro_declaration_component_sudo; include pro_declaration_functions_sudo; -"/software/components/sudo/privilege_lines" = list ( - dict ( "user", "mejias", +"/software/components/sudo/privilege_lines" = list( + dict( + "user", "mejias", "run_as", "munoz", "host", "localhost", "cmd", "/bin/ls", - "options", "NOPASSWD" - ) - ); + "options", "NOPASSWD", + ), +); -"/software/components/sudo/user_aliases" = dict ( - "FOO", list ("bar") - ); +"/software/components/sudo/user_aliases" = dict( + "FOO", list("bar"), +); "/software/components/sudo/active" = true; "/software/components/sudo/dispatch" = true; -"/software/components/sudo/general_options/" = list ( - dict ( +"/software/components/sudo/general_options" = list( + dict( "user", "munoz", - "options", dict ("insults", false) - ) - ); + "options", dict("insults", false), + ), +); diff --git a/ncm-sudo/src/test/resources/testoptionerr.pan b/ncm-sudo/src/test/resources/testoptionerr.pan index e25a06d70e..d3398f08e7 100644 --- a/ncm-sudo/src/test/resources/testoptionerr.pan +++ b/ncm-sudo/src/test/resources/testoptionerr.pan @@ -8,17 +8,18 @@ include pro_declaration_types; include pro_declaration_component_sudo; include pro_declaration_functions_sudo; -"/software/components/sudo/privilege_lines" = list ( - dict ( "user", "mejias", +"/software/components/sudo/privilege_lines" = list( + dict( + "user", "mejias", "run_as", "munoz", "host", "localhost", "cmd", "/bin/ls", - "options", "INVALIDOPTION" - ) - ); + "options", "INVALIDOPTION", + ), +); -"/software/components/sudo/user_aliases" = dict ( - "FOO", list ("bar") - ); +"/software/components/sudo/user_aliases" = dict( + "FOO", list("bar"), +); "/software/components/sudo/active" = true; "/software/components/sudo/dispatch" = true;