]> 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>
Tue, 13 Oct 2015 10:06:15 +0000 (12:06 +0200)
fixes #10004

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

index b452b4a787418eb98c3573ee4cff0488e1be94d8..b262c715963fce9a5ccb56b20a0957e7a4c4ce96 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.
 escape\_create\_process\_arg(text)| (Windows only) Escapes a string for use as an argument for CreateProcess().
 exit(integer)                   | Terminates the application.
 
index 837885b8043d4df9f12b8479fdc5c8b3e5053701..f9b5429bfab114b7d0930382dca2787c63d694a9 100644 (file)
@@ -58,10 +58,11 @@ REGISTER_SCRIPTFUNCTION(get_time, &Utility::GetTime);
 REGISTER_SCRIPTFUNCTION(basename, &Utility::BaseName);
 REGISTER_SCRIPTFUNCTION(dirname, &Utility::DirName);
 REGISTER_SCRIPTFUNCTION(msi_get_component_path, &ScriptUtils::MsiGetComponentPathShim);
+REGISTER_SCRIPTFUNCTION(escape_shell_cmd, &Utility::EscapeShellCmd);
+REGISTER_SCRIPTFUNCTION(escape_shell_arg, &Utility::EscapeShellArg);
 #ifdef _WIN32
 REGISTER_SCRIPTFUNCTION(escape_create_process_arg, &Utility::EscapeCreateProcessArg);
 #endif /* _WIN32 */
->>>>>>> 08ccb4e... Build fix
 
 String ScriptUtils::CastString(const Value& value)
 {