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

Unquoted role names with non-ASCII characters passed in DPB are upper-cased wrongly [CORE3511] #3869

Closed
firebird-issue-importer opened this issue Jun 3, 2011 · 6 comments

Comments

@firebird-issue-importer
Copy link

@firebird-issue-importer firebird-issue-importer commented Jun 3, 2011

Submitted by: @asfernandes

The problem is different in Windows and others OSes.

In Windows, the utf-8 encoded string is upper-cased as a Windows ANSI string hence mangling non-ASCII characters.

In others, only ASCII characters are upper-cased, leaving others as was.

Commits: 59d841e e2bd4d0

====== Test Details ======

Waiting for reply on letter 14-mar-2016 21:06 (sent dimitr): it seems that test can be implemented only for run under POSIX.

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jun 4, 2011

Modified by: @asfernandes

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

resolution: Fixed [ 1 ]

Fix Version: 2.5.1 [ 10333 ]

Fix Version: 3.0 Alpha 1 [ 10331 ]

assignee: Adriano dos Santos Fernandes [ asfernandes ]

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Apr 23, 2013

Modified by: @pcisar

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

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented Jan 18, 2016

Modified by: @pavel-zotov

QA Status: No test

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented May 24, 2016

Modified by: @pavel-zotov

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

QA Status: No test => Deferred

Test Details: Waiting for reply on letter 14-mar-2016 21:06 (sent dimitr): it seems that test can be implemented only for run under POSIX.

@firebird-issue-importer
Copy link
Author

@firebird-issue-importer firebird-issue-importer commented May 24, 2016

Commented by: @pavel-zotov

On Windows non-ascii role can not be passed within connection statement (i.e. connect ... role <some-non-ascii-text> )
Is it possible to solve ?

Sample:
#⁠#⁠#⁠#⁠#⁠#⁠#⁠

drop user tmp$c3511;
commit;
create user tmp$c3511 password '123';
commit;

set bail on;
set wng off;

create or alter view v_whoami as
select current_user as cur_user,mon$role as mon_role,current_role as cur_role
from mon$attachments
where mon$attachment_id=current_connection;

revoke all on all from tmp$c3511;
commit;
create role "Gros";
create role "Groß";
create role "Groſ";
create role "οµικρον";
create role "αβγδε";

grant "Gros" to tmp$c3511;
grant "Groß" to tmp$c3511;
grant "Groſ" to tmp$c3511;
grant "οµικρον" to tmp$c3511;
grant "αβγδε" to tmp$c3511;
commit;

grant select on v_whoami to tmp$c3511;
commit;

show roles;
show grants;

set list on;
set echo on;

connect '/:e30' user tmp$c3511 password '123' role "Gros"; select * from v_whoami;
commit;

connect '/:e30' user tmp$c3511 password '123' role "αβγδε"; select * from v_whoami;
commit;

connect '/:e30' user tmp$c3511 password '123' role "Groß"; select * from v_whoami;
commit;

Output (see also attached screen):
#⁠#⁠#⁠#⁠#⁠#⁠

C:\MIX\firebird\QA\fbt-repo\tmp>chcp
Текущая кодовая страница: 65001 --------------- this is somewhat like 'utf8 codepage' in MS Win

C:\MIX\firebird\QA\fbt-repo\tmp>copy /y e30.fd0 *.fdb 1>nul 2>&1 & C:\MIX\firebird\fb30\isql /:e30 -i c3511-30.sql
Gros Groß
Groſ αβγδε
οµικρον

/* Grant permissions for this database */
GRANT SELECT ON V_WHOAMI TO USER TMP$C3511
GRANT Gros TO TMP$C3511
GRANT Groß TO TMP$C3511
GRANT Groſ TO TMP$C3511
GRANT αβγδε TO TMP$C3511
GRANT οµικρον TO TMP$C3511

connect '/:e30' user tmp$c3511 password '123' role "Gros"; select * from v_whoami;

CUR_USER TMP$C3511
MON_ROLE Gros
CUR_ROLE Gros

commit;

connect '/:e30' user tmp$c3511 password '123' role "αβγδε"; select * from v_whoami;

CUR_USER TMP$C3511
MON_ROLE NONE
CUR_ROLE NONE

commit;

connect '/:e30' user tmp$c3511 password '123' role "Groß"; select * from v_whoami;

CUR_USER TMP$C3511
MON_ROLE NONE
CUR_ROLE NONE

commit;

@pavel-zotov
Copy link

@pavel-zotov pavel-zotov commented Apr 27, 2021

::: test details :::
Attribute 'test_type' can be 'ISQL' only under LINUX.

As of Windows, only system code page can be used when ISQL passes user/role containing non-ascii characters
(see letter from dimitr, 12-mar-2016, 19:14).

Because of this, it was decided to use Pytthon FDB for connect with DPB that contains non-ascii data.
FDB method connect() of class Connection has parameter 'utf8params' with possible values True | False.
When this parameter is True, all info passed to DPB in UTF-8. Test uses this to form proper DPB and connect
to database with non-ascii role. This role must be specified WITHOUT double quotes.

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

Successfully merging a pull request may close this issue.

None yet
3 participants