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

Can't connect with mixed case user name [DNET851] #783

Closed
firebird-automations opened this issue Sep 15, 2018 · 7 comments
Closed

Can't connect with mixed case user name [DNET851] #783

firebird-automations opened this issue Sep 15, 2018 · 7 comments

Comments

@firebird-automations
Copy link

Submitted by: Kjell Rilbe (kjellrilbe)

I created a user and database in isql connected to security3.db:

create user "KorningarDev" password '***';
create database 'KorningarDev' user "KorningarDev" password '***' page_size 4096 set names 'UTF8' default character set UTF8 collation UNICODE;

I can use this database from FlameRobin, specifying the user name with quotes "KorningarDev". But I can't connect to it from the FirebirdClient. I've tried several different variations of connection string, but nothing works.

With a uppercase user, this connection string works:

http://Server=xxx.xxx.xxx.xxx;Port=3050;Database=KorningarDev;Charset=UTF8;User=DEV;Password=***

With the mixed case user name, none of these semm to work:

http://Server=xxx.xxx.xxx.xxx;Port=3050;Database=KorningarDev;Charset=UTF8;User=KorningarDev;Password=***
http://Server=xxx.xxx.xxx.xxx;Port=3050;Database=KorningarDev;Charset=UTF8;User="KorningarDev";Password=***
http://Server=xxx.xxx.xxx.xxx;Port=3050;Database=KorningarDev;Charset=UTF8;User='KorningarDev';Password=***

I would assume that the FirebirdClient, along the way, loses the quotes on the user name, causing the login request to attemt login with an uppercased username KORNINGARDEV.

Commits: a6ef565

@firebird-automations
Copy link
Author

Commented by: Kjell Rilbe (kjellrilbe)

After additional debugging into the FirebirdClient code I can deduce that both mixed case and double or single quotes from the connection string are still present in the encoded DatabaseParameterBlock. Connection strings' values can be quoted using "'...'" (causing a single quoted value) or vice versa '"..."' (causing a double quoted value). This seems to work as expected.

According to Mark Rotteveel in the Firebird-devel mailing list, there is a problem "down the line". He indicated that the SRP implementation always uppercases the user name, which would be incorrect. A quoted user name should not be tampered with in any way (except transliteration if required).

@firebird-automations
Copy link
Author

Commented by: Kjell Rilbe (kjellrilbe)

I have now also tried to change SrpClient. I replaced all three ToUpper() calls with a function that returns uppercase value only if the value is unquoted. A quoted value is returned as is.

I tried two variations: 1) preserve the double quotes, and 2) strip away the double quotes.

I still get the same error. Something else has to be wrong.

Maybe take a look at FlameRobin code? If the user name is registered with double quotes, FlameRobin is able to connect, and everything works fine. So FlameRobin apparently does this right.

@firebird-automations
Copy link
Author

Commented by: @mrotteveel

Pull request with fix: cincuranet/FirebirdSql.Data.FirebirdClient#79

@firebird-automations
Copy link
Author

Modified by: @cincuranet

status: Open [ 1 ] => In Progress [ 3 ]

@firebird-automations
Copy link
Author

Modified by: @cincuranet

Fix Version: 6.4.0.0 [ 10884 ]

@firebird-automations
Copy link
Author

Commented by: @cincuranet

Fixed with PR, commit cincuranet/FirebirdSql.Data.FirebirdClient@a6ef565.

@firebird-automations
Copy link
Author

Modified by: @cincuranet

status: In Progress [ 3 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

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

No branches or pull requests

2 participants