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

connection socket has no close-on-exec flag set

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Minor
    • Resolution: Unresolved
    • None
    • None
    • None
    • None
    • Linux archlinux 5.0.9-arch1-1-ARCH #1 SMP PREEMPT Sat Apr 20 15:00:46 UTC 2019 x86_64 GNU/Linux

      Installed mariadb packages:
      - local/mariadb 10.3.14-1
      - local/mariadb-clients 10.3.14-1
      - local/mariadb-libs 10.3.14-1

    Description

      After opening connection with mysql_real_connect(), the connection socket (the one that mysql_get_socket() returns) has no close-on-exec flag set. The following code is needed after calling mysql_real_connect() to get this flag set:

      // Set CLOEXEC flag on the mysql socket
      int mysql_socket = mysql_get_socket(...);
      int flags = fcntl(mysql_socket, F_GETFD);
      if (flags == -1)
      	/* Handle error */;
      if (fcntl(mysql_socket, F_SETFD, flags | FD_CLOEXEC) == -1)
      	/* Handle error */;
      

      I suppose that this flag should be set by the connector, for security reasons.

      Attachments

        Activity

          People

            georg Georg Richter
            quasar Krzysztof Małysa
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

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