Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
68364fe2
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
68364fe2
编写于
8月 30, 2016
作者:
M
Markus Koller
提交者:
Rémy Coutable
9月 28, 2016
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Log LDAP lookup errors and don't swallow unrelated exceptions
Signed-off-by:
N
Roger Meier
<
r.meier@siemens.com
>
上级
3b206ccb
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
44 addition
and
5 deletion
+44
-5
CHANGELOG
CHANGELOG
+1
-0
doc/administration/auth/ldap.md
doc/administration/auth/ldap.md
+6
-0
lib/gitlab/ldap/access.rb
lib/gitlab/ldap/access.rb
+0
-2
lib/gitlab/ldap/adapter.rb
lib/gitlab/ldap/adapter.rb
+3
-0
spec/lib/gitlab/ldap/adapter_spec.rb
spec/lib/gitlab/ldap/adapter_spec.rb
+34
-3
未找到文件。
CHANGELOG
浏览文件 @
68364fe2
...
...
@@ -3,6 +3,7 @@ Please view this file on the master branch, on stable branches it's out of date.
v 8.13.0 (unreleased)
- Use gitlab-shell v3.6.2 (GIT TRACE logging)
- Speed-up group milestones show page
- Log LDAP lookup errors and don't swallow unrelated exceptions. !6103 (Markus Koller)
- Add more tests for calendar contribution (ClemMakesApps)
- Fix robots.txt disallowing access to groups starting with "s" (Matt Harrison)
- Only update issuable labels if they have been changed
...
...
doc/administration/auth/ldap.md
浏览文件 @
68364fe2
...
...
@@ -275,3 +275,9 @@ If you are getting 'Connection Refused' errors when trying to connect to the
LDAP server please double-check the LDAP
`port`
and
`method`
settings used by
GitLab. Common combinations are
`method: 'plain'`
and
`port: 389`
, OR
`method: 'ssl'`
and
`port: 636`
.
### Login with valid credentials rejected
If there is an unexpected error while authenticating the user with the LDAP
backend, the login is rejected and details about the error are logged to
`production.log`
.
lib/gitlab/ldap/access.rb
浏览文件 @
68364fe2
...
...
@@ -51,8 +51,6 @@ module Gitlab
user
.
ldap_block
false
end
rescue
false
end
def
adapter
...
...
lib/gitlab/ldap/adapter.rb
浏览文件 @
68364fe2
...
...
@@ -62,6 +62,9 @@ module Gitlab
results
end
end
rescue
Net
::
LDAP
::
Error
=>
error
Rails
.
logger
.
warn
(
"LDAP search raised exception
#{
error
.
class
}
:
#{
error
.
message
}
"
)
[]
rescue
Timeout
::
Error
Rails
.
logger
.
warn
(
"LDAP search timed out after
#{
config
.
timeout
}
seconds"
)
[]
...
...
spec/lib/gitlab/ldap/adapter_spec.rb
浏览文件 @
68364fe2
...
...
@@ -73,17 +73,33 @@ describe Gitlab::LDAP::Adapter, lib: true do
describe
'#dn_matches_filter?'
do
subject
{
adapter
.
dn_matches_filter?
(
:dn
,
:filter
)
}
context
"when the search result is non-empty"
do
before
{
allow
(
adapter
).
to
receive
(
:ldap_search
).
and_return
([
:foo
])
}
it
{
is_expected
.
to
be_truthy
}
end
context
"when the search result is empty"
do
before
{
allow
(
adapter
).
to
receive
(
:ldap_search
).
and_return
([])
}
it
{
is_expected
.
to
be_falsey
}
end
end
describe
'#ldap_search'
do
subject
{
adapter
.
ldap_search
(
base: :dn
,
filter: :filter
)
}
context
"when the search is successful"
do
context
"and the result is non-empty"
do
before
{
allow
(
ldap
).
to
receive
(
:search
).
and_return
([
:foo
])
}
it
{
is_expected
.
to
be_truthy
}
it
{
is_expected
.
to
eq
[
:foo
]
}
end
context
"and the result is empty"
do
before
{
allow
(
ldap
).
to
receive
(
:search
).
and_return
([])
}
it
{
is_expected
.
to
be_falsey
}
it
{
is_expected
.
to
eq
[]
}
end
end
...
...
@@ -95,7 +111,22 @@ describe Gitlab::LDAP::Adapter, lib: true do
)
end
it
{
is_expected
.
to
be_falsey
}
it
{
is_expected
.
to
eq
[]
}
end
context
"when the search raises an LDAP exception"
do
before
do
allow
(
ldap
).
to
receive
(
:search
)
{
raise
Net
::
LDAP
::
Error
,
"some error"
}
allow
(
Rails
.
logger
).
to
receive
(
:warn
)
end
it
{
is_expected
.
to
eq
[]
}
it
'logs the error'
do
subject
expect
(
Rails
.
logger
).
to
have_received
(
:warn
).
with
(
"LDAP search raised exception Net::LDAP::Error: some error"
)
end
end
end
end
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录