Skip to content

Commit dc9507e

Browse files
Dmitry ShmidtThe Android Open Source Project
Dmitry Shmidt
authored and
The Android Open Source Project
committed
AI 146505: am: CL 146027 Update wpa_supplicant from 0.5.10 to 0.5.11
Original author: dimitrysh Automated import of CL 146505
1 parent 1d40835 commit dc9507e

37 files changed

+450
-133
lines changed

ChangeLog

+26
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,31 @@
11
ChangeLog for wpa_supplicant
22

3+
2008-11-28 - v0.5.11
4+
* fixed race condition between disassociation event and group key
5+
handshake to avoid getting stuck in incorrect state [Bug 261]
6+
* updated D-Bus usage to avoid deprecated functions
7+
* silence SIOCSIWAUTH ioctl failure message (these can be ignored in
8+
most cases and are now only shown in debug output)
9+
* increase timeout for IBSS connection
10+
* driver_wext: do not overwrite BSS frequency if channel was already
11+
received
12+
* driver_wext: set interface down for mode switches, if needed (e.g.,
13+
for mac80211)
14+
* driver_wext: fixed re-initialization of a removed and re-inserted
15+
interface (e.g., USB dongle or on resume if driver was unloaded for
16+
suspend)
17+
* improve per-SSID scanning for drivers that report background scan
18+
results frequently
19+
* fixed scanning behavior after a failed initial association
20+
* driver_wext: fixed processing of invalid event messages from kernel
21+
not to crash wpa_supplicant (this could happen when using 64-bit
22+
kernel with 32-bit userspace)
23+
* fixed EAP-AKA to use RES Length field in AT_RES as length in bits,
24+
not bytes
25+
* fixed canceling of PMKSA caching when using drivers that generate
26+
RSN IE and refuse to drop PMKIDs that wpa_supplicant does not know
27+
about
28+
329
2008-02-19 - v0.5.10
430
* added support for Makefile builds to include debug-log-to-a-file
531
functionality (CONFIG_DEBUG_FILE=y and -f<path> on command line)

Makefile

+4-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,10 @@ endif
149149

150150
ifdef CONFIG_DRIVER_NDIS
151151
CFLAGS += -DCONFIG_DRIVER_NDIS
152-
OBJS_d += driver_ndis.o driver_ndis_.o
152+
OBJS_d += driver_ndis.o
153+
ifdef CONFIG_NDIS_EVENTS_INTEGRATED
154+
OBJS_d += driver_ndis_.o
155+
endif
153156
ifndef CONFIG_L2_PACKET
154157
CONFIG_L2_PACKET=pcap
155158
endif

base64.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ unsigned char * base64_decode(const unsigned char *src, size_t len,
115115
count++;
116116
}
117117

118-
if (count % 4)
118+
if (count == 0 || count % 4)
119119
return NULL;
120120

121121
olen = count / 4 * 3;

ctrl_iface.c

+5-1
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ static int wpa_supplicant_ctrl_iface_set(struct wpa_supplicant *wpa_s,
7676
}
7777

7878

79+
#ifdef IEEE8021X_EAPOL
7980
static int wpa_supplicant_ctrl_iface_preauth(struct wpa_supplicant *wpa_s,
8081
char *addr)
8182
{
@@ -94,6 +95,7 @@ static int wpa_supplicant_ctrl_iface_preauth(struct wpa_supplicant *wpa_s,
9495

9596
return 0;
9697
}
98+
#endif /* IEEE8021X_EAPOL */
9799

98100

99101
#ifdef CONFIG_PEERKEY
@@ -538,7 +540,7 @@ static int wpa_supplicant_ctrl_iface_scan_results(
538540
return 0;
539541
if (wpa_s->scan_results == NULL)
540542
return 0;
541-
543+
542544
pos = buf;
543545
end = buf + buflen;
544546
ret = os_snprintf(pos, end - pos, "bssid / frequency / signal level / "
@@ -1200,9 +1202,11 @@ char * wpa_supplicant_ctrl_iface_process(struct wpa_supplicant *wpa_s,
12001202
wpa_s->reassociate = 1;
12011203
wpa_supplicant_req_scan(wpa_s, 0, 0);
12021204
}
1205+
#ifdef IEEE8021X_EAPOL
12031206
} else if (os_strncmp(buf, "PREAUTH ", 8) == 0) {
12041207
if (wpa_supplicant_ctrl_iface_preauth(wpa_s, buf + 8))
12051208
reply_len = -1;
1209+
#endif /* IEEE8021X_EAPOL */
12061210
#ifdef CONFIG_PEERKEY
12071211
} else if (os_strncmp(buf, "STKSTART ", 9) == 0) {
12081212
if (wpa_supplicant_ctrl_iface_stkstart(wpa_s, buf + 9))

ctrl_iface_dbus.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@
3030
#include "wpa_ctrl.h"
3131
#include "eap.h"
3232

33-
#define DBUS_VERSION (DBUS_VERSION_MAJOR << 8 | DBUS_VERSION_MINOR)
33+
#define _DBUS_VERSION (DBUS_VERSION_MAJOR << 8 | DBUS_VERSION_MINOR)
3434
#define DBUS_VER(major, minor) ((major) << 8 | (minor))
3535

36-
#if DBUS_VERSION < DBUS_VER(1,1)
36+
#if _DBUS_VERSION < DBUS_VER(1,1)
3737
#define dbus_watch_get_unix_fd dbus_watch_get_fd
3838
#endif
3939

ctrl_iface_unix.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ wpa_supplicant_ctrl_iface_init(struct wpa_supplicant *wpa_s)
315315
/* Group name not found - try to parse this as gid */
316316
gid = strtol(gid_str, &endp, 10);
317317
if (*gid_str == '\0' || *endp != '\0') {
318-
wpa_printf(MSG_DEBUG, "CTRL: Invalid group "
318+
wpa_printf(MSG_ERROR, "CTRL: Invalid group "
319319
"'%s'", gid_str);
320320
goto fail;
321321
}

dbus_dict_helpers.c

+62-40
Original file line numberDiff line numberDiff line change
@@ -629,45 +629,68 @@ dbus_bool_t wpa_dbus_dict_open_read(DBusMessageIter *iter,
629629
}
630630

631631

632+
#define BYTE_ARRAY_CHUNK_SIZE 34
633+
#define BYTE_ARRAY_ITEM_SIZE (sizeof (char))
634+
632635
static dbus_bool_t _wpa_dbus_dict_entry_get_byte_array(
633-
DBusMessageIter *iter, int array_len, int array_type,
636+
DBusMessageIter *iter, int array_type,
634637
struct wpa_dbus_dict_entry *entry)
635638
{
636-
dbus_uint32_t i = 0;
639+
dbus_uint32_t count = 0;
637640
dbus_bool_t success = FALSE;
638-
char byte;
641+
char *buffer;
639642

640-
/* Zero-length arrays are valid. */
641-
if (array_len == 0) {
642-
entry->bytearray_value = NULL;
643-
entry->array_type = DBUS_TYPE_BYTE;
644-
success = TRUE;
645-
goto done;
646-
}
643+
entry->bytearray_value = NULL;
644+
entry->array_type = DBUS_TYPE_BYTE;
647645

648-
entry->bytearray_value = wpa_zalloc(array_len * sizeof(char));
649-
if (!entry->bytearray_value) {
646+
buffer = wpa_zalloc(BYTE_ARRAY_ITEM_SIZE * BYTE_ARRAY_CHUNK_SIZE);
647+
if (!buffer) {
650648
perror("_wpa_dbus_dict_entry_get_byte_array[dbus]: out of "
651649
"memory");
652650
goto done;
653651
}
654652

655-
entry->array_type = DBUS_TYPE_BYTE;
656-
entry->array_len = array_len;
653+
entry->bytearray_value = buffer;
654+
entry->array_len = 0;
657655
while (dbus_message_iter_get_arg_type(iter) == DBUS_TYPE_BYTE) {
656+
char byte;
657+
658+
if ((count % BYTE_ARRAY_CHUNK_SIZE) == 0 && count != 0) {
659+
buffer = realloc(buffer, BYTE_ARRAY_ITEM_SIZE *
660+
(count + BYTE_ARRAY_CHUNK_SIZE));
661+
if (buffer == NULL) {
662+
perror("_wpa_dbus_dict_entry_get_byte_array["
663+
"dbus] out of memory trying to "
664+
"retrieve the string array");
665+
goto done;
666+
}
667+
}
668+
entry->bytearray_value = buffer;
669+
658670
dbus_message_iter_get_basic(iter, &byte);
659-
entry->bytearray_value[i++] = byte;
671+
entry->bytearray_value[count] = byte;
672+
entry->array_len = ++count;
660673
dbus_message_iter_next(iter);
661674
}
675+
676+
/* Zero-length arrays are valid. */
677+
if (entry->array_len == 0) {
678+
free(entry->bytearray_value);
679+
entry->bytearray_value = NULL;
680+
}
681+
662682
success = TRUE;
663683

664684
done:
665685
return success;
666686
}
667687

668688

689+
#define STR_ARRAY_CHUNK_SIZE 8
690+
#define STR_ARRAY_ITEM_SIZE (sizeof (char *))
691+
669692
static dbus_bool_t _wpa_dbus_dict_entry_get_string_array(
670-
DBusMessageIter *iter, int array_len, int array_type,
693+
DBusMessageIter *iter, int array_type,
671694
struct wpa_dbus_dict_entry *entry)
672695
{
673696
dbus_uint32_t count = 0;
@@ -677,13 +700,7 @@ static dbus_bool_t _wpa_dbus_dict_entry_get_string_array(
677700
entry->strarray_value = NULL;
678701
entry->array_type = DBUS_TYPE_STRING;
679702

680-
/* Zero-length arrays are valid. */
681-
if (array_len == 0) {
682-
success = TRUE;
683-
goto done;
684-
}
685-
686-
buffer = wpa_zalloc(sizeof (char *) * 8);
703+
buffer = wpa_zalloc(STR_ARRAY_ITEM_SIZE * STR_ARRAY_CHUNK_SIZE);
687704
if (buffer == NULL) {
688705
perror("_wpa_dbus_dict_entry_get_string_array[dbus] out of "
689706
"memory trying to retrieve a string array");
@@ -696,18 +713,15 @@ static dbus_bool_t _wpa_dbus_dict_entry_get_string_array(
696713
const char *value;
697714
char *str;
698715

699-
if ((count % 8) == 0 && count != 0) {
700-
char **tmp;
701-
tmp = realloc(buffer, sizeof(char *) * (count + 8));
702-
if (tmp == NULL) {
716+
if ((count % STR_ARRAY_CHUNK_SIZE) == 0 && count != 0) {
717+
buffer = realloc(buffer, STR_ARRAY_ITEM_SIZE *
718+
(count + STR_ARRAY_CHUNK_SIZE));
719+
if (buffer == NULL) {
703720
perror("_wpa_dbus_dict_entry_get_string_array["
704721
"dbus] out of memory trying to "
705722
"retrieve the string array");
706-
free(buffer);
707-
buffer = NULL;
708723
goto done;
709724
}
710-
buffer = tmp;
711725
}
712726
entry->strarray_value = buffer;
713727

@@ -723,6 +737,13 @@ static dbus_bool_t _wpa_dbus_dict_entry_get_string_array(
723737
entry->array_len = ++count;
724738
dbus_message_iter_next(iter);
725739
}
740+
741+
/* Zero-length arrays are valid. */
742+
if (entry->array_len == 0) {
743+
free(entry->strarray_value);
744+
entry->strarray_value = NULL;
745+
}
746+
726747
success = TRUE;
727748

728749
done:
@@ -734,7 +755,6 @@ static dbus_bool_t _wpa_dbus_dict_entry_get_array(
734755
DBusMessageIter *iter_dict_val, struct wpa_dbus_dict_entry *entry)
735756
{
736757
int array_type = dbus_message_iter_get_element_type(iter_dict_val);
737-
int array_len;
738758
dbus_bool_t success = FALSE;
739759
DBusMessageIter iter_array;
740760

@@ -743,20 +763,14 @@ static dbus_bool_t _wpa_dbus_dict_entry_get_array(
743763

744764
dbus_message_iter_recurse(iter_dict_val, &iter_array);
745765

746-
array_len = dbus_message_iter_get_array_len(&iter_array);
747-
if (array_len < 0)
748-
return FALSE;
749-
750766
switch (array_type) {
751767
case DBUS_TYPE_BYTE:
752768
success = _wpa_dbus_dict_entry_get_byte_array(&iter_array,
753-
array_len,
754769
array_type,
755770
entry);
756771
break;
757772
case DBUS_TYPE_STRING:
758773
success = _wpa_dbus_dict_entry_get_string_array(&iter_array,
759-
array_len,
760774
array_type,
761775
entry);
762776
break;
@@ -946,9 +960,17 @@ void wpa_dbus_dict_entry_clear(struct wpa_dbus_dict_entry *entry)
946960
break;
947961
case DBUS_TYPE_ARRAY:
948962
switch (entry->array_type) {
949-
case DBUS_TYPE_BYTE:
950-
free(entry->bytearray_value);
951-
break;
963+
case DBUS_TYPE_BYTE: {
964+
free(entry->bytearray_value);
965+
break;
966+
}
967+
case DBUS_TYPE_STRING: {
968+
unsigned int i;
969+
for (i = 0; i < entry->array_len; i++)
970+
free(entry->strarray_value[i]);
971+
free(entry->strarray_value);
972+
break;
973+
}
952974
}
953975
break;
954976
}

driver_broadcom.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -487,8 +487,9 @@ wpa_driver_broadcom_get_scan_results(void *priv,
487487
wbi = (wl_bss_info_t *) ((u8 *) wbi + wbi->length);
488488
}
489489

490-
wpa_printf(MSG_MSGDUMP, "Received %d bytes of scan results (%d BSSes)",
491-
wsr->buflen, ap_num);
490+
wpa_printf(MSG_MSGDUMP, "Received %d bytes of scan results (%lu "
491+
"BSSes)",
492+
wsr->buflen, (unsigned long) ap_num);
492493

493494
os_free(buf);
494495
return ap_num;

driver_hostap.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,9 @@ enum {
8484

8585
#define PRISM2_HOSTAPD_MAX_BUF_SIZE 1024
8686
#define PRISM2_HOSTAPD_RID_HDR_LEN \
87-
((int) (&((struct prism2_hostapd_param *) 0)->u.rid.data))
87+
((size_t) (&((struct prism2_hostapd_param *) 0)->u.rid.data))
8888
#define PRISM2_HOSTAPD_GENERIC_ELEMENT_HDR_LEN \
89-
((int) (&((struct prism2_hostapd_param *) 0)->u.generic_elem.data))
89+
((size_t) (&((struct prism2_hostapd_param *) 0)->u.generic_elem.data))
9090

9191
/* Maximum length for algorithm names (-1 for nul termination) used in ioctl()
9292
*/

driver_ndis.c

+2
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ int close(int fd);
4242
#include "driver_ndis.h"
4343

4444
int wpa_driver_register_event_cb(struct wpa_driver_ndis_data *drv);
45+
#ifdef CONFIG_NDIS_EVENTS_INTEGRATED
4546
void wpa_driver_ndis_event_pipe_cb(void *eloop_data, void *user_data);
47+
#endif /* CONFIG_NDIS_EVENTS_INTEGRATED */
4648

4749
static void wpa_driver_ndis_deinit(void *priv);
4850
static void wpa_driver_ndis_poll(void *drv);

0 commit comments

Comments
 (0)