[CONC-631] Anonymous user with skip-resolve-name recognized as 'USERNAME' on Windows Created: 2023-01-30 Updated: 2023-10-13 Resolved: 2023-10-13 |
|
| Status: | Closed |
| Project: | MariaDB Connector/C |
| Component/s: | Documentation |
| Affects Version/s: | None |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Major |
| Reporter: | Anel Husakovic | Assignee: | Georg Richter |
| Resolution: | Incomplete | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Windows |
||
| Issue Links: |
|
||||||||
| Description |
|
MDEV-30487 showed example of missing test case with skip-name-resolve and anonymous user in mtr. |
| Comments |
| Comment by Vladislav Vaintroub [ 2023-01-30 ] | ||||||||
|
anelThe situation does very well occur on non-Windows OSes, but in your environment read_user_name probably resolves to "root", and you accidentally are able to connect with that user and empty password. | ||||||||
| Comment by Georg Richter [ 2023-01-30 ] | ||||||||
|
read_user_name() returns the currently logged in user, if user name for mysql_real_connect() was not specified.
| ||||||||
| Comment by Vladislav Vaintroub [ 2023-01-30 ] | ||||||||
|
user name not specified, is when NULL is passed to mysql_real_connect. | ||||||||
| Comment by Georg Richter [ 2023-01-30 ] | ||||||||
|
Same behavior in MySQL, but it is documented: https://dev.mysql.com/doc/c-api/8.0/en/mysql-real-connect.html "If user is NULL or the empty string "", the current user is assumed". So yes, it's missing in our documentation. | ||||||||
| Comment by Anel Husakovic [ 2023-01-30 ] | ||||||||
|
By testing I noted that combination anonymous user + skip-name-resolve fails on buildbot and only on Windows (below is proof). 1. Without skip-name-resolve, here we still have anonymous user, buildbot doesn't fail. 2. With skip-name-resolve it fails (only on Windows) - here we may have a bug/or undocumented behavior: Just wanted to point that mtr is missing this test case to cover and we have failure on buildbot only on Windows.
[1] https://dev.mysql.com/doc/c-api/8.0/en/mysql-real-connect.html | ||||||||
| Comment by Vladislav Vaintroub [ 2023-01-30 ] | ||||||||
|
I derive from looking at the code and from Georg's answer, that there is no anonymous user possible, with Connector C, because connector C does not send empty string. So, I'm not sure what's tested here. What you assume as anonymous is probably root@localhost, or root@127.0.0.1, or root@::1 . (I'm not commenting, whether localhost is or should be 127.0.0.1 or ::1, with or without skip-name-resolve, I do not care, to me it is the same thing |