From 4cda1281f1d83208bf6a6c704cbf67b7e7e83b8a Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Thu, 28 Apr 2022 09:34:12 +0200 Subject: global-functions: validate syntax of modules (cherry picked from commit 7c8e230521f1a936da034dfc05197fe9434926ed) --- global-functions | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'global-functions') diff --git a/global-functions b/global-functions index a86c1ea..89234f9 100644 --- a/global-functions +++ b/global-functions @@ -1271,7 +1271,12 @@ # load modules :foreach Script in=[ / system script find where name ~ "^mod/." ] do={ - / system script run $Script; + :local ScriptVal [ / system script get $Script ]; + :if ([ $ValidateSyntax ($ScriptVal->"source") ] = true) do={ + / system script run $Script; + } else={ + $LogPrintExit2 error $0 ("Module '" . $ScriptVal->"name" . "' failed syntax validation, skipping.") false; + } } # check for required RouterOS version -- cgit v1.2.3-70-g09d2