-
Type: Bug
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: auth
-
None
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.