]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Need to check if the max_uses/lifetime/idle_timeout values > 0 (enabled) before enfor...
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Mon, 10 Oct 2011 22:17:37 +0000 (00:17 +0200)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Mon, 10 Oct 2011 22:19:01 +0000 (00:19 +0200)
src/main/connection.c

index 020ca5ed7b05c24636af8f5ff072c7e3bdb4539f..b226dced7c5f73e1120d56d935e9fb27c77924e9 100644 (file)
@@ -285,16 +285,18 @@ static int fr_connection_manage(fr_connection_pool_t *fc,
        rad_assert(fc != NULL);
        rad_assert(this != NULL);
 
-       if (this->num_uses >= fc->max_uses) {
+       if ((fc->max_uses > 0) && (this->num_uses >= fc->max_uses)) {
        do_delete:
                fr_connection_close(fc, this);
                pthread_mutex_unlock(&fc->mutex);
                return 0;
        }
 
-       if ((this->start + fc->lifetime) < now) goto do_delete;
+       if ((fc->lifetime > 0) && ((this->start + fc->lifetime) < now))
+               goto do_delete;
 
-       if ((this->last_used + fc->idle_timeout) < now) goto do_delete;
+       if ((fc->idle_timeout > 0) && ((this->last_used + fc->idle_timeout) < now))
+               goto do_delete;
 
        return 1;
 }