From bdfa5e714a81cc6f75adc9f3b55e0e959a37d30a Mon Sep 17 00:00:00 2001 From: "Roger A. Light" Date: Sun, 6 Dec 2020 16:01:46 +0000 Subject: [PATCH] Fix `mosquitto_passwd -U` --- ChangeLog.txt | 3 +++ apps/mosquitto_passwd/mosquitto_passwd.c | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 4fdcfde5..5be1bc2f 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -2,6 +2,9 @@ Broker: - Fix websockets connections on Windows blocking subsequent connections. Closes #1934. +Apps: +- Fix `mosquitto_passwd -U` + Build: - Fix cjson include paths. - Fix build using WITH_TLS=no when the openssl headers aren't available. diff --git a/apps/mosquitto_passwd/mosquitto_passwd.c b/apps/mosquitto_passwd/mosquitto_passwd.c index 94162714..92613f0f 100644 --- a/apps/mosquitto_passwd/mosquitto_passwd.c +++ b/apps/mosquitto_passwd/mosquitto_passwd.c @@ -273,7 +273,11 @@ int delete_pwuser(FILE *fptr, FILE *ftmp, const char *username) * ====================================================================== */ static int update_file_cb(FILE *fptr, FILE *ftmp, const char *username, const char *password, const char *line, struct cb_helper *helper) { - return output_new_password(ftmp, username, password, helper->iterations); + if(helper){ + return output_new_password(ftmp, username, password, helper->iterations); + }else{ + return output_new_password(ftmp, username, password, PW_DEFAULT_ITERATIONS); + } } int update_file(FILE *fptr, FILE *ftmp)