Skip to content

Incorrect handling of non-ASCII object names in CREATE MAPPING statement #8253

@hvlad

Description

@hvlad

Steps to reproduce:

  1. check current console code page
firebird>chcp
Active code page: 866
  1. connect with charset corresponding to the console code page
firebird>isql employee -ch dos866
Database: employee, User: SYSDBA
  1. create mapping using non-ASCII group name
SQL> create mapping m1 using any plugin from group группа to role role1;
Statement failed, SQLSTATE = 42000
Dynamic SQL Error
-SQL error code = -104
-Token unknown - line 1, column 47
-г

this is expected as literal группа is not quoted

  1. check with single and double quotes, local and global mappings
SQL> create mapping m1 using any plugin from group 'группа' to role role1;
SQL> create mapping m2 using any plugin from group "группа" to role role1;
SQL> create global mapping m3 using any plugin from group 'группа' to role role1;
SQL> create global mapping m4 using any plugin from group "группа" to role role1;

no errors, as expected

  1. check created mappings
SQL> show mapping;
M1 USING ANY PLUGIN FROM GROUP группа TO ROLE ROLE1
M2 USING ANY PLUGIN FROM GROUP ╨│╤А╤Г╨┐╨┐╨░ TO ROLE ROLE1

*** Global mapping ***
M3 USING ANY PLUGIN FROM GROUP ???????????? TO ROLE ROLE1
M4 USING ANY PLUGIN FROM GROUP ?????????????????????????????????? TO ROLE ROLE1

I see two issues here:

  • when using double quotes, literal is not encoded correctly by parser before put into database
  • when creating global mapping, strings is not not encoded correctly when passed into security.db connection

Also, it is not clear why double quotes is allowed at all. I don't think that name of the mapped object (for ex. OS user or group name) should follow rules of SQL-identifier.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions