From ad242a796afb14692f19bfd266a1f8ced08c6d3b Mon Sep 17 00:00:00 2001 From: James Prestwood Date: Thu, 15 Nov 2018 08:58:35 -0800 Subject: [PATCH] network: fix 8021x autoconnect In network_autoconnect, when the network was SECURITY_8021X there was no check (for SECURITY_PSK) before calling network_load_psk. Since the provisioning file was for an 8021x network neither PreSharedKey or Passphrase existed so this would always fail. This fixes the 8021x failure in testConnectAutoconnect. --- src/network.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/network.c b/src/network.c index 5509a94d..8558df84 100644 --- a/src/network.c +++ b/src/network.c @@ -505,11 +505,12 @@ int network_autoconnect(struct network *network, struct scan_bss *bss) { struct station *station = network->station; struct wiphy *wiphy = station_get_wiphy(station); + enum security security = network_get_security(network); bool is_autoconnectable; bool is_rsn; int ret; - switch (network_get_security(network)) { + switch (security) { case SECURITY_NONE: is_rsn = false; break; @@ -541,9 +542,11 @@ int network_autoconnect(struct network *network, struct scan_bss *bss) goto close_settings; } - ret = network_load_psk(network, bss_is_sae(bss)); - if (ret < 0) - goto close_settings; + if (security == SECURITY_PSK) { + ret = network_load_psk(network, bss_is_sae(bss)); + if (ret < 0) + goto close_settings; + } } /* If no entry, default to Autoconnectable=True */ @@ -555,7 +558,7 @@ int network_autoconnect(struct network *network, struct scan_bss *bss) if (!is_autoconnectable) goto close_settings; - if (network_get_security(network) == SECURITY_8021X) { + if (security == SECURITY_8021X) { struct l_queue *missing_secrets = NULL; ret = eap_check_settings(network->settings, network->secrets,