00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #include "includes.h"
00016 #include <dbus/dbus.h>
00017
00018 #include "common.h"
00019 #include "dbus_dict_helpers.h"
00020
00021
00031 dbus_bool_t wpa_dbus_dict_open_write(DBusMessageIter *iter,
00032 DBusMessageIter *iter_dict)
00033 {
00034 dbus_bool_t result;
00035
00036 if (!iter || !iter_dict)
00037 return FALSE;
00038
00039 result = dbus_message_iter_open_container(
00040 iter,
00041 DBUS_TYPE_ARRAY,
00042 DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING
00043 DBUS_TYPE_STRING_AS_STRING
00044 DBUS_TYPE_VARIANT_AS_STRING
00045 DBUS_DICT_ENTRY_END_CHAR_AS_STRING,
00046 iter_dict);
00047 return result;
00048 }
00049
00050
00062 dbus_bool_t wpa_dbus_dict_close_write(DBusMessageIter *iter,
00063 DBusMessageIter *iter_dict)
00064 {
00065 if (!iter || !iter_dict)
00066 return FALSE;
00067
00068 return dbus_message_iter_close_container(iter, iter_dict);
00069 }
00070
00071
00072 const char * wpa_dbus_type_as_string(const int type)
00073 {
00074 switch(type) {
00075 case DBUS_TYPE_BYTE:
00076 return DBUS_TYPE_BYTE_AS_STRING;
00077 case DBUS_TYPE_BOOLEAN:
00078 return DBUS_TYPE_BOOLEAN_AS_STRING;
00079 case DBUS_TYPE_INT16:
00080 return DBUS_TYPE_INT16_AS_STRING;
00081 case DBUS_TYPE_UINT16:
00082 return DBUS_TYPE_UINT16_AS_STRING;
00083 case DBUS_TYPE_INT32:
00084 return DBUS_TYPE_INT32_AS_STRING;
00085 case DBUS_TYPE_UINT32:
00086 return DBUS_TYPE_UINT32_AS_STRING;
00087 case DBUS_TYPE_INT64:
00088 return DBUS_TYPE_INT64_AS_STRING;
00089 case DBUS_TYPE_UINT64:
00090 return DBUS_TYPE_UINT64_AS_STRING;
00091 case DBUS_TYPE_DOUBLE:
00092 return DBUS_TYPE_DOUBLE_AS_STRING;
00093 case DBUS_TYPE_STRING:
00094 return DBUS_TYPE_STRING_AS_STRING;
00095 case DBUS_TYPE_OBJECT_PATH:
00096 return DBUS_TYPE_OBJECT_PATH_AS_STRING;
00097 case DBUS_TYPE_ARRAY:
00098 return DBUS_TYPE_ARRAY_AS_STRING;
00099 default:
00100 return NULL;
00101 }
00102 }
00103
00104
00105 static dbus_bool_t _wpa_dbus_add_dict_entry_start(
00106 DBusMessageIter *iter_dict, DBusMessageIter *iter_dict_entry,
00107 const char *key, const int value_type)
00108 {
00109 if (!dbus_message_iter_open_container(iter_dict,
00110 DBUS_TYPE_DICT_ENTRY, NULL,
00111 iter_dict_entry))
00112 return FALSE;
00113
00114 if (!dbus_message_iter_append_basic(iter_dict_entry, DBUS_TYPE_STRING,
00115 &key))
00116 return FALSE;
00117
00118 return TRUE;
00119 }
00120
00121
00122 static dbus_bool_t _wpa_dbus_add_dict_entry_end(
00123 DBusMessageIter *iter_dict, DBusMessageIter *iter_dict_entry,
00124 DBusMessageIter *iter_dict_val)
00125 {
00126 if (!dbus_message_iter_close_container(iter_dict_entry, iter_dict_val))
00127 return FALSE;
00128 if (!dbus_message_iter_close_container(iter_dict, iter_dict_entry))
00129 return FALSE;
00130
00131 return TRUE;
00132 }
00133
00134
00135 static dbus_bool_t _wpa_dbus_add_dict_entry_basic(DBusMessageIter *iter_dict,
00136 const char *key,
00137 const int value_type,
00138 const void *value)
00139 {
00140 DBusMessageIter iter_dict_entry, iter_dict_val;
00141 const char *type_as_string = NULL;
00142
00143 if (key == NULL)
00144 return FALSE;
00145
00146 type_as_string = wpa_dbus_type_as_string(value_type);
00147 if (!type_as_string)
00148 return FALSE;
00149
00150 if (!_wpa_dbus_add_dict_entry_start(iter_dict, &iter_dict_entry,
00151 key, value_type))
00152 return FALSE;
00153
00154 if (!dbus_message_iter_open_container(&iter_dict_entry,
00155 DBUS_TYPE_VARIANT,
00156 type_as_string, &iter_dict_val))
00157 return FALSE;
00158
00159 if (!dbus_message_iter_append_basic(&iter_dict_val, value_type, value))
00160 return FALSE;
00161
00162 if (!_wpa_dbus_add_dict_entry_end(iter_dict, &iter_dict_entry,
00163 &iter_dict_val))
00164 return FALSE;
00165
00166 return TRUE;
00167 }
00168
00169
00170 static dbus_bool_t _wpa_dbus_add_dict_entry_byte_array(
00171 DBusMessageIter *iter_dict, const char *key,
00172 const char *value, const dbus_uint32_t value_len)
00173 {
00174 DBusMessageIter iter_dict_entry, iter_dict_val, iter_array;
00175 dbus_uint32_t i;
00176
00177 if (!_wpa_dbus_add_dict_entry_start(iter_dict, &iter_dict_entry,
00178 key, DBUS_TYPE_ARRAY))
00179 return FALSE;
00180
00181 if (!dbus_message_iter_open_container(&iter_dict_entry,
00182 DBUS_TYPE_VARIANT,
00183 DBUS_TYPE_ARRAY_AS_STRING
00184 DBUS_TYPE_BYTE_AS_STRING,
00185 &iter_dict_val))
00186 return FALSE;
00187
00188 if (!dbus_message_iter_open_container(&iter_dict_val, DBUS_TYPE_ARRAY,
00189 DBUS_TYPE_BYTE_AS_STRING,
00190 &iter_array))
00191 return FALSE;
00192
00193 for (i = 0; i < value_len; i++) {
00194 if (!dbus_message_iter_append_basic(&iter_array,
00195 DBUS_TYPE_BYTE,
00196 &(value[i])))
00197 return FALSE;
00198 }
00199
00200 if (!dbus_message_iter_close_container(&iter_dict_val, &iter_array))
00201 return FALSE;
00202
00203 if (!_wpa_dbus_add_dict_entry_end(iter_dict, &iter_dict_entry,
00204 &iter_dict_val))
00205 return FALSE;
00206
00207 return TRUE;
00208 }
00209
00210
00221 dbus_bool_t wpa_dbus_dict_append_string(DBusMessageIter *iter_dict,
00222 const char *key, const char *value)
00223 {
00224 if (!value)
00225 return FALSE;
00226 return _wpa_dbus_add_dict_entry_basic(iter_dict, key, DBUS_TYPE_STRING,
00227 &value);
00228 }
00229
00230
00241 dbus_bool_t wpa_dbus_dict_append_byte(DBusMessageIter *iter_dict,
00242 const char *key, const char value)
00243 {
00244 return _wpa_dbus_add_dict_entry_basic(iter_dict, key, DBUS_TYPE_BYTE,
00245 &value);
00246 }
00247
00248
00259 dbus_bool_t wpa_dbus_dict_append_bool(DBusMessageIter *iter_dict,
00260 const char *key, const dbus_bool_t value)
00261 {
00262 return _wpa_dbus_add_dict_entry_basic(iter_dict, key,
00263 DBUS_TYPE_BOOLEAN, &value);
00264 }
00265
00266
00277 dbus_bool_t wpa_dbus_dict_append_int16(DBusMessageIter *iter_dict,
00278 const char *key,
00279 const dbus_int16_t value)
00280 {
00281 return _wpa_dbus_add_dict_entry_basic(iter_dict, key, DBUS_TYPE_INT16,
00282 &value);
00283 }
00284
00285
00296 dbus_bool_t wpa_dbus_dict_append_uint16(DBusMessageIter *iter_dict,
00297 const char *key,
00298 const dbus_uint16_t value)
00299 {
00300 return _wpa_dbus_add_dict_entry_basic(iter_dict, key, DBUS_TYPE_UINT16,
00301 &value);
00302 }
00303
00304
00315 dbus_bool_t wpa_dbus_dict_append_int32(DBusMessageIter *iter_dict,
00316 const char *key,
00317 const dbus_int32_t value)
00318 {
00319 return _wpa_dbus_add_dict_entry_basic(iter_dict, key, DBUS_TYPE_INT32,
00320 &value);
00321 }
00322
00323
00334 dbus_bool_t wpa_dbus_dict_append_uint32(DBusMessageIter *iter_dict,
00335 const char *key,
00336 const dbus_uint32_t value)
00337 {
00338 return _wpa_dbus_add_dict_entry_basic(iter_dict, key, DBUS_TYPE_UINT32,
00339 &value);
00340 }
00341
00342
00353 dbus_bool_t wpa_dbus_dict_append_int64(DBusMessageIter *iter_dict,
00354 const char *key,
00355 const dbus_int64_t value)
00356 {
00357 return _wpa_dbus_add_dict_entry_basic(iter_dict, key, DBUS_TYPE_INT64,
00358 &value);
00359 }
00360
00361
00372 dbus_bool_t wpa_dbus_dict_append_uint64(DBusMessageIter *iter_dict,
00373 const char *key,
00374 const dbus_uint64_t value)
00375 {
00376 return _wpa_dbus_add_dict_entry_basic(iter_dict, key, DBUS_TYPE_UINT64,
00377 &value);
00378 }
00379
00380
00391 dbus_bool_t wpa_dbus_dict_append_double(DBusMessageIter *iter_dict,
00392 const char *key, const double value)
00393 {
00394 return _wpa_dbus_add_dict_entry_basic(iter_dict, key, DBUS_TYPE_DOUBLE,
00395 &value);
00396 }
00397
00398
00409 dbus_bool_t wpa_dbus_dict_append_object_path(DBusMessageIter *iter_dict,
00410 const char *key,
00411 const char *value)
00412 {
00413 if (!value)
00414 return FALSE;
00415 return _wpa_dbus_add_dict_entry_basic(iter_dict, key,
00416 DBUS_TYPE_OBJECT_PATH, &value);
00417 }
00418
00419
00431 dbus_bool_t wpa_dbus_dict_append_byte_array(DBusMessageIter *iter_dict,
00432 const char *key,
00433 const char *value,
00434 const dbus_uint32_t value_len)
00435 {
00436 if (!key)
00437 return FALSE;
00438 if (!value && (value_len != 0))
00439 return FALSE;
00440 return _wpa_dbus_add_dict_entry_byte_array(iter_dict, key, value,
00441 value_len);
00442 }
00443
00444
00460 dbus_bool_t wpa_dbus_dict_begin_string_array(DBusMessageIter *iter_dict,
00461 const char *key,
00462 DBusMessageIter *iter_dict_entry,
00463 DBusMessageIter *iter_dict_val,
00464 DBusMessageIter *iter_array)
00465 {
00466 if (!iter_dict || !iter_dict_entry || !iter_dict_val || !iter_array)
00467 return FALSE;
00468
00469 if (!_wpa_dbus_add_dict_entry_start(iter_dict, iter_dict_entry,
00470 key, DBUS_TYPE_ARRAY))
00471 return FALSE;
00472
00473 if (!dbus_message_iter_open_container(iter_dict_entry,
00474 DBUS_TYPE_VARIANT,
00475 DBUS_TYPE_ARRAY_AS_STRING
00476 DBUS_TYPE_STRING_AS_STRING,
00477 iter_dict_val))
00478 return FALSE;
00479
00480 if (!dbus_message_iter_open_container(iter_dict_val, DBUS_TYPE_ARRAY,
00481 DBUS_TYPE_BYTE_AS_STRING,
00482 iter_array))
00483 return FALSE;
00484
00485 return TRUE;
00486 }
00487
00488
00499 dbus_bool_t wpa_dbus_dict_string_array_add_element(DBusMessageIter *iter_array,
00500 const char *elem)
00501 {
00502 if (!iter_array || !elem)
00503 return FALSE;
00504
00505 return dbus_message_iter_append_basic(iter_array, DBUS_TYPE_STRING,
00506 &elem);
00507 }
00508
00509
00524 dbus_bool_t wpa_dbus_dict_end_string_array(DBusMessageIter *iter_dict,
00525 DBusMessageIter *iter_dict_entry,
00526 DBusMessageIter *iter_dict_val,
00527 DBusMessageIter *iter_array)
00528 {
00529 if (!iter_dict || !iter_dict_entry || !iter_dict_val || !iter_array)
00530 return FALSE;
00531
00532 if (!dbus_message_iter_close_container(iter_dict_val, iter_array))
00533 return FALSE;
00534
00535 if (!_wpa_dbus_add_dict_entry_end(iter_dict, iter_dict_entry,
00536 iter_dict_val))
00537 return FALSE;
00538
00539 return TRUE;
00540 }
00541
00542
00554 dbus_bool_t wpa_dbus_dict_append_string_array(DBusMessageIter *iter_dict,
00555 const char *key,
00556 const char **items,
00557 const dbus_uint32_t num_items)
00558 {
00559 DBusMessageIter iter_dict_entry, iter_dict_val, iter_array;
00560 dbus_uint32_t i;
00561
00562 if (!key)
00563 return FALSE;
00564 if (!items && (num_items != 0))
00565 return FALSE;
00566
00567 if (!wpa_dbus_dict_begin_string_array(iter_dict, key,
00568 &iter_dict_entry, &iter_dict_val,
00569 &iter_array))
00570 return FALSE;
00571
00572 for (i = 0; i < num_items; i++) {
00573 if (!wpa_dbus_dict_string_array_add_element(&iter_array,
00574 items[i]))
00575 return FALSE;
00576 }
00577
00578 if (!wpa_dbus_dict_end_string_array(iter_dict, &iter_dict_entry,
00579 &iter_dict_val, &iter_array))
00580 return FALSE;
00581
00582 return TRUE;
00583 }
00584
00585
00586
00587
00588
00589
00599 dbus_bool_t wpa_dbus_dict_open_read(DBusMessageIter *iter,
00600 DBusMessageIter *iter_dict)
00601 {
00602 if (!iter || !iter_dict)
00603 return FALSE;
00604
00605 if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_ARRAY ||
00606 dbus_message_iter_get_element_type(iter) != DBUS_TYPE_DICT_ENTRY)
00607 return FALSE;
00608
00609 dbus_message_iter_recurse(iter, iter_dict);
00610 return TRUE;
00611 }
00612
00613
00614 #define BYTE_ARRAY_CHUNK_SIZE 34
00615 #define BYTE_ARRAY_ITEM_SIZE (sizeof(char))
00616
00617 static dbus_bool_t _wpa_dbus_dict_entry_get_byte_array(
00618 DBusMessageIter *iter, int array_type,
00619 struct wpa_dbus_dict_entry *entry)
00620 {
00621 dbus_uint32_t count = 0;
00622 dbus_bool_t success = FALSE;
00623 char *buffer, *nbuffer;;
00624
00625 entry->bytearray_value = NULL;
00626 entry->array_type = DBUS_TYPE_BYTE;
00627
00628 buffer = os_zalloc(BYTE_ARRAY_ITEM_SIZE * BYTE_ARRAY_CHUNK_SIZE);
00629 if (!buffer)
00630 return FALSE;
00631
00632 entry->bytearray_value = buffer;
00633 entry->array_len = 0;
00634 while (dbus_message_iter_get_arg_type(iter) == DBUS_TYPE_BYTE) {
00635 char byte;
00636
00637 if ((count % BYTE_ARRAY_CHUNK_SIZE) == 0 && count != 0) {
00638 nbuffer = os_realloc(buffer, BYTE_ARRAY_ITEM_SIZE *
00639 (count + BYTE_ARRAY_CHUNK_SIZE));
00640 if (nbuffer == NULL) {
00641 os_free(buffer);
00642 wpa_printf(MSG_ERROR, "dbus: _wpa_dbus_dict_"
00643 "entry_get_byte_array out of "
00644 "memory trying to retrieve the "
00645 "string array");
00646 goto done;
00647 }
00648 buffer = nbuffer;
00649 }
00650 entry->bytearray_value = buffer;
00651
00652 dbus_message_iter_get_basic(iter, &byte);
00653 entry->bytearray_value[count] = byte;
00654 entry->array_len = ++count;
00655 dbus_message_iter_next(iter);
00656 }
00657
00658
00659 if (entry->array_len == 0) {
00660 os_free(entry->bytearray_value);
00661 entry->bytearray_value = NULL;
00662 }
00663
00664 success = TRUE;
00665
00666 done:
00667 return success;
00668 }
00669
00670
00671 #define STR_ARRAY_CHUNK_SIZE 8
00672 #define STR_ARRAY_ITEM_SIZE (sizeof(char *))
00673
00674 static dbus_bool_t _wpa_dbus_dict_entry_get_string_array(
00675 DBusMessageIter *iter, int array_type,
00676 struct wpa_dbus_dict_entry *entry)
00677 {
00678 dbus_uint32_t count = 0;
00679 dbus_bool_t success = FALSE;
00680 char **buffer, **nbuffer;
00681
00682 entry->strarray_value = NULL;
00683 entry->array_type = DBUS_TYPE_STRING;
00684
00685 buffer = os_zalloc(STR_ARRAY_ITEM_SIZE * STR_ARRAY_CHUNK_SIZE);
00686 if (buffer == NULL)
00687 return FALSE;
00688
00689 entry->strarray_value = buffer;
00690 entry->array_len = 0;
00691 while (dbus_message_iter_get_arg_type(iter) == DBUS_TYPE_STRING) {
00692 const char *value;
00693 char *str;
00694
00695 if ((count % STR_ARRAY_CHUNK_SIZE) == 0 && count != 0) {
00696 nbuffer = os_realloc(buffer, STR_ARRAY_ITEM_SIZE *
00697 (count + STR_ARRAY_CHUNK_SIZE));
00698 if (nbuffer == NULL) {
00699 os_free(buffer);
00700 wpa_printf(MSG_ERROR, "dbus: _wpa_dbus_dict_"
00701 "entry_get_string_array out of "
00702 "memory trying to retrieve the "
00703 "string array");
00704 goto done;
00705 }
00706 buffer = nbuffer;
00707 }
00708 entry->strarray_value = buffer;
00709
00710 dbus_message_iter_get_basic(iter, &value);
00711 str = os_strdup(value);
00712 if (str == NULL) {
00713 wpa_printf(MSG_ERROR, "dbus: _wpa_dbus_dict_entry_get_"
00714 "string_array out of memory trying to "
00715 "duplicate the string array");
00716 goto done;
00717 }
00718 entry->strarray_value[count] = str;
00719 entry->array_len = ++count;
00720 dbus_message_iter_next(iter);
00721 }
00722
00723
00724 if (entry->array_len == 0) {
00725 os_free(entry->strarray_value);
00726 entry->strarray_value = NULL;
00727 }
00728
00729 success = TRUE;
00730
00731 done:
00732 return success;
00733 }
00734
00735
00736 static dbus_bool_t _wpa_dbus_dict_entry_get_array(
00737 DBusMessageIter *iter_dict_val, struct wpa_dbus_dict_entry *entry)
00738 {
00739 int array_type = dbus_message_iter_get_element_type(iter_dict_val);
00740 dbus_bool_t success = FALSE;
00741 DBusMessageIter iter_array;
00742
00743 if (!entry)
00744 return FALSE;
00745
00746 dbus_message_iter_recurse(iter_dict_val, &iter_array);
00747
00748 switch (array_type) {
00749 case DBUS_TYPE_BYTE:
00750 success = _wpa_dbus_dict_entry_get_byte_array(&iter_array,
00751 array_type,
00752 entry);
00753 break;
00754 case DBUS_TYPE_STRING:
00755 success = _wpa_dbus_dict_entry_get_string_array(&iter_array,
00756 array_type,
00757 entry);
00758 break;
00759 default:
00760 break;
00761 }
00762
00763 return success;
00764 }
00765
00766
00767 static dbus_bool_t _wpa_dbus_dict_fill_value_from_variant(
00768 struct wpa_dbus_dict_entry *entry, DBusMessageIter *iter)
00769 {
00770 const char *v;
00771
00772 switch (entry->type) {
00773 case DBUS_TYPE_OBJECT_PATH:
00774 case DBUS_TYPE_STRING:
00775 dbus_message_iter_get_basic(iter, &v);
00776 entry->str_value = os_strdup(v);
00777 if (entry->str_value == NULL)
00778 return FALSE;
00779 break;
00780 case DBUS_TYPE_BOOLEAN:
00781 dbus_message_iter_get_basic(iter, &entry->bool_value);
00782 break;
00783 case DBUS_TYPE_BYTE:
00784 dbus_message_iter_get_basic(iter, &entry->byte_value);
00785 break;
00786 case DBUS_TYPE_INT16:
00787 dbus_message_iter_get_basic(iter, &entry->int16_value);
00788 break;
00789 case DBUS_TYPE_UINT16:
00790 dbus_message_iter_get_basic(iter, &entry->uint16_value);
00791 break;
00792 case DBUS_TYPE_INT32:
00793 dbus_message_iter_get_basic(iter, &entry->int32_value);
00794 break;
00795 case DBUS_TYPE_UINT32:
00796 dbus_message_iter_get_basic(iter, &entry->uint32_value);
00797 break;
00798 case DBUS_TYPE_INT64:
00799 dbus_message_iter_get_basic(iter, &entry->int64_value);
00800 break;
00801 case DBUS_TYPE_UINT64:
00802 dbus_message_iter_get_basic(iter, &entry->uint64_value);
00803 break;
00804 case DBUS_TYPE_DOUBLE:
00805 dbus_message_iter_get_basic(iter, &entry->double_value);
00806 break;
00807 case DBUS_TYPE_ARRAY:
00808 return _wpa_dbus_dict_entry_get_array(iter, entry);
00809 default:
00810 return FALSE;
00811 }
00812
00813 return TRUE;
00814 }
00815
00816
00833 dbus_bool_t wpa_dbus_dict_get_entry(DBusMessageIter *iter_dict,
00834 struct wpa_dbus_dict_entry * entry)
00835 {
00836 DBusMessageIter iter_dict_entry, iter_dict_val;
00837 int type;
00838 const char *key;
00839
00840 if (!iter_dict || !entry)
00841 goto error;
00842
00843 if (dbus_message_iter_get_arg_type(iter_dict) != DBUS_TYPE_DICT_ENTRY)
00844 goto error;
00845
00846 dbus_message_iter_recurse(iter_dict, &iter_dict_entry);
00847 dbus_message_iter_get_basic(&iter_dict_entry, &key);
00848 entry->key = key;
00849
00850 if (!dbus_message_iter_next(&iter_dict_entry))
00851 goto error;
00852 type = dbus_message_iter_get_arg_type(&iter_dict_entry);
00853 if (type != DBUS_TYPE_VARIANT)
00854 goto error;
00855
00856 dbus_message_iter_recurse(&iter_dict_entry, &iter_dict_val);
00857 entry->type = dbus_message_iter_get_arg_type(&iter_dict_val);
00858 if (!_wpa_dbus_dict_fill_value_from_variant(entry, &iter_dict_val))
00859 goto error;
00860
00861 dbus_message_iter_next(iter_dict);
00862 return TRUE;
00863
00864 error:
00865 if (entry) {
00866 wpa_dbus_dict_entry_clear(entry);
00867 entry->type = DBUS_TYPE_INVALID;
00868 entry->array_type = DBUS_TYPE_INVALID;
00869 }
00870
00871 return FALSE;
00872 }
00873
00874
00883 dbus_bool_t wpa_dbus_dict_has_dict_entry(DBusMessageIter *iter_dict)
00884 {
00885 if (!iter_dict)
00886 return FALSE;
00887 return dbus_message_iter_get_arg_type(iter_dict) ==
00888 DBUS_TYPE_DICT_ENTRY;
00889 }
00890
00891
00897 void wpa_dbus_dict_entry_clear(struct wpa_dbus_dict_entry *entry)
00898 {
00899 unsigned int i;
00900
00901 if (!entry)
00902 return;
00903 switch (entry->type) {
00904 case DBUS_TYPE_OBJECT_PATH:
00905 case DBUS_TYPE_STRING:
00906 os_free(entry->str_value);
00907 break;
00908 case DBUS_TYPE_ARRAY:
00909 switch (entry->array_type) {
00910 case DBUS_TYPE_BYTE:
00911 os_free(entry->bytearray_value);
00912 break;
00913 case DBUS_TYPE_STRING:
00914 for (i = 0; i < entry->array_len; i++)
00915 os_free(entry->strarray_value[i]);
00916 os_free(entry->strarray_value);
00917 break;
00918 }
00919 break;
00920 }
00921
00922 memset(entry, 0, sizeof(struct wpa_dbus_dict_entry));
00923 }