summaryrefslogtreecommitdiffstats
path: root/meta/recipes-connectivity/wpa-supplicant/wpa-supplicant-0.7.3/wpa_supplicant-fix-deprecated-dbus-function.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-connectivity/wpa-supplicant/wpa-supplicant-0.7.3/wpa_supplicant-fix-deprecated-dbus-function.patch')
-rw-r--r--meta/recipes-connectivity/wpa-supplicant/wpa-supplicant-0.7.3/wpa_supplicant-fix-deprecated-dbus-function.patch189
1 files changed, 0 insertions, 189 deletions
diff --git a/meta/recipes-connectivity/wpa-supplicant/wpa-supplicant-0.7.3/wpa_supplicant-fix-deprecated-dbus-function.patch b/meta/recipes-connectivity/wpa-supplicant/wpa-supplicant-0.7.3/wpa_supplicant-fix-deprecated-dbus-function.patch
deleted file mode 100644
index a1898c3887..0000000000
--- a/meta/recipes-connectivity/wpa-supplicant/wpa-supplicant-0.7.3/wpa_supplicant-fix-deprecated-dbus-function.patch
+++ /dev/null
@@ -1,189 +0,0 @@
1Upstream-Status: Inappropriate [not used]
2
3--- dbus_dict_helpers.c.array-fix 2006-12-18 12:31:11.000000000 -0500
4+++ dbus_dict_helpers.c 2006-12-20 03:17:08.000000000 -0500
5@@ -629,36 +629,55 @@ dbus_bool_t wpa_dbus_dict_open_read(DBus
6 }
7
8
9+#define BYTE_ARRAY_CHUNK_SIZE 34
10+#define BYTE_ARRAY_ITEM_SIZE (sizeof (char))
11+
12 static dbus_bool_t _wpa_dbus_dict_entry_get_byte_array(
13- DBusMessageIter *iter, int array_len, int array_type,
14+ DBusMessageIter *iter, int array_type,
15 struct wpa_dbus_dict_entry *entry)
16 {
17- dbus_uint32_t i = 0;
18+ dbus_uint32_t count = 0;
19 dbus_bool_t success = FALSE;
20- char byte;
21+ char * buffer;
22
23- /* Zero-length arrays are valid. */
24- if (array_len == 0) {
25- entry->bytearray_value = NULL;
26- entry->array_type = DBUS_TYPE_BYTE;
27- success = TRUE;
28- goto done;
29- }
30+ entry->bytearray_value = NULL;
31+ entry->array_type = DBUS_TYPE_BYTE;
32
33- entry->bytearray_value = wpa_zalloc(array_len * sizeof(char));
34- if (!entry->bytearray_value) {
35+ buffer = wpa_zalloc(BYTE_ARRAY_ITEM_SIZE * BYTE_ARRAY_CHUNK_SIZE);
36+ if (!buffer) {
37 perror("_wpa_dbus_dict_entry_get_byte_array[dbus]: out of "
38 "memory");
39 goto done;
40 }
41
42- entry->array_type = DBUS_TYPE_BYTE;
43- entry->array_len = array_len;
44+ entry->bytearray_value = buffer;
45+ entry->array_len = 0;
46 while (dbus_message_iter_get_arg_type(iter) == DBUS_TYPE_BYTE) {
47+ char byte;
48+
49+ if ((count % BYTE_ARRAY_CHUNK_SIZE) == 0 && count != 0) {
50+ buffer = realloc(buffer, BYTE_ARRAY_ITEM_SIZE * (count + BYTE_ARRAY_CHUNK_SIZE));
51+ if (buffer == NULL) {
52+ perror("_wpa_dbus_dict_entry_get_byte_array["
53+ "dbus] out of memory trying to "
54+ "retrieve the string array");
55+ goto done;
56+ }
57+ }
58+ entry->bytearray_value = buffer;
59+
60 dbus_message_iter_get_basic(iter, &byte);
61- entry->bytearray_value[i++] = byte;
62+ entry->bytearray_value[count] = byte;
63+ entry->array_len = ++count;
64 dbus_message_iter_next(iter);
65 }
66+
67+ /* Zero-length arrays are valid. */
68+ if (entry->array_len == 0) {
69+ free(entry->bytearray_value);
70+ entry->strarray_value = NULL;
71+ }
72+
73 success = TRUE;
74
75 done:
76@@ -666,8 +685,11 @@ done:
77 }
78
79
80+#define STR_ARRAY_CHUNK_SIZE 8
81+#define STR_ARRAY_ITEM_SIZE (sizeof (char *))
82+
83 static dbus_bool_t _wpa_dbus_dict_entry_get_string_array(
84- DBusMessageIter *iter, int array_len, int array_type,
85+ DBusMessageIter *iter, int array_type,
86 struct wpa_dbus_dict_entry *entry)
87 {
88 dbus_uint32_t count = 0;
89@@ -677,13 +699,7 @@ static dbus_bool_t _wpa_dbus_dict_entry_
90 entry->strarray_value = NULL;
91 entry->array_type = DBUS_TYPE_STRING;
92
93- /* Zero-length arrays are valid. */
94- if (array_len == 0) {
95- success = TRUE;
96- goto done;
97- }
98-
99- buffer = wpa_zalloc(sizeof (char *) * 8);
100+ buffer = wpa_zalloc(STR_ARRAY_ITEM_SIZE * STR_ARRAY_CHUNK_SIZE);
101 if (buffer == NULL) {
102 perror("_wpa_dbus_dict_entry_get_string_array[dbus] out of "
103 "memory trying to retrieve a string array");
104@@ -696,18 +712,14 @@ static dbus_bool_t _wpa_dbus_dict_entry_
105 const char *value;
106 char *str;
107
108- if ((count % 8) == 0 && count != 0) {
109- char **tmp;
110- tmp = realloc(buffer, sizeof(char *) * (count + 8));
111- if (tmp == NULL) {
112+ if ((count % STR_ARRAY_CHUNK_SIZE) == 0 && count != 0) {
113+ buffer = realloc(buffer, STR_ARRAY_ITEM_SIZE * (count + STR_ARRAY_CHUNK_SIZE));
114+ if (buffer == NULL) {
115 perror("_wpa_dbus_dict_entry_get_string_array["
116 "dbus] out of memory trying to "
117 "retrieve the string array");
118- free(buffer);
119- buffer = NULL;
120 goto done;
121 }
122- buffer = tmp;
123 }
124 entry->strarray_value = buffer;
125
126@@ -723,6 +735,13 @@ static dbus_bool_t _wpa_dbus_dict_entry_
127 entry->array_len = ++count;
128 dbus_message_iter_next(iter);
129 }
130+
131+ /* Zero-length arrays are valid. */
132+ if (entry->array_len == 0) {
133+ free(entry->strarray_value);
134+ entry->strarray_value = NULL;
135+ }
136+
137 success = TRUE;
138
139 done:
140@@ -734,7 +753,6 @@ static dbus_bool_t _wpa_dbus_dict_entry_
141 DBusMessageIter *iter_dict_val, struct wpa_dbus_dict_entry *entry)
142 {
143 int array_type = dbus_message_iter_get_element_type(iter_dict_val);
144- int array_len;
145 dbus_bool_t success = FALSE;
146 DBusMessageIter iter_array;
147
148@@ -743,20 +761,14 @@ static dbus_bool_t _wpa_dbus_dict_entry_
149
150 dbus_message_iter_recurse(iter_dict_val, &iter_array);
151
152- array_len = dbus_message_iter_get_array_len(&iter_array);
153- if (array_len < 0)
154- return FALSE;
155-
156 switch (array_type) {
157 case DBUS_TYPE_BYTE:
158 success = _wpa_dbus_dict_entry_get_byte_array(&iter_array,
159- array_len,
160 array_type,
161 entry);
162 break;
163 case DBUS_TYPE_STRING:
164 success = _wpa_dbus_dict_entry_get_string_array(&iter_array,
165- array_len,
166 array_type,
167 entry);
168 break;
169@@ -943,9 +955,17 @@ void wpa_dbus_dict_entry_clear(struct wp
170 break;
171 case DBUS_TYPE_ARRAY:
172 switch (entry->array_type) {
173- case DBUS_TYPE_BYTE:
174- free(entry->bytearray_value);
175- break;
176+ case DBUS_TYPE_BYTE: {
177+ free(entry->bytearray_value);
178+ break;
179+ }
180+ case DBUS_TYPE_STRING: {
181+ int i;
182+ for (i = 0; i < entry->array_len; i++)
183+ free (entry->strarray_value[i]);
184+ free (entry->strarray_value);
185+ break;
186+ }
187 }
188 break;
189 }