Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-12963

Unable to pass $ sign to external check

XMLWordPrintable

    • Sprint 23, Sprint 24, Sprint 46, Nov 2018
    • 1

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

      \${code} would become 


      ${code} 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"
      

            martins-v Martins Valkovskis
            vzhuravlev Vitaly Zhuravlev
            Team D
            Votes:
            0 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated:
              Resolved: