Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MQTT & OTA Fingerprint setting capitalization fix #1952

Merged
merged 2 commits into from
Oct 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions code/espurna/mqtt.ino
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ SecureClientConfig _mqtt_sc_config {
return getSetting("mqttScCheck", MQTT_SECURE_CLIENT_CHECK).toInt();
},
[]() -> String {
return getSetting("mqttfp", MQTT_SSL_FINGERPRINT);
return getSetting("mqttFP", MQTT_SSL_FINGERPRINT);
},
true
};
Expand All @@ -118,7 +118,7 @@ SecureClientConfig _mqtt_sc_config {
return _mqtt_client_trusted_root_ca;
},
[]() -> String {
return getSetting("mqttfp", MQTT_SSL_FINGERPRINT);
return getSetting("mqttFP", MQTT_SSL_FINGERPRINT);
},
[]() -> uint16_t {
return getSetting("mqttScMFLN", MQTT_SECURE_CLIENT_MFLN).toInt();
Expand Down
5 changes: 4 additions & 1 deletion code/espurna/ota_asynctcp.ino
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ void _otaClientOnConnect(void *arg, AsyncClient *client) {
int check = getSetting("otaScCheck", OTA_SECURE_CLIENT_CHECK).toInt();
if ((check == SECURE_CLIENT_CHECK_FINGERPRINT) && (443 == _ota_url->port)) {
uint8_t fp[20] = {0};
sslFingerPrintArray(getSetting("otafp", OTA_FINGERPRINT).c_str(), fp);
sslFingerPrintArray(getSetting("otaFP", OTA_FINGERPRINT).c_str(), fp);
SSL * ssl = _ota_client->getSSL();
if (ssl_match_fingerprint(ssl, fp) != SSL_OK) {
DEBUG_MSG_P(PSTR("[OTA] Warning: certificate fingerpint doesn't match\n"));
Expand Down Expand Up @@ -214,6 +214,9 @@ void _otaClientMqttCallback(unsigned int type, const char * topic, const char *

void otaClientSetup() {

// Backwards compatibility
moveSetting("otafp", "otaFP");

#if TERMINAL_SUPPORT
_otaClientInitCommands();
#endif
Expand Down
9 changes: 6 additions & 3 deletions code/espurna/ota_httpupdate.ino
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@ void _otaClientFromHttps(const String& url) {
}

if (check == SECURE_CLIENT_CHECK_FINGERPRINT) {
String fp_string = getSetting("otafp", OTA_FINGERPRINT);
String fp_string = getSetting("otaFP", OTA_FINGERPRINT);
if (!fp_string.length()) {
DEBUG_MSG_P(PSTR("[OTA] Requested fingerprint auth, but 'otafp' is not set\n"));
DEBUG_MSG_P(PSTR("[OTA] Requested fingerprint auth, but 'otaFP' is not set\n"));
return;
}

Expand Down Expand Up @@ -166,7 +166,7 @@ void _otaClientFromHttps(const String& url) {

String fp_string;
if (check == SECURE_CLIENT_CHECK_FINGERPRINT) {
fp_string = getSetting("otafp", OTA_FINGERPRINT);
fp_string = getSetting("otaFP", OTA_FINGERPRINT);
if (!fp_string.length() || !sslCheckFingerPrint(fp_string.c_str())) {
DEBUG_MSG_P(PSTR("[OTA] Wrong fingerprint\n"));
return;
Expand Down Expand Up @@ -250,6 +250,9 @@ void _otaClientMqttCallback(unsigned int type, const char * topic, const char *

void otaClientSetup() {

// Backwards compatibility
moveSetting("otafp", "otaFP");

#if TERMINAL_SUPPORT
_otaClientInitCommands();
#endif
Expand Down