Give better error message if a client sends a password without a username.

Closes #1015. Thanks to TabascoEye.
This commit is contained in:
Roger A. Light 2018-11-07 17:29:39 +00:00
parent 9f7577aab6
commit 34c752a0d0
2 changed files with 3 additions and 0 deletions

View File

@ -7,6 +7,8 @@ Broker:
have its DISCONNECT message processed properly and so no Will will be sent. have its DISCONNECT message processed properly and so no Will will be sent.
Closes #7. Closes #7.
- $SYS/broker/clients/disconnected should never be negative. Closes #287. - $SYS/broker/clients/disconnected should never be negative. Closes #287.
- Give better error message if a client sends a password without a username.
Closes #1015.
Library: Library:
- Fix memory leak that occurred if mosquitto_reconnect() was used when TLS - Fix memory leak that occurred if mosquitto_reconnect() was used when TLS

View File

@ -395,6 +395,7 @@ int handle__connect(struct mosquitto_db *db, struct mosquitto *context)
if(context->protocol == mosq_p_mqtt311){ if(context->protocol == mosq_p_mqtt311){
if(password_flag){ if(password_flag){
/* username_flag == 0 && password_flag == 1 is forbidden */ /* username_flag == 0 && password_flag == 1 is forbidden */
log__printf(NULL, MOSQ_LOG_ERR, "Protocol error from %s: password without username, closing connection.", client_id);
rc = MOSQ_ERR_PROTOCOL; rc = MOSQ_ERR_PROTOCOL;
goto handle_connect_error; goto handle_connect_error;
} }