Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
gitlab-ce
Commits
ca5ade22
Commit
ca5ade22
authored
Sep 18, 2017
by
Michael Kozono
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix `dn?` for a UID with an escaped equal sign
parent
fee3c95d
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
3 deletions
+4
-3
lib/gitlab/ldap/person.rb
lib/gitlab/ldap/person.rb
+1
-1
spec/lib/gitlab/ldap/person_spec.rb
spec/lib/gitlab/ldap/person_spec.rb
+3
-2
No files found.
lib/gitlab/ldap/person.rb
View file @
ca5ade22
...
@@ -50,7 +50,7 @@ module Gitlab
...
@@ -50,7 +50,7 @@ module Gitlab
# An empty string is technically a valid DN (null DN), although we should
# An empty string is technically a valid DN (null DN), although we should
# never need to worry about that.
# never need to worry about that.
def
self
.
dn?
(
uid_or_dn
)
def
self
.
dn?
(
uid_or_dn
)
uid_or_dn
.
blank?
||
uid_or_dn
.
include?
(
'='
)
uid_or_dn
.
blank?
||
!!
uid_or_dn
.
match
(
/(?<!\\)=/
)
end
end
# Returns the UID in a normalized form.
# Returns the UID in a normalized form.
...
...
spec/lib/gitlab/ldap/person_spec.rb
View file @
ca5ade22
...
@@ -100,12 +100,13 @@ describe Gitlab::LDAP::Person do
...
@@ -100,12 +100,13 @@ describe Gitlab::LDAP::Person do
where
(
:test_description
,
:given
,
:expected
)
do
where
(
:test_description
,
:given
,
:expected
)
do
'given a DN with a single RDN'
|
'uid=John C. Smith'
|
true
'given a DN with a single RDN'
|
'uid=John C. Smith'
|
true
'given a DN with multiple RDNs'
|
'uid=John C. Smith,ou=People,dc=example,dc=com'
|
true
'given a DN with multiple RDNs'
|
'uid=John C. Smith,ou=People,dc=example,dc=com'
|
true
'given a UID'
|
'John C. Smith'
|
false
'given a DN with a single RDN with excess spaces'
|
' uid=John C. Smith '
|
true
'given a DN with a single RDN with excess spaces'
|
' uid=John C. Smith '
|
true
'given a DN with multiple RDNs with excess spaces'
|
' uid=John C. Smith,ou=People,dc=example,dc=com '
|
true
'given a DN with multiple RDNs with excess spaces'
|
' uid=John C. Smith,ou=People,dc=example,dc=com '
|
true
'given a UID with excess spaces'
|
' John C. Smith '
|
false
'given a DN with an escaped equal sign'
|
'uid=John C. Smith,ou=People\\='
|
true
'given a DN with an escaped equal sign'
|
'uid=John C. Smith,ou=People\\='
|
true
'given a DN with an equal sign in escaped hex'
|
'uid=John C. Smith,ou=People\\3D'
|
true
'given a DN with an equal sign in escaped hex'
|
'uid=John C. Smith,ou=People\\3D'
|
true
'given a UID'
|
'John C. Smith'
|
false
'given a UID with excess spaces'
|
' John C. Smith '
|
false
'given a UID with an escaped equal sign'
|
'John C. \\= Smith'
|
false
end
end
with_them
do
with_them
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment