]> git.ipfire.org Git - thirdparty/openldap.git/commitdiff
ITS#9468 always init lc_time and lc_create_time
authorHoward Chu <hyc@openldap.org>
Tue, 25 May 2021 19:02:45 +0000 (20:02 +0100)
committerQuanah Gibson-Mount <quanah@openldap.org>
Tue, 8 Jun 2021 15:41:40 +0000 (15:41 +0000)
Doesn't cost us anything and guarantees expiry will work if conn_ttl
or idletimeout are configured at a later time.

servers/slapd/back-ldap/bind.c

index 630a398eff7fae2eb55e5d5e7136a9fc980f5858..b0dd0a17a3886a9b7f5b0e6e9c311c9fee4be7e0 100644 (file)
@@ -658,7 +658,6 @@ ldap_back_prepare_conn( ldapconn_t *lc, Operation *op, SlapReply *rs, ldap_back_
 #ifdef HAVE_TLS
        int             is_tls = op->o_conn->c_is_tls;
        int             flags = li->li_flags;
-       time_t          lctime = (time_t)(-1);
        slap_bindconf *sb;
 #endif /* HAVE_TLS */
 
@@ -744,10 +743,6 @@ ldap_back_prepare_conn( ldapconn_t *lc, Operation *op, SlapReply *rs, ldap_back_
                ldap_unbind_ext( ld, NULL, NULL );
                rs->sr_text = "Start TLS failed";
                goto error_return;
-
-       } else if ( li->li_idle_timeout ) {
-               /* only touch when activity actually took place... */
-               lctime = op->o_time;
        }
 #endif /* HAVE_TLS */
 
@@ -759,9 +754,6 @@ ldap_back_prepare_conn( ldapconn_t *lc, Operation *op, SlapReply *rs, ldap_back_
        } else {
                LDAP_BACK_CONN_ISTLS_CLEAR( lc );
        }
-       if ( lctime != (time_t)(-1) ) {
-               lc->lc_time = lctime;
-       }
 #endif /* HAVE_TLS */
 
 error_return:;
@@ -775,9 +767,8 @@ error_return:;
                }
 
        } else {
-               if ( li->li_conn_ttl > 0 ) {
-                       lc->lc_create_time = op->o_time;
-               }
+               lc->lc_create_time = op->o_time;
+               lc->lc_time = op->o_time;
        }
 
        return rs->sr_err;
@@ -3230,4 +3221,4 @@ ldap_back_schedule_conn_expiry( ldapinfo_t *li, ldapconn_t *lc ) {
        ldap_pvt_thread_mutex_unlock( &slapd_rq.rq_mutex );
 
        return;
-}
\ No newline at end of file
+}