Fix session expiry list corruption

This happens if a client with session-expiry-interval set disconnects,
is kicked by a plugin, and then expires.
This commit is contained in:
Roger A. Light
2025-08-25 08:50:14 +01:00
parent d27632a206
commit f604b09f57
+12
View File
@@ -67,6 +67,12 @@ int session_expiry__add(struct mosquitto *context)
{
struct session_expiry_list *item;
if(context->expiry_list_item){
/* Already added, may happen in cases like a client disconnecting then
* being kicked by a plugin. */
return MOSQ_ERR_SUCCESS;
}
if(db.config->persistent_client_expiration == 0){
if(context->session_expiry_interval == UINT32_MAX){
/* There isn't a global expiry set, and the client has asked to
@@ -92,6 +98,12 @@ int session_expiry__add_from_persistence(struct mosquitto *context, time_t expir
{
struct session_expiry_list *item;
if(context->expiry_list_item){
/* Already added, may happen in cases like a client disconnecting then
* being kicked by a plugin. */
return MOSQ_ERR_SUCCESS;
}
if(db.config->persistent_client_expiration == 0){
if(context->session_expiry_interval == UINT32_MAX){
/* There isn't a global expiry set, and the client has asked to