From d3fb6f35716ff1d6f6644dea2043d539007811de Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Fri, 18 Apr 2003 17:45:34 +0000 Subject: 2003-04-18 Havoc Pennington * dbus/dbus-auth.c (record_mechanisms): memleak fixes * dbus/dbus-sysdeps.c (_dbus_string_save_to_file): fix some memleaks * dbus/dbus-keyring.c (add_new_key): fix a memleak, and on realloc be sure to update the pointer in the keyring * dbus/dbus-string.c (_dbus_string_zero): compensate for align offset to avoid writing to unallocated memory * dbus/dbus-auth.c (process_rejected): return FALSE if we fail to try the next mechanism, so we properly handle OOM * dbus/dbus-keyring.c (_dbus_keyring_new_homedir): fix double-free on OOM. (_dbus_keyring_new): fix OOM bug (_dbus_keyring_new_homedir): always set error; impose a maximum number of keys we'll load from the file, mostly to speed up the test suite and make its OOM checks more useful, but also for general sanity. * dbus/dbus-auth.c (process_error_server): reject authentication if we get an error from the client (process_cancel): on cancel, send REJECTED, per the spec (process_error_client): send CANCEL if we get an error from the server. --- dbus/dbus-transport-unix.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'dbus/dbus-transport-unix.c') diff --git a/dbus/dbus-transport-unix.c b/dbus/dbus-transport-unix.c index 37012b88..fbf334e4 100644 --- a/dbus/dbus-transport-unix.c +++ b/dbus/dbus-transport-unix.c @@ -345,40 +345,47 @@ do_authentication (DBusTransport *transport, transport->receive_credentials_pending); goto out; } - + +#define TRANSPORT_SIDE(t) ((t)->is_server ? "server" : "client") switch (_dbus_auth_do_work (transport->auth)) { case DBUS_AUTH_STATE_WAITING_FOR_INPUT: - _dbus_verbose (" auth state: waiting for input\n"); + _dbus_verbose (" %s auth state: waiting for input\n", + TRANSPORT_SIDE (transport)); if (!do_reading || !read_data_into_auth (transport, &oom)) goto out; break; case DBUS_AUTH_STATE_WAITING_FOR_MEMORY: - _dbus_verbose (" auth state: waiting for memory\n"); + _dbus_verbose (" %s auth state: waiting for memory\n", + TRANSPORT_SIDE (transport)); oom = TRUE; goto out; break; case DBUS_AUTH_STATE_HAVE_BYTES_TO_SEND: - _dbus_verbose (" auth state: bytes to send\n"); + _dbus_verbose (" %s auth state: bytes to send\n", + TRANSPORT_SIDE (transport)); if (!do_writing || !write_data_from_auth (transport)) goto out; break; case DBUS_AUTH_STATE_NEED_DISCONNECT: - _dbus_verbose (" auth state: need to disconnect\n"); + _dbus_verbose (" %s auth state: need to disconnect\n", + TRANSPORT_SIDE (transport)); do_io_error (transport); break; case DBUS_AUTH_STATE_AUTHENTICATED_WITH_UNUSED_BYTES: - _dbus_verbose (" auth state: auth with unused bytes\n"); + _dbus_verbose (" %s auth state: auth with unused bytes\n", + TRANSPORT_SIDE (transport)); /* We'll recover the unused bytes in dbus-transport.c */ goto out; break; case DBUS_AUTH_STATE_AUTHENTICATED: - _dbus_verbose (" auth state: authenticated\n"); + _dbus_verbose (" %s auth state: authenticated\n", + TRANSPORT_SIDE (transport)); break; } } -- cgit