[go: up one dir, main page]

Skip to content

Downcase with cyrillic symbols

Hi!

There is a problem with API auth (POST /session) by ldap credentials, if CN contains cyrillic symbols.

in log file:

SELECT "users".* FROM "users" WHERE (lower(username) = 'meremin' OR lower(email) = 'meremin') ORDER BY "users"."id" ASC LIMIT 1

SELECT "users".* FROM "users" WHERE "users"."provider" IN ('ldapmain', 'ldap') AND (lower(extern_uid) = 'cn=Еремин Михаил,cn=users,dc=creat0rs,dc=creators,dc=ru') ORDER BY "users"."id" DESC LIMIT 1

The problem is in downcase method of ruby String class. I've fixed this problem by replacing

where('lower(extern_uid) = ?', uid.downcase).last  

with

where('lower(extern_uid) = ?', uid.mb_chars.downcase.to_s).last

but it is not a clean solution.

System information
System:		Debian 7.6
Current User:	git
Using RVM:	no
Ruby Version:	2.1.2p95
Gem Version:	2.2.2
Bundler Version:1.6.3
Rake Version:	10.3.2
Sidekiq Version:2.17.0

GitLab information
Version:	7.5.1
Revision:	36679b5
Directory:	/home/git/gitlab
DB Adapter:	postgresql
URL:		http://gitlab.crt
HTTP Clone URL:	http://gitlab.crt/some-project.git
SSH Clone URL:	git@gitlab.crt:some-project.git
Using LDAP:	yes
Using Omniauth:	no

GitLab Shell
Version:	2.2.0
Repositories:	/home/git/repositories/
Hooks:		/home/git/gitlab-shell/hooks/
Git:		/usr/bin/git