Details

    • Team:
      Team D
    • Sprint:
      Sprint 23, Sprint 24, Sprint 46, Nov 2018
    • Story Points:
      1

      Description

      Unable to pass argument to external check containing literal $ since everything is wrapped in double quotes. Escaping $ doesn't work also since sequence

      \$

      would become

      \\$

      by zabbix code here:

      svn blame svn://svn.zabbix.com/trunk/src/zabbix_server/poller/checks_external.c

      49450      wiper               param_esc = zbx_dyn_escape_string(param, "\"\\");
      49450      wiper               zbx_snprintf_alloc(&cmd, &cmd_alloc, &cmd_offset, " \"%s\"", param_esc);
       

      Steps to reproduce:
      create external check with key:

      script.sh[login,passwor$d]
      

      and file script.sh

      #!/bin/bash
      echo $1 $2
      

      Result:
      this would turn to

      login passwor
      

      Expected:

      login passwor$d
      

      Suggested
      Wrapping to single quotes instead of double quotes could help. Change how arguments are wrapped automatically:

      zabbix key                               -> command
      script.sh[login,passwor$d]       -> script.sh 'login' 'passwor$d'
      script.sh['login','passwor$d']    -> script.sh 'login' 'passwor$d'
      script.sh["login","passwor$d"]  -> script.sh "login" "passwor$d"
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                martins-v Martins Valkovskis
                Reporter:
                vzhuravlev Vitaly Zhuravlev
              • Votes:
                0 Vote for this issue
                Watchers:
                12 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: