Commit e349ca13 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'ldap-filter-eq' into 'master'

Escape wildcards when searching LDAP by username.

Addresses https://dev.gitlab.org/gitlab/gitlabhq/issues/2086.

Also see https://dev.gitlab.org/gitlab/gitlab-ee/merge_requests/344 and https://dev.gitlab.org/gitlab/omniauth-ldap/merge_requests/2.

See merge request !1644
parents 8cebbea7 757dca2b
...@@ -58,6 +58,7 @@ v 7.8.2 ...@@ -58,6 +58,7 @@ v 7.8.2
- Fix import check for case sensetive namespaces - Fix import check for case sensetive namespaces
- Increase timeout for Git-over-HTTP requests to 1 hour since large pulls/pushes can take a long time. - Increase timeout for Git-over-HTTP requests to 1 hour since large pulls/pushes can take a long time.
- Properly handle autosave local storage exceptions. - Properly handle autosave local storage exceptions.
- Escape wildcards when searching LDAP by username.
v 7.8.1 v 7.8.1
- Fix run of custom post receive hooks - Fix run of custom post receive hooks
......
...@@ -50,7 +50,7 @@ module Gitlab ...@@ -50,7 +50,7 @@ module Gitlab
end end
def user_filter(login) def user_filter(login)
filter = Net::LDAP::Filter.eq(config.uid, login) filter = Net::LDAP::Filter.equals(config.uid, login)
# Apply LDAP user filter if present # Apply LDAP user filter if present
if config.user_filter.present? if config.user_filter.present?
......
...@@ -9,10 +9,12 @@ module Gitlab ...@@ -9,10 +9,12 @@ module Gitlab
attr_accessor :entry, :provider attr_accessor :entry, :provider
def self.find_by_uid(uid, adapter) def self.find_by_uid(uid, adapter)
uid = Net::LDAP::Filter.escape(uid)
adapter.user(adapter.config.uid, uid) adapter.user(adapter.config.uid, uid)
end end
def self.find_by_dn(dn, adapter) def self.find_by_dn(dn, adapter)
dn = Net::LDAP::Filter.escape(dn)
adapter.user('dn', dn) adapter.user('dn', dn)
end end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment