Skip to content

Commit

Permalink
wifi: Fix crash in ent auth when user is not set
Browse files Browse the repository at this point in the history
#8

CL: wifi: Fix crash in ent auth when user is not set

PUBLISHED_FROM=a30aa6696c7041c288a9ae4d3d7f64b2f71615df
  • Loading branch information
Deomid Ryabkov authored and cesantabot committed Jun 8, 2018
1 parent f70c764 commit 6b4beef
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions esp32/src/esp32_wifi.c
Original file line number Diff line number Diff line change
Expand Up @@ -293,17 +293,18 @@ bool mgos_wifi_dev_sta_setup(const struct mgos_config_wifi_sta *cfg) {
if (!mgos_conf_str_empty(cfg->cert) || !mgos_conf_str_empty(cfg->user)) {
/* WPA-enterprise mode */
static char *s_ca_cert_pem = NULL, *s_cert_pem = NULL, *s_key_pem = NULL;
const char *user = cfg->user;

esp_wifi_sta_wpa2_ent_set_username((unsigned char *) cfg->user,
strlen(cfg->user));
if (user == NULL) user = "";

esp_wifi_sta_wpa2_ent_set_username((unsigned char *) user, strlen(user));

if (!mgos_conf_str_empty(cfg->anon_identity)) {
esp_wifi_sta_wpa2_ent_set_identity((unsigned char *) cfg->anon_identity,
strlen(cfg->anon_identity));
} else {
/* By default, username is used. */
esp_wifi_sta_wpa2_ent_set_identity((unsigned char *) cfg->user,
strlen(cfg->user));
esp_wifi_sta_wpa2_ent_set_identity((unsigned char *) user, strlen(user));
}
if (!mgos_conf_str_empty(cfg->pass)) {
esp_wifi_sta_wpa2_ent_set_password((unsigned char *) cfg->pass,
Expand Down

0 comments on commit 6b4beef

Please sign in to comment.