Skip to content

Commit

Permalink
Fix TLS-PSK mode not working with port 8883.
Browse files Browse the repository at this point in the history
Closes #2152. Thanks to jetpax.
  • Loading branch information
ralight committed Mar 26, 2021
1 parent 3ac2c3e commit 7d214a4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
1 change: 1 addition & 0 deletions ChangeLog.txt
Expand Up @@ -8,6 +8,7 @@ Broker:
Clients:
- Set `receive-maximum` to not exceed the `-C` message count in mosquitto_sub
and mosquitto_rr, to avoid potentially lost messages. Closes #2134.
- Fix TLS-PSK mode not working with port 8883. Closes #2152.

Build:
- A variety of minor build related fixes, like functions not having previous
Expand Down
15 changes: 8 additions & 7 deletions client/client_shared.c
Expand Up @@ -1263,6 +1263,14 @@ int client_opts_set(struct mosquitto *mosq, struct mosq_config *cfg)
mosquitto_lib_cleanup();
return 1;
}
# ifdef FINAL_WITH_TLS_PSK
}else if(cfg->psk){
if(mosquitto_tls_psk_set(mosq, cfg->psk, cfg->psk_identity, NULL)){
err_printf(cfg, "Error: Problem setting TLS-PSK options.\n");
mosquitto_lib_cleanup();
return 1;
}
# endif
}else if(cfg->port == 8883){
mosquitto_int_option(mosq, MOSQ_OPT_TLS_USE_OS_CERTS, 1);
}
Expand Down Expand Up @@ -1295,13 +1303,6 @@ int client_opts_set(struct mosquitto *mosq, struct mosq_config *cfg)
mosquitto_lib_cleanup();
return 1;
}
# ifdef FINAL_WITH_TLS_PSK
if(cfg->psk && mosquitto_tls_psk_set(mosq, cfg->psk, cfg->psk_identity, NULL)){
err_printf(cfg, "Error: Problem setting TLS-PSK options.\n");
mosquitto_lib_cleanup();
return 1;
}
# endif
if((cfg->tls_version || cfg->ciphers) && mosquitto_tls_opts_set(mosq, 1, cfg->tls_version, cfg->ciphers)){
err_printf(cfg, "Error: Problem setting TLS options, check the options are valid.\n");
mosquitto_lib_cleanup();
Expand Down

0 comments on commit 7d214a4

Please sign in to comment.