From f63386bf4a8a6e07621a3f4ecae2897b4ea01294 Mon Sep 17 00:00:00 2001 From: Roger Light Date: Sun, 13 Dec 2020 20:32:30 +0000 Subject: [PATCH] Fix `mosquitto_passwd -b` using username as password. Only applies if if `-c` is not also used. Closes #1949. Thanks to J. Augusto de Oliveira. Signed-off-by: Peter Korsgaard [Peter: drop ChangeLog.txt hunk] --- apps/mosquitto_passwd/mosquitto_passwd.c | 2 +- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/mosquitto_passwd/mosquitto_passwd.c b/apps/mosquitto_passwd/mosquitto_passwd.c index 92613f0f..9495c3c5 100644 --- a/apps/mosquitto_passwd/mosquitto_passwd.c +++ b/apps/mosquitto_passwd/mosquitto_passwd.c @@ -505,7 +505,7 @@ int main(int argc, char *argv[]) }else if(batch_mode == true && idx+3 == argc){ password_file_tmp = argv[idx]; username = argv[idx+1]; - password_cmd = argv[idx+1]; + password_cmd = argv[idx+2]; }else if(batch_mode == false && idx+2 == argc){ password_file_tmp = argv[idx]; username = argv[idx+1]; -- 2.20.1