mirror of
https://github.com/samba-team/samba.git
synced 2025-02-22 05:57:43 +03:00
s3/libads: use monotonic clock for ldap connection timeouts
This commit is contained in:
parent
f69085e5ff
commit
5b016dbab8
@ -65,7 +65,7 @@ typedef struct ads_struct {
|
||||
struct {
|
||||
LDAP *ld;
|
||||
struct sockaddr_storage ss; /* the ip of the active connection, if any */
|
||||
time_t last_attempt; /* last attempt to reconnect */
|
||||
time_t last_attempt; /* last attempt to reconnect, monotonic clock */
|
||||
int port;
|
||||
|
||||
enum ads_saslwrap_type wrap_type;
|
||||
|
@ -596,7 +596,7 @@ ADS_STATUS ads_connect(ADS_STRUCT *ads)
|
||||
char addr[INET6_ADDRSTRLEN];
|
||||
|
||||
ZERO_STRUCT(ads->ldap);
|
||||
ads->ldap.last_attempt = time(NULL);
|
||||
ads->ldap.last_attempt = time_mono(NULL);
|
||||
ads->ldap.wrap_type = ADS_SASLWRAP_TYPE_PLAIN;
|
||||
|
||||
/* try with a user specified server */
|
||||
|
@ -40,7 +40,7 @@ static ADS_STATUS ads_do_search_retry_internal(ADS_STRUCT *ads, const char *bind
|
||||
*res = NULL;
|
||||
|
||||
if (!ads->ldap.ld &&
|
||||
time(NULL) - ads->ldap.last_attempt < ADS_RECONNECT_TIME) {
|
||||
time_mono(NULL) - ads->ldap.last_attempt < ADS_RECONNECT_TIME) {
|
||||
return ADS_ERROR(LDAP_SERVER_DOWN);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user