-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: legacy-1.0.3
-
Component/s: API
We're upgrading from 2.x to 3.0.4 and are having difficulty connecting to a fresh 3.0.4 replica set via the C++ 1.0.3 driver. If the connection string contains just a single member of the set, connection/auth works perfectly, but if all replica set members are specified, auth fails. Using either mongo::DBClientReplicaSet or mongo::ConnectionString::connect results in the same failure behavior.
When multiple members of a set are specified, the driver does not detect that it's connecting to a Mongo 3 instance, and will attempt to use MONGO-CR instead of SCRAM-SHA1. Tracing through the client code, the client is setting its minimum and maximum wireline versions to (0,0) instead of (0,3) when connecting to the 3.0.4 replica set, which then causes it to default to MONGO-CR as its authentication mechanism. If we add code to detect the wireline version after making a connection (as is done by the driver when connecting to a single machine), the authentication type is set correctly and authentication succeeds.
Are we doing something wrong or is this a defect in the driver? FWIW, connecting to the same replica sets with the Python driver works as expected when all members are listed...
A test executable is attached. To build, update the property sheets with the correct locations for boost, mongo, openssl, and gmock. Enable one of the two test methods DISABLED_TestConnectionReplicaSetAuth or DISABLED_TestConnectionReplicaSetConnectionStringAuth to reproduce the issue.