From 3abcc7d28d73559c1f6d585c619c7298ff79101e Mon Sep 17 00:00:00 2001 From: Olivier Andrieu Date: Sat, 31 Jul 2004 18:28:10 +0000 Subject: * bus/config-parser.c (bus_config_parser_new): fix an invalid _unref in the SELinux support. * doc/busconfig.dtd: update DTD for SELinux support. * bus/config-loader-libxml.c: fix error handler and parser initialisation/cleanup. OOM test now works with libxml2 HEAD. * configure.in: remove the warning about libxml2 * dbus/dbus-bus.c: silence doxygen warning. --- ChangeLog | 14 ++++++++++++++ bus/config-loader-libxml.c | 43 +++++++++++++++++++++---------------------- bus/config-parser.c | 3 --- configure.in | 6 ------ dbus/dbus-bus.c | 2 +- doc/busconfig.dtd | 8 +++++++- 6 files changed, 43 insertions(+), 33 deletions(-) diff --git a/ChangeLog b/ChangeLog index 229872e9..8be41714 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2004-07-31 Olivier Andrieu + + * bus/config-parser.c (bus_config_parser_new): fix an invalid + _unref in the SELinux support. + + * doc/busconfig.dtd: update DTD for SELinux support. + + * bus/config-loader-libxml.c: fix error handler and parser + initialisation/cleanup. OOM test now works with libxml2 HEAD. + + * configure.in: remove the warning about libxml2. + + * dbus/dbus-bus.c: silence doxygen warning. + 2004-07-31 Colin Walters * configure.in: Move #error in SELinux check to its own line. diff --git a/bus/config-loader-libxml.c b/bus/config-loader-libxml.c index a1b8f838..51ee1e59 100644 --- a/bus/config-loader-libxml.c +++ b/bus/config-loader-libxml.c @@ -122,13 +122,12 @@ xml_text_reader_error (void *arg, xmlErrorPtr xml_error) xml_error->code, xml_error->message); #endif - if (!dbus_error_is_set (error) && - (xml_error->level == XML_ERR_ERROR || - xml_error->level == XML_ERR_FATAL)) + if (!dbus_error_is_set (error)) { - if (xml_error->code != XML_ERR_NO_MEMORY) + if (xml_error->code == XML_ERR_NO_MEMORY) _DBUS_SET_OOM (error); - else + else if (xml_error->level == XML_ERR_ERROR || + xml_error->level == XML_ERR_FATAL) dbus_set_error (error, DBUS_ERROR_FAILED, "Error loading config file: '%s'", xml_error->message); @@ -146,7 +145,6 @@ bus_config_load (const DBusString *file, xmlTextReader *reader; BusConfigParser *parser; DBusString dirname, data; - const char *data_str; DBusError tmp_error; int ret; @@ -155,17 +153,6 @@ bus_config_load (const DBusString *file, parser = NULL; reader = NULL; - if (is_toplevel) - { - /* xmlMemSetup only fails if one of the functions is NULL */ - xmlMemSetup (dbus_free, - dbus_malloc, - dbus_realloc, - _dbus_strdup); - xmlInitParser (); - xmlSetGenericErrorFunc (NULL, xml_shut_up); - } - if (!_dbus_string_init (&dirname)) { _DBUS_SET_OOM (error); @@ -179,6 +166,17 @@ bus_config_load (const DBusString *file, return NULL; } + if (is_toplevel) + { + /* xmlMemSetup only fails if one of the functions is NULL */ + xmlMemSetup (dbus_free, + dbus_malloc, + dbus_realloc, + _dbus_strdup); + xmlInitParser (); + xmlSetGenericErrorFunc (NULL, xml_shut_up); + } + if (!_dbus_string_get_dirname (file, &dirname)) { _DBUS_SET_OOM (error); @@ -195,9 +193,8 @@ bus_config_load (const DBusString *file, if (!_dbus_file_get_contents (&data, file, error)) goto failed; - data_str = _dbus_string_get_const_data (&data); - - reader = xmlReaderForMemory (data_str, _dbus_string_get_length (&data), + reader = xmlReaderForMemory (_dbus_string_get_const_data (&data), + _dbus_string_get_length (&data), NULL, NULL, 0); if (reader == NULL) { @@ -295,8 +292,6 @@ bus_config_load (const DBusString *file, reader_out: xmlFreeTextReader (reader); - if (is_toplevel) - xmlCleanupParser(); reader = NULL; if (dbus_error_is_set (&tmp_error)) { @@ -308,6 +303,8 @@ bus_config_load (const DBusString *file, goto failed; _dbus_string_free (&dirname); _dbus_string_free (&data); + if (is_toplevel) + xmlCleanupParser(); _DBUS_ASSERT_ERROR_IS_CLEAR (error); return parser; @@ -315,6 +312,8 @@ bus_config_load (const DBusString *file, _DBUS_ASSERT_ERROR_IS_SET (error); _dbus_string_free (&dirname); _dbus_string_free (&data); + if (is_toplevel) + xmlCleanupParser(); if (parser) bus_config_parser_unref (parser); _dbus_assert (reader == NULL); /* must go to reader_out first */ diff --git a/bus/config-parser.c b/bus/config-parser.c index 29fade16..89492f03 100644 --- a/bus/config-parser.c +++ b/bus/config-parser.c @@ -346,9 +346,6 @@ bus_config_parser_new (const DBusString *basedir, _dbus_string_free (&parser->basedir); - if (parser->service_sid_table == NULL) - _dbus_hash_table_unref (parser->service_sid_table); - dbus_free (parser); return NULL; } diff --git a/configure.in b/configure.in index cbc4774e..75eab6e0 100644 --- a/configure.in +++ b/configure.in @@ -672,12 +672,6 @@ else fi fi -if $dbus_use_libxml ; then - dnl libxml OOM handling is a bit broken - AC_MSG_WARN([libxml loader is not as robust as the expat one wrt. OOM handling]) -fi - - AM_CONDITIONAL(DBUS_USE_EXPAT, $dbus_use_expat) AM_CONDITIONAL(DBUS_USE_LIBXML, $dbus_use_libxml) diff --git a/dbus/dbus-bus.c b/dbus/dbus-bus.c index 4dd2eaf9..567468ff 100644 --- a/dbus/dbus-bus.c +++ b/dbus/dbus-bus.c @@ -549,7 +549,7 @@ dbus_bus_get_base_service (DBusConnection *connection) * Asks the bus to return the uid of a service. * * @param connection the connection - * @param service_name the service name + * @param service the service name * @param error location to store the error * @returns a result code, -1 if error is set */ diff --git a/doc/busconfig.dtd b/doc/busconfig.dtd index 97c0b82e..5414bc5b 100644 --- a/doc/busconfig.dtd +++ b/doc/busconfig.dtd @@ -8,7 +8,8 @@ auth | include | policy | - limit)*> + limit | + selinux)*> @@ -50,3 +51,8 @@ + + + -- cgit