mirror of
				https://github.com/esp8266/Arduino.git
				synced 2025-11-03 14:33:37 +03:00 
			
		
		
		
	Set authmode if passphrase is provided (#5317)
This commit is contained in:
		@@ -117,8 +117,11 @@ wl_status_t ESP8266WiFiSTAClass::begin(const char* ssid, const char *passphrase,
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    struct station_config conf;
 | 
					    struct station_config conf;
 | 
				
			||||||
    strcpy(reinterpret_cast<char*>(conf.ssid), ssid);
 | 
					    strcpy(reinterpret_cast<char*>(conf.ssid), ssid);
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    conf.threshold.authmode = AUTH_OPEN;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if(passphrase) {
 | 
					    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
 | 
					        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);
 | 
					            memcpy(reinterpret_cast<char*>(conf.password), passphrase, 64);
 | 
				
			||||||
        else
 | 
					        else
 | 
				
			||||||
@@ -130,9 +133,6 @@ wl_status_t ESP8266WiFiSTAClass::begin(const char* ssid, const char *passphrase,
 | 
				
			|||||||
    conf.threshold.rssi = -127;
 | 
					    conf.threshold.rssi = -127;
 | 
				
			||||||
    conf.open_and_wep_mode_disable = !(_useInsecureWEP || *conf.password == 0);
 | 
					    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) {
 | 
					    if(bssid) {
 | 
				
			||||||
        conf.bssid_set = 1;
 | 
					        conf.bssid_set = 1;
 | 
				
			||||||
        memcpy((void *) &conf.bssid[0], (void *) bssid, 6);
 | 
					        memcpy((void *) &conf.bssid[0], (void *) bssid, 6);
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user