Uploaded image for project: 'MariaDB Connector/C'
  1. MariaDB Connector/C
  2. CONC-693

ma_tls_async_check_result improperly considers return value of 0 from SSL_read/write as success

Details

    Description

      While debugging an issue with proxysql which leverages the mariadb client library I found that ma_tls_async_check_result() improperly considers a return value of 0 from SSL_read/write as success. I filed the following pull request via github, but haven't seen any movement on it so found this Jira project and decided to see if this is the proper place to file these sorts of issues.

      Please let me know if you need more information about the issue. This is my first proposed patch to mariadb.

      https://github.com/mariadb-corporation/mariadb-connector-c/pull/243

      SSL_read man page states:

      Return Values
      The following return values can occur:

      >0
      The read operation was successful; the return value is the number of bytes actually read from the TLS/SSL connection.

      0

      The read operation was not successful. The reason may either be a clean shutdown due to a "close notify" alert sent by the peer (in which case the SSL_RECEIVED_SHUTDOWN flag in the ssl shutdown state is set (see ssl_shutdown(3), ssl_set_shutdown(3)). It is also possible, that the peer simply shut down the underlying transport and the shutdown is incomplete. Call SSL_get_error() with the return value ret to find out, whether an error occurred or the connection was shut down cleanly ( SSL_ERROR_ZERO_RETURN ).

      SSLv2 (deprecated) does not support a shutdown alert protocol, so it can only be detected, whether the underlying connection was closed. It cannot be checked, whether the closure was initiated by the peer or by something else.

      Attachments

        Activity

          johunt Josh Hunt added a comment -

          @serg thanks for taking a look at this ticket. Is it ok to use the pull request I filed on github, or should I submit one to this ticket?

          johunt Josh Hunt added a comment - @serg thanks for taking a look at this ticket. Is it ok to use the pull request I filed on github, or should I submit one to this ticket?

          Yes, sure, it's fine. I've added the issue key to the PR title, hopefully Jira will pick it up now. But even if not — you put the link in the description, it's enough, thanks!

          serg Sergei Golubchik added a comment - Yes, sure, it's fine. I've added the issue key to the PR title, hopefully Jira will pick it up now. But even if not — you put the link in the description, it's enough, thanks!

          People

            georg Georg Richter
            johunt Josh Hunt
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.