LDAP_OPT_ERROR_STRING, pp_ld_error);
}
-static int get_cached_ldap_connect(struct smbldap_state *ldap_state)
+static int get_cached_ldap_connect(struct smbldap_state *ldap_state, time_t abs_endtime)
{
int attempts = 0;
while (1) {
int rc;
+ time_t now;
- rc = smbldap_open(ldap_state);
+ now = time_mono(NULL);
+ ldap_state->last_use = now;
+
+ if (abs_endtime && now > abs_endtime) {
+ smbldap_close(ldap_state);
+ return LDAP_TIMEOUT;
+ }
- ldap_state->last_use = time_mono(NULL);
+ rc = smbldap_open(ldap_state);
if (rc == LDAP_SUCCESS) {
return LDAP_SUCCESS;
char *ld_error = NULL;
int ld_errno;
- rc = get_cached_ldap_connect(ldap_state);
+ rc = get_cached_ldap_connect(ldap_state, abs_endtime);
if (rc != LDAP_SUCCESS) {
break;
}
char *ld_error = NULL;
int ld_errno;
- rc = get_cached_ldap_connect(ldap_state);
+ rc = get_cached_ldap_connect(ldap_state, abs_endtime);
if (rc != LDAP_SUCCESS) {
break;
}
char *ld_error = NULL;
int ld_errno;
- rc = get_cached_ldap_connect(ldap_state);
+ rc = get_cached_ldap_connect(ldap_state, abs_endtime);
if (rc != LDAP_SUCCESS) {
break;
}
char *ld_error = NULL;
int ld_errno;
- rc = get_cached_ldap_connect(ldap_state);
+ rc = get_cached_ldap_connect(ldap_state, abs_endtime);
if (rc != LDAP_SUCCESS) {
break;
}
char *ld_error = NULL;
int ld_errno;
- rc = get_cached_ldap_connect(ldap_state);
+ rc = get_cached_ldap_connect(ldap_state, abs_endtime);
if (rc != LDAP_SUCCESS) {
break;
}