Skip to content

Commit

Permalink
Fix mosquitto_passwd -b not updating passwords for existing users
Browse files Browse the repository at this point in the history
Closes eclipse#1664. Thanks to Leon Kiefer.
  • Loading branch information
ralight authored and FranciscoKnebel committed Jul 30, 2020
1 parent 2f87dfc commit 4d1e0b9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions ChangeLog.txt
@@ -1,6 +1,9 @@
Broker:
- Report invalid bridge prefix+pattern combinations at config parsing time
rather than letting the bridge fail later. Issue #1635.
- Fix `mosquitto_passwd -b` not updating passwords for existing users
correctly. Creating a new user with `-b` worked without problem.
Closes #1664.

Client library:
- Don't treat an unexpected PUBACK, PUBREL, or PUBCOMP as a fatal error.
Expand Down
3 changes: 2 additions & 1 deletion src/mosquitto_passwd.c
Expand Up @@ -337,7 +337,7 @@ static int update_pwuser_cb(FILE *fptr, FILE *ftmp, const char *username, const
}else{
/* Write out a new line for our matching username */
helper->found = true;
rc = output_new_password(ftmp, username, password);
rc = output_new_password(ftmp, username, helper->password);
}
return rc;
}
Expand All @@ -349,6 +349,7 @@ int update_pwuser(FILE *fptr, FILE *ftmp, const char *username, const char *pass

memset(&helper, 0, sizeof(helper));
helper.username = username;
helper.password = password;
rc = pwfile_iterate(fptr, ftmp, update_pwuser_cb, &helper);

if(helper.found){
Expand Down

0 comments on commit 4d1e0b9

Please sign in to comment.