]> granicus.if.org Git - icinga2/commitdiff
Implement the escape_shell_arg and escape_shell_cmd functions
authorGunnar Beutner <gunnar@beutner.name>
Thu, 27 Aug 2015 06:57:56 +0000 (08:57 +0200)
committerGunnar Beutner <gunnar@beutner.name>
Thu, 27 Aug 2015 07:02:21 +0000 (09:02 +0200)
fixes #10004

doc/20-library-reference.md
lib/base/scriptutils.cpp

index dca6294cd64de4162e646e88923306480a0dce00..9531b1df441960c3a40a9f56899d5c1f5a1da102 100644 (file)
@@ -21,6 +21,8 @@ get_time()                      | Returns the current UNIX timestamp.
 parse_performance_data(pd)      | Parses a performance data string and returns an array describing the values.
 dirname(path)                   | Returns the directory portion of the specified path.
 basename(path)                  | Returns the filename portion of the specified path.
+escape\_shell\_arg(text)        | Escapes a string for use as a single shell argument.
+escape\_shell\_cmd(text)        | Escapes shell meta characters in a string.
 exit(integer)                   | Terminates the application.
 
 ## <a id="object-accessor-functions"></a> Object Accessor Functions
index 4d62522d9f9460f64d4de175d2ea5e9a7a42e94e..5651b29d1688b1c72425e698368d2f90a8c9282a 100644 (file)
@@ -59,6 +59,8 @@ REGISTER_SAFE_SCRIPTFUNCTION(basename, &Utility::BaseName);
 REGISTER_SAFE_SCRIPTFUNCTION(dirname, &Utility::DirName);
 REGISTER_SAFE_SCRIPTFUNCTION(msi_get_component_path, &ScriptUtils::MsiGetComponentPathShim);
 REGISTER_SAFE_SCRIPTFUNCTION(track_parents, &ScriptUtils::TrackParents);
+REGISTER_SAFE_SCRIPTFUNCTION(escape_shell_cmd, &Utility::EscapeShellCmd);
+REGISTER_SAFE_SCRIPTFUNCTION(escape_shell_arg, &Utility::EscapeShellArg);
 
 String ScriptUtils::CastString(const Value& value)
 {