-
Type: Bug
-
Resolution: Done
-
Priority: Minor - P4
-
Affects Version/s: 1.5.0
-
Component/s: libmongoc
-
None
In PHPLIB-174, a user failed to escape the Unix domain socket path in their connection URI and received an odd exception message when database authentication failed. While reading the server logs, I realized that libmongoc was still connecting via a Unix domain socket, despite the socket path inadvertently getting picked up as uri->database in mongoc-uri.c.
I added some string dumping to mongoc_uri_parse_database() and mongoc_uri_append_host() and determined the following:
URI: mongodb://foo:bar@/tmp/mongodb-27017.sock/admin HOST: /tmp/mongodb-27017.sock DATABASE: tmp/mongodb-27017.sock:27017/
Although Unix domain sockets do need to be escaped per the Connection String Specification, I found it odd that libmongoc was able to parse the host properly, but failed to parse the database. Since the order of URI components is clearly defined (e.g. credentials, host list, database, query string), database parsing should start after the host list to ensure that component parsing never overlaps.
- is related to
-
CDRIVER-1928 "Unknown command error" from authentication and misformatted domain socket URI
- Closed
-
PHPLIB-174 Document that socket paths must be URL-encoded
- Closed