Skip to content

Commit

Permalink
Set authmode if passphrase is provided (#5317)
Browse files Browse the repository at this point in the history
  • Loading branch information
dav1901 authored and devyte committed Nov 8, 2018
1 parent 4726a25 commit 5662733
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions libraries/ESP8266WiFi/src/ESP8266WiFiSTA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,11 @@ wl_status_t ESP8266WiFiSTAClass::begin(const char* ssid, const char *passphrase,

struct station_config conf;
strcpy(reinterpret_cast<char*>(conf.ssid), ssid);

conf.threshold.authmode = AUTH_OPEN;

if(passphrase) {
conf.threshold.authmode = AUTH_WPA_PSK;
if (strlen(passphrase) == 64) // it's not a passphrase, is the PSK, which is copied into conf.password without null term
memcpy(reinterpret_cast<char*>(conf.password), passphrase, 64);
else
Expand All @@ -130,9 +133,6 @@ wl_status_t ESP8266WiFiSTAClass::begin(const char* ssid, const char *passphrase,
conf.threshold.rssi = -127;
conf.open_and_wep_mode_disable = !(_useInsecureWEP || *conf.password == 0);

// TODO(#909): set authmode to AUTH_WPA_PSK if passphrase is provided
conf.threshold.authmode = AUTH_OPEN;

if(bssid) {
conf.bssid_set = 1;
memcpy((void *) &conf.bssid[0], (void *) bssid, 6);
Expand Down

0 comments on commit 5662733

Please sign in to comment.