Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-3696

An "ok":0 ismaster reply should only be considered an auth error during handshake

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Major - P3 Major - P3
    • None
    • None
    • auth
    • None

    Description

      mongoc_server_description_handle_ismaster checks if the ismaster reply returned "ok":0 and always treats it like an authentication error:

                  /* ismaster response returned ok: 0. According to auth spec: "If the
                   * isMaster of the MongoDB Handshake fails with an error, drivers
                   * MUST treat this an authentication error." */
                  sd->error.domain = MONGOC_ERROR_CLIENT;
                  sd->error.code = MONGOC_ERROR_CLIENT_AUTHENTICATE;
                  goto failure;
               }
      

      But this is called for any ismaster reply. That happens when opening an application connection and on ismaster replies received from monitoring. The auth spec says:

      Upon opening a general-use socket to a server for a given MongoClient, drivers MUST issue a MongoDB Handshake immediately. This allows a driver to determine the server type. If the isMaster of the MongoDB Handshake fails with an error, drivers MUST treat this as an authentication error.

      libmongoc should only treat this as an auth error if processing an ismaster reply from the initial handshake on an application connection.

      Attachments

        Activity

          People

            Unassigned Unassigned
            kevin.albertson@mongodb.com Kevin Albertson
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: