D-Bus  1.13.7
dbus-address.c
1 /* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
2 /* dbus-address.c Server address parser.
3  *
4  * Copyright (C) 2003 CodeFactory AB
5  * Copyright (C) 2004,2005 Red Hat, Inc.
6  *
7  * Licensed under the Academic Free License version 2.1
8  *
9  * This program is free software; you can redistribute it and/or modify
10  * it under the terms of the GNU General Public License as published by
11  * the Free Software Foundation; either version 2 of the License, or
12  * (at your option) any later version.
13  *
14  * This program is distributed in the hope that it will be useful,
15  * but WITHOUT ANY WARRANTY; without even the implied warranty of
16  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  * GNU General Public License for more details.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with this program; if not, write to the Free Software
21  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22  *
23  */
24 
25 #include <config.h>
26 #include "dbus-address.h"
27 #include "dbus-internals.h"
28 #include "dbus-list.h"
29 #include "dbus-string.h"
30 #include "dbus-protocol.h"
31 #include <dbus/dbus-test-tap.h>
32 
45 {
50 };
51 
52 
65 void
67  const char *address_problem_type,
68  const char *address_problem_field,
69  const char *address_problem_other)
70 {
71  if (address_problem_type != NULL)
73  "Server address of type %s was missing argument %s",
74  address_problem_type, address_problem_field);
75  else
77  "Could not parse server address: %s",
78  address_problem_other);
79 }
80 
85 #define _DBUS_ADDRESS_OPTIONALLY_ESCAPED_BYTE(b) \
86  (((b) >= 'a' && (b) <= 'z') || \
87  ((b) >= 'A' && (b) <= 'Z') || \
88  ((b) >= '0' && (b) <= '9') || \
89  (b) == '-' || \
90  (b) == '_' || \
91  (b) == '/' || \
92  (b) == '\\' || \
93  (b) == '*' || \
94  (b) == '.')
95 
106  const DBusString *unescaped)
107 {
108  const unsigned char *p;
109  const unsigned char *end;
110  dbus_bool_t ret;
111  int orig_len;
112 
113  ret = FALSE;
114 
115  orig_len = _dbus_string_get_length (escaped);
116  p = _dbus_string_get_const_udata (unescaped);
117  end = p + _dbus_string_get_length (unescaped);
118  while (p != end)
119  {
121  {
122  if (!_dbus_string_append_byte (escaped, *p))
123  goto out;
124  }
125  else
126  {
127  if (!_dbus_string_append_byte (escaped, '%'))
128  goto out;
129  if (!_dbus_string_append_byte_as_hex (escaped, *p))
130  goto out;
131  }
132 
133  ++p;
134  }
135 
136  ret = TRUE;
137 
138  out:
139  if (!ret)
140  _dbus_string_set_length (escaped, orig_len);
141  return ret;
142 }
143  /* End of internals */
145 
146 static void
147 dbus_address_entry_free (DBusAddressEntry *entry)
148 {
149  DBusList *link;
150 
151  _dbus_string_free (&entry->method);
152 
153  link = _dbus_list_get_first_link (&entry->keys);
154  while (link != NULL)
155  {
156  _dbus_string_free (link->data);
157  dbus_free (link->data);
158 
159  link = _dbus_list_get_next_link (&entry->keys, link);
160  }
161  _dbus_list_clear (&entry->keys);
162 
163  link = _dbus_list_get_first_link (&entry->values);
164  while (link != NULL)
165  {
166  _dbus_string_free (link->data);
167  dbus_free (link->data);
168 
169  link = _dbus_list_get_next_link (&entry->values, link);
170  }
171  _dbus_list_clear (&entry->values);
172 
173  dbus_free (entry);
174 }
175 
189 void
191 {
192  int i;
193 
194  for (i = 0; entries[i] != NULL; i++)
195  dbus_address_entry_free (entries[i]);
196  dbus_free (entries);
197 }
198 
199 static DBusAddressEntry *
200 create_entry (void)
201 {
202  DBusAddressEntry *entry;
203 
204  entry = dbus_new0 (DBusAddressEntry, 1);
205 
206  if (entry == NULL)
207  return NULL;
208 
209  if (!_dbus_string_init (&entry->method))
210  {
211  dbus_free (entry);
212  return NULL;
213  }
214 
215  return entry;
216 }
217 
227 const char *
229 {
230  return _dbus_string_get_const_data (&entry->method);
231 }
232 
244 const char *
246  const char *key)
247 {
248  DBusList *values, *keys;
249 
250  keys = _dbus_list_get_first_link (&entry->keys);
251  values = _dbus_list_get_first_link (&entry->values);
252 
253  while (keys != NULL)
254  {
255  _dbus_assert (values != NULL);
256 
257  if (_dbus_string_equal_c_str (keys->data, key))
258  return _dbus_string_get_const_data (values->data);
259 
260  keys = _dbus_list_get_next_link (&entry->keys, keys);
261  values = _dbus_list_get_next_link (&entry->values, values);
262  }
263 
264  return NULL;
265 }
266 
267 static dbus_bool_t
268 append_unescaped_value (DBusString *unescaped,
269  const DBusString *escaped,
270  int escaped_start,
271  int escaped_len,
272  DBusError *error)
273 {
274  const char *p;
275  const char *end;
276  dbus_bool_t ret;
277 
278  ret = FALSE;
279 
280  p = _dbus_string_get_const_data (escaped) + escaped_start;
281  end = p + escaped_len;
282  while (p != end)
283  {
285  {
286  if (!_dbus_string_append_byte (unescaped, *p))
287  goto out;
288  }
289  else if (*p == '%')
290  {
291  /* Efficiency is king */
292  char buf[3];
293  DBusString hex;
294  int hex_end;
295 
296  ++p;
297 
298  if ((p + 2) > end)
299  {
301  "In D-Bus address, percent character was not followed by two hex digits");
302  goto out;
303  }
304 
305  buf[0] = *p;
306  ++p;
307  buf[1] = *p;
308  buf[2] = '\0';
309 
310  _dbus_string_init_const (&hex, buf);
311 
312  if (!_dbus_string_hex_decode (&hex, 0, &hex_end,
313  unescaped,
314  _dbus_string_get_length (unescaped)))
315  goto out;
316 
317  if (hex_end != 2)
318  {
320  "In D-Bus address, percent character was followed by characters other than hex digits");
321  goto out;
322  }
323  }
324  else
325  {
326  /* Error, should have been escaped */
328  "In D-Bus address, character '%c' should have been escaped\n",
329  *p);
330  goto out;
331  }
332 
333  ++p;
334  }
335 
336  ret = TRUE;
337 
338  out:
339  if (!ret && error && !dbus_error_is_set (error))
340  _DBUS_SET_OOM (error);
341 
342  _dbus_assert (ret || error == NULL || dbus_error_is_set (error));
343 
344  return ret;
345 }
346 
364 dbus_parse_address (const char *address,
365  DBusAddressEntry ***entry_result,
366  int *array_len,
367  DBusError *error)
368 {
369  DBusString str;
370  int pos, end_pos, len, i;
371  DBusList *entries, *link;
372  DBusAddressEntry **entry_array;
373 
374  _DBUS_ASSERT_ERROR_IS_CLEAR (error);
375 
376  _dbus_string_init_const (&str, address);
377 
378  entries = NULL;
379  pos = 0;
380  len = _dbus_string_get_length (&str);
381 
382  if (len == 0)
383  {
385  "Empty address '%s'", address);
386  goto error;
387  }
388 
389  while (pos < len)
390  {
391  DBusAddressEntry *entry;
392 
393  int found_pos;
394 
395  entry = create_entry ();
396  if (!entry)
397  {
399 
400  goto error;
401  }
402 
403  /* Append the entry */
404  if (!_dbus_list_append (&entries, entry))
405  {
407  dbus_address_entry_free (entry);
408  goto error;
409  }
410 
411  /* Look for a semi-colon */
412  if (!_dbus_string_find (&str, pos, ";", &end_pos))
413  end_pos = len;
414 
415  /* Look for the colon : */
416  if (!_dbus_string_find_to (&str, pos, end_pos, ":", &found_pos))
417  {
418  dbus_set_error (error, DBUS_ERROR_BAD_ADDRESS, "Address does not contain a colon");
419  goto error;
420  }
421 
422  if (!_dbus_string_copy_len (&str, pos, found_pos - pos, &entry->method, 0))
423  {
425  goto error;
426  }
427 
428  pos = found_pos + 1;
429 
430  while (pos < end_pos)
431  {
432  int comma_pos, equals_pos;
433 
434  if (!_dbus_string_find_to (&str, pos, end_pos, ",", &comma_pos))
435  comma_pos = end_pos;
436 
437  if (!_dbus_string_find_to (&str, pos, comma_pos, "=", &equals_pos) ||
438  equals_pos == pos || equals_pos + 1 == comma_pos)
439  {
441  "'=' character not found or has no value following it");
442  goto error;
443  }
444  else
445  {
446  DBusString *key;
447  DBusString *value;
448 
449  key = dbus_new0 (DBusString, 1);
450 
451  if (!key)
452  {
454  goto error;
455  }
456 
457  value = dbus_new0 (DBusString, 1);
458  if (!value)
459  {
461  dbus_free (key);
462  goto error;
463  }
464 
465  if (!_dbus_string_init (key))
466  {
468  dbus_free (key);
469  dbus_free (value);
470 
471  goto error;
472  }
473 
474  if (!_dbus_string_init (value))
475  {
477  _dbus_string_free (key);
478 
479  dbus_free (key);
480  dbus_free (value);
481  goto error;
482  }
483 
484  if (!_dbus_string_copy_len (&str, pos, equals_pos - pos, key, 0))
485  {
487  _dbus_string_free (key);
488  _dbus_string_free (value);
489 
490  dbus_free (key);
491  dbus_free (value);
492  goto error;
493  }
494 
495  if (!append_unescaped_value (value, &str, equals_pos + 1,
496  comma_pos - equals_pos - 1, error))
497  {
498  _dbus_assert (error == NULL || dbus_error_is_set (error));
499  _dbus_string_free (key);
500  _dbus_string_free (value);
501 
502  dbus_free (key);
503  dbus_free (value);
504  goto error;
505  }
506 
507  if (!_dbus_list_append (&entry->keys, key))
508  {
510  _dbus_string_free (key);
511  _dbus_string_free (value);
512 
513  dbus_free (key);
514  dbus_free (value);
515  goto error;
516  }
517 
518  if (!_dbus_list_append (&entry->values, value))
519  {
521  _dbus_string_free (value);
522 
523  dbus_free (value);
524  goto error;
525  }
526  }
527 
528  pos = comma_pos + 1;
529  }
530 
531  pos = end_pos + 1;
532  }
533 
534  *array_len = _dbus_list_get_length (&entries);
535 
536  entry_array = dbus_new (DBusAddressEntry *, *array_len + 1);
537 
538  if (!entry_array)
539  {
541 
542  goto error;
543  }
544 
545  entry_array [*array_len] = NULL;
546 
547  link = _dbus_list_get_first_link (&entries);
548  i = 0;
549  while (link != NULL)
550  {
551  entry_array[i] = link->data;
552  i++;
553  link = _dbus_list_get_next_link (&entries, link);
554  }
555 
556  _dbus_list_clear (&entries);
557  *entry_result = entry_array;
558 
559  return TRUE;
560 
561  error:
562 
563  link = _dbus_list_get_first_link (&entries);
564  while (link != NULL)
565  {
566  dbus_address_entry_free (link->data);
567  link = _dbus_list_get_next_link (&entries, link);
568  }
569 
570  _dbus_list_clear (&entries);
571 
572  return FALSE;
573 
574 }
575 
583 char*
584 dbus_address_escape_value (const char *value)
585 {
586  DBusString escaped;
587  DBusString unescaped;
588  char *ret;
589 
590  ret = NULL;
591 
592  _dbus_string_init_const (&unescaped, value);
593 
594  if (!_dbus_string_init (&escaped))
595  return NULL;
596 
597  if (!_dbus_address_append_escaped (&escaped, &unescaped))
598  goto out;
599 
600  if (!_dbus_string_steal_data (&escaped, &ret))
601  goto out;
602 
603  out:
604  _dbus_string_free (&escaped);
605  return ret;
606 }
607 
617 char*
618 dbus_address_unescape_value (const char *value,
619  DBusError *error)
620 {
621  DBusString unescaped;
622  DBusString escaped;
623  char *ret;
624 
625  ret = NULL;
626 
627  _dbus_string_init_const (&escaped, value);
628 
629  if (!_dbus_string_init (&unescaped))
630  return NULL;
631 
632  if (!append_unescaped_value (&unescaped, &escaped,
633  0, _dbus_string_get_length (&escaped),
634  error))
635  goto out;
636 
637  if (!_dbus_string_steal_data (&unescaped, &ret))
638  goto out;
639 
640  out:
641  if (ret == NULL && error && !dbus_error_is_set (error))
642  _DBUS_SET_OOM (error);
643 
644  _dbus_assert (ret != NULL || error == NULL || dbus_error_is_set (error));
645 
646  _dbus_string_free (&unescaped);
647  return ret;
648 }
649  /* End of public API */
651 
652 #ifdef DBUS_ENABLE_EMBEDDED_TESTS
653 
654 #ifndef DOXYGEN_SHOULD_SKIP_THIS
655 
656 #include "dbus-test.h"
657 #include <stdlib.h>
658 
659 typedef struct
660 {
661  const char *escaped;
662  const char *unescaped;
663 } EscapeTest;
664 
665 static const EscapeTest escape_tests[] = {
666  { "abcde", "abcde" },
667  { "", "" },
668  { "%20%20", " " },
669  { "%24", "$" },
670  { "%25", "%" },
671  { "abc%24", "abc$" },
672  { "%24abc", "$abc" },
673  { "abc%24abc", "abc$abc" },
674  { "/", "/" },
675  { "-", "-" },
676  { "_", "_" },
677  { "A", "A" },
678  { "I", "I" },
679  { "Z", "Z" },
680  { "a", "a" },
681  { "i", "i" },
682  { "z", "z" },
683  /* Bug: https://bugs.freedesktop.org/show_bug.cgi?id=53499 */
684  { "%c3%b6", "\xc3\xb6" }
685 };
686 
687 static const char* invalid_escaped_values[] = {
688  "%a",
689  "%q",
690  "%az",
691  "%%",
692  "%$$",
693  "abc%a",
694  "%axyz",
695  "%",
696  "$",
697  " ",
698 };
699 
701 _dbus_address_test (void)
702 {
703  DBusAddressEntry **entries;
704  int len;
705  DBusError error = DBUS_ERROR_INIT;
706  int i;
707 
708  i = 0;
709  while (i < _DBUS_N_ELEMENTS (escape_tests))
710  {
711  const EscapeTest *test = &escape_tests[i];
712  char *escaped;
713  char *unescaped;
714 
715  escaped = dbus_address_escape_value (test->unescaped);
716  if (escaped == NULL)
717  _dbus_test_fatal ("oom");
718 
719  if (strcmp (escaped, test->escaped) != 0)
720  {
721  _dbus_warn ("Escaped '%s' as '%s' should have been '%s'",
722  test->unescaped, escaped, test->escaped);
723  exit (1);
724  }
725  dbus_free (escaped);
726 
727  unescaped = dbus_address_unescape_value (test->escaped, &error);
728  if (unescaped == NULL)
729  {
730  _dbus_warn ("Failed to unescape '%s': %s",
731  test->escaped, error.message);
732  dbus_error_free (&error);
733  exit (1);
734  }
735 
736  if (strcmp (unescaped, test->unescaped) != 0)
737  {
738  _dbus_warn ("Unescaped '%s' as '%s' should have been '%s'",
739  test->escaped, unescaped, test->unescaped);
740  exit (1);
741  }
742  dbus_free (unescaped);
743 
744  ++i;
745  }
746 
747  i = 0;
748  while (i < _DBUS_N_ELEMENTS (invalid_escaped_values))
749  {
750  char *unescaped;
751 
752  unescaped = dbus_address_unescape_value (invalid_escaped_values[i],
753  &error);
754  if (unescaped != NULL)
755  {
756  _dbus_warn ("Should not have successfully unescaped '%s' to '%s'",
757  invalid_escaped_values[i], unescaped);
758  dbus_free (unescaped);
759  exit (1);
760  }
761 
762  _dbus_assert (dbus_error_is_set (&error));
763  dbus_error_free (&error);
764 
765  ++i;
766  }
767 
768  if (!dbus_parse_address ("unix:path=/tmp/foo;debug:name=test,sliff=sloff;",
769  &entries, &len, &error))
770  _dbus_test_fatal ("could not parse address");
771  _dbus_assert (len == 2);
772  _dbus_assert (strcmp (dbus_address_entry_get_value (entries[0], "path"), "/tmp/foo") == 0);
773  _dbus_assert (strcmp (dbus_address_entry_get_value (entries[1], "name"), "test") == 0);
774  _dbus_assert (strcmp (dbus_address_entry_get_value (entries[1], "sliff"), "sloff") == 0);
775 
776  dbus_address_entries_free (entries);
777 
778  /* Different possible errors */
779  if (dbus_parse_address ("", &entries, &len, &error))
780  _dbus_test_fatal ("Parsed incorrect address.");
781  else
782  dbus_error_free (&error);
783 
784  if (dbus_parse_address ("foo", &entries, &len, &error))
785  _dbus_test_fatal ("Parsed incorrect address.");
786  else
787  dbus_error_free (&error);
788 
789  if (dbus_parse_address ("foo:bar", &entries, &len, &error))
790  _dbus_test_fatal ("Parsed incorrect address.");
791  else
792  dbus_error_free (&error);
793 
794  if (dbus_parse_address ("foo:bar,baz", &entries, &len, &error))
795  _dbus_test_fatal ("Parsed incorrect address.");
796  else
797  dbus_error_free (&error);
798 
799  if (dbus_parse_address ("foo:bar=foo,baz", &entries, &len, &error))
800  _dbus_test_fatal ("Parsed incorrect address.");
801  else
802  dbus_error_free (&error);
803 
804  if (dbus_parse_address ("foo:bar=foo;baz", &entries, &len, &error))
805  _dbus_test_fatal ("Parsed incorrect address.");
806  else
807  dbus_error_free (&error);
808 
809  if (dbus_parse_address ("foo:=foo", &entries, &len, &error))
810  _dbus_test_fatal ("Parsed incorrect address.");
811  else
812  dbus_error_free (&error);
813 
814  if (dbus_parse_address ("foo:foo=", &entries, &len, &error))
815  _dbus_test_fatal ("Parsed incorrect address.");
816  else
817  dbus_error_free (&error);
818 
819  if (dbus_parse_address ("foo:foo,bar=baz", &entries, &len, &error))
820  _dbus_test_fatal ("Parsed incorrect address.");
821  else
822  dbus_error_free (&error);
823 
824  return TRUE;
825 }
826 
827 #endif /* !DOXYGEN_SHOULD_SKIP_THIS */
828 
829 #endif
const char * message
public error message field
Definition: dbus-errors.h:51
#define NULL
A null pointer, defined appropriately for C or C++.
void dbus_free(void *memory)
Frees a block of memory previously allocated by dbus_malloc() or dbus_malloc0().
Definition: dbus-memory.c:703
#define _DBUS_ADDRESS_OPTIONALLY_ESCAPED_BYTE(b)
TRUE if the byte need not be escaped when found in a dbus address.
Definition: dbus-address.c:85
#define dbus_new(type, count)
Safe macro for using dbus_malloc().
Definition: dbus-memory.h:57
DBusString method
The address type (unix, tcp, etc.)
Definition: dbus-address.c:46
#define _dbus_assert(condition)
Aborts with an error message if the condition is false.
#define DBUS_ERROR_INIT
Expands to a suitable initializer for a DBusError on the stack.
Definition: dbus-errors.h:62
void * data
Data stored at this element.
Definition: dbus-list.h:38
const char * dbus_address_entry_get_method(DBusAddressEntry *entry)
Returns the method string of an address entry.
Definition: dbus-address.c:228
void dbus_error_free(DBusError *error)
Frees an error that&#39;s been set (or just initialized), then reinitializes the error as in dbus_error_i...
Definition: dbus-errors.c:211
void dbus_address_entries_free(DBusAddressEntry **entries)
Frees a NULL-terminated array of address entries.
Definition: dbus-address.c:190
dbus_bool_t _dbus_string_init(DBusString *str)
Initializes a string.
Definition: dbus-string.c:175
dbus_bool_t _dbus_string_find(const DBusString *str, int start, const char *substr, int *found)
Finds the given substring in the string, returning TRUE and filling in the byte index where the subst...
Definition: dbus-string.c:1621
#define _dbus_list_get_next_link(list, link)
Gets the next link in the list, or NULL if there are no more links.
Definition: dbus-list.h:119
const char * dbus_address_entry_get_value(DBusAddressEntry *entry, const char *key)
Returns a value from a key of an entry.
Definition: dbus-address.c:245
#define dbus_new0(type, count)
Safe macro for using dbus_malloc0().
Definition: dbus-memory.h:58
dbus_bool_t _dbus_string_equal_c_str(const DBusString *a, const char *c_str)
Checks whether a string is equal to a C string.
Definition: dbus-string.c:2169
dbus_uint32_t dbus_bool_t
A boolean, valid values are TRUE and FALSE.
Definition: dbus-types.h:35
void _dbus_string_init_const(DBusString *str, const char *value)
Initializes a constant string.
Definition: dbus-string.c:190
void _dbus_warn(const char *format,...)
Prints a warning message to stderr.
dbus_bool_t _dbus_list_append(DBusList **list, void *data)
Appends a value to the list.
Definition: dbus-list.c:271
Internals of DBusAddressEntry.
Definition: dbus-address.c:44
void _dbus_set_bad_address(DBusError *error, const char *address_problem_type, const char *address_problem_field, const char *address_problem_other)
Sets DBUS_ERROR_BAD_ADDRESS.
Definition: dbus-address.c:66
Object representing an exception.
Definition: dbus-errors.h:48
dbus_bool_t _dbus_address_append_escaped(DBusString *escaped, const DBusString *unescaped)
Appends an escaped version of one string to another string, using the D-Bus address escaping mechanis...
Definition: dbus-address.c:105
#define DBUS_ERROR_BAD_ADDRESS
A D-Bus bus address was malformed.
void dbus_set_error(DBusError *error, const char *name, const char *format,...)
Assigns an error name and message to a DBusError.
Definition: dbus-errors.c:354
#define _DBUS_N_ELEMENTS(array)
Computes the number of elements in a fixed-size array using sizeof().
dbus_bool_t _dbus_string_append_byte(DBusString *str, unsigned char byte)
Appends a single byte to the string, returning FALSE if not enough memory.
Definition: dbus-string.c:1174
void _dbus_string_free(DBusString *str)
Frees a string created by _dbus_string_init(), and fills it with the same contents as #_DBUS_STRING_I...
Definition: dbus-string.c:264
#define TRUE
Expands to "1".
char * dbus_address_unescape_value(const char *value, DBusError *error)
Unescapes the given string as a value in a key=value pair for a D-Bus address.
Definition: dbus-address.c:618
DBusList * keys
List of keys.
Definition: dbus-address.c:48
char * dbus_address_escape_value(const char *value)
Escapes the given string as a value in a key=value pair for a D-Bus address.
Definition: dbus-address.c:584
dbus_bool_t _dbus_string_hex_decode(const DBusString *source, int start, int *end_return, DBusString *dest, int insert_at)
Decodes a string from hex encoding.
Definition: dbus-string.c:2326
A node in a linked list.
Definition: dbus-list.h:34
dbus_bool_t _dbus_string_append_byte_as_hex(DBusString *str, unsigned char byte)
Appends a two-character hex digit to a string, where the hex digit has the value of the given byte...
Definition: dbus-string.c:2242
dbus_bool_t _dbus_string_find_to(const DBusString *str, int start, int end, const char *substr, int *found)
Finds the given substring in the string, up to a certain position, returning TRUE and filling in the ...
Definition: dbus-string.c:1714
int _dbus_list_get_length(DBusList **list)
Gets the length of a list.
Definition: dbus-list.c:758
#define DBUS_ERROR_NO_MEMORY
There was not enough memory to complete an operation.
DBusList * _dbus_list_get_first_link(DBusList **list)
Gets the first link in the list.
Definition: dbus-list.c:595
#define FALSE
Expands to "0".
dbus_bool_t _dbus_string_set_length(DBusString *str, int length)
Sets the length of a string.
Definition: dbus-string.c:819
dbus_bool_t _dbus_string_copy_len(const DBusString *source, int start, int len, DBusString *dest, int insert_at)
Like _dbus_string_copy(), but can copy a segment from the middle of the source string.
Definition: dbus-string.c:1392
dbus_bool_t _dbus_string_steal_data(DBusString *str, char **data_return)
Like _dbus_string_get_data(), but removes the gotten data from the original string.
Definition: dbus-string.c:658
dbus_bool_t dbus_error_is_set(const DBusError *error)
Checks whether an error occurred (the error is set).
Definition: dbus-errors.c:329
dbus_bool_t dbus_parse_address(const char *address, DBusAddressEntry ***entry_result, int *array_len, DBusError *error)
Parses an address string of the form:
Definition: dbus-address.c:364
void _dbus_list_clear(DBusList **list)
Frees all links in the list and sets the list head to NULL.
Definition: dbus-list.c:543
DBusList * values
List of values.
Definition: dbus-address.c:49