[CDRIVER-369] Consider backporting "Fix sharded cluster & replica set authentication" Created: 20/May/14  Updated: 31/May/14  Resolved: 31/May/14

Status: Closed
Project: C Driver
Component/s: None
Affects Version/s: 0.94.2
Fix Version/s: 0.96.0

Type: Bug Priority: Major - P3
Reporter: Gianfranco Palumbo Assignee: Christian Hergert
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
Backwards Compatibility: 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



 Comments   
Comment by Christian Hergert [ 31/May/14 ]

This is fixed in 0.96.0. This is largely a bugfix release (although with a lot more documentation). Please update to 0.96.0 for the fix.

Generated at Wed Feb 07 21:09:17 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.