]> git.sur5r.net Git - openldap/commitdiff
back-ldap should only touch the connection timestamp when activity actually occurred...
authorPierangelo Masarati <ando@openldap.org>
Sun, 3 Sep 2006 11:02:15 +0000 (11:02 +0000)
committerPierangelo Masarati <ando@openldap.org>
Sun, 3 Sep 2006 11:02:15 +0000 (11:02 +0000)
servers/slapd/back-ldap/bind.c
servers/slapd/back-ldap/extended.c
servers/slapd/back-ldap/search.c

index 9d36a4a768b839f3038b358e63708c7746a3ffcc..2d3527e239e89a23ed087a6d214b4c68cd2d0287 100644 (file)
@@ -505,6 +505,7 @@ ldap_back_prepare_conn( ldapconn_t **lcp, Operation *op, SlapReply *rs, ldap_bac
 #ifdef HAVE_TLS
        int             is_tls = op->o_conn->c_is_tls;
 #endif /* HAVE_TLS */
+       time_t          lc_time = (time_t)(-1);
 
        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 ) {
                ldap_unbind_ext( ld, NULL, NULL );
                goto error_return;
+
+       } else if ( li->li_idle_timeout ) {
+               /* only touch when activity actually took place... */
+               lc_time = op->o_time;
        }
 #endif /* HAVE_TLS */
 
@@ -570,6 +575,9 @@ ldap_back_prepare_conn( ldapconn_t **lcp, Operation *op, SlapReply *rs, ldap_bac
        } else {
                LDAP_BACK_CONN_ISTLS_CLEAR( *lcp );
        }
+       if ( lc_time != (time_t)(-1) ) {
+               (*lcp)->lc_time = lc_time;
+       }
 #endif /* HAVE_TLS */
 
 error_return:;
@@ -804,9 +812,6 @@ retry_lock:
 #ifdef HAVE_TLS
 done:;
 #endif /* HAVE_TLS */
-       if ( li->li_idle_timeout && lc ) {
-               lc->lc_time = op->o_time;
-       }
 
        return lc;
 }
@@ -1302,6 +1307,11 @@ retry:;
                 * structure (this includes 
                 * LDAP_COMPARE_{TRUE|FALSE}) */
                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,
                                        &match, &text, &refs, &ctrls, 1 );
                        rs->sr_text = text;
index 9af2738a8b5f5699da56297413de1e4469d9e448..0a4620f8b2041d28a8771c9f776bad33860a0735 100644 (file)
@@ -142,6 +142,11 @@ retry:
                        rs->sr_err = rc;
 
                } 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
                         * doesn't give us the err / match / msg info.
                         */
@@ -252,6 +257,11 @@ retry:
                        rs->sr_err = rc;
 
                } 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
                         * doesn't give us the err / match / msg info.
                         */
index a122b85dfb31fd9ee523e2ed9a30a9905f765f78..b5647e5dc9d39e1d3107ae666e7d1cbb7e44a98e 100644 (file)
@@ -287,6 +287,11 @@ retry:
                        continue;
 
                } 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 */
                        dont_retry = 1;
                }