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

    Details

    • Team:
      Team C
    • Sprint:
      Sprint 4, Sprint 5
    • Story Points:
      0.5

      Description

      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 */
      

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            wiper Andris Zeila
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: