diff options
author | Jouni Malinen <jouni@qca.qualcomm.com> | 2016-12-05 19:28:50 (GMT) |
---|---|---|
committer | Jouni Malinen <j@w1.fi> | 2016-12-05 19:28:50 (GMT) |
commit | 20b1a9e2389c429bfe36a725804c61b4977d7322 (patch) | |
tree | 76f6a5f541724814c4af8b523bca7fbc378eb387 /hostapd | |
parent | 609be6f7c07ac6d0f4b593aa3cd635daecdc9bea (diff) | |
download | hostap-20b1a9e2389c429bfe36a725804c61b4977d7322.zip hostap-20b1a9e2389c429bfe36a725804c61b4977d7322.tar.gz hostap-20b1a9e2389c429bfe36a725804c61b4977d7322.tar.bz2 |
Allow hostapd wep_key# parameters to be cleared
Setting wep_key# to an empty string will now clear a previously
configured key. This is needed to be able to change WEP configured AP to
using WPA/WPA2 through the hostapd control interface SET commands.
Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Diffstat (limited to 'hostapd')
-rw-r--r-- | hostapd/config_file.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/hostapd/config_file.c b/hostapd/config_file.c index 832ff55..d9fdd20 100644 --- a/hostapd/config_file.c +++ b/hostapd/config_file.c @@ -768,7 +768,25 @@ static int hostapd_config_read_wep(struct hostapd_wep_keys *wep, int keyidx, { size_t len = os_strlen(val); - if (keyidx < 0 || keyidx > 3 || wep->key[keyidx] != NULL) + if (keyidx < 0 || keyidx > 3) + return -1; + + if (len == 0) { + int i, set = 0; + + bin_clear_free(wep->key[keyidx], wep->len[keyidx]); + wep->key[keyidx] = NULL; + wep->len[keyidx] = 0; + for (i = 0; i < NUM_WEP_KEYS; i++) { + if (wep->key[i]) + set++; + } + if (!set) + wep->keys_set = 0; + return 0; + } + + if (wep->key[keyidx] != NULL) return -1; if (val[0] == '"') { |