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

Get "Different logins in connect and attach packets - client library error" when DENY to create database using valid pair login+password of user who was granted this privilege [CORE4820] #5117

Closed
firebird-automations opened this issue May 30, 2015 · 9 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: @pavel-zotov

Is related to CORE4811

Attachments:
trace-when-choose-NOT-to-create-database-as-user-john.zip

On WI-T3.0.0.31845

C:\TEMP>isql localhost/3333:e30 -user sysdba -pas masterke
Database: localhost/3333:e30, User: sysdba
SQL> drop user john; commit;
SQL> revoke all on all from john;
SQL> commit;
SQL>
C:\TEMP>isql localhost/3333:e30 -user sysdba -pas masterke
Database: localhost/3333:e30, User: sysdba
SQL> create or alter user john password '123';
SQL> revoke all on all from john;
Warning: ALL on ALL is not granted to JOHN.
SQL> grant create database to john;
SQL> create database 'localhost/3333:c:\temp\e30n.fdb' user 'john' password '123';
Commit current transaction (y/n)?n
Rolling back work.
Statement failed, SQLSTATE = 28000
Your user name and password are not defined. Ask your database administrator to set up a Firebird login.
-Different logins in connect and attach packets - client library error
SQL>

On LI-T3.0.0.31842

$ /opt/fb30ss/bin/isql localhost/3333:e30
Database: localhost/3333:e30
SQL> drop user john; commit;
Statement failed, SQLSTATE = HY000
record not found for user: JOHN
SQL> revoke all on all from john;
Warning: ALL on ALL is not granted to JOHN.
SQL> commit;
SQL> exit;

$ /opt/fb30ss/bin/isql localhost/3333:e30 -user sysdba -pas masterke
Database: localhost/3333:e30, User: sysdba
SQL> create or alter user john password '123';
SQL> revoke all on all from john;
Warning: ALL on ALL is not granted to JOHN.
SQL> grant create database to john;
SQL> create database 'localhost/3333:/var/db/fb30/e30n.fdb' user 'john' password '123';
Commit current transaction (y/n)?n
Rolling back work.
Statement failed, SQLSTATE = 28000
Your user name and password are not defined. Ask your database administrator to set up a Firebird login.
-Different logins in connect and attach packets - client library error
SQL>

Trace shows that after pressing 'n' (as answer to rollback Tx) user `john` actually DOES some actions - see attach:

2015-05-30T15:10:29.6710 (4092:01FD3B60) FAILED CREATE_DATABASE
localhost/3333:c:\temp\e30n.fdb (ATT_0, JOHN, NONE, <internal>)

2015-05-30T15:10:29.6710 (4092:01FD3B60) ERROR AT JProvider::createDatabase
localhost/3333:c:\temp\e30n.fdb (ATT_0, JOHN, NONE, <internal>)
335544375 : unavailable database

2015-05-30T15:10:29.6710 (4092:01FD3B60) TRACE_FINI
SESSION_2

PS. Why I get "Your user name and password are not defined" if I decided only NOT to *start* 'CREATE DATABASE' statement and wanted to return to SYSDBA session ?

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

Attachment: trace-when-choose-NOT-to-create-database-as-user-john.zip [ 12750 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @pavel-zotov

It looks like user who was granted to create database can do that only when he first connect to some existent database:

C:\TEMP>isql localhost/3333:e30 -user sysdba -pas masterke
Database: localhost/3333:e30, User: sysdba
SQL> create database 'localhost/3333:c:\temp\e30n.fdb' user 'john' password '123';
Commit current transaction (y/n)?y
Committing.
Statement failed, SQLSTATE = 28000
Your user name and password are not defined. Ask your database administrator to set up a Firebird login.
-Different logins in connect and attach packets - client library error
SQL>
C:\TEMP>isql localhost/3333:e30 -user sysdba -pas masterke
Database: localhost/3333:e30, User: sysdba
SQL> commit; create database 'localhost/3333:c:\temp\e30n.fdb' user 'john' password '123';
Statement failed, SQLSTATE = 28000
Your user name and password are not defined. Ask your database administrator to set up a Firebird login.
-Different logins in connect and attach packets - client library error
SQL>

C:\TEMP>isql localhost/3333:e30 -user john -pas 123
Database: localhost/3333:e30, User: john
SQL> commit; create database 'localhost/3333:c:\temp\e30n.fdb' user 'john' password '123';
SQL> select current_user from rdb$database;

USER

JOHN

Used firebird.conf:

AuthClient = Legacy_Auth,Srp,Win_Sspi
AuthServer = Legacy_Auth,Srp
UserManager = Legacy_UserManager
WireCrypt = Disabled

@firebird-automations
Copy link
Collaborator Author

Modified by: @AlexPeshkoff

assignee: Alexander Peshkov [ alexpeshkoff ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @AlexPeshkoff

Pavel, first of all re
> PS. Why I get "Your user name and password are not defined" if I decided only NOT to *start* 'CREATE DATABASE' statement and wanted to return to SYSDBA session ?
You've decided to not _commit_ last transaction in isql session, i.e. to _rollback_ it. I agree that text is probably far from ideal, but be sure - CREATE DATABASE is executed after answer no:

#⁠ ./isql localhost:employee -user sysdba -pas masterke
Database: localhost:employee, User: sysdba
SQL> create or alter user john password '123';
SQL> revoke all on all from john;
SQL> grant create database to john;
SQL> create database 'localhost:e30n.fdb' user john password '123';
Commit current transaction (y/n)?n
Rolling back work.
SQL> show database;
Database: localhost:e30n.fdb
Owner: JOHN
DB = /tmp/e30n.fdb
Host = localhost
Host = localhost
Host = localhost
PAGE_SIZE 4096
Number of DB pages allocated = 224
Sweep interval = 20000
Forced Writes are ON
Transaction - oldest = 1
Transaction - oldest active = 2
Transaction - oldest snapshot = 2
Transaction - Next = 5
ODS = 12.0
Default Character set: NONE
SQL>

At the same time you can see that error is not reproduced any more. Please recheck yourself with any snapshot after fix for CORE4811 - I had to enhance CREATE DATABASE statement when implementing it and looks like this issue is also gone.

@firebird-automations
Copy link
Collaborator Author

Commented by: @pavel-zotov

> recheck yourself with any snapshot after fix for CORE4811

Checked on WI-T3.0.0.31855 - all works OK, rollback of transaction and new database creation works fine, no such confusing messages.

@firebird-automations
Copy link
Collaborator Author

Modified by: @AlexPeshkoff

Link: This issue is related to CORE4811 [ CORE4811 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @AlexPeshkoff

Sooner of all has gone when fixing CORE4811

@firebird-automations
Copy link
Collaborator Author

Modified by: @AlexPeshkoff

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Cannot Reproduce [ 5 ]

Fix Version: 3.0 Beta 2 [ 10586 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

status: Resolved [ 5 ] => Closed [ 6 ]

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