1 /* -*- mode: C; c-file-style: "gnu" -*- */
2 /* config-parser.c XML-library-agnostic configuration file parser
4 * Copyright (C) 2003 Red Hat, Inc.
6 * Licensed under the Academic Free License version 1.2
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #include "config-parser.h"
27 #include <dbus/dbus-list.h>
28 #include <dbus/dbus-internals.h>
54 unsigned int had_content : 1;
60 unsigned int ignore_missing : 1;
80 struct BusConfigParser
84 DBusString basedir; /**< Directory we resolve paths relative to */
86 DBusList *stack; /**< stack of Element */
88 char *user; /**< user to run as */
90 char *bus_type; /**< Message bus type */
92 DBusList *listen_on; /**< List of addresses to listen to */
94 DBusList *mechanisms; /**< Auth mechanisms */
96 DBusList *service_dirs; /**< Directories to look for services in */
98 BusPolicy *policy; /**< Security policy */
100 unsigned int fork : 1; /**< TRUE to fork into daemon mode */
106 element_type_to_name (ElementType type)
112 case ELEMENT_BUSCONFIG:
114 case ELEMENT_INCLUDE:
132 case ELEMENT_PIDFILE:
134 case ELEMENT_SERVICEDIR:
136 case ELEMENT_INCLUDEDIR:
142 _dbus_assert_not_reached ("bad element type");
148 push_element (BusConfigParser *parser,
153 _dbus_assert (type != ELEMENT_NONE);
155 e = dbus_new0 (Element, 1);
159 if (!_dbus_list_append (&parser->stack, e))
171 element_free (Element *e)
178 pop_element (BusConfigParser *parser)
182 e = _dbus_list_pop_last (&parser->stack);
188 peek_element (BusConfigParser *parser)
192 e = _dbus_list_get_last (&parser->stack);
198 top_element_type (BusConfigParser *parser)
202 e = _dbus_list_get_last (&parser->stack);
211 merge_included (BusConfigParser *parser,
212 BusConfigParser *included,
217 if (included->user != NULL)
219 dbus_free (parser->user);
220 parser->user = included->user;
221 included->user = NULL;
224 if (included->bus_type != NULL)
226 dbus_free (parser->bus_type);
227 parser->bus_type = included->bus_type;
228 included->bus_type = NULL;
234 if (included->pidfile != NULL)
236 dbus_free (parser->pidfile);
237 parser->pidfile = included->pidfile;
238 included->pidfile = NULL;
241 while ((link = _dbus_list_pop_first_link (&included->listen_on)))
242 _dbus_list_append_link (&parser->listen_on, link);
244 while ((link = _dbus_list_pop_first_link (&included->mechanisms)))
245 _dbus_list_append_link (&parser->mechanisms, link);
247 while ((link = _dbus_list_pop_first_link (&included->service_dirs)))
248 _dbus_list_append_link (&parser->service_dirs, link);
254 bus_config_parser_new (const DBusString *basedir)
256 BusConfigParser *parser;
258 parser = dbus_new0 (BusConfigParser, 1);
262 if (!_dbus_string_init (&parser->basedir))
268 if (((parser->policy = bus_policy_new ()) == NULL) ||
269 !_dbus_string_copy (basedir, 0, &parser->basedir, 0))
272 bus_policy_unref (parser->policy);
274 _dbus_string_free (&parser->basedir);
279 parser->refcount = 1;
285 bus_config_parser_ref (BusConfigParser *parser)
287 _dbus_assert (parser->refcount > 0);
289 parser->refcount += 1;
293 bus_config_parser_unref (BusConfigParser *parser)
295 _dbus_assert (parser->refcount > 0);
297 parser->refcount -= 1;
299 if (parser->refcount == 0)
301 while (parser->stack != NULL)
302 pop_element (parser);
304 dbus_free (parser->user);
305 dbus_free (parser->bus_type);
306 dbus_free (parser->pidfile);
308 _dbus_list_foreach (&parser->listen_on,
309 (DBusForeachFunction) dbus_free,
312 _dbus_list_clear (&parser->listen_on);
314 _dbus_list_foreach (&parser->service_dirs,
315 (DBusForeachFunction) dbus_free,
318 _dbus_list_clear (&parser->service_dirs);
320 _dbus_list_foreach (&parser->mechanisms,
321 (DBusForeachFunction) dbus_free,
324 _dbus_list_clear (&parser->mechanisms);
326 _dbus_string_free (&parser->basedir);
329 bus_policy_unref (parser->policy);
336 bus_config_parser_check_doctype (BusConfigParser *parser,
340 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
342 if (strcmp (doctype, "busconfig") != 0)
344 dbus_set_error (error,
346 "Configuration file has the wrong document type %s",
361 locate_attributes (BusConfigParser *parser,
362 const char *element_name,
363 const char **attribute_names,
364 const char **attribute_values,
366 const char *first_attribute_name,
367 const char **first_attribute_retloc,
375 LocateAttr attrs[MAX_ATTRS];
379 _dbus_assert (first_attribute_name != NULL);
380 _dbus_assert (first_attribute_retloc != NULL);
385 attrs[0].name = first_attribute_name;
386 attrs[0].retloc = first_attribute_retloc;
387 *first_attribute_retloc = NULL;
389 va_start (args, first_attribute_retloc);
391 name = va_arg (args, const char*);
392 retloc = va_arg (args, const char**);
396 _dbus_assert (retloc != NULL);
397 _dbus_assert (n_attrs < MAX_ATTRS);
399 attrs[n_attrs].name = name;
400 attrs[n_attrs].retloc = retloc;
404 name = va_arg (args, const char*);
405 retloc = va_arg (args, const char**);
414 while (attribute_names[i])
423 if (strcmp (attrs[j].name, attribute_names[i]) == 0)
425 retloc = attrs[j].retloc;
429 dbus_set_error (error, DBUS_ERROR_FAILED,
430 "Attribute \"%s\" repeated twice on the same <%s> element",
431 attrs[j].name, element_name);
436 *retloc = attribute_values[i];
445 dbus_set_error (error, DBUS_ERROR_FAILED,
446 "Attribute \"%s\" is invalid on <%s> element in this context",
447 attribute_names[i], element_name);
460 check_no_attributes (BusConfigParser *parser,
461 const char *element_name,
462 const char **attribute_names,
463 const char **attribute_values,
466 if (attribute_names[0] != NULL)
468 dbus_set_error (error, DBUS_ERROR_FAILED,
469 "Attribute \"%s\" is invalid on <%s> element in this context",
470 attribute_names[0], element_name);
478 start_busconfig_child (BusConfigParser *parser,
479 const char *element_name,
480 const char **attribute_names,
481 const char **attribute_values,
484 if (strcmp (element_name, "user") == 0)
486 if (!check_no_attributes (parser, "user", attribute_names, attribute_values, error))
489 if (push_element (parser, ELEMENT_USER) == NULL)
497 else if (strcmp (element_name, "type") == 0)
499 if (!check_no_attributes (parser, "type", attribute_names, attribute_values, error))
502 if (push_element (parser, ELEMENT_TYPE) == NULL)
510 else if (strcmp (element_name, "fork") == 0)
512 if (!check_no_attributes (parser, "fork", attribute_names, attribute_values, error))
515 if (push_element (parser, ELEMENT_FORK) == NULL)
525 else if (strcmp (element_name, "pidfile") == 0)
527 if (!check_no_attributes (parser, "pidfile", attribute_names, attribute_values, error))
530 if (push_element (parser, ELEMENT_PIDFILE) == NULL)
538 else if (strcmp (element_name, "listen") == 0)
540 if (!check_no_attributes (parser, "listen", attribute_names, attribute_values, error))
543 if (push_element (parser, ELEMENT_LISTEN) == NULL)
551 else if (strcmp (element_name, "auth") == 0)
553 if (!check_no_attributes (parser, "auth", attribute_names, attribute_values, error))
556 if (push_element (parser, ELEMENT_AUTH) == NULL)
564 else if (strcmp (element_name, "includedir") == 0)
566 if (!check_no_attributes (parser, "includedir", attribute_names, attribute_values, error))
569 if (push_element (parser, ELEMENT_INCLUDEDIR) == NULL)
577 else if (strcmp (element_name, "servicedir") == 0)
579 if (!check_no_attributes (parser, "servicedir", attribute_names, attribute_values, error))
582 if (push_element (parser, ELEMENT_SERVICEDIR) == NULL)
590 else if (strcmp (element_name, "include") == 0)
593 const char *ignore_missing;
595 if ((e = push_element (parser, ELEMENT_INCLUDE)) == NULL)
601 e->d.include.ignore_missing = FALSE;
603 if (!locate_attributes (parser, "include",
607 "ignore_missing", &ignore_missing,
611 if (ignore_missing != NULL)
613 if (strcmp (ignore_missing, "yes") == 0)
614 e->d.include.ignore_missing = TRUE;
615 else if (strcmp (ignore_missing, "no") == 0)
616 e->d.include.ignore_missing = FALSE;
619 dbus_set_error (error, DBUS_ERROR_FAILED,
620 "ignore_missing attribute must have value \"yes\" or \"no\"");
627 else if (strcmp (element_name, "policy") == 0)
634 if ((e = push_element (parser, ELEMENT_POLICY)) == NULL)
640 if (!locate_attributes (parser, "policy",
650 if (((context && user) ||
651 (context && group)) ||
653 !(context || user || group))
655 dbus_set_error (error, DBUS_ERROR_FAILED,
656 "<policy> element must have exactly one of (context|user|group) attributes");
662 if (strcmp (context, "default") == 0)
666 else if (strcmp (context, "mandatory") == 0)
672 dbus_set_error (error, DBUS_ERROR_FAILED,
673 "context attribute on <policy> must have the value \"default\" or \"mandatory\", not \"%s\"",
681 else if (user != NULL)
686 else if (group != NULL)
693 _dbus_assert_not_reached ("all <policy> attributes null and we didn't set error");
700 dbus_set_error (error, DBUS_ERROR_FAILED,
701 "Element <%s> not allowed inside <%s> in configuration file",
702 element_name, "busconfig");
708 start_policy_child (BusConfigParser *parser,
709 const char *element_name,
710 const char **attribute_names,
711 const char **attribute_values,
714 if (strcmp (element_name, "allow") == 0)
716 if (push_element (parser, ELEMENT_ALLOW) == NULL)
724 else if (strcmp (element_name, "deny") == 0)
726 if (push_element (parser, ELEMENT_DENY) == NULL)
736 dbus_set_error (error, DBUS_ERROR_FAILED,
737 "Element <%s> not allowed inside <%s> in configuration file",
738 element_name, "policy");
744 bus_config_parser_start_element (BusConfigParser *parser,
745 const char *element_name,
746 const char **attribute_names,
747 const char **attribute_values,
752 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
754 /* printf ("START: %s\n", element_name); */
756 t = top_element_type (parser);
758 if (t == ELEMENT_NONE)
760 if (strcmp (element_name, "busconfig") == 0)
762 if (!check_no_attributes (parser, "busconfig", attribute_names, attribute_values, error))
765 if (push_element (parser, ELEMENT_BUSCONFIG) == NULL)
775 dbus_set_error (error, DBUS_ERROR_FAILED,
776 "Unknown element <%s> at root of configuration file",
781 else if (t == ELEMENT_BUSCONFIG)
783 return start_busconfig_child (parser, element_name,
784 attribute_names, attribute_values,
787 else if (t == ELEMENT_POLICY)
789 return start_policy_child (parser, element_name,
790 attribute_names, attribute_values,
795 dbus_set_error (error, DBUS_ERROR_FAILED,
796 "Element <%s> is not allowed in this context",
803 bus_config_parser_end_element (BusConfigParser *parser,
804 const char *element_name,
811 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
813 /* printf ("END: %s\n", element_name); */
815 t = top_element_type (parser);
817 if (t == ELEMENT_NONE)
819 /* should probably be an assertion failure but
820 * being paranoid about XML parsers
822 dbus_set_error (error, DBUS_ERROR_FAILED,
823 "XML parser ended element with no element on the stack");
827 n = element_type_to_name (t);
828 _dbus_assert (n != NULL);
829 if (strcmp (n, element_name) != 0)
831 /* should probably be an assertion failure but
832 * being paranoid about XML parsers
834 dbus_set_error (error, DBUS_ERROR_FAILED,
835 "XML element <%s> ended but topmost element on the stack was <%s>",
840 e = peek_element (parser);
841 _dbus_assert (e != NULL);
846 _dbus_assert_not_reached ("element in stack has no type");
849 case ELEMENT_INCLUDE:
853 case ELEMENT_PIDFILE:
855 case ELEMENT_SERVICEDIR:
856 case ELEMENT_INCLUDEDIR:
859 dbus_set_error (error, DBUS_ERROR_FAILED,
860 "XML element <%s> was expected to have content inside it",
861 element_type_to_name (e->type));
866 case ELEMENT_BUSCONFIG:
875 pop_element (parser);
881 all_whitespace (const DBusString *str)
885 _dbus_string_skip_white (str, 0, &i);
887 return i == _dbus_string_get_length (str);
891 make_full_path (const DBusString *basedir,
892 const DBusString *filename,
893 DBusString *full_path)
895 if (_dbus_path_is_absolute (filename))
897 return _dbus_string_copy (filename, 0, full_path, 0);
901 if (!_dbus_string_copy (basedir, 0, full_path, 0))
904 if (!_dbus_concat_dir_and_file (full_path, filename))
912 include_file (BusConfigParser *parser,
913 const DBusString *filename,
914 dbus_bool_t ignore_missing,
917 /* FIXME good test case for this would load each config file in the
918 * test suite both alone, and as an include, and check
919 * that the result is the same
921 BusConfigParser *included;
924 dbus_error_init (&tmp_error);
925 included = bus_config_load (filename, &tmp_error);
926 if (included == NULL)
928 _DBUS_ASSERT_ERROR_IS_SET (&tmp_error);
930 if (dbus_error_has_name (&tmp_error, DBUS_ERROR_FILE_NOT_FOUND) &&
933 dbus_error_free (&tmp_error);
938 dbus_move_error (&tmp_error, error);
944 _DBUS_ASSERT_ERROR_IS_CLEAR (&tmp_error);
946 if (!merge_included (parser, included, error))
948 bus_config_parser_unref (included);
952 bus_config_parser_unref (included);
958 include_dir (BusConfigParser *parser,
959 const DBusString *dirname,
967 if (!_dbus_string_init (&filename))
975 dir = _dbus_directory_open (dirname, error);
980 dbus_error_init (&tmp_error);
981 while (_dbus_directory_get_next_file (dir, &filename, &tmp_error))
983 DBusString full_path;
985 if (!_dbus_string_init (&full_path))
991 if (!_dbus_string_copy (dirname, 0, &full_path, 0))
994 _dbus_string_free (&full_path);
998 if (!_dbus_concat_dir_and_file (&full_path, &filename))
1000 BUS_SET_OOM (error);
1001 _dbus_string_free (&full_path);
1005 if (_dbus_string_ends_with_c_str (&full_path, ".conf"))
1007 if (!include_file (parser, &full_path, TRUE, error))
1009 _dbus_string_free (&full_path);
1014 _dbus_string_free (&full_path);
1017 if (dbus_error_is_set (&tmp_error))
1019 dbus_move_error (&tmp_error, error);
1026 _dbus_string_free (&filename);
1029 _dbus_directory_close (dir);
1035 bus_config_parser_content (BusConfigParser *parser,
1036 const DBusString *content,
1041 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
1047 _dbus_string_get_const_data (content, &c_str);
1049 printf ("CONTENT %d bytes: %s\n", _dbus_string_get_length (content), c_str);
1053 e = peek_element (parser);
1056 dbus_set_error (error, DBUS_ERROR_FAILED,
1057 "Text content outside of any XML element in configuration file");
1060 else if (e->had_content)
1062 _dbus_assert_not_reached ("Element had multiple content blocks");
1066 switch (top_element_type (parser))
1069 _dbus_assert_not_reached ("element at top of stack has no type");
1072 case ELEMENT_BUSCONFIG:
1073 case ELEMENT_POLICY:
1078 if (all_whitespace (content))
1082 dbus_set_error (error, DBUS_ERROR_FAILED,
1083 "No text content expected inside XML element %s in configuration file",
1084 element_type_to_name (top_element_type (parser)));
1088 case ELEMENT_PIDFILE:
1092 e->had_content = TRUE;
1094 if (!_dbus_string_copy_data (content, &s))
1097 dbus_free (parser->pidfile);
1098 parser->pidfile = s;
1102 case ELEMENT_INCLUDE:
1104 DBusString full_path;
1106 e->had_content = TRUE;
1108 if (!_dbus_string_init (&full_path))
1111 if (!make_full_path (&parser->basedir, content, &full_path))
1113 _dbus_string_free (&full_path);
1117 if (!include_file (parser, &full_path,
1118 e->d.include.ignore_missing, error))
1120 _dbus_string_free (&full_path);
1124 _dbus_string_free (&full_path);
1128 case ELEMENT_INCLUDEDIR:
1130 DBusString full_path;
1132 e->had_content = TRUE;
1134 if (!_dbus_string_init (&full_path))
1137 if (!make_full_path (&parser->basedir, content, &full_path))
1139 _dbus_string_free (&full_path);
1143 if (!include_dir (parser, &full_path, error))
1145 _dbus_string_free (&full_path);
1149 _dbus_string_free (&full_path);
1157 e->had_content = TRUE;
1159 if (!_dbus_string_copy_data (content, &s))
1162 dbus_free (parser->user);
1171 e->had_content = TRUE;
1173 if (!_dbus_string_copy_data (content, &s))
1176 dbus_free (parser->bus_type);
1177 parser->bus_type = s;
1181 case ELEMENT_LISTEN:
1185 e->had_content = TRUE;
1187 if (!_dbus_string_copy_data (content, &s))
1190 if (!_dbus_list_append (&parser->listen_on,
1203 e->had_content = TRUE;
1205 if (!_dbus_string_copy_data (content, &s))
1208 if (!_dbus_list_append (&parser->mechanisms,
1217 case ELEMENT_SERVICEDIR:
1220 DBusString full_path;
1222 e->had_content = TRUE;
1224 if (!_dbus_string_init (&full_path))
1227 if (!make_full_path (&parser->basedir, content, &full_path))
1229 _dbus_string_free (&full_path);
1233 if (!_dbus_string_copy_data (&full_path, &s))
1235 _dbus_string_free (&full_path);
1239 if (!_dbus_list_append (&parser->service_dirs, s))
1241 _dbus_string_free (&full_path);
1246 _dbus_string_free (&full_path);
1251 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
1255 BUS_SET_OOM (error);
1260 bus_config_parser_finished (BusConfigParser *parser,
1263 _DBUS_ASSERT_ERROR_IS_CLEAR (error);
1265 if (parser->stack != NULL)
1267 dbus_set_error (error, DBUS_ERROR_FAILED,
1268 "Element <%s> was not closed in configuration file",
1269 element_type_to_name (top_element_type (parser)));
1274 if (parser->listen_on == NULL)
1276 dbus_set_error (error, DBUS_ERROR_FAILED,
1277 "Configuration file needs one or more <listen> elements giving addresses");
1285 bus_config_parser_get_user (BusConfigParser *parser)
1287 return parser->user;
1291 bus_config_parser_get_type (BusConfigParser *parser)
1293 return parser->bus_type;
1297 bus_config_parser_get_addresses (BusConfigParser *parser)
1299 return &parser->listen_on;
1303 bus_config_parser_get_mechanisms (BusConfigParser *parser)
1305 return &parser->mechanisms;
1309 bus_config_parser_get_service_dirs (BusConfigParser *parser)
1311 return &parser->service_dirs;
1315 bus_config_parser_get_fork (BusConfigParser *parser)
1317 return parser->fork;
1321 bus_config_parser_get_pidfile (BusConfigParser *parser)
1323 return parser->pidfile;
1327 bus_config_parser_steal_policy (BusConfigParser *parser)
1331 _dbus_assert (parser->policy != NULL); /* can only steal the policy 1 time */
1333 policy = parser->policy;
1335 parser->policy = NULL;
1340 #ifdef DBUS_BUILD_TESTS
1351 do_load (const DBusString *full_path,
1353 dbus_bool_t oom_possible)
1355 BusConfigParser *parser;
1358 dbus_error_init (&error);
1360 parser = bus_config_load (full_path, &error);
1363 _DBUS_ASSERT_ERROR_IS_SET (&error);
1366 dbus_error_has_name (&error, DBUS_ERROR_NO_MEMORY))
1368 _dbus_verbose ("Failed to load valid file due to OOM\n");
1369 dbus_error_free (&error);
1372 else if (validity == VALID)
1374 _dbus_warn ("Failed to load valid file but still had memory: %s\n",
1377 dbus_error_free (&error);
1382 dbus_error_free (&error);
1388 _DBUS_ASSERT_ERROR_IS_CLEAR (&error);
1390 bus_config_parser_unref (parser);
1392 if (validity == INVALID)
1394 _dbus_warn ("Accepted invalid file\n");
1404 const DBusString *full_path;
1409 check_loader_oom_func (void *data)
1411 LoaderOomData *d = data;
1413 return do_load (d->full_path, d->validity, TRUE);
1417 process_test_subdir (const DBusString *test_base_dir,
1421 DBusString test_directory;
1422 DBusString filename;
1430 if (!_dbus_string_init (&test_directory))
1431 _dbus_assert_not_reached ("didn't allocate test_directory\n");
1433 _dbus_string_init_const (&filename, subdir);
1435 if (!_dbus_string_copy (test_base_dir, 0,
1436 &test_directory, 0))
1437 _dbus_assert_not_reached ("couldn't copy test_base_dir to test_directory");
1439 if (!_dbus_concat_dir_and_file (&test_directory, &filename))
1440 _dbus_assert_not_reached ("couldn't allocate full path");
1442 _dbus_string_free (&filename);
1443 if (!_dbus_string_init (&filename))
1444 _dbus_assert_not_reached ("didn't allocate filename string\n");
1446 dbus_error_init (&error);
1447 dir = _dbus_directory_open (&test_directory, &error);
1450 _dbus_warn ("Could not open %s: %s\n",
1451 _dbus_string_get_const_data (&test_directory),
1453 dbus_error_free (&error);
1457 printf ("Testing:\n");
1460 while (_dbus_directory_get_next_file (dir, &filename, &error))
1462 DBusString full_path;
1465 if (!_dbus_string_init (&full_path))
1466 _dbus_assert_not_reached ("couldn't init string");
1468 if (!_dbus_string_copy (&test_directory, 0, &full_path, 0))
1469 _dbus_assert_not_reached ("couldn't copy dir to full_path");
1471 if (!_dbus_concat_dir_and_file (&full_path, &filename))
1472 _dbus_assert_not_reached ("couldn't concat file to dir");
1474 if (!_dbus_string_ends_with_c_str (&full_path, ".conf"))
1476 _dbus_verbose ("Skipping non-.conf file %s\n",
1477 _dbus_string_get_const_data (&filename));
1478 _dbus_string_free (&full_path);
1482 printf (" %s\n", _dbus_string_get_const_data (&filename));
1484 _dbus_verbose (" expecting %s\n",
1485 validity == VALID ? "valid" :
1486 (validity == INVALID ? "invalid" :
1487 (validity == UNKNOWN ? "unknown" : "???")));
1489 d.full_path = &full_path;
1490 d.validity = validity;
1491 if (!_dbus_test_oom_handling ("config-loader", check_loader_oom_func, &d))
1492 _dbus_assert_not_reached ("test failed");
1494 _dbus_string_free (&full_path);
1497 if (dbus_error_is_set (&error))
1499 _dbus_warn ("Could not get next file in %s: %s\n",
1500 _dbus_string_get_const_data (&test_directory),
1502 dbus_error_free (&error);
1511 _dbus_directory_close (dir);
1512 _dbus_string_free (&test_directory);
1513 _dbus_string_free (&filename);
1519 bus_config_parser_test (const DBusString *test_data_dir)
1521 if (test_data_dir == NULL ||
1522 _dbus_string_get_length (test_data_dir) == 0)
1524 printf ("No test data\n");
1528 if (!process_test_subdir (test_data_dir, "valid-config-files", VALID))
1534 #endif /* DBUS_BUILD_TESTS */