summaryrefslogtreecommitdiffstats
path: root/dbus/dbus-auth.c
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2003-03-13 00:56:43 +0000
committerHavoc Pennington <hp@redhat.com>2003-03-13 00:56:43 +0000
commit29560adcc79a259a0be3511c056ee7453aa26c04 (patch)
tree57e72dd26b5876da48379e5ff910c63e66cb7001 /dbus/dbus-auth.c
parent799a3ff443f5357ae7857ebe989a7f92f7bd84df (diff)
2003-03-12 Havoc Pennington <hp@redhat.com>
Mega-patch that gets the message bus daemon initially handling out-of-memory. Work still needed. Also lots of random moving stuff to DBusError instead of ResultCode. * dbus/dbus-list.c (_dbus_list_length_is_one): new function * dbus/dbus-connection.c (dbus_connection_send_with_reply_and_block): use DBusError * dbus/dbus-bus.c: adapt to API changes, make it use DBusError not DBusResultCode * dbus/dbus-connection.c (dbus_connection_send): drop the result code here, as the only failure possible is OOM. * bus/connection.c (bus_connection_disconnect): rename bus_connection_disconnected as it's a notification only * bus/driver.c (bus_driver_handle_acquire_service): don't free "name" on get_args failure, should be done by get_args; don't disconnect client for bad args, just return an error. (bus_driver_handle_service_exists): ditto * bus/services.c (bus_services_list): NULL-terminate returned array * bus/driver.c (bus_driver_send_service_lost) (bus_driver_send_service_acquired): send messages from driver to a specific client to the client's unique name, not to the broadcast service. * dbus/dbus-message.c (decode_header_data): reject messages that contain no name field (_dbus_message_get_client_serial): rename to dbus_message_get_serial and make public (_dbus_message_set_serial): rename from set_client_serial (_dbus_message_set_reply_serial): make public (_dbus_message_get_reply_serial): make public * bus/connection.c (bus_connection_foreach): allow stopping iteration by returning FALSE from foreach function. * dbus/dbus-connection.c (dbus_connection_send_preallocated) (dbus_connection_free_preallocated_send) (dbus_connection_preallocate_send): new API for sending a message without possibility of malloc failure. (dbus_connection_send_message): rename to just dbus_connection_send (and same for whole function family) * dbus/dbus-errors.c (dbus_error_free): make this reinit the error * dbus/dbus-sysdeps.c (_dbus_exit): new function * bus/activation.c: handle/return errors * dbus/dbus-errors.h: add more DBUS_ERROR #define * dbus/dbus-sysdeps.c (_dbus_directory_open) (_dbus_file_get_contents) (_dbus_directory_get_next_file): use DBusError instead of DBusResultCode (_dbus_result_from_errno): move to this file
Diffstat (limited to 'dbus/dbus-auth.c')
-rw-r--r--dbus/dbus-auth.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/dbus/dbus-auth.c b/dbus/dbus-auth.c
index 516a51ae..8dfdc766 100644
--- a/dbus/dbus-auth.c
+++ b/dbus/dbus-auth.c
@@ -514,7 +514,7 @@ sha1_handle_first_client_response (DBusAuth *auth,
}
else
{
- _dbus_assert (dbus_error_is_set (&error));
+ _DBUS_ASSERT_ERROR_IS_SET (&error);
_dbus_verbose ("Error loading keyring: %s\n",
error.message);
if (send_rejected (auth))
@@ -535,7 +535,7 @@ sha1_handle_first_client_response (DBusAuth *auth,
auth->cookie_id = _dbus_keyring_get_best_key (auth->keyring, &error);
if (auth->cookie_id < 0)
{
- _dbus_assert (dbus_error_is_set (&error));
+ _DBUS_ASSERT_ERROR_IS_SET (&error);
_dbus_verbose ("Could not get a cookie ID to send to client: %s\n",
error.message);
if (send_rejected (auth))
@@ -844,7 +844,8 @@ handle_client_data_cookie_sha1_mech (DBusAuth *auth,
}
else
{
- _dbus_assert (dbus_error_is_set (&error));
+ _DBUS_ASSERT_ERROR_IS_SET (&error);
+
_dbus_verbose ("Error loading keyring: %s\n",
error.message);
@@ -2238,7 +2239,7 @@ process_test_subdir (const DBusString *test_base_dir,
DBusString filename;
DBusDirIter *dir;
dbus_bool_t retval;
- DBusResultCode result;
+ DBusError error;
retval = FALSE;
dir = NULL;
@@ -2258,22 +2259,23 @@ process_test_subdir (const DBusString *test_base_dir,
_dbus_string_free (&filename);
if (!_dbus_string_init (&filename, _DBUS_INT_MAX))
_dbus_assert_not_reached ("didn't allocate filename string\n");
-
- dir = _dbus_directory_open (&test_directory, &result);
+
+ dbus_error_init (&error);
+ dir = _dbus_directory_open (&test_directory, &error);
if (dir == NULL)
{
const char *s;
_dbus_string_get_const_data (&test_directory, &s);
_dbus_warn ("Could not open %s: %s\n", s,
- dbus_result_to_string (result));
+ error.message);
+ dbus_error_free (&error);
goto failed;
}
printf ("Testing:\n");
- result = DBUS_RESULT_SUCCESS;
next:
- while (_dbus_directory_get_next_file (dir, &filename, &result))
+ while (_dbus_directory_get_next_file (dir, &filename, &error))
{
DBusString full_path;
@@ -2311,12 +2313,13 @@ process_test_subdir (const DBusString *test_base_dir,
_dbus_string_free (&full_path);
}
- if (result != DBUS_RESULT_SUCCESS)
+ if (dbus_error_is_set (&error))
{
const char *s;
_dbus_string_get_const_data (&test_directory, &s);
_dbus_warn ("Could not get next file in %s: %s\n",
- s, dbus_result_to_string (result));
+ s, error.message);
+ dbus_error_free (&error);
goto failed;
}