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

SSH check does not properly handle type conversion error

XMLWordPrintable

    • Sprint 4, Sprint 5
    • 0.5

      SSH check stores the received value as a string without attempting to convert it to the item's value type. This leads to type conversion errors being silently ignored.

      For example create ssh check with numeric data type and script 'echo A'. The received value 'A' will be ignored instead of making item notsupported with appropriate error message.

      The following patch fixes it:

      Index: src/zabbix_server/poller/checks_ssh.c
      ===================================================================
      --- src/zabbix_server/poller/checks_ssh.c       (revision 66782)
      +++ src/zabbix_server/poller/checks_ssh.c       (working copy)
      @@ -86,7 +86,7 @@
              int             auth_pw = 0, rc, ret = NOTSUPPORTED,
                              exitcode, bytecount = 0;
              char            buffer[MAX_BUFFER_LEN], buf[16], *userauthlist,
      -                       *publickey = NULL, *privatekey = NULL, *ssherr;
      +                       *publickey = NULL, *privatekey = NULL, *ssherr, *output;
              size_t          sz;
       
              zabbix_log(LOG_LEVEL_DEBUG, "In %s()", __function_name);
      @@ -291,9 +291,11 @@
              }
       
              buffer[bytecount] = '\0';
      -       SET_STR_RESULT(result, convert_to_utf8(buffer, bytecount, encoding));
      +       output = convert_to_utf8(buffer, bytecount, encoding);
      +       if (SUCCEED == set_result_type(result, item->value_type, item->data_type, output))
      +               ret = SYSINFO_RET_OK;
       
      -       ret = SYSINFO_RET_OK;
      +       zbx_free(output);
       
       channel_close:
              /* close an active data channel */
      

            Unassigned Unassigned
            wiper Andris Zeila
            Team C
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: