2
* WPA Supplicant / dbus-based control interface
3
* Copyright (c) 2006, Dan Williams <dcbw@redhat.com> and Red Hat, Inc.
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License version 2 as
7
* published by the Free Software Foundation.
9
* Alternatively, this software may be distributed under the terms of BSD
12
* See README and COPYING for more details.
15
#include <dbus/dbus.h>
21
#include "dbus_dict_helpers.h"
25
* Start a dict in a dbus message. Should be paired with a call to
26
* {@link wpa_dbus_dict_close_write}.
28
* @param iter A valid dbus message iterator
29
* @param iter_dict (out) A dict iterator to pass to further dict functions
30
* @return TRUE on success, FALSE on failure
33
dbus_bool_t wpa_dbus_dict_open_write(DBusMessageIter *iter,
34
DBusMessageIter *iter_dict)
38
if (!iter || !iter_dict)
41
result = dbus_message_iter_open_container(
44
DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING
45
DBUS_TYPE_STRING_AS_STRING
46
DBUS_TYPE_VARIANT_AS_STRING
47
DBUS_DICT_ENTRY_END_CHAR_AS_STRING,
54
* End a dict element in a dbus message. Should be paired with
55
* a call to {@link wpa_dbus_dict_open_write}.
57
* @param iter valid dbus message iterator, same as passed to
58
* wpa_dbus_dict_open_write()
59
* @param iter_dict a dbus dict iterator returned from
60
* {@link wpa_dbus_dict_open_write}
61
* @return TRUE on success, FALSE on failure
64
dbus_bool_t wpa_dbus_dict_close_write(DBusMessageIter *iter,
65
DBusMessageIter *iter_dict)
67
if (!iter || !iter_dict)
70
return dbus_message_iter_close_container(iter, iter_dict);
74
static const char * _wpa_get_type_as_string_from_type(const int type)
78
return DBUS_TYPE_BYTE_AS_STRING;
79
case DBUS_TYPE_BOOLEAN:
80
return DBUS_TYPE_BOOLEAN_AS_STRING;
82
return DBUS_TYPE_INT16_AS_STRING;
83
case DBUS_TYPE_UINT16:
84
return DBUS_TYPE_UINT16_AS_STRING;
86
return DBUS_TYPE_INT32_AS_STRING;
87
case DBUS_TYPE_UINT32:
88
return DBUS_TYPE_UINT32_AS_STRING;
90
return DBUS_TYPE_INT64_AS_STRING;
91
case DBUS_TYPE_UINT64:
92
return DBUS_TYPE_UINT64_AS_STRING;
93
case DBUS_TYPE_DOUBLE:
94
return DBUS_TYPE_DOUBLE_AS_STRING;
95
case DBUS_TYPE_STRING:
96
return DBUS_TYPE_STRING_AS_STRING;
97
case DBUS_TYPE_OBJECT_PATH:
98
return DBUS_TYPE_OBJECT_PATH_AS_STRING;
100
return DBUS_TYPE_ARRAY_AS_STRING;
107
static dbus_bool_t _wpa_dbus_add_dict_entry_start(
108
DBusMessageIter *iter_dict, DBusMessageIter *iter_dict_entry,
109
const char *key, const int value_type)
111
if (!dbus_message_iter_open_container(iter_dict,
112
DBUS_TYPE_DICT_ENTRY, NULL,
116
if (!dbus_message_iter_append_basic(iter_dict_entry, DBUS_TYPE_STRING,
124
static dbus_bool_t _wpa_dbus_add_dict_entry_end(
125
DBusMessageIter *iter_dict, DBusMessageIter *iter_dict_entry,
126
DBusMessageIter *iter_dict_val)
128
if (!dbus_message_iter_close_container(iter_dict_entry, iter_dict_val))
130
if (!dbus_message_iter_close_container(iter_dict, iter_dict_entry))
137
static dbus_bool_t _wpa_dbus_add_dict_entry_basic(DBusMessageIter *iter_dict,
139
const int value_type,
142
DBusMessageIter iter_dict_entry, iter_dict_val;
143
const char *type_as_string = NULL;
145
type_as_string = _wpa_get_type_as_string_from_type(value_type);
149
if (!_wpa_dbus_add_dict_entry_start(iter_dict, &iter_dict_entry,
153
if (!dbus_message_iter_open_container(&iter_dict_entry,
155
type_as_string, &iter_dict_val))
158
if (!dbus_message_iter_append_basic(&iter_dict_val, value_type, value))
161
if (!_wpa_dbus_add_dict_entry_end(iter_dict, &iter_dict_entry,
169
static dbus_bool_t _wpa_dbus_add_dict_entry_byte_array(
170
DBusMessageIter *iter_dict, const char *key,
171
const char *value, const dbus_uint32_t value_len)
173
DBusMessageIter iter_dict_entry, iter_dict_val, iter_array;
176
if (!_wpa_dbus_add_dict_entry_start(iter_dict, &iter_dict_entry,
177
key, DBUS_TYPE_ARRAY))
180
if (!dbus_message_iter_open_container(&iter_dict_entry,
182
DBUS_TYPE_ARRAY_AS_STRING
183
DBUS_TYPE_BYTE_AS_STRING,
187
if (!dbus_message_iter_open_container(&iter_dict_val, DBUS_TYPE_ARRAY,
188
DBUS_TYPE_BYTE_AS_STRING,
192
for (i = 0; i < value_len; i++) {
193
if (!dbus_message_iter_append_basic(&iter_array,
199
if (!dbus_message_iter_close_container(&iter_dict_val, &iter_array))
202
if (!_wpa_dbus_add_dict_entry_end(iter_dict, &iter_dict_entry,
211
* Add a string entry to the dict.
213
* @param iter_dict A valid DBusMessageIter returned from
214
* {@link wpa_dbus_dict_open_write}
215
* @param key The key of the dict item
216
* @param value The string value
217
* @return TRUE on success, FALSE on failure
220
dbus_bool_t wpa_dbus_dict_append_string(DBusMessageIter *iter_dict,
221
const char *key, const char *value)
225
return _wpa_dbus_add_dict_entry_basic(iter_dict, key, DBUS_TYPE_STRING,
231
* Add a byte entry to the dict.
233
* @param iter_dict A valid DBusMessageIter returned from
234
* {@link wpa_dbus_dict_open_write}
235
* @param key The key of the dict item
236
* @param value The byte value
237
* @return TRUE on success, FALSE on failure
240
dbus_bool_t wpa_dbus_dict_append_byte(DBusMessageIter *iter_dict,
241
const char *key, const char value)
245
return _wpa_dbus_add_dict_entry_basic(iter_dict, key, DBUS_TYPE_BYTE,
251
* Add a boolean entry to the dict.
253
* @param iter_dict A valid DBusMessageIter returned from
254
* {@link wpa_dbus_dict_open_write}
255
* @param key The key of the dict item
256
* @param value The boolean value
257
* @return TRUE on success, FALSE on failure
260
dbus_bool_t wpa_dbus_dict_append_bool(DBusMessageIter *iter_dict,
261
const char *key, const dbus_bool_t value)
265
return _wpa_dbus_add_dict_entry_basic(iter_dict, key,
266
DBUS_TYPE_BOOLEAN, &value);
271
* Add a 16-bit signed integer entry to the dict.
273
* @param iter_dict A valid DBusMessageIter returned from
274
* {@link wpa_dbus_dict_open_write}
275
* @param key The key of the dict item
276
* @param value The 16-bit signed integer value
277
* @return TRUE on success, FALSE on failure
280
dbus_bool_t wpa_dbus_dict_append_int16(DBusMessageIter *iter_dict,
282
const dbus_int16_t value)
286
return _wpa_dbus_add_dict_entry_basic(iter_dict, key, DBUS_TYPE_INT16,
292
* Add a 16-bit unsigned integer entry to the dict.
294
* @param iter_dict A valid DBusMessageIter returned from
295
* {@link wpa_dbus_dict_open_write}
296
* @param key The key of the dict item
297
* @param value The 16-bit unsigned integer value
298
* @return TRUE on success, FALSE on failure
301
dbus_bool_t wpa_dbus_dict_append_uint16(DBusMessageIter *iter_dict,
303
const dbus_uint16_t value)
307
return _wpa_dbus_add_dict_entry_basic(iter_dict, key, DBUS_TYPE_UINT16,
313
* Add a 32-bit signed integer to the dict.
315
* @param iter_dict A valid DBusMessageIter returned from
316
* {@link wpa_dbus_dict_open_write}
317
* @param key The key of the dict item
318
* @param value The 32-bit signed integer value
319
* @return TRUE on success, FALSE on failure
322
dbus_bool_t wpa_dbus_dict_append_int32(DBusMessageIter *iter_dict,
324
const dbus_int32_t value)
328
return _wpa_dbus_add_dict_entry_basic(iter_dict, key, DBUS_TYPE_INT32,
334
* Add a 32-bit unsigned integer entry to the dict.
336
* @param iter_dict A valid DBusMessageIter returned from
337
* {@link wpa_dbus_dict_open_write}
338
* @param key The key of the dict item
339
* @param value The 32-bit unsigned integer value
340
* @return TRUE on success, FALSE on failure
343
dbus_bool_t wpa_dbus_dict_append_uint32(DBusMessageIter *iter_dict,
345
const dbus_uint32_t value)
349
return _wpa_dbus_add_dict_entry_basic(iter_dict, key, DBUS_TYPE_UINT32,
355
* Add a 64-bit integer entry to the dict.
357
* @param iter_dict A valid DBusMessageIter returned from
358
* {@link wpa_dbus_dict_open_write}
359
* @param key The key of the dict item
360
* @param value The 64-bit integer value
361
* @return TRUE on success, FALSE on failure
364
dbus_bool_t wpa_dbus_dict_append_int64(DBusMessageIter *iter_dict,
366
const dbus_int64_t value)
370
return _wpa_dbus_add_dict_entry_basic(iter_dict, key, DBUS_TYPE_INT64,
376
* Add a 64-bit unsigned integer entry to the dict.
378
* @param iter_dict A valid DBusMessageIter returned from
379
* {@link wpa_dbus_dict_open_write}
380
* @param key The key of the dict item
381
* @param value The 64-bit unsigned integer value
382
* @return TRUE on success, FALSE on failure
385
dbus_bool_t wpa_dbus_dict_append_uint64(DBusMessageIter *iter_dict,
387
const dbus_uint64_t value)
391
return _wpa_dbus_add_dict_entry_basic(iter_dict, key, DBUS_TYPE_UINT64,
397
* Add a double-precision floating point entry to the dict.
399
* @param iter_dict A valid DBusMessageIter returned from
400
* {@link wpa_dbus_dict_open_write}
401
* @param key The key of the dict item
402
* @param value The double-precision floating point value
403
* @return TRUE on success, FALSE on failure
406
dbus_bool_t wpa_dbus_dict_append_double(DBusMessageIter *iter_dict,
412
return _wpa_dbus_add_dict_entry_basic(iter_dict, key, DBUS_TYPE_DOUBLE,
418
* Add a DBus object path entry to the dict.
420
* @param iter_dict A valid DBusMessageIter returned from
421
* {@link wpa_dbus_dict_open_write}
422
* @param key The key of the dict item
423
* @param value The DBus object path value
424
* @return TRUE on success, FALSE on failure
427
dbus_bool_t wpa_dbus_dict_append_object_path(DBusMessageIter *iter_dict,
433
return _wpa_dbus_add_dict_entry_basic(iter_dict, key,
434
DBUS_TYPE_OBJECT_PATH, &value);
439
* Add a byte array entry to the dict.
441
* @param iter_dict A valid DBusMessageIter returned from
442
* {@link wpa_dbus_dict_open_write}
443
* @param key The key of the dict item
444
* @param value The byte array
445
* @param value_len The length of the byte array, in bytes
446
* @return TRUE on success, FALSE on failure
449
dbus_bool_t wpa_dbus_dict_append_byte_array(DBusMessageIter *iter_dict,
452
const dbus_uint32_t value_len)
456
if (!value && (value_len != 0))
458
return _wpa_dbus_add_dict_entry_byte_array(iter_dict, key, value,
464
* Begin a string array entry in the dict
466
* @param iter_dict A valid DBusMessageIter returned from
467
* {@link nmu_dbus_dict_open_write}
468
* @param key The key of the dict item
469
* @param iter_dict_entry A private DBusMessageIter provided by the caller to
470
* be passed to {@link wpa_dbus_dict_end_string_array}
471
* @param iter_dict_val A private DBusMessageIter provided by the caller to
472
* be passed to {@link wpa_dbus_dict_end_string_array}
473
* @param iter_array On return, the DBusMessageIter to be passed to
474
* {@link wpa_dbus_dict_string_array_add_element}
475
* @return TRUE on success, FALSE on failure
478
dbus_bool_t wpa_dbus_dict_begin_string_array(DBusMessageIter *iter_dict,
480
DBusMessageIter *iter_dict_entry,
481
DBusMessageIter *iter_dict_val,
482
DBusMessageIter *iter_array)
484
if (!iter_dict || !iter_dict_entry || !iter_dict_val || !iter_array)
487
if (!_wpa_dbus_add_dict_entry_start(iter_dict, iter_dict_entry,
488
key, DBUS_TYPE_ARRAY))
491
if (!dbus_message_iter_open_container(iter_dict_entry,
493
DBUS_TYPE_ARRAY_AS_STRING
494
DBUS_TYPE_STRING_AS_STRING,
498
if (!dbus_message_iter_open_container(iter_dict_val, DBUS_TYPE_ARRAY,
499
DBUS_TYPE_BYTE_AS_STRING,
508
* Add a single string element to a string array dict entry
510
* @param iter_array A valid DBusMessageIter returned from
511
* {@link wpa_dbus_dict_begin_string_array}'s
512
* iter_array parameter
513
* @param elem The string element to be added to the dict entry's string array
514
* @return TRUE on success, FALSE on failure
517
dbus_bool_t wpa_dbus_dict_string_array_add_element(DBusMessageIter *iter_array,
520
if (!iter_array || !elem)
523
return dbus_message_iter_append_basic(iter_array, DBUS_TYPE_STRING,
529
* End a string array dict entry
531
* @param iter_dict A valid DBusMessageIter returned from
532
* {@link nmu_dbus_dict_open_write}
533
* @param iter_dict_entry A private DBusMessageIter returned from
534
* {@link wpa_dbus_dict_end_string_array}
535
* @param iter_dict_val A private DBusMessageIter returned from
536
* {@link wpa_dbus_dict_end_string_array}
537
* @param iter_array A DBusMessageIter returned from
538
* {@link wpa_dbus_dict_end_string_array}
539
* @return TRUE on success, FALSE on failure
542
dbus_bool_t wpa_dbus_dict_end_string_array(DBusMessageIter *iter_dict,
543
DBusMessageIter *iter_dict_entry,
544
DBusMessageIter *iter_dict_val,
545
DBusMessageIter *iter_array)
547
if (!iter_dict || !iter_dict_entry || !iter_dict_val || !iter_array)
550
if (!dbus_message_iter_close_container(iter_dict_val, iter_array))
553
if (!_wpa_dbus_add_dict_entry_end(iter_dict, iter_dict_entry,
562
* Convenience function to add an entire string array to the dict.
564
* @param iter_dict A valid DBusMessageIter returned from
565
* {@link nmu_dbus_dict_open_write}
566
* @param key The key of the dict item
567
* @param items The array of strings
568
* @param num_items The number of strings in the array
569
* @return TRUE on success, FALSE on failure
572
dbus_bool_t wpa_dbus_dict_append_string_array(DBusMessageIter *iter_dict,
575
const dbus_uint32_t num_items)
577
DBusMessageIter iter_dict_entry, iter_dict_val, iter_array;
582
if (!items && (num_items != 0))
585
if (!wpa_dbus_dict_begin_string_array(iter_dict, key,
586
&iter_dict_entry, &iter_dict_val,
590
for (i = 0; i < num_items; i++) {
591
if (!wpa_dbus_dict_string_array_add_element(&iter_array,
596
if (!wpa_dbus_dict_end_string_array(iter_dict, &iter_dict_entry,
597
&iter_dict_val, &iter_array))
604
/*****************************************************/
605
/* Stuff for reading dicts */
606
/*****************************************************/
609
* Start reading from a dbus dict.
611
* @param iter A valid DBusMessageIter pointing to the start of the dict
612
* @param iter_dict (out) A DBusMessageIter to be passed to
613
* {@link wpa_dbus_dict_read_next_entry}
614
* @return TRUE on success, FALSE on failure
617
dbus_bool_t wpa_dbus_dict_open_read(DBusMessageIter *iter,
618
DBusMessageIter *iter_dict)
620
if (!iter || !iter_dict)
623
if (dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_ARRAY ||
624
dbus_message_iter_get_element_type(iter) != DBUS_TYPE_DICT_ENTRY)
627
dbus_message_iter_recurse(iter, iter_dict);
632
static dbus_bool_t _wpa_dbus_dict_entry_get_byte_array(
633
DBusMessageIter *iter, int array_len, int array_type,
634
struct wpa_dbus_dict_entry *entry)
637
dbus_bool_t success = FALSE;
640
/* Zero-length arrays are valid. */
641
if (array_len == 0) {
642
entry->bytearray_value = NULL;
643
entry->array_type = DBUS_TYPE_BYTE;
648
entry->bytearray_value = wpa_zalloc(array_len * sizeof(char));
649
if (!entry->bytearray_value) {
650
perror("_wpa_dbus_dict_entry_get_byte_array[dbus]: out of "
655
entry->array_type = DBUS_TYPE_BYTE;
656
entry->array_len = array_len;
657
while (dbus_message_iter_get_arg_type(iter) == DBUS_TYPE_BYTE) {
658
dbus_message_iter_get_basic(iter, &byte);
659
entry->bytearray_value[i++] = byte;
660
dbus_message_iter_next(iter);
669
static dbus_bool_t _wpa_dbus_dict_entry_get_string_array(
670
DBusMessageIter *iter, int array_len, int array_type,
671
struct wpa_dbus_dict_entry *entry)
673
dbus_uint32_t count = 0;
674
dbus_bool_t success = FALSE;
677
entry->strarray_value = NULL;
678
entry->array_type = DBUS_TYPE_STRING;
680
/* Zero-length arrays are valid. */
681
if (array_len == 0) {
686
buffer = wpa_zalloc(sizeof (char *) * 8);
687
if (buffer == NULL) {
688
perror("_wpa_dbus_dict_entry_get_string_array[dbus] out of "
689
"memory trying to retrieve a string array");
693
entry->strarray_value = buffer;
694
entry->array_len = 0;
695
while (dbus_message_iter_get_arg_type(iter) == DBUS_TYPE_STRING) {
699
if ((count % 8) == 0 && count != 0) {
701
tmp = realloc(buffer, sizeof(char *) * (count + 8));
703
perror("_wpa_dbus_dict_entry_get_string_array["
704
"dbus] out of memory trying to "
705
"retrieve the string array");
712
entry->strarray_value = buffer;
714
dbus_message_iter_get_basic(iter, &value);
717
perror("_wpa_dbus_dict_entry_get_string_array[dbus] "
718
"out of memory trying to duplicate the string "
722
entry->strarray_value[count] = str;
723
entry->array_len = ++count;
724
dbus_message_iter_next(iter);
733
static dbus_bool_t _wpa_dbus_dict_entry_get_array(
734
DBusMessageIter *iter_dict_val, struct wpa_dbus_dict_entry *entry)
736
int array_type = dbus_message_iter_get_element_type(iter_dict_val);
738
dbus_bool_t success = FALSE;
739
DBusMessageIter iter_array;
744
dbus_message_iter_recurse(iter_dict_val, &iter_array);
746
array_len = dbus_message_iter_get_array_len(&iter_array);
750
switch (array_type) {
752
success = _wpa_dbus_dict_entry_get_byte_array(&iter_array,
757
case DBUS_TYPE_STRING:
758
success = _wpa_dbus_dict_entry_get_string_array(&iter_array,
771
static dbus_bool_t _wpa_dbus_dict_fill_value_from_variant(
772
struct wpa_dbus_dict_entry *entry, DBusMessageIter *iter_dict_val)
774
dbus_bool_t success = TRUE;
776
switch (entry->type) {
777
case DBUS_TYPE_STRING: {
779
dbus_message_iter_get_basic(iter_dict_val, &v);
780
entry->str_value = strdup(v);
783
case DBUS_TYPE_BOOLEAN: {
785
dbus_message_iter_get_basic(iter_dict_val, &v);
786
entry->bool_value = v;
789
case DBUS_TYPE_BYTE: {
791
dbus_message_iter_get_basic(iter_dict_val, &v);
792
entry->byte_value = v;
795
case DBUS_TYPE_INT16: {
797
dbus_message_iter_get_basic(iter_dict_val, &v);
798
entry->int16_value = v;
801
case DBUS_TYPE_UINT16: {
803
dbus_message_iter_get_basic(iter_dict_val, &v);
804
entry->uint16_value = v;
807
case DBUS_TYPE_INT32: {
809
dbus_message_iter_get_basic(iter_dict_val, &v);
810
entry->int32_value = v;
813
case DBUS_TYPE_UINT32: {
815
dbus_message_iter_get_basic(iter_dict_val, &v);
816
entry->uint32_value = v;
819
case DBUS_TYPE_INT64: {
821
dbus_message_iter_get_basic(iter_dict_val, &v);
822
entry->int64_value = v;
825
case DBUS_TYPE_UINT64: {
827
dbus_message_iter_get_basic(iter_dict_val, &v);
828
entry->uint64_value = v;
831
case DBUS_TYPE_DOUBLE: {
833
dbus_message_iter_get_basic(iter_dict_val, &v);
834
entry->double_value = v;
837
case DBUS_TYPE_OBJECT_PATH: {
839
dbus_message_iter_get_basic(iter_dict_val, &v);
840
entry->str_value = strdup(v);
843
case DBUS_TYPE_ARRAY: {
844
success = _wpa_dbus_dict_entry_get_array(iter_dict_val, entry);
857
* Read the current key/value entry from the dict. Entries are dynamically
858
* allocated when needed and must be freed after use with the
859
* {@link wpa_dbus_dict_entry_clear} function.
861
* The returned entry object will be filled with the type and value of the next
862
* entry in the dict, or the type will be DBUS_TYPE_INVALID if an error
865
* @param iter_dict A valid DBusMessageIter returned from
866
* {@link wpa_dbus_dict_open_read}
867
* @param entry A valid dict entry object into which the dict key and value
869
* @return TRUE on success, FALSE on failure
872
dbus_bool_t wpa_dbus_dict_get_entry(DBusMessageIter *iter_dict,
873
struct wpa_dbus_dict_entry * entry)
875
DBusMessageIter iter_dict_entry, iter_dict_val;
879
if (!iter_dict || !entry)
882
if (dbus_message_iter_get_arg_type(iter_dict) != DBUS_TYPE_DICT_ENTRY)
885
dbus_message_iter_recurse(iter_dict, &iter_dict_entry);
886
dbus_message_iter_get_basic(&iter_dict_entry, &key);
889
if (!dbus_message_iter_next(&iter_dict_entry))
891
type = dbus_message_iter_get_arg_type(&iter_dict_entry);
892
if (type != DBUS_TYPE_VARIANT)
895
dbus_message_iter_recurse(&iter_dict_entry, &iter_dict_val);
896
entry->type = dbus_message_iter_get_arg_type(&iter_dict_val);
897
if (!_wpa_dbus_dict_fill_value_from_variant(entry, &iter_dict_val))
900
dbus_message_iter_next(iter_dict);
904
wpa_dbus_dict_entry_clear(entry);
905
entry->type = DBUS_TYPE_INVALID;
906
entry->array_type = DBUS_TYPE_INVALID;
912
* Return whether or not there are additional dictionary entries.
914
* @param iter_dict A valid DBusMessageIter returned from
915
* {@link wpa_dbus_dict_open_read}
916
* @return TRUE if more dict entries exists, FALSE if no more dict entries
919
dbus_bool_t wpa_dbus_dict_has_dict_entry(DBusMessageIter *iter_dict)
922
perror("wpa_dbus_dict_has_dict_entry[dbus]: out of memory");
925
return dbus_message_iter_get_arg_type(iter_dict) ==
926
DBUS_TYPE_DICT_ENTRY;
931
* Free any memory used by the entry object.
933
* @param entry The entry object
935
void wpa_dbus_dict_entry_clear(struct wpa_dbus_dict_entry *entry)
939
switch (entry->type) {
940
case DBUS_TYPE_OBJECT_PATH:
941
case DBUS_TYPE_STRING:
942
free(entry->str_value);
944
case DBUS_TYPE_ARRAY:
945
switch (entry->array_type) {
947
free(entry->bytearray_value);
953
memset(entry, 0, sizeof(struct wpa_dbus_dict_entry));