Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
dotNET Platform
runtime
提交
66165e63
R
runtime
项目概览
dotNET Platform
/
runtime
12 个月 前同步成功
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
runtime
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
66165e63
编写于
8月 10, 2022
作者:
J
Jiri Formacek
提交者:
GitHub
8月 09, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Ldap search crashes on Linux when timeout specified (#72676)
上级
8b1aecb7
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
34 addition
and
3 deletion
+34
-3
src/libraries/Common/src/Interop/Linux/OpenLdap/Interop.Ldap.cs
...braries/Common/src/Interop/Linux/OpenLdap/Interop.Ldap.cs
+1
-1
src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/Interop/LdapPal.Linux.cs
...stem/DirectoryServices/Protocols/Interop/LdapPal.Linux.cs
+13
-2
src/libraries/System.DirectoryServices.Protocols/tests/DirectoryServicesProtocolsTests.cs
...rvices.Protocols/tests/DirectoryServicesProtocolsTests.cs
+20
-0
未找到文件。
src/libraries/Common/src/Interop/Linux/OpenLdap/Interop.Ldap.cs
浏览文件 @
66165e63
...
...
@@ -122,7 +122,7 @@ static Ldap()
[
MarshalAs
(
UnmanagedType
.
Bool
)]
bool
attributeOnly
,
IntPtr
servercontrol
,
IntPtr
clientcontrol
,
in
t
timelimit
,
in
LDAP_TIMEVAL
timelimit
,
int
sizelimit
,
ref
int
messageNumber
);
...
...
src/libraries/System.DirectoryServices.Protocols/src/System/DirectoryServices/Protocols/Interop/LdapPal.Linux.cs
浏览文件 @
66165e63
...
...
@@ -90,9 +90,20 @@ internal static int ParseResultReferral(ConnectionHandle ldapHandle, IntPtr resu
internal
static
int
ResultToErrorCode
(
ConnectionHandle
ldapHandle
,
IntPtr
result
,
int
freeIt
)
=>
Interop
.
Ldap
.
ldap_result2error
(
ldapHandle
,
result
,
freeIt
);
internal
static
int
SearchDirectory
(
ConnectionHandle
ldapHandle
,
string
dn
,
int
scope
,
string
filter
,
IntPtr
attributes
,
bool
attributeOnly
,
IntPtr
servercontrol
,
IntPtr
clientcontrol
,
int
timelimit
,
int
sizelimit
,
ref
int
messageNumber
)
=>
Interop
.
Ldap
.
ldap_search
(
ldapHandle
,
dn
,
scope
,
filter
,
attributes
,
attributeOnly
,
servercontrol
,
clientcontrol
,
timelimit
,
sizelimit
,
ref
messageNumber
);
internal
static
int
SearchDirectory
(
ConnectionHandle
ldapHandle
,
string
dn
,
int
scope
,
string
filter
,
IntPtr
attributes
,
bool
attributeOnly
,
IntPtr
servercontrol
,
IntPtr
clientcontrol
,
int
timelimit
,
int
sizelimit
,
ref
int
messageNumber
)
{
LDAP_TIMEVAL
searchTimeout
=
new
LDAP_TIMEVAL
{
tv_sec
=
timelimit
};
//zero must not be passed otherwise libldap runtime returns LDAP_PARAM_ERROR
if
(
searchTimeout
.
tv_sec
<
1
)
//-1 means no time limit
searchTimeout
.
tv_sec
=
-
1
;
return
Interop
.
Ldap
.
ldap_search
(
ldapHandle
,
dn
,
scope
,
filter
,
attributes
,
attributeOnly
,
servercontrol
,
clientcontrol
,
searchTimeout
,
sizelimit
,
ref
messageNumber
);
}
internal
static
int
SetBoolOption
(
ConnectionHandle
ld
,
LdapOption
option
,
bool
value
)
=>
Interop
.
Ldap
.
ldap_set_option_bool
(
ld
,
option
,
value
);
// This option is not supported in Linux, so it would most likely throw.
...
...
src/libraries/System.DirectoryServices.Protocols/tests/DirectoryServicesProtocolsTests.cs
浏览文件 @
66165e63
...
...
@@ -74,6 +74,26 @@ public void TestUnavailableNonCriticalExtension()
_
=
(
SearchResponse
)
connection
.
SendRequest
(
searchRequest
);
// Does not throw
}
[
InlineData
(
60
)]
[
InlineData
(
0
)]
[
InlineData
(-
60
)]
[
ConditionalTheory
(
nameof
(
IsLdapConfigurationExist
))]
public
void
TestSearchWithTimeLimit
(
int
timeLimit
)
{
using
LdapConnection
connection
=
GetConnection
();
var
searchRequest
=
new
SearchRequest
(
LdapConfiguration
.
Configuration
.
SearchDn
,
"(objectClass=*)"
,
SearchScope
.
Subtree
);
if
(
timeLimit
<
0
)
{
Assert
.
Throws
<
ArgumentException
>(()
=>
searchRequest
.
TimeLimit
=
TimeSpan
.
FromSeconds
(
timeLimit
));
}
else
{
searchRequest
.
TimeLimit
=
TimeSpan
.
FromSeconds
(
timeLimit
);
_
=
(
SearchResponse
)
connection
.
SendRequest
(
searchRequest
);
// Shall succeed
}
}
[
ConditionalFact
(
nameof
(
IsLdapConfigurationExist
))]
public
void
TestAddingOU
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录