Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mysql-auth drops trailing spaces before database-request #161

Open
sh-dvl opened this issue Apr 22, 2020 · 1 comment
Open

mysql-auth drops trailing spaces before database-request #161

sh-dvl opened this issue Apr 22, 2020 · 1 comment

Comments

@sh-dvl
Copy link

sh-dvl commented Apr 22, 2020

if someone enters a trailing space after the username, windows recognize it as normal character.

using the mysql-plugin this username is cleaned up before checking auth.

auth succeeds, but windows keeps this space, so first a new user is created and then on any access to fileservers windows asks for auth-credentials.

system is windows 10 1909, pgIna 3.9.9.12

@sh-dvl
Copy link
Author

sh-dvl commented Jun 16, 2020

this is not a bug of the plugin, but standard behaviour of mysql/mariadb, called collating pad.
(see: https://dev.mysql.com/doc/refman/8.0/en/charset-binary-collations.html#charset-binary-collations-trailing-space-comparisons , https://mariadb.com/kb/en/supported-character-sets-and-collations/#no-pad-collations )

for mysql it seems that this can be configured, for mariadb this seems not to be possible.

a workaround is, to modify in file MySqlUserDataSource.cs the select-strings by adding "BINARY" in front of the user-param.

for example in function GetUserEntry() instead of:
"SELECT {1}, {2}, {3} FROM {0} WHERE {1}=@user"
use:
"SELECT {1}, {2}, {3} FROM {0} WHERE {1} = BINARY @user"

same in IsMemberOfGroup()

after changing these statements, trailing spaces won't match anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant