summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoss Burton <ross@openedhand.com>2007-09-28 14:50:50 +0000
committerRoss Burton <ross@openedhand.com>2007-09-28 14:50:50 +0000
commitcdafd8b8c839d010fc8e99a11292a17932ab428e (patch)
tree3047814ad994e1314f43e7588b1450e3d4d04745
parentf2287f417a884fcd839666d6a8de73ec78ab410a (diff)
downloadpoky-cdafd8b8c839d010fc8e99a11292a17932ab428e.tar.gz
wpa-supplicant: add some patches from redhat
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@2818 311d38ba-8fff-0310-9ca6-ca027cbcb966
-rw-r--r--meta/packages/wpa-supplicant/files/wpa_supplicant-0.5.7-always-scan.patch12
-rw-r--r--meta/packages/wpa-supplicant/files/wpa_supplicant-fix-deprecated-dbus-function.patch187
-rw-r--r--meta/packages/wpa-supplicant/wpa-supplicant-0.5.inc2
-rw-r--r--meta/packages/wpa-supplicant/wpa-supplicant_0.5.8.bb2
4 files changed, 202 insertions, 1 deletions
diff --git a/meta/packages/wpa-supplicant/files/wpa_supplicant-0.5.7-always-scan.patch b/meta/packages/wpa-supplicant/files/wpa_supplicant-0.5.7-always-scan.patch
new file mode 100644
index 0000000000..25afd07a11
--- /dev/null
+++ b/meta/packages/wpa-supplicant/files/wpa_supplicant-0.5.7-always-scan.patch
@@ -0,0 +1,12 @@
1diff -up wpa_supplicant-0.5.7/wpa_supplicant.c.always-scan wpa_supplicant-0.5.7/wpa_supplicant.c
2--- wpa_supplicant-0.5.7/wpa_supplicant.c.always-scan 2007-09-25 15:51:35.000000000 -0400
3+++ wpa_supplicant-0.5.7/wpa_supplicant.c 2007-09-25 16:31:27.000000000 -0400
4@@ -972,7 +972,7 @@ static void wpa_supplicant_scan(void *el
5 struct wpa_ssid *ssid;
6 int enabled, scan_req = 0, ret;
7
8- if (wpa_s->disconnected)
9+ if (wpa_s->disconnected && !wpa_s->scan_req)
10 return;
11
12 enabled = 0;
diff --git a/meta/packages/wpa-supplicant/files/wpa_supplicant-fix-deprecated-dbus-function.patch b/meta/packages/wpa-supplicant/files/wpa_supplicant-fix-deprecated-dbus-function.patch
new file mode 100644
index 0000000000..dbd5e4e934
--- /dev/null
+++ b/meta/packages/wpa-supplicant/files/wpa_supplicant-fix-deprecated-dbus-function.patch
@@ -0,0 +1,187 @@
1--- dbus_dict_helpers.c.array-fix 2006-12-18 12:31:11.000000000 -0500
2+++ dbus_dict_helpers.c 2006-12-20 03:17:08.000000000 -0500
3@@ -629,36 +629,55 @@ dbus_bool_t wpa_dbus_dict_open_read(DBus
4 }
5
6
7+#define BYTE_ARRAY_CHUNK_SIZE 34
8+#define BYTE_ARRAY_ITEM_SIZE (sizeof (char))
9+
10 static dbus_bool_t _wpa_dbus_dict_entry_get_byte_array(
11- DBusMessageIter *iter, int array_len, int array_type,
12+ DBusMessageIter *iter, int array_type,
13 struct wpa_dbus_dict_entry *entry)
14 {
15- dbus_uint32_t i = 0;
16+ dbus_uint32_t count = 0;
17 dbus_bool_t success = FALSE;
18- char byte;
19+ char * buffer;
20
21- /* Zero-length arrays are valid. */
22- if (array_len == 0) {
23- entry->bytearray_value = NULL;
24- entry->array_type = DBUS_TYPE_BYTE;
25- success = TRUE;
26- goto done;
27- }
28+ entry->bytearray_value = NULL;
29+ entry->array_type = DBUS_TYPE_BYTE;
30
31- entry->bytearray_value = wpa_zalloc(array_len * sizeof(char));
32- if (!entry->bytearray_value) {
33+ buffer = wpa_zalloc(BYTE_ARRAY_ITEM_SIZE * BYTE_ARRAY_CHUNK_SIZE);
34+ if (!buffer) {
35 perror("_wpa_dbus_dict_entry_get_byte_array[dbus]: out of "
36 "memory");
37 goto done;
38 }
39
40- entry->array_type = DBUS_TYPE_BYTE;
41- entry->array_len = array_len;
42+ entry->bytearray_value = buffer;
43+ entry->array_len = 0;
44 while (dbus_message_iter_get_arg_type(iter) == DBUS_TYPE_BYTE) {
45+ char byte;
46+
47+ if ((count % BYTE_ARRAY_CHUNK_SIZE) == 0 && count != 0) {
48+ buffer = realloc(buffer, BYTE_ARRAY_ITEM_SIZE * (count + BYTE_ARRAY_CHUNK_SIZE));
49+ if (buffer == NULL) {
50+ perror("_wpa_dbus_dict_entry_get_byte_array["
51+ "dbus] out of memory trying to "
52+ "retrieve the string array");
53+ goto done;
54+ }
55+ }
56+ entry->bytearray_value = buffer;
57+
58 dbus_message_iter_get_basic(iter, &byte);
59- entry->bytearray_value[i++] = byte;
60+ entry->bytearray_value[count] = byte;
61+ entry->array_len = ++count;
62 dbus_message_iter_next(iter);
63 }
64+
65+ /* Zero-length arrays are valid. */
66+ if (entry->array_len == 0) {
67+ free(entry->bytearray_value);
68+ entry->strarray_value = NULL;
69+ }
70+
71 success = TRUE;
72
73 done:
74@@ -666,8 +685,11 @@ done:
75 }
76
77
78+#define STR_ARRAY_CHUNK_SIZE 8
79+#define STR_ARRAY_ITEM_SIZE (sizeof (char *))
80+
81 static dbus_bool_t _wpa_dbus_dict_entry_get_string_array(
82- DBusMessageIter *iter, int array_len, int array_type,
83+ DBusMessageIter *iter, int array_type,
84 struct wpa_dbus_dict_entry *entry)
85 {
86 dbus_uint32_t count = 0;
87@@ -677,13 +699,7 @@ static dbus_bool_t _wpa_dbus_dict_entry_
88 entry->strarray_value = NULL;
89 entry->array_type = DBUS_TYPE_STRING;
90
91- /* Zero-length arrays are valid. */
92- if (array_len == 0) {
93- success = TRUE;
94- goto done;
95- }
96-
97- buffer = wpa_zalloc(sizeof (char *) * 8);
98+ buffer = wpa_zalloc(STR_ARRAY_ITEM_SIZE * STR_ARRAY_CHUNK_SIZE);
99 if (buffer == NULL) {
100 perror("_wpa_dbus_dict_entry_get_string_array[dbus] out of "
101 "memory trying to retrieve a string array");
102@@ -696,18 +712,14 @@ static dbus_bool_t _wpa_dbus_dict_entry_
103 const char *value;
104 char *str;
105
106- if ((count % 8) == 0 && count != 0) {
107- char **tmp;
108- tmp = realloc(buffer, sizeof(char *) * (count + 8));
109- if (tmp == NULL) {
110+ if ((count % STR_ARRAY_CHUNK_SIZE) == 0 && count != 0) {
111+ buffer = realloc(buffer, STR_ARRAY_ITEM_SIZE * (count + STR_ARRAY_CHUNK_SIZE));
112+ if (buffer == NULL) {
113 perror("_wpa_dbus_dict_entry_get_string_array["
114 "dbus] out of memory trying to "
115 "retrieve the string array");
116- free(buffer);
117- buffer = NULL;
118 goto done;
119 }
120- buffer = tmp;
121 }
122 entry->strarray_value = buffer;
123
124@@ -723,6 +735,13 @@ static dbus_bool_t _wpa_dbus_dict_entry_
125 entry->array_len = ++count;
126 dbus_message_iter_next(iter);
127 }
128+
129+ /* Zero-length arrays are valid. */
130+ if (entry->array_len == 0) {
131+ free(entry->strarray_value);
132+ entry->strarray_value = NULL;
133+ }
134+
135 success = TRUE;
136
137 done:
138@@ -734,7 +753,6 @@ static dbus_bool_t _wpa_dbus_dict_entry_
139 DBusMessageIter *iter_dict_val, struct wpa_dbus_dict_entry *entry)
140 {
141 int array_type = dbus_message_iter_get_element_type(iter_dict_val);
142- int array_len;
143 dbus_bool_t success = FALSE;
144 DBusMessageIter iter_array;
145
146@@ -743,20 +761,14 @@ static dbus_bool_t _wpa_dbus_dict_entry_
147
148 dbus_message_iter_recurse(iter_dict_val, &iter_array);
149
150- array_len = dbus_message_iter_get_array_len(&iter_array);
151- if (array_len < 0)
152- return FALSE;
153-
154 switch (array_type) {
155 case DBUS_TYPE_BYTE:
156 success = _wpa_dbus_dict_entry_get_byte_array(&iter_array,
157- array_len,
158 array_type,
159 entry);
160 break;
161 case DBUS_TYPE_STRING:
162 success = _wpa_dbus_dict_entry_get_string_array(&iter_array,
163- array_len,
164 array_type,
165 entry);
166 break;
167@@ -943,9 +955,17 @@ void wpa_dbus_dict_entry_clear(struct wp
168 break;
169 case DBUS_TYPE_ARRAY:
170 switch (entry->array_type) {
171- case DBUS_TYPE_BYTE:
172- free(entry->bytearray_value);
173- break;
174+ case DBUS_TYPE_BYTE: {
175+ free(entry->bytearray_value);
176+ break;
177+ }
178+ case DBUS_TYPE_STRING: {
179+ int i;
180+ for (i = 0; i < entry->array_len; i++)
181+ free (entry->strarray_value[i]);
182+ free (entry->strarray_value);
183+ break;
184+ }
185 }
186 break;
187 }
diff --git a/meta/packages/wpa-supplicant/wpa-supplicant-0.5.inc b/meta/packages/wpa-supplicant/wpa-supplicant-0.5.inc
index bc8cb80e8e..f56f060151 100644
--- a/meta/packages/wpa-supplicant/wpa-supplicant-0.5.inc
+++ b/meta/packages/wpa-supplicant/wpa-supplicant-0.5.inc
@@ -5,6 +5,8 @@ HOMEPAGE = "http://hostap.epitest.fi/wpa_supplicant/"
5DEPENDS = "gnutls dbus" 5DEPENDS = "gnutls dbus"
6 6
7SRC_URI = "http://hostap.epitest.fi/releases/wpa_supplicant-${PV}.tar.gz \ 7SRC_URI = "http://hostap.epitest.fi/releases/wpa_supplicant-${PV}.tar.gz \
8 file://wpa_supplicant-0.5.7-always-scan.patch;patch=1 \
9 file://wpa_supplicant-fix-deprecated-dbus-function.patch;patch=1;pnum=0 \
8 file://defconfig-gnutls \ 10 file://defconfig-gnutls \
9 file://init.sh \ 11 file://init.sh \
10 file://defaults-sane \ 12 file://defaults-sane \
diff --git a/meta/packages/wpa-supplicant/wpa-supplicant_0.5.8.bb b/meta/packages/wpa-supplicant/wpa-supplicant_0.5.8.bb
index 68eceea918..ce744b3fe7 100644
--- a/meta/packages/wpa-supplicant/wpa-supplicant_0.5.8.bb
+++ b/meta/packages/wpa-supplicant/wpa-supplicant_0.5.8.bb
@@ -1,3 +1,3 @@
1require wpa-supplicant-0.5.inc 1require wpa-supplicant-0.5.inc
2 2
3PR = "r2" 3PR = "r3"