mirror of
https://git.openldap.org/openldap/openldap.git
synced 2024-12-21 03:10:25 +08:00
back-ldap should only touch the connection timestamp when activity actually occurred (i.e. ldap_result() returned a positive value), otherwise if "the network cable is removed after the connection is established" ldap_result() keeps returning 0 forever...
This commit is contained in:
parent
3a83c813df
commit
00c2498543
@ -505,6 +505,7 @@ ldap_back_prepare_conn( ldapconn_t **lcp, Operation *op, SlapReply *rs, ldap_bac
|
|||||||
#ifdef HAVE_TLS
|
#ifdef HAVE_TLS
|
||||||
int is_tls = op->o_conn->c_is_tls;
|
int is_tls = op->o_conn->c_is_tls;
|
||||||
#endif /* HAVE_TLS */
|
#endif /* HAVE_TLS */
|
||||||
|
time_t lc_time = (time_t)(-1);
|
||||||
|
|
||||||
assert( lcp != NULL );
|
assert( lcp != NULL );
|
||||||
|
|
||||||
@ -554,6 +555,10 @@ ldap_back_prepare_conn( ldapconn_t **lcp, Operation *op, SlapReply *rs, ldap_bac
|
|||||||
if ( rs->sr_err != LDAP_SUCCESS ) {
|
if ( rs->sr_err != LDAP_SUCCESS ) {
|
||||||
ldap_unbind_ext( ld, NULL, NULL );
|
ldap_unbind_ext( ld, NULL, NULL );
|
||||||
goto error_return;
|
goto error_return;
|
||||||
|
|
||||||
|
} else if ( li->li_idle_timeout ) {
|
||||||
|
/* only touch when activity actually took place... */
|
||||||
|
lc_time = op->o_time;
|
||||||
}
|
}
|
||||||
#endif /* HAVE_TLS */
|
#endif /* HAVE_TLS */
|
||||||
|
|
||||||
@ -570,6 +575,9 @@ ldap_back_prepare_conn( ldapconn_t **lcp, Operation *op, SlapReply *rs, ldap_bac
|
|||||||
} else {
|
} else {
|
||||||
LDAP_BACK_CONN_ISTLS_CLEAR( *lcp );
|
LDAP_BACK_CONN_ISTLS_CLEAR( *lcp );
|
||||||
}
|
}
|
||||||
|
if ( lc_time != (time_t)(-1) ) {
|
||||||
|
(*lcp)->lc_time = lc_time;
|
||||||
|
}
|
||||||
#endif /* HAVE_TLS */
|
#endif /* HAVE_TLS */
|
||||||
|
|
||||||
error_return:;
|
error_return:;
|
||||||
@ -804,9 +812,6 @@ retry_lock:
|
|||||||
#ifdef HAVE_TLS
|
#ifdef HAVE_TLS
|
||||||
done:;
|
done:;
|
||||||
#endif /* HAVE_TLS */
|
#endif /* HAVE_TLS */
|
||||||
if ( li->li_idle_timeout && lc ) {
|
|
||||||
lc->lc_time = op->o_time;
|
|
||||||
}
|
|
||||||
|
|
||||||
return lc;
|
return lc;
|
||||||
}
|
}
|
||||||
@ -1302,6 +1307,11 @@ retry:;
|
|||||||
* structure (this includes
|
* structure (this includes
|
||||||
* LDAP_COMPARE_{TRUE|FALSE}) */
|
* LDAP_COMPARE_{TRUE|FALSE}) */
|
||||||
default:
|
default:
|
||||||
|
/* only touch when activity actually took place... */
|
||||||
|
if ( li->li_idle_timeout && lc ) {
|
||||||
|
lc->lc_time = op->o_time;
|
||||||
|
}
|
||||||
|
|
||||||
rc = ldap_parse_result( lc->lc_ld, res, &rs->sr_err,
|
rc = ldap_parse_result( lc->lc_ld, res, &rs->sr_err,
|
||||||
&match, &text, &refs, &ctrls, 1 );
|
&match, &text, &refs, &ctrls, 1 );
|
||||||
rs->sr_text = text;
|
rs->sr_text = text;
|
||||||
|
@ -142,6 +142,11 @@ retry:
|
|||||||
rs->sr_err = rc;
|
rs->sr_err = rc;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
/* only touch when activity actually took place... */
|
||||||
|
if ( li->li_idle_timeout && lc ) {
|
||||||
|
lc->lc_time = op->o_time;
|
||||||
|
}
|
||||||
|
|
||||||
/* sigh. parse twice, because parse_passwd
|
/* sigh. parse twice, because parse_passwd
|
||||||
* doesn't give us the err / match / msg info.
|
* doesn't give us the err / match / msg info.
|
||||||
*/
|
*/
|
||||||
@ -252,6 +257,11 @@ retry:
|
|||||||
rs->sr_err = rc;
|
rs->sr_err = rc;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
/* only touch when activity actually took place... */
|
||||||
|
if ( li->li_idle_timeout && lc ) {
|
||||||
|
lc->lc_time = op->o_time;
|
||||||
|
}
|
||||||
|
|
||||||
/* sigh. parse twice, because parse_passwd
|
/* sigh. parse twice, because parse_passwd
|
||||||
* doesn't give us the err / match / msg info.
|
* doesn't give us the err / match / msg info.
|
||||||
*/
|
*/
|
||||||
|
@ -287,6 +287,11 @@ retry:
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
/* only touch when activity actually took place... */
|
||||||
|
if ( li->li_idle_timeout && lc ) {
|
||||||
|
lc->lc_time = op->o_time;
|
||||||
|
}
|
||||||
|
|
||||||
/* don't retry any more */
|
/* don't retry any more */
|
||||||
dont_retry = 1;
|
dont_retry = 1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user