hivemq-community-edition
hivemq-community-edition copied to clipboard
Reauthorize only works once
Expected behavior
A client should be able to reauthorize, if it is currently connected and authorize
Actual behavior
A reauthorize works only once. If a client has already been reauthorized in the past, it receives a 'PROTOCOL_ERROR' as a response
To Reproduce
Try to reauthorize as a connected client more than once
Details
The reauthorization worked with version 2021.2. The described behaviour appeared first at Version 2021.3.
While looking through the code, I had the impression that the problem might be in the reauthorize implementation. If a client reauthorizes, it is checked whether the client is currently in the state 'REAUTHORIZING' or 'AUTHORIZING'. In this case the response is a 'PROTOCOL_ERROR'. If this is not the case, the client is set to the state 'REAUTHORIZING', for the actual reauthorize process. The problem is that the client is never set to the state 'AUTHORIZED' if the reauthorize was successful. Therefore the second reauthorizing attempt fails, since the client is still in the 'REAUTHORIZING' state.