From: Alan T. DeKok Date: Mon, 30 Oct 2023 13:25:45 +0000 (-0400) Subject: move away from backticks, and use %exec() X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fac9b5211cfe41136f88624bbc206fef24aff31b;p=thirdparty%2Ffreeradius-server.git move away from backticks, and use %exec() It looks harder to use. Instead of passing one string which is then split by exec, we pass multiple strings as function arguments. However, this is likely safer, too. --- diff --git a/src/tests/modules/exec/backticks_list.unlang b/src/tests/modules/exec/backticks_list.unlang index e946b5e7da0..bb1261718fd 100644 --- a/src/tests/modules/exec/backticks_list.unlang +++ b/src/tests/modules/exec/backticks_list.unlang @@ -2,7 +2,7 @@ # Sync calls should always return a zero length string # because we don't wait for the response. # -&Tmp-String-0 := `/bin/sh -c 'echo hello'` +&Tmp-String-0 := %exec('/bin/sh', '-c', 'echo hello') if (&Tmp-String-0 != 'hello') { test_fail } else { @@ -12,7 +12,7 @@ if (&Tmp-String-0 != 'hello') { # # @todo - list over-rides are not allowed! # -&control += `/bin/sh -c "echo Reply-Message := \'hello\'"` +&control += %exec('/bin/sh', '-c', "echo Reply-Message := \'hello\'") if (&control.Reply-Message != 'hello') { test_fail diff --git a/src/tests/modules/exec/module.conf b/src/tests/modules/exec/module.conf index c4fcd49ad6d..9e4382b9958 100644 --- a/src/tests/modules/exec/module.conf +++ b/src/tests/modules/exec/module.conf @@ -1,3 +1,10 @@ +exec { + wait = yes + input_pairs = &request + shell_escape = yes + timeout = 10 +} + exec exec_async { wait = no input_pairs = &request diff --git a/src/tests/modules/linelog/linelog.unlang b/src/tests/modules/linelog/linelog.unlang index 99ff5d5da50..723ff1976d3 100644 --- a/src/tests/modules/linelog/linelog.unlang +++ b/src/tests/modules/linelog/linelog.unlang @@ -273,7 +273,7 @@ else { test_fail } -&Tmp-Integer-0 := `/bin/sh -c "wc -l < $ENV{MODULE_TEST_DIR}/test_e.log"` +&Tmp-Integer-0 := %exec('/bin/sh', '-c', "wc -l < $ENV{MODULE_TEST_DIR}/test_e.log") if (&Tmp-Integer-0 == 3) { test_pass diff --git a/src/tests/modules/linelog/module.conf b/src/tests/modules/linelog/module.conf index 5eebcd63871..eae06742c5a 100644 --- a/src/tests/modules/linelog/module.conf +++ b/src/tests/modules/linelog/module.conf @@ -140,3 +140,10 @@ linelog linelog_ref_multi { test_empty = &control.User-Name[*] } } + +exec { + wait = yes + input_pairs = &request + shell_escape = yes + timeout = 10 +}