Skip to content

Commit

Permalink
Fix MQTT v5 clients not being able to specify a password without a us…
Browse files Browse the repository at this point in the history
…ername.

Thanks to Erik Moqvist.

Closes #1274.
  • Loading branch information
ralight committed Jun 6, 2019
1 parent 3e858c1 commit 31f448f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions client/client_shared.c
Original file line number Diff line number Diff line change
Expand Up @@ -1081,8 +1081,8 @@ int client_opts_set(struct mosquitto *mosq, struct mosq_config *cfg)
}
cfg->will_props = NULL;

if(cfg->username && mosquitto_username_pw_set(mosq, cfg->username, cfg->password)){
err_printf(cfg, "Error: Problem setting username and password.\n");
if((cfg->username || cfg->password) && mosquitto_username_pw_set(mosq, cfg->username, cfg->password)){
err_printf(cfg, "Error: Problem setting username and/or password.\n");
mosquitto_lib_cleanup();
return 1;
}
Expand Down

0 comments on commit 31f448f

Please sign in to comment.