Skip to content

Commit

Permalink
Fixed a bug with IE parsing on some wireless interfaces with Linux.
Browse files Browse the repository at this point in the history
  • Loading branch information
chessing committed Jun 3, 2009
1 parent af9717a commit ee215bb
Show file tree
Hide file tree
Showing 8 changed files with 364 additions and 600 deletions.
566 changes: 161 additions & 405 deletions xsupplicant-ui/xsupptray/XSupCalls.cpp

Large diffs are not rendered by default.

35 changes: 13 additions & 22 deletions xsupplicant/src/config_ssid.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,13 @@ struct found_ssids *config_ssid_best_signal(struct found_ssids *one,
if ((one->quality != 0) && (two->quality != 0))
{
if (one->quality > two->quality)
{
return one;
}
{
return one;
}
else
{
return two;
}
{
return two;
}
}
}
}
Expand Down Expand Up @@ -472,6 +472,7 @@ void config_ssid_dump(wireless_ctx * wctx)
if (cur->ssid_name != NULL) {
debug_printf(DEBUG_PHYSICAL_STATE, "ESSID : %s\n",
cur->ssid_name);
debug_printf(DEBUG_PHYSICAL_STATE, "BSSID : %02X:%02X:%02X:%02X:%02X:%02X\n", MACADDR(cur->mac));
debug_printf(DEBUG_PHYSICAL_STATE, "Abilities : %02X\n",
cur->abilities);
debug_printf(DEBUG_PHYSICAL_STATE, "Quality : %d ",
Expand Down Expand Up @@ -583,14 +584,6 @@ struct found_ssids *config_ssid_find_by_name(wireless_ctx * wctx,
cur = wctx->ssid_cache;

while (cur != NULL) {
/*
if ((cur->ssid_name != NULL)
&& (strcmp(ssid_name, cur->ssid_name) != 0)) {
cur = cur->next;
} else {
break;
}
*/
if ((cur->ssid_name != NULL) &&
(strcmp(ssid_name, cur->ssid_name) == 0))
break;
Expand Down Expand Up @@ -673,8 +666,7 @@ struct found_ssids *config_ssid_find_best_ssid(context * ctx)
if ((globals != NULL)
&& (globals->wirelessMachineAuthConnection != NULL)
&& (win_impersonate_is_user_on_console() == FALSE)) {
conn =
config_find_connection(CONFIG_LOAD_GLOBAL,
conn = config_find_connection(CONFIG_LOAD_GLOBAL,
globals->wirelessMachineAuthConnection);
if (conn != NULL) {
machineAuth_wireless = _strdup(conn->ssid);
Expand Down Expand Up @@ -702,20 +694,17 @@ struct found_ssids *config_ssid_find_best_ssid(context * ctx)
"Checking %s with Priority %d\n", cur->ssid_name,
cur_pri);

conf =
config_find_connection_from_ssid(CONFIG_LOAD_GLOBAL,
conf = config_find_connection_from_ssid(CONFIG_LOAD_GLOBAL,
cur->ssid_name);
if (conf == NULL) {
conf =
config_find_connection_from_ssid(CONFIG_LOAD_USER,
conf = config_find_connection_from_ssid(CONFIG_LOAD_USER,
cur->ssid_name);
}

if (conf != NULL) {
if ((best != NULL)
&& (strcmp(cur->ssid_name, best->ssid_name) == 0)) {
if ((temp =
config_ssid_best_signal(best,
if ((temp = config_ssid_best_signal(best,
cur)) != NULL) {
// We found the same SSID with a better signal, so select that
// one.
Expand Down Expand Up @@ -1085,6 +1074,7 @@ uint8_t *config_ssid_get_mac_with_freq(wireless_ctx * wctx, double freq)
if (!xsup_assert((wctx->cur_essid != NULL), "ssid_name != NULL", FALSE))
return NULL;

config_ssid_dump(wctx);
// Start at the top of the list.
cur = wctx->ssid_cache;

Expand All @@ -1093,6 +1083,7 @@ uint8_t *config_ssid_get_mac_with_freq(wireless_ctx * wctx, double freq)
debug_printf(DEBUG_PHYSICAL_STATE,
"Found hidden SSID\n");
}

if ((cur->ssid_name == NULL)
|| ((strcmp(wctx->cur_essid, cur->ssid_name) == 0) && (freq == cur->freq))
|| (freq != cur->freq)) {
Expand Down
1 change: 0 additions & 1 deletion xsupplicant/src/ipc_callout.c
Original file line number Diff line number Diff line change
Expand Up @@ -8794,7 +8794,6 @@ int ipc_callout_enum_user_certs(xmlNodePtr innode, xmlNodePtr * outnode)

cert_handler_free_cert_enum(numcas, &casa);

debug_printf(DEBUG_NORMAL, "********************** Done!\n");
(*outnode) = n;

return IPC_SUCCESS;
Expand Down
21 changes: 6 additions & 15 deletions xsupplicant/src/platform/linux/cardif_linux_rtnetlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -636,23 +636,17 @@ void cardif_linux_rtnetlink_parse_ies(context * ctx,
if (!xsup_assert((ielen > 0), "ielen > 0", FALSE))
return;

if (!xsup_assert((ielen < 256), "ielen < 256", FALSE))
return;

wctx = (wireless_ctx *) ctx->intTypeData;

while (i < ielen) {
if (iedata[i] == WPA_EID) {
if (wpa_parse_ie((char *)&iedata[i]) > 0) {
authtypes =
wpa_parse_auth_type((char *)&iedata[i]);
authtypes = wpa_parse_auth_type((char *)&iedata[i]);
if (authtypes != 0xff) {
if (TEST_FLAG(authtypes, WPA_PSK))
config_ssid_update_abilities
(wctx, ABIL_WPA_PSK);
config_ssid_update_abilities(wctx, ABIL_WPA_PSK);
if (TEST_FLAG(authtypes, WPA_DOT1X))
config_ssid_update_abilities
(wctx, ABIL_WPA_DOT1X);
config_ssid_update_abilities(wctx, ABIL_WPA_DOT1X);
}
// We have a valid IE, save it.
config_ssid_update_abilities(wctx, ABIL_WPA_IE);
Expand All @@ -664,15 +658,12 @@ void cardif_linux_rtnetlink_parse_ies(context * ctx,

if (iedata[i] == WPA2_EID) {
if (wpa2_parse_ie((char *)&iedata[i]) > 0) {
authtypes =
wpa2_parse_auth_type((char *)&iedata[i]);
authtypes = wpa2_parse_auth_type((char *)&iedata[i]);
if (authtypes != 0xff) {
if (TEST_FLAG(authtypes, RSN_PSK))
config_ssid_update_abilities
(wctx, ABIL_RSN_PSK);
config_ssid_update_abilities(wctx, ABIL_RSN_PSK);
if (TEST_FLAG(authtypes, RSN_DOT1X))
config_ssid_update_abilities
(wctx, ABIL_RSN_DOT1X);
config_ssid_update_abilities(wctx, ABIL_RSN_DOT1X);
}
// We have a valid IE, save it.
config_ssid_update_abilities(wctx, ABIL_RSN_IE);
Expand Down
26 changes: 6 additions & 20 deletions xsupplicant/src/platform/linux/cardif_linux_wext.c
Original file line number Diff line number Diff line change
Expand Up @@ -969,13 +969,11 @@ int cardif_linux_wext_wep_associate(context * intdata, int zero_keys)
alg, "802.11 auth. alg to open") < 0) {
debug_printf(DEBUG_NORMAL, "Couldn't set 802.11 auth. alg.\n");
}
/*OPEN FIX: Below condition added */

if (config_ssid_get_ssid_abilities(wctx) == 0) {
debug_printf(DEBUG_INT, "Its OPEN, so disable ENC \n");
cardif_linux_wext_enc_disable(intdata);
}

/*OPEN FIX: the below statement was at the beginning of the function, has been moved here */
cardif_linux_wext_wpa_state(intdata, 0);

#endif
Expand Down Expand Up @@ -1362,14 +1360,11 @@ int cardif_linux_wext_wpa_state(context * intdata, char state)
cardif_linux_wext_wpa(intdata, FALSE);

if (config_ssid_get_ssid_abilities(wctx) == 0) {
debug_printf(DEBUG_NORMAL,
"Its OPEN, so don't drop UNENC \n");
cardif_linux_wext_drop_unencrypted(intdata, FALSE);
}
// Otherwise, make sure we don't have an IE set.
memset(wpaie, 0x00, sizeof(wpaie));
if (cardif_linux_wext_set_wpa_ie
(intdata, (unsigned char *)wpaie, 0) < 0) {
if (cardif_linux_wext_set_wpa_ie(intdata, (unsigned char *)wpaie, 0) < 0) {
debug_printf(DEBUG_NORMAL,
"Couldn't clear WPA IE on device %s!\n",
intdata->intName);
Expand Down Expand Up @@ -1399,10 +1394,8 @@ int cardif_linux_wext_set_iwauth(context * intdata,
xsup_assert((sockData != NULL), "sockData != NULL", TRUE);

memset(&wrq, 0x00, sizeof(wrq));
//Strncpy((char *)&wrq.ifr_name, sizeof(wrq.ifr_name), intdata->intName,
// sizeof(intdata->intName)+1);
strncpy((char *)&wrq.ifr_name, intdata->intName,
sizeof(intdata->intName) + 1);
Strncpy((char *)&wrq.ifr_name, sizeof(wrq.ifr_name), intdata->intName,
strlen(intdata->intName)+1);

if (strlen(wrq.ifr_name) == 0) {
debug_printf(DEBUG_NORMAL,
Expand Down Expand Up @@ -1663,16 +1656,9 @@ void cardif_linux_wext_associate(context * ctx)
freq = cardif_linux_wext_set_freq(ctx);
cardif_linux_wext_set_ssid(ctx, wctx->cur_essid);

//Patch for associating with best Frequency radio if there are multiple radios on one AP
//If we are able to set the frequency then search for the BSSID of that particular radio
if (freq) {
#warning Test and clean up!
// if(reason) {
bssid = config_ssid_get_mac_with_freq(wctx, freq);
/* } else {
bssid = wctx->cur_bssid;
}*/

bssid = config_ssid_get_mac_with_freq(wctx, freq);

wctx->freq = freq;
}

Expand Down
Loading

0 comments on commit ee215bb

Please sign in to comment.