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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
094a2590
Commit
094a2590
authored
Oct 28, 2016
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor DN cleaning
parent
0d344be8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
18 deletions
+18
-18
lib/ee/gitlab/ldap/sync/proxy.rb
lib/ee/gitlab/ldap/sync/proxy.rb
+18
-18
No files found.
lib/ee/gitlab/ldap/sync/proxy.rb
View file @
094a2590
...
...
@@ -76,32 +76,32 @@ module EE
next
end
# If there is more than one key/value set we must have a full DN,
# or at least the probability is higher.
if
parsed_dn
.
count
>
2
dn
elsif
parsed_dn
[
0
]
==
'uid'
dn_for_uid
(
parsed_dn
[
1
])
else
logger
.
warn
{
"Found potentially malformed/incomplete DN: '
#{
dn
}
'"
}
dn
end
final_dn
=
# If there is more than one key/value set we must have a full DN,
# or at least the probability is higher.
if
parsed_dn
.
count
>
2
dn
elsif
parsed_dn
[
0
]
==
'uid'
dn_for_uid
(
parsed_dn
[
1
])
else
logger
.
warn
{
"Found potentially malformed/incomplete DN: '
#{
dn
}
'"
}
dn
end
clean_encoding
(
final_dn
)
end
# Remove `nil` values generated by the rescue above.
dns
.
compact!
clean_encoding
(
dns
)
end
# net-ldap only returns ASCII-8BIT and does not support UTF-8 out-of-the-box:
# https://github.com/ruby-ldap/ruby-net-ldap/issues/4
def
clean_encoding
(
dns
)
dns
.
map
do
|
dn
|
begin
dn
.
force_encoding
(
'UTF-8'
)
rescue
dn
end
def
clean_encoding
(
dn
)
begin
dn
.
force_encoding
(
'UTF-8'
)
rescue
dn
end
end
...
...
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