[CDRIVER-640] mongoc_client_get_database_names does not set error Created: 07/May/15  Updated: 17/Aug/15  Resolved: 28/May/15

Status: Closed
Project: C Driver
Component/s: libmongoc
Affects Version/s: 1.1.4
Fix Version/s: 1.2-beta0

Type: Bug Priority: Major - P3
Reporter: Maverick Chan Assignee: A. Jesse Jiryu Davis
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

mongoc_client_get_database_names does not set the bson_error_t struct or return NULL even if an error is encountered.

If I change mongoc-client.c:1316 to:

   if (!ret && !mongoc_cursor_error(cursor, error)) {

then it looks like the error is set.

A simple test case is connecting with an invalid user/pwd, then calling mongoc_client_get_database_names (should return NULL).



 Comments   
Comment by Githook User [ 05/Aug/15 ]

Author:

{u'username': u'ajdavis', u'name': u'A. Jesse Jiryu Davis', u'email': u'jesse@mongodb.com'}

Message: CDRIVER-640 mongoc_client_get_database_names err handling in 1.1.x
Branch: 1.2.0-dev
https://github.com/mongodb/mongo-c-driver/commit/ec4ad3d0e504e279b821356d054726f34cc36285

Comment by Githook User [ 29/May/15 ]

Author:

{u'username': u'ajdavis', u'name': u'A. Jesse Jiryu Davis', u'email': u'jesse@mongodb.com'}

Message: CDRIVER-640 mongoc_client_get_database_names err handling in 1.1.x
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/ec4ad3d0e504e279b821356d054726f34cc36285

Comment by Githook User [ 28/May/15 ]

Author:

{u'username': u'ajdavis', u'name': u'A. Jesse Jiryu Davis', u'email': u'jesse@mongodb.com'}

Message: CDRIVER-640 mongoc_client_get_database_names err handling

Properly sets bson_error_t and returns NULL on error.
Branch: 1.2.0-dev
https://github.com/mongodb/mongo-c-driver/commit/bc5e70cb7a121a770ea478452ff459ef9d304cce

Comment by Githook User [ 28/May/15 ]

Author:

{u'username': u'ajdavis', u'name': u'A. Jesse Jiryu Davis', u'email': u'jesse@mongodb.com'}

Message: CDRIVER-640 test mongoc_client_get_database_names
Branch: 1.2.0-dev
https://github.com/mongodb/mongo-c-driver/commit/f0bb103d490b8bdabef6fa4cff98ceab0a7f4673

Comment by A. Jesse Jiryu Davis [ 09/May/15 ]

Thanks for the report and the suggested fix! I noticed a similar bug in get_collection_names, CDRIVER-618, which I'm fixing in this release. I'll take a look at mongoc_client_get_database_names for the next release.

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