]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
enfore connected sockets for TCP, and check for hash table
authorAlan T. DeKok <aland@freeradius.org>
Mon, 6 Feb 2023 20:46:16 +0000 (15:46 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Mon, 6 Feb 2023 20:46:16 +0000 (15:46 -0500)
before dereferencing it

src/lib/io/master.c
src/lib/server/client.c

index fe89530dd9099de09e5dfe53b802865f1aa939fb..f17a53b49a77e4cdb2d3712b0694aa2dd456f426 100644 (file)
@@ -1950,9 +1950,11 @@ static void client_expiry_timer(fr_event_list_t *el, fr_time_t now, void *uctx)
                if (connection) {
                        fr_io_client_t *parent = connection->parent;
 
-                       pthread_mutex_lock(&parent->mutex);
-                       (void) fr_hash_table_delete(parent->ht, connection);
-                       pthread_mutex_unlock(&parent->mutex);
+                       if (parent->ht) {
+                               pthread_mutex_lock(&parent->mutex);
+                               (void) fr_hash_table_delete(parent->ht, connection);
+                               pthread_mutex_unlock(&parent->mutex);
+                       }
 
                        /*
                         *      Mark the connection as dead, and tell
index 7576f56b4742ca84cb0177b11022584418c12433..17a838d3082846964a7aac5d9028142b3f1a81cc 100644 (file)
@@ -558,6 +558,11 @@ RADCLIENT_LIST *client_list_parse_section(CONF_SECTION *section, int proto, TLS_
                        return NULL;
                }
 
+               /*
+                *      TCP sockets are always connected.
+                */
+               c->use_connected |= (c->proto == IPPROTO_TCP);
+
 #ifdef WITH_TLS
                /*
                 *      TLS clients CANNOT use non-TLS listeners.