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

Consider backporting "Fix sharded cluster & replica set authentication"

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • 0.96.0
    • 0.94.2
    • None
    • None
    • Minor Change

    Description

      This commit fixes the authentication command not being sent when using the replicaSet option in the uri.

      For example:

      Start a single node replicaset with auth:

      $ mongod --auth --dbpath replset/ --replSet db01

      Add a user with the appropriate roles to read from any database:

      use test
      db.test.insert({})
      use admin
      db.addUser({ user:"usr", pwd:"pwd", roles: ["readWriteAnyDatabase"]})

      cd mongo-c-driver-0.94.2
      ./example-client mongodb://usr:pwd@localhost/?replicaSet=db01
      2014/05/20 10:09:43.0299: [13722]:     INFO:      cluster: Client initialized in replica set mode.
      2014/05/20 10:09:43.0299: [13722]:    DEBUG:      cluster: Reconnecting to replica set.
      2014/05/20 10:09:43.0300: [13722]:    DEBUG:      cluster: Registering potential peer: localhost.localdomain:27017
      2014/05/20 10:09:43.0300: [13722]:    DEBUG:      cluster: Registering potential peer: localhost.localdomain:27017
      Cursor Failure: not authorized for query on test.test

      Attachments

        Activity

          People

            christian.hergert@10gen.com Christian Hergert
            gianfranco Gianfranco Palumbo
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: