From 37ec801682960e1f88a531a7b0e57db4505a1ffb Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Fri, 7 Aug 2009 01:51:17 +0200 Subject: Complain whenever someone uses at_console at_console should be considered obsolete. Applications should use PolicyKit instea for verifying that a process is on the (active) console. --- bus/config-parser.c | 319 ++++++++++++++++++++++++++-------------------------- 1 file changed, 160 insertions(+), 159 deletions(-) diff --git a/bus/config-parser.c b/bus/config-parser.c index a4a01914..38297b38 100644 --- a/bus/config-parser.c +++ b/bus/config-parser.c @@ -61,7 +61,7 @@ typedef struct struct { PolicyType type; - unsigned long gid_uid_or_at_console; + unsigned long gid_uid_or_at_console; } policy; struct @@ -69,20 +69,20 @@ typedef struct char *name; long value; } limit; - + } d; } Element; /** - * Parser for bus configuration file. + * Parser for bus configuration file. */ struct BusConfigParser { int refcount; /**< Reference count */ DBusString basedir; /**< Directory we resolve paths relative to */ - + DBusList *stack; /**< stack of Element */ char *user; /**< user to run as */ @@ -90,7 +90,7 @@ struct BusConfigParser char *servicehelper; /**< location of the setuid helper */ char *bus_type; /**< Message bus type */ - + DBusList *listen_on; /**< List of addresses to listen to */ DBusList *mechanisms; /**< Auth mechanisms */ @@ -126,7 +126,7 @@ push_element (BusConfigParser *parser, Element *e; _dbus_assert (type != ELEMENT_NONE); - + e = dbus_new0 (Element, 1); if (e == NULL) return NULL; @@ -136,7 +136,7 @@ push_element (BusConfigParser *parser, dbus_free (e); return NULL; } - + e->type = type; return e; @@ -147,7 +147,7 @@ element_free (Element *e) { if (e->type == ELEMENT_LIMIT) dbus_free (e->d.limit.name); - + dbus_free (e); } @@ -157,7 +157,7 @@ pop_element (BusConfigParser *parser) Element *e; e = _dbus_list_pop_last (&parser->stack); - + element_free (e); } @@ -206,13 +206,13 @@ merge_service_context_hash (DBusHashTable *dest, goto fail; context_copy = _dbus_strdup (context); if (context_copy == NULL) - goto fail; - + goto fail; + if (!_dbus_hash_table_insert_string (dest, service_copy, context_copy)) goto fail; service_copy = NULL; - context_copy = NULL; + context_copy = NULL; } return TRUE; @@ -238,7 +238,7 @@ service_dirs_find_dir (DBusList **service_dirs, for (link = *service_dirs; link; link = _dbus_list_get_next_link(service_dirs, link)) { const char *link_dir; - + link_dir = (const char *)link->data; if (strcmp (dir, link_dir) == 0) return TRUE; @@ -252,13 +252,13 @@ service_dirs_append_unique_or_free (DBusList **service_dirs, char *dir) { if (!service_dirs_find_dir (service_dirs, dir)) - return _dbus_list_append (service_dirs, dir); + return _dbus_list_append (service_dirs, dir); dbus_free (dir); return TRUE; } -static void +static void service_dirs_append_link_unique_or_free (DBusList **service_dirs, DBusList *dir_link) { @@ -293,7 +293,7 @@ merge_included (BusConfigParser *parser, BUS_SET_OOM (error); return FALSE; } - + if (included->user != NULL) { dbus_free (parser->user); @@ -307,7 +307,7 @@ merge_included (BusConfigParser *parser, parser->bus_type = included->bus_type; included->bus_type = NULL; } - + if (included->fork) parser->fork = TRUE; @@ -320,7 +320,7 @@ merge_included (BusConfigParser *parser, parser->pidfile = included->pidfile; included->pidfile = NULL; } - + while ((link = _dbus_list_pop_first_link (&included->listen_on))) _dbus_list_append_link (&parser->listen_on, link); @@ -332,7 +332,7 @@ merge_included (BusConfigParser *parser, while ((link = _dbus_list_pop_first_link (&included->conf_dirs))) _dbus_list_append_link (&parser->conf_dirs, link); - + return TRUE; } @@ -366,7 +366,7 @@ bus_config_parser_new (const DBusString *basedir, return NULL; parser->is_toplevel = !!is_toplevel; - + if (!_dbus_string_init (&parser->basedir)) { dbus_free (parser); @@ -381,7 +381,7 @@ bus_config_parser_new (const DBusString *basedir, { if (parser->policy) bus_policy_unref (parser->policy); - + _dbus_string_free (&parser->basedir); dbus_free (parser); @@ -413,7 +413,7 @@ bus_config_parser_new (const DBusString *basedir, parser->limits.max_incoming_unix_fds = 1024*4; parser->limits.max_outgoing_unix_fds = 1024*4; parser->limits.max_message_unix_fds = 1024; - + /* Making this long means the user has to wait longer for an error * message if something screws up, but making it too short means * they might see a false failure. @@ -425,16 +425,16 @@ bus_config_parser_new (const DBusString *basedir, * password) is allowed, then potentially it has to be quite long. */ parser->limits.auth_timeout = 30000; /* 30 seconds */ - + parser->limits.max_incomplete_connections = 64; parser->limits.max_connections_per_user = 256; - + /* Note that max_completed_connections / max_connections_per_user * is the number of users that would have to work together to * DOS all the other users. */ parser->limits.max_completed_connections = 2048; - + parser->limits.max_pending_activations = 512; parser->limits.max_services_per_connection = 512; @@ -447,7 +447,7 @@ bus_config_parser_new (const DBusString *basedir, * match rules. */ parser->limits.max_match_rules_per_connection = 512; - + parser->limits.reply_timeout = -1; /* never */ /* this is effectively a limit on message queue size for messages @@ -455,9 +455,9 @@ bus_config_parser_new (const DBusString *basedir, */ parser->limits.max_replies_per_connection = 1024*8; } - + parser->refcount = 1; - + return parser; } @@ -487,7 +487,7 @@ bus_config_parser_unref (BusConfigParser *parser) dbus_free (parser->servicehelper); dbus_free (parser->bus_type); dbus_free (parser->pidfile); - + _dbus_list_foreach (&parser->listen_on, (DBusForeachFunction) dbus_free, NULL); @@ -511,7 +511,7 @@ bus_config_parser_unref (BusConfigParser *parser) NULL); _dbus_list_clear (&parser->mechanisms); - + _dbus_string_free (&parser->basedir); if (parser->policy) @@ -519,7 +519,7 @@ bus_config_parser_unref (BusConfigParser *parser) if (parser->service_context_table) _dbus_hash_table_unref (parser->service_context_table); - + dbus_free (parser); } } @@ -604,7 +604,7 @@ locate_attributes (BusConfigParser *parser, { int j; dbus_bool_t found; - + found = FALSE; j = 0; while (j < n_attrs) @@ -712,7 +712,7 @@ start_busconfig_child (BusConfigParser *parser, } parser->fork = TRUE; - + return TRUE; } else if (element_type == ELEMENT_SYSLOG) @@ -725,9 +725,9 @@ start_busconfig_child (BusConfigParser *parser, BUS_SET_OOM (error); return FALSE; } - + parser->syslog = TRUE; - + return TRUE; } else if (element_type == ELEMENT_KEEP_UMASK) @@ -742,7 +742,7 @@ start_busconfig_child (BusConfigParser *parser, } parser->keep_umask = TRUE; - + return TRUE; } else if (element_type == ELEMENT_PIDFILE) @@ -781,7 +781,7 @@ start_busconfig_child (BusConfigParser *parser, BUS_SET_OOM (error); return FALSE; } - + return TRUE; } else if (element_type == ELEMENT_SERVICEHELPER) @@ -944,7 +944,7 @@ start_busconfig_child (BusConfigParser *parser, return FALSE; } } - + if (selinux_root_relative != NULL) { if (strcmp (selinux_root_relative, "yes") == 0) @@ -977,7 +977,7 @@ start_busconfig_child (BusConfigParser *parser, } e->d.policy.type = POLICY_IGNORED; - + if (!locate_attributes (parser, "policy", attribute_names, attribute_values, @@ -1042,7 +1042,7 @@ start_busconfig_child (BusConfigParser *parser, e->d.policy.type = POLICY_GROUP; else _dbus_warn ("Unknown group \"%s\" in message bus configuration file\n", - group); + group); } else if (at_console != NULL) { @@ -1050,9 +1050,11 @@ start_busconfig_child (BusConfigParser *parser, t = (strcmp (at_console, "true") == 0); if (t || strcmp (at_console, "false") == 0) { - e->d.policy.gid_uid_or_at_console = t; + e->d.policy.gid_uid_or_at_console = t; e->d.policy.type = POLICY_CONSOLE; - } + + _dbus_warn ("Obsolete at_console policy used in message bus configuration file.\n"); + } else { dbus_set_error (error, DBUS_ERROR_FAILED, @@ -1066,7 +1068,7 @@ start_busconfig_child (BusConfigParser *parser, { _dbus_assert_not_reached ("all attributes null and we didn't set error"); } - + return TRUE; } else if (element_type == ELEMENT_LIMIT) @@ -1079,7 +1081,7 @@ start_busconfig_child (BusConfigParser *parser, BUS_SET_OOM (error); return FALSE; } - + if (!locate_attributes (parser, "limit", attribute_names, attribute_values, @@ -1155,7 +1157,7 @@ append_rule_from_element (BusConfigParser *parser, const char *group; BusPolicyRule *rule; - + if (!locate_attributes (parser, element_name, attribute_names, attribute_values, @@ -1203,7 +1205,7 @@ append_rule_from_element (BusConfigParser *parser, element_name); return FALSE; } - + /* Allowed combinations of elements are: * * base, must be all send or all receive: @@ -1211,7 +1213,7 @@ append_rule_from_element (BusConfigParser *parser, * interface * interface + member * error - * + * * base send_ can combine with send_destination, send_path, send_type, send_requested_reply * base receive_ with receive_sender, receive_path, receive_type, receive_requested_reply, eavesdrop * @@ -1239,7 +1241,7 @@ append_rule_from_element (BusConfigParser *parser, (send_member && own) || (send_member && user) || (send_member && group)) || - + ((send_error && receive_interface) || (send_error && receive_member) || (send_error && receive_error) || @@ -1284,7 +1286,7 @@ append_rule_from_element (BusConfigParser *parser, (send_requested_reply && own) || (send_requested_reply && user) || (send_requested_reply && group)) || - + ((receive_interface && receive_error) || (receive_interface && own) || (receive_interface && user) || @@ -1294,7 +1296,7 @@ append_rule_from_element (BusConfigParser *parser, (receive_member && own) || (receive_member && user) || (receive_member && group)) || - + ((receive_error && own) || (receive_error && user) || (receive_error && group)) || @@ -1306,7 +1308,7 @@ append_rule_from_element (BusConfigParser *parser, ((receive_requested_reply && own) || (receive_requested_reply && user) || (receive_requested_reply && group)) || - + ((own && user) || (own && group)) || @@ -1317,7 +1319,7 @@ append_rule_from_element (BusConfigParser *parser, element_name); return FALSE; } - + rule = NULL; /* In BusPolicyRule, NULL represents wildcard. @@ -1329,7 +1331,7 @@ append_rule_from_element (BusConfigParser *parser, send_path || send_type || send_requested_reply) { int message_type; - + if (IS_WILDCARD (send_interface)) send_interface = NULL; if (IS_WILDCARD (send_member)) @@ -1375,11 +1377,11 @@ append_rule_from_element (BusConfigParser *parser, "send_requested_reply", send_requested_reply); return FALSE; } - - rule = bus_policy_rule_new (BUS_POLICY_RULE_SEND, allow); + + rule = bus_policy_rule_new (BUS_POLICY_RULE_SEND, allow); if (rule == NULL) goto nomem; - + if (eavesdrop) rule->d.send.eavesdrop = (strcmp (eavesdrop, "true") == 0); @@ -1410,7 +1412,7 @@ append_rule_from_element (BusConfigParser *parser, receive_path || receive_type || eavesdrop || receive_requested_reply) { int message_type; - + if (IS_WILDCARD (receive_interface)) receive_interface = NULL; if (IS_WILDCARD (receive_member)) @@ -1457,8 +1459,8 @@ append_rule_from_element (BusConfigParser *parser, "receive_requested_reply", receive_requested_reply); return FALSE; } - - rule = bus_policy_rule_new (BUS_POLICY_RULE_RECEIVE, allow); + + rule = bus_policy_rule_new (BUS_POLICY_RULE_RECEIVE, allow); if (rule == NULL) goto nomem; @@ -1467,7 +1469,7 @@ append_rule_from_element (BusConfigParser *parser, if (receive_requested_reply) rule->d.receive.requested_reply = (strcmp (receive_requested_reply, "true") == 0); - + rule->d.receive.message_type = message_type; rule->d.receive.path = _dbus_strdup (receive_path); rule->d.receive.interface = _dbus_strdup (receive_interface); @@ -1488,22 +1490,22 @@ append_rule_from_element (BusConfigParser *parser, } else if (own) { - rule = bus_policy_rule_new (BUS_POLICY_RULE_OWN, allow); + rule = bus_policy_rule_new (BUS_POLICY_RULE_OWN, allow); if (rule == NULL) goto nomem; if (IS_WILDCARD (own)) own = NULL; - + rule->d.own.service_name = _dbus_strdup (own); if (own && rule->d.own.service_name == NULL) goto nomem; } else if (user) - { + { if (IS_WILDCARD (user)) { - rule = bus_policy_rule_new (BUS_POLICY_RULE_USER, allow); + rule = bus_policy_rule_new (BUS_POLICY_RULE_USER, allow); if (rule == NULL) goto nomem; @@ -1513,12 +1515,12 @@ append_rule_from_element (BusConfigParser *parser, { DBusString username; dbus_uid_t uid; - + _dbus_string_init_const (&username, user); - + if (_dbus_parse_unix_user_from_config (&username, &uid)) { - rule = bus_policy_rule_new (BUS_POLICY_RULE_USER, allow); + rule = bus_policy_rule_new (BUS_POLICY_RULE_USER, allow); if (rule == NULL) goto nomem; @@ -1535,7 +1537,7 @@ append_rule_from_element (BusConfigParser *parser, { if (IS_WILDCARD (group)) { - rule = bus_policy_rule_new (BUS_POLICY_RULE_GROUP, allow); + rule = bus_policy_rule_new (BUS_POLICY_RULE_GROUP, allow); if (rule == NULL) goto nomem; @@ -1545,12 +1547,12 @@ append_rule_from_element (BusConfigParser *parser, { DBusString groupname; dbus_gid_t gid; - + _dbus_string_init_const (&groupname, group); - + if (_dbus_parse_unix_group_from_config (&groupname, &gid)) { - rule = bus_policy_rule_new (BUS_POLICY_RULE_GROUP, allow); + rule = bus_policy_rule_new (BUS_POLICY_RULE_GROUP, allow); if (rule == NULL) goto nomem; @@ -1569,8 +1571,8 @@ append_rule_from_element (BusConfigParser *parser, if (rule != NULL) { Element *pe; - - pe = peek_element (parser); + + pe = peek_element (parser); _dbus_assert (pe != NULL); _dbus_assert (pe->type == ELEMENT_POLICY); @@ -1579,7 +1581,7 @@ append_rule_from_element (BusConfigParser *parser, case POLICY_IGNORED: /* drop the rule on the floor */ break; - + case POLICY_DEFAULT: if (!bus_policy_append_default_rule (parser->policy, rule)) goto nomem; @@ -1596,7 +1598,7 @@ append_rule_from_element (BusConfigParser *parser, element_name); goto failed; } - + if (!bus_policy_append_user_rule (parser->policy, pe->d.policy.gid_uid_or_at_console, rule)) goto nomem; @@ -1609,12 +1611,12 @@ append_rule_from_element (BusConfigParser *parser, element_name); goto failed; } - + if (!bus_policy_append_group_rule (parser->policy, pe->d.policy.gid_uid_or_at_console, rule)) goto nomem; break; - + case POLICY_CONSOLE: if (!bus_policy_append_console_rule (parser->policy, pe->d.policy.gid_uid_or_at_console, @@ -1622,11 +1624,11 @@ append_rule_from_element (BusConfigParser *parser, goto nomem; break; } - + bus_policy_rule_unref (rule); rule = NULL; } - + return TRUE; nomem: @@ -1650,13 +1652,13 @@ start_policy_child (BusConfigParser *parser, attribute_names, attribute_values, TRUE, error)) return FALSE; - + if (push_element (parser, ELEMENT_ALLOW) == NULL) { BUS_SET_OOM (error); return FALSE; } - + return TRUE; } else if (strcmp (element_name, "deny") == 0) @@ -1665,13 +1667,13 @@ start_policy_child (BusConfigParser *parser, attribute_names, attribute_values, FALSE, error)) return FALSE; - + if (push_element (parser, ELEMENT_DENY) == NULL) { BUS_SET_OOM (error); return FALSE; } - + return TRUE; } else @@ -1700,7 +1702,7 @@ start_selinux_child (BusConfigParser *parser, { const char *own; const char *context; - + if (!locate_attributes (parser, "associate", attribute_names, attribute_values, @@ -1709,7 +1711,7 @@ start_selinux_child (BusConfigParser *parser, "context", &context, NULL)) return FALSE; - + if (push_element (parser, ELEMENT_ASSOCIATE) == NULL) { BUS_SET_OOM (error); @@ -1748,7 +1750,7 @@ start_selinux_child (BusConfigParser *parser, if (own_copy) dbus_free (own_copy); - if (context_copy) + if (context_copy) dbus_free (context_copy); BUS_SET_OOM (error); @@ -1767,7 +1769,7 @@ bus_config_parser_start_element (BusConfigParser *parser, _DBUS_ASSERT_ERROR_IS_CLEAR (error); /* printf ("START: %s\n", element_name); */ - + t = top_element_type (parser); if (t == ELEMENT_NONE) @@ -1776,7 +1778,7 @@ bus_config_parser_start_element (BusConfigParser *parser, { if (!check_no_attributes (parser, "busconfig", attribute_names, attribute_values, error)) return FALSE; - + if (push_element (parser, ELEMENT_BUSCONFIG) == NULL) { BUS_SET_OOM (error); @@ -1817,7 +1819,7 @@ bus_config_parser_start_element (BusConfigParser *parser, "Element <%s> is not allowed in this context", element_name); return FALSE; - } + } } static dbus_bool_t @@ -1831,7 +1833,7 @@ set_limit (BusConfigParser *parser, must_be_int = FALSE; must_be_positive = FALSE; - + if (strcmp (name, "max_incoming_bytes") == 0) { must_be_positive = TRUE; @@ -1929,7 +1931,7 @@ set_limit (BusConfigParser *parser, name); return FALSE; } - + if (must_be_positive && value < 0) { dbus_set_error (error, DBUS_ERROR_FAILED, @@ -1947,7 +1949,7 @@ set_limit (BusConfigParser *parser, return FALSE; } - return TRUE; + return TRUE; } dbus_bool_t @@ -1962,7 +1964,7 @@ bus_config_parser_end_element (BusConfigParser *parser, _DBUS_ASSERT_ERROR_IS_CLEAR (error); /* printf ("END: %s\n", element_name); */ - + t = top_element_type (parser); if (t == ELEMENT_NONE) @@ -2066,7 +2068,7 @@ make_full_path (const DBusString *basedir, { if (!_dbus_string_copy (basedir, 0, full_path, 0)) return FALSE; - + if (!_dbus_concat_dir_and_file (full_path, filename)) return FALSE; @@ -2087,7 +2089,7 @@ include_file (BusConfigParser *parser, BusConfigParser *included; const char *filename_str; DBusError tmp_error; - + dbus_error_init (&tmp_error); filename_str = _dbus_string_get_const_data (filename); @@ -2100,7 +2102,7 @@ include_file (BusConfigParser *parser, filename_str); return FALSE; } - + if (! _dbus_list_append (&parser->included_files, (void *) filename_str)) { BUS_SET_OOM (error); @@ -2177,7 +2179,7 @@ servicehelper_path (BusConfigParser *parser, * It also allows the parser test suite to successfully parse * test cases without installing the helper. ;-) */ - + return TRUE; } @@ -2191,7 +2193,7 @@ include_dir (BusConfigParser *parser, DBusError tmp_error; DBusDirIter *dir; char *s; - + if (!_dbus_string_init (&filename)) { BUS_SET_OOM (error); @@ -2199,7 +2201,7 @@ include_dir (BusConfigParser *parser, } retval = FALSE; - + dir = _dbus_directory_open (dirname, error); if (dir == NULL) @@ -2221,7 +2223,7 @@ include_dir (BusConfigParser *parser, BUS_SET_OOM (error); _dbus_string_free (&full_path); goto failed; - } + } if (!_dbus_concat_dir_and_file (&full_path, &filename)) { @@ -2229,7 +2231,7 @@ include_dir (BusConfigParser *parser, _dbus_string_free (&full_path); goto failed; } - + if (_dbus_string_ends_with_c_str (&full_path, ".conf")) { if (!include_file (parser, &full_path, TRUE, error)) @@ -2263,10 +2265,10 @@ include_dir (BusConfigParser *parser, } retval = TRUE; - + failed: _dbus_string_free (&filename); - + if (dir) _dbus_directory_close (dir); @@ -2285,13 +2287,13 @@ bus_config_parser_content (BusConfigParser *parser, #if 0 { const char *c_str; - + _dbus_string_get_const_data (content, &c_str); printf ("CONTENT %d bytes: %s\n", _dbus_string_get_length (content), c_str); } #endif - + e = peek_element (parser); if (e == NULL) { @@ -2318,8 +2320,8 @@ bus_config_parser_content (BusConfigParser *parser, case ELEMENT_FORK: case ELEMENT_SYSLOG: case ELEMENT_KEEP_UMASK: - case ELEMENT_STANDARD_SESSION_SERVICEDIRS: - case ELEMENT_STANDARD_SYSTEM_SERVICEDIRS: + case ELEMENT_STANDARD_SESSION_SERVICEDIRS: + case ELEMENT_STANDARD_SYSTEM_SERVICEDIRS: case ELEMENT_ALLOW_ANONYMOUS: case ELEMENT_SELINUX: case ELEMENT_ASSOCIATE: @@ -2338,10 +2340,10 @@ bus_config_parser_content (BusConfigParser *parser, char *s; e->had_content = TRUE; - + if (!_dbus_string_copy_data (content, &s)) goto nomem; - + dbus_free (parser->pidfile); parser->pidfile = s; } @@ -2397,12 +2399,12 @@ bus_config_parser_content (BusConfigParser *parser, case ELEMENT_SERVICEHELPER: { DBusString full_path; - + e->had_content = TRUE; if (!_dbus_string_init (&full_path)) goto nomem; - + if (!make_full_path (&parser->basedir, content, &full_path)) { _dbus_string_free (&full_path); @@ -2418,22 +2420,22 @@ bus_config_parser_content (BusConfigParser *parser, _dbus_string_free (&full_path); } break; - + case ELEMENT_INCLUDEDIR: { DBusString full_path; - + e->had_content = TRUE; if (!_dbus_string_init (&full_path)) goto nomem; - + if (!make_full_path (&parser->basedir, content, &full_path)) { _dbus_string_free (&full_path); goto nomem; } - + if (!include_dir (parser, &full_path, error)) { _dbus_string_free (&full_path); @@ -2443,16 +2445,16 @@ bus_config_parser_content (BusConfigParser *parser, _dbus_string_free (&full_path); } break; - + case ELEMENT_USER: { char *s; e->had_content = TRUE; - + if (!_dbus_string_copy_data (content, &s)) goto nomem; - + dbus_free (parser->user); parser->user = s; } @@ -2466,18 +2468,18 @@ bus_config_parser_content (BusConfigParser *parser, if (!_dbus_string_copy_data (content, &s)) goto nomem; - + dbus_free (parser->bus_type); parser->bus_type = s; } break; - + case ELEMENT_LISTEN: { char *s; e->had_content = TRUE; - + if (!_dbus_string_copy_data (content, &s)) goto nomem; @@ -2493,7 +2495,7 @@ bus_config_parser_content (BusConfigParser *parser, case ELEMENT_AUTH: { char *s; - + e->had_content = TRUE; if (!_dbus_string_copy_data (content, &s)) @@ -2512,18 +2514,18 @@ bus_config_parser_content (BusConfigParser *parser, { char *s; DBusString full_path; - + e->had_content = TRUE; if (!_dbus_string_init (&full_path)) goto nomem; - + if (!make_full_path (&parser->basedir, content, &full_path)) { _dbus_string_free (&full_path); goto nomem; } - + if (!_dbus_string_copy_data (&full_path, &s)) { _dbus_string_free (&full_path); @@ -2592,10 +2594,10 @@ bus_config_parser_finished (BusConfigParser *parser, if (parser->is_toplevel && parser->listen_on == NULL) { dbus_set_error (error, DBUS_ERROR_FAILED, - "Configuration file needs one or more elements giving addresses"); + "Configuration file needs one or more elements giving addresses"); return FALSE; } - + return TRUE; } @@ -2677,7 +2679,7 @@ bus_config_parser_steal_policy (BusConfigParser *parser) BusPolicy *policy; _dbus_assert (parser->policy != NULL); /* can only steal the policy 1 time */ - + policy = parser->policy; parser->policy = NULL; @@ -2871,7 +2873,7 @@ process_test_valid_subdir (const DBusString *test_base_dir, /* if (!_dbus_test_oom_handling ("config-loader", check_loader_oom_func, &d)) */ if (!check_loader_oom_func (&d)) _dbus_assert_not_reached ("test failed"); - + _dbus_string_free (&full_path); } @@ -2964,7 +2966,7 @@ lists_of_elements_equal (DBusList *a, ia = a; ib = b; - + while (ia != NULL && ib != NULL) { if (elements_equal (ia->data, ib->data)) @@ -2985,7 +2987,7 @@ lists_of_c_strings_equal (DBusList *a, ia = a; ib = b; - + while (ia != NULL && ib != NULL) { if (strcmp (ia->data, ib->data)) @@ -3041,7 +3043,7 @@ config_parsers_equal (const BusConfigParser *a, if (!lists_of_c_strings_equal (a->service_dirs, b->service_dirs)) return FALSE; - + /* FIXME: compare policy */ /* FIXME: compare service selinux ID table */ @@ -3156,7 +3158,7 @@ all_are_equiv (const DBusString *target_directory) _dbus_directory_close (dir); return retval; - + } static dbus_bool_t @@ -3216,7 +3218,7 @@ process_test_equiv_subdir (const DBusString *test_base_dir, if (!_dbus_concat_dir_and_file (&full_path, &filename)) _dbus_assert_not_reached ("couldn't concat file to dir"); - + equal = all_are_equiv (&full_path); _dbus_string_free (&full_path); @@ -3233,10 +3235,10 @@ process_test_equiv_subdir (const DBusString *test_base_dir, _dbus_directory_close (dir); return retval; - + } -static const char *test_session_service_dir_matches[] = +static const char *test_session_service_dir_matches[] = { #ifdef DBUS_UNIX "/testusr/testlocal/testshare/dbus-1/services", @@ -3265,15 +3267,15 @@ test_default_session_servicedirs (void) common_progs = _dbus_getenv ("CommonProgramFiles"); #ifndef DBUS_UNIX - if (common_progs) + if (common_progs) { - if (!_dbus_string_append (&progs, common_progs)) + if (!_dbus_string_append (&progs, common_progs)) { _dbus_string_free (&progs); return FALSE; } - if (!_dbus_string_append (&progs, "/dbus-1/services")) + if (!_dbus_string_append (&progs, "/dbus-1/services")) { _dbus_string_free (&progs); return FALSE; @@ -3291,7 +3293,7 @@ test_default_session_servicedirs (void) while ((link = _dbus_list_pop_first_link (&dirs))) { DBusString path; - + printf (" default service dir: %s\n", (char *)link->data); _dbus_string_init_const (&path, (char *)link->data); if (!_dbus_string_ends_with_c_str (&path, "dbus-1/services")) @@ -3302,7 +3304,7 @@ test_default_session_servicedirs (void) _dbus_string_free (&progs); return FALSE; } - + dbus_free (link->data); _dbus_list_free_link (link); } @@ -3330,11 +3332,11 @@ test_default_session_servicedirs (void) _dbus_string_free (&progs); return FALSE; } - - if (strcmp (test_session_service_dir_matches[i], + + if (strcmp (test_session_service_dir_matches[i], (char *)link->data) != 0) { - printf ("%s directory does not match %s in the match set\n", + printf ("%s directory does not match %s in the match set\n", (char *)link->data, test_session_service_dir_matches[i]); dbus_free (link->data); @@ -3348,7 +3350,7 @@ test_default_session_servicedirs (void) dbus_free (link->data); _dbus_list_free_link (link); } - + if (test_session_service_dir_matches[i] != NULL) { printf ("extra data %s in the match set was not matched\n", @@ -3357,12 +3359,12 @@ test_default_session_servicedirs (void) _dbus_string_free (&progs); return FALSE; } - + _dbus_string_free (&progs); return TRUE; } -static const char *test_system_service_dir_matches[] = +static const char *test_system_service_dir_matches[] = { #ifdef DBUS_UNIX "/testusr/testlocal/testshare/dbus-1/system-services", @@ -3388,15 +3390,15 @@ test_default_system_servicedirs (void) common_progs = _dbus_getenv ("CommonProgramFiles"); #ifndef DBUS_UNIX - if (common_progs) + if (common_progs) { - if (!_dbus_string_append (&progs, common_progs)) + if (!_dbus_string_append (&progs, common_progs)) { _dbus_string_free (&progs); return FALSE; } - if (!_dbus_string_append (&progs, "/dbus-1/system-services")) + if (!_dbus_string_append (&progs, "/dbus-1/system-services")) { _dbus_string_free (&progs); return FALSE; @@ -3414,7 +3416,7 @@ test_default_system_servicedirs (void) while ((link = _dbus_list_pop_first_link (&dirs))) { DBusString path; - + printf (" default service dir: %s\n", (char *)link->data); _dbus_string_init_const (&path, (char *)link->data); if (!_dbus_string_ends_with_c_str (&path, "dbus-1/system-services")) @@ -3425,7 +3427,7 @@ test_default_system_servicedirs (void) _dbus_string_free (&progs); return FALSE; } - + dbus_free (link->data); _dbus_list_free_link (link); } @@ -3453,11 +3455,11 @@ test_default_system_servicedirs (void) _dbus_string_free (&progs); return FALSE; } - - if (strcmp (test_system_service_dir_matches[i], + + if (strcmp (test_system_service_dir_matches[i], (char *)link->data) != 0) { - printf ("%s directory does not match %s in the match set\n", + printf ("%s directory does not match %s in the match set\n", (char *)link->data, test_system_service_dir_matches[i]); dbus_free (link->data); @@ -3471,7 +3473,7 @@ test_default_system_servicedirs (void) dbus_free (link->data); _dbus_list_free_link (link); } - + if (test_system_service_dir_matches[i] != NULL) { printf ("extra data %s in the match set was not matched\n", @@ -3480,11 +3482,11 @@ test_default_system_servicedirs (void) _dbus_string_free (&progs); return FALSE; } - + _dbus_string_free (&progs); return TRUE; } - + dbus_bool_t bus_config_parser_test (const DBusString *test_data_dir) { @@ -3514,4 +3516,3 @@ bus_config_parser_test (const DBusString *test_data_dir) } #endif /* DBUS_BUILD_TESTS */ - -- cgit