LDAP客户端身份验证超时失败 [英] LDAP Client Authentication Timeout Fail
问题描述
您好Microsoft C ++社区
Hi Microsoft C++ Community,
我最近基于MSDN示例代码向LDAP服务器编写了基本的C ++ LDAP客户端身份验证:https:// msdn。 microsoft.com/en-us/library/aa366106.aspx。
I have recently written a basic C++ LDAP client authentication to a LDAP server based on MSDN sample code: https://msdn.microsoft.com/en-us/library/aa366106.aspx .
应用程序可以毫无问题地与服务器连接和验证。但是,当我尝试通过物理上断开客户端与服务器的连接来模拟网络故障时,就会出现问题。我已在LDAP结构中将
LDAP_OPT_TIMELIMIT 添加到60秒,但
ldap_connect / ldap_bind_s 功能似乎在等待60秒后才继续。事实上,在继续申请之前,两个函数都等待约20秒的响应。
The application is able to connect and authenticate with the server without any problems. However, the problem arises when I tried to simulate a network breakdown by disconnecting the client from the server physically. I have added LDAP_OPT_TIMELIMIT to 60 seconds in LDAP struct but the ldap_connect/ldap_bind_s function does not seem to wait for 60 seconds before continuing. In fact, both functions waited for response for ~20 seconds before continuing with the application.
如果我错了请修正我,LDAP_OPT_TIMELIMIT只是让服务器等待客户端吗?或者它控制客户端等待服务器响应的时间。
Please correct me if I am wrong, is LDAP_OPT_TIMELIMIT only for the server to wait for the client? or does it control how long the client waits for a response from the server.
另外,我可以知道如何控制客户端连接/绑定调用以在一段时间内侦听响应执行下一行代码?
Also, may I know how can I control client connect/bind calls to listen for response for a certain period before executing next line of code?
最好的问候,
Lim
Best Regards,
Lim
推荐答案
Hi Lim,
Hi Lim,
感谢您在此处发帖。
>>如果我错了请纠正我,是LDAP_OPT_TIMELIMIT只为服务器等待客户端?或者它控制客户端等待服务器响应的时间。
如果ldap_set_option 使用LDAP_TIMELIMIT调用,它设置了
服务器用于等待的秒数限制在执行超时之前完成绑定或搜索请求。
If ldap_set_option is called with LDAP_TIMELIMIT, it sets a limit on the number of seconds the server uses to wait for a bind or search request to complete before performing a timeout.
A 客户端可以调用
ldap_init 初始化会话,然后调用
ldap_connect ,带有非NULL超时参数值,用于连接到具有指定超时的服务器。强>
A client could call ldap_init to initialize a session, then call ldap_connect, with a non-NULL timeout parameter value, to connect to the server with a specified time-out.
希望这可以帮助你。
最好的问候,
Baron Bi
Baron Bi
这篇关于LDAP客户端身份验证超时失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!