mirror of
https://github.com/esphome/esphome.git
synced 2026-05-25 10:26:10 +08:00
[wifi] Avoid copying EAP config in three connect handlers (#16094)
This commit is contained in:
@@ -1099,9 +1099,9 @@ void WiFiComponent::start_connecting(const WiFiAP &ap) {
|
||||
}
|
||||
|
||||
#ifdef USE_WIFI_WPA2_EAP
|
||||
auto eap_opt = ap.get_eap();
|
||||
const auto &eap_opt = ap.get_eap();
|
||||
if (eap_opt.has_value()) {
|
||||
EAPAuth eap_config = *eap_opt;
|
||||
const EAPAuth &eap_config = *eap_opt;
|
||||
// clang-format off
|
||||
ESP_LOGV(
|
||||
TAG,
|
||||
|
||||
@@ -313,10 +313,10 @@ bool WiFiComponent::wifi_sta_connect_(const WiFiAP &ap) {
|
||||
|
||||
// setup enterprise authentication if required
|
||||
#ifdef USE_WIFI_WPA2_EAP
|
||||
auto eap_opt = ap.get_eap();
|
||||
const auto &eap_opt = ap.get_eap();
|
||||
if (eap_opt.has_value()) {
|
||||
// note: all certificates and keys have to be null terminated. Lengths are appended by +1 to include \0.
|
||||
EAPAuth eap = *eap_opt;
|
||||
const EAPAuth &eap = *eap_opt;
|
||||
ret = wifi_station_set_enterprise_identity((uint8_t *) eap.identity.c_str(), eap.identity.length());
|
||||
if (ret) {
|
||||
ESP_LOGV(TAG, "esp_wifi_sta_wpa2_ent_set_identity failed: %d", ret);
|
||||
|
||||
@@ -407,10 +407,10 @@ bool WiFiComponent::wifi_sta_connect_(const WiFiAP &ap) {
|
||||
|
||||
// setup enterprise authentication if required
|
||||
#ifdef USE_WIFI_WPA2_EAP
|
||||
auto eap_opt = ap.get_eap();
|
||||
const auto &eap_opt = ap.get_eap();
|
||||
if (eap_opt.has_value()) {
|
||||
// note: all certificates and keys have to be null terminated. Lengths are appended by +1 to include \0.
|
||||
EAPAuth eap = *eap_opt;
|
||||
const EAPAuth &eap = *eap_opt;
|
||||
#if ESP_IDF_VERSION >= ESP_IDF_VERSION_VAL(5, 1, 0)
|
||||
err = esp_eap_client_set_identity((uint8_t *) eap.identity.c_str(), eap.identity.length());
|
||||
#else
|
||||
|
||||
Reference in New Issue
Block a user