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
430ceaa9
Commit
430ceaa9
authored
Mar 28, 2014
by
Jacob Vosmaer
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'bug/ldap_dn_matches_filter' into 'master'
Handle LDAP errors in Adapter#dn_matches_filter?
parents
ec73107d
4e9d2808
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
1 deletion
+40
-1
CHANGELOG-EE
CHANGELOG-EE
+3
-0
lib/gitlab/ldap/adapter.rb
lib/gitlab/ldap/adapter.rb
+6
-1
spec/lib/gitlab/ldap/ldap_adapter_spec.rb
spec/lib/gitlab/ldap/ldap_adapter_spec.rb
+31
-0
No files found.
CHANGELOG-EE
View file @
430ceaa9
v 6.7.1
- Handle LDAP errors in Adapter#dn_matches_filter?
v 6.7.0
- Improve LDAP sign-in speed by reusing connections
- Add support for Active Directory nested LDAP groups
...
...
lib/gitlab/ldap/adapter.rb
View file @
430ceaa9
...
...
@@ -107,7 +107,12 @@ module Gitlab
end
def
dn_matches_filter?
(
dn
,
filter
)
ldap
.
search
(
base:
dn
,
filter:
filter
,
attributes:
%w{dn}
).
any?
results
=
ldap
.
search
(
base:
dn
,
filter:
filter
,
attributes:
%w{dn}
)
if
results
.
nil?
false
# Net::LDAP encountered an LDAP error
else
results
.
any?
end
end
private
...
...
spec/lib/gitlab/ldap/ldap_adapter_spec.rb
0 → 100644
View file @
430ceaa9
require
'spec_helper'
describe
Gitlab
::
LDAP
::
Adapter
do
let
(
:adapter
)
{
Gitlab
::
LDAP
::
Adapter
.
new
}
describe
:dn_matches_filter?
do
let
(
:ldap
)
{
double
(
:ldap
)
}
subject
{
adapter
.
dn_matches_filter?
(
:dn
,
:filter
)
}
before
{
adapter
.
stub
(
ldap:
ldap
)
}
context
"when the search is successful"
do
context
"and the result is non-empty"
do
before
{
ldap
.
stub
(
search:
[
:foo
])
}
it
{
should
be_true
}
end
context
"and the result is empty"
do
before
{
ldap
.
stub
(
search:
[])
}
it
{
should
be_false
}
end
end
context
"when the search encounters an error"
do
before
{
ldap
.
stub
(
search:
nil
)
}
it
{
should
be_false
}
end
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