Browse Source

MQTT & OTA Fingerprint setting capitalization fix (#1952)

* MQTT Fingerprint setting capitalization fix

* otafp -> otaFP
master
Niek van der Maas 5 years ago
committed by Max Prokhorov
parent
commit
e17ee6168e
3 changed files with 12 additions and 6 deletions
  1. +2
    -2
      code/espurna/mqtt.ino
  2. +4
    -1
      code/espurna/ota_asynctcp.ino
  3. +6
    -3
      code/espurna/ota_httpupdate.ino

+ 2
- 2
code/espurna/mqtt.ino View File

@ -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
};
@ -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();


+ 4
- 1
code/espurna/ota_asynctcp.ino View File

@ -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"));
@ -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


+ 6
- 3
code/espurna/ota_httpupdate.ino View File

@ -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;
}
@ -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;
@ -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


Loading…
Cancel
Save