mirror of
https://github.com/esp-rs/esp-hal.git
synced 2025-10-02 06:40:47 +00:00
esp-wifi: Check no password given for AuthMethod::None (#1806)
* esp-wifi: Check no password given for AuthMethod::None * CHANGELOG.md
This commit is contained in:
parent
04cad71926
commit
37299237cb
@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
### Added
|
### Added
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
- Check no password is set when using `AuthMethod::None`(#1806)
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
@ -2074,6 +2074,12 @@ fn apply_ap_config(config: &AccessPointConfiguration) -> Result<(), WifiError> {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if config.auth_method == AuthMethod::None && !config.password.is_empty() {
|
||||||
|
return Err(WifiError::InternalError(
|
||||||
|
InternalWifiError::EspErrInvalidArg,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
cfg.ap.ssid[0..(config.ssid.len())].copy_from_slice(config.ssid.as_bytes());
|
cfg.ap.ssid[0..(config.ssid.len())].copy_from_slice(config.ssid.as_bytes());
|
||||||
cfg.ap.ssid_len = config.ssid.len() as u8;
|
cfg.ap.ssid_len = config.ssid.len() as u8;
|
||||||
@ -2113,6 +2119,12 @@ fn apply_sta_config(config: &ClientConfiguration) -> Result<(), WifiError> {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if config.auth_method == AuthMethod::None && !config.password.is_empty() {
|
||||||
|
return Err(WifiError::InternalError(
|
||||||
|
InternalWifiError::EspErrInvalidArg,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
cfg.sta.ssid[0..(config.ssid.len())].copy_from_slice(config.ssid.as_bytes());
|
cfg.sta.ssid[0..(config.ssid.len())].copy_from_slice(config.ssid.as_bytes());
|
||||||
cfg.sta.password[0..(config.password.len())].copy_from_slice(config.password.as_bytes());
|
cfg.sta.password[0..(config.password.len())].copy_from_slice(config.password.as_bytes());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user