summaryrefslogtreecommitdiff
path: root/dbus/dbus-transport-socket.c
AgeCommit message (Collapse)AuthorFilesLines
2014-01-06_dbus_auth_return_buffer(): remove unused argumentChengwei Yang1-2/+1
The argument bytes_read of _dbus_auth_return_buffer() function isn't used at all, so remove it. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=71477 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-10-08dbus-message.c: unused variable bytes_read in _dbus_message_loader_get_bufferVasiliy Balyasnyy1-11/+4
Bug: https://bugs.freedesktop.org/show_bug.cgi?id=70218 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
2013-08-23Fix confusion between "is it authenticated?" and "try to authenticate"Simon McVittie1-8/+8
Historically, _dbus_transport_get_is_authenticated() has had the side-effect of trying to advance the authentication state machine (if there's enough buffered input to do so). This seems an inappropriate activity for what looks like a simple getter. Split it into _dbus_transport_try_to_authenticate (which does what it always used to do) and _dbus_transport_peek_is_authenticated (which is the simple getter version). To minimize the difference in behaviour for the stable branch of D-Bus, I've only used _dbus_transport_peek_is_authenticated where it was used in an assertion, which should clearly not have side effects (and I've checked that the asserting function cannot be called until both authentication and authorization have completed). Replacing most of the calls to get_is_authenticated with try_to_authenticate is a possible piece of future work. Based on patches from Cosimo Alfarano, who noticed this assertion-with-side-effects. Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk> https://bugs.freedesktop.org/show_bug.cgi?id=39720 Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.com>
2013-08-22Doc: fix incorrect param names, missing params, non-exist paramsChengwei Yang1-1/+1
Signed-off-by: Chengwei Yang <chengwei.yang@intel.com> Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=65755
2012-06-05_dbus_transport_new_for_tcp_socket: add missing commas to addressSimon McVittie1-2/+2
Ralf pointed out that the address doesn't round-trip correctly. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=45896 Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk> Reviewed-by: Ralf Habacker <ralf.habacker@freenet.de> Tested-by: Ralf Habacker <ralf.habacker@freenet.de>
2011-07-28_dbus_connection_message_sent: rename to _unlockedSimon McVittie1-2/+2
It's called with the connection's lock held. Reviewed-by: Colin Walters <walters@verbum.org> Bug: https://bugs.freedesktop.org/show_bug.cgi?id=34393
2011-06-13Always remove, invalidate and free watches before closing watched socketsSimon McVittie1-0/+2
This should mean we don't get invalid fds in the main loop. The BSD (kqueue) and Windows code paths are untested, but follow the same patterns as the tested Linux/generic Unix versions. DBusTransportSocket was already OK (it called free_watches() before _dbus_close_socket, and that did the remove, invalidate, unref dance). Bug: https://bugs.freedesktop.org/show_bug.cgi?id=33336 Reviewed-by: Will Thompson <will.thompson@collabora.co.uk> Reviewed-by: Thiago Macieira <thiago@kde.org>
2010-03-27Cleaned up _dbus_verbose calls: function names and code line numbers are ↵Ralf Habacker1-10/+8
printed by default.
2010-03-19Consistently include <config.h> in all C source files and never in header files.Marcus Brinkmann1-0/+1
2010-03-16Merge branch 'dbus-1.2'Colin Walters1-3/+1
Conflicts: bus/bus.c configure.in
2010-03-15Fix double-free in error case.Marcus Brinkmann1-3/+1
Signed-off-by: Thiago Macieira <thiago@kde.org>
2009-12-01Fixes to the nonce codeFrank Osterfeld1-0/+1
Cherry-picked from commit f9bc0f4bd036f6ede5d9850fb0f8587178c85f44 in the dbus4win repository, slightly massaged to apply by tml@iki.fi.
2009-12-01Add api dox for nonce-tcpFrank Osterfeld1-2/+1
Cherry-picked from commit e7a070db22ed4a84dc04a062255356c9f6c4c9c5 in the dbus4win repository, trailing whitespace issues corrected by tml@iki.fi.
2009-12-01The current state of the nonce-tcp implementationFrank Osterfeld1-6/+25
Merged and cleaned up patch from my [Frank Osterfeld's] local work branch. Cherry-picked from commit e2801eca57b2d9e09afd662ed5ef6fc83be73afc and edited by tml@iki.fi to make it apply, and fixing whitespace issues.
2009-07-16Merge branch 'fd-passing'Thiago Macieira1-24/+85
Conflicts: dbus/dbus-connection.c dbus/dbus-message-util.c dbus/dbus-sysdeps-unix.c
2009-07-14Bug 896 - Avoid race conditions reading message from exited processColin Walters1-8/+28
Patch based on extensive work from Michael Meeks <michael.meeks@novell.com>, thanks to Dafydd Harries <dafydd.harries@collabora.co.uk>, Kimmo Hämäläinen <kimmo.hamalainen@nokia.com> and others. The basic idea with this bug is that we effectively ignore errors on write. Only when we're done reading from a connection do we close down a connection. This avoids a race condition where if a process (such as dbus-send) exited while we still had data to read in the buffer, we'd miss that data. (cherry picked from commit 0e36cdd54964c4012acec2bb8e598b85e82d2846)
2009-07-14Bug 21161 - Update the FSF addressTobias Mueller1-1/+1
No comment. Signed-off-by: Colin Walters <walters@verbum.org> (cherry picked from commit 5baf2f856a9c6625993234855b07680da1c8916f)
2009-07-13Bug 896 - Avoid race conditions reading message from exited processColin Walters1-8/+28
Patch based on extensive work from Michael Meeks <michael.meeks@novell.com>, thanks to Dafydd Harries <dafydd.harries@collabora.co.uk>, Kimmo Hämäläinen <kimmo.hamalainen@nokia.com> and others. The basic idea with this bug is that we effectively ignore errors on write. Only when we're done reading from a connection do we close down a connection. This avoids a race condition where if a process (such as dbus-send) exited while we still had data to read in the buffer, we'd miss that data.
2009-07-10Bug 21161 - Update the FSF addressTobias Mueller1-1/+1
No comment. Signed-off-by: Colin Walters <walters@verbum.org>
2009-05-20unix-fd: add logic to count unix fds the same way as allocated memoryLennart Poettering1-1/+2
This make all counters count both bytes of memory and unix fds.
2009-05-20auth: add fd passing negotiation supportLennart Poettering1-3/+3
This adds two new directives to the auth protocol: NEGOTIATE_UNIX_FD is sent by the client after the authentication was sucessful, i.e. OK was received. AGREE_UNIX_FD is then sent by the server if it can do unix fd passing as well. ERROR is returned when the server cannot or is unwilling to do unix fd passing. This should be compatible with existing D-Bus implementations which will naturally return ERROR on NEGOTIATE_UNIX_FD.
2009-05-20cloexec: set all sockets that are created with SOCK_CLOEXECLennart Poettering1-2/+0
Since all socket users enable FD_CLOEXEC anyway we can just do that in _dbus_open_socket() and be done with it for all cases. By side effect this allows us to use SOCK_CLOEXEC and hence close the CLOEXEC race.
2009-05-20unix-fd: add message encoding/decoding for unix fdsLennart Poettering1-21/+83
When appending unix fds to the message a new entry in the fd array will be allocated and the index to it will be written to the message payload. When parsing unix fds from the message the index will be read from the payload and then looked up in the fd array. When we read fds we put them in a queue first. Since each message knows how many fds are attached to it we will then pop enough fds from this queue each time we decode a message from the stream. This should make sending and receiving more portable since we don't make any strong requirements on the exact semantics of the SCM_RIGHTS implementation: as long as fds are recieved in order, none or lost and the arrive at the same time as at least one byte from the actual message dat we should be able to handle them correctly.
2009-05-06Bug 19567 - Make marshaling code usable without DBusConnectionWilliam Lachance1-1/+1
Some projects want to reuse the DBus message format, without actually going through a DBusConnection. This set of changes makes a few functions from DBusMessage public, and adds a new function to determine the number of bytes needed to demarshal a message. Signed-off-by: Colin Walters <walters@verbum.org>
2009-04-21Bug 19567 - Make marshaling code usable without DBusConnectionWilliam Lachance1-1/+1
Some projects want to reuse the DBus message format, without actually going through a DBusConnection. This set of changes makes a few functions from DBusMessage public, and adds a new function to determine the number of bytes needed to demarshal a message. Signed-off-by: Colin Walters <walters@verbum.org>
2008-01-14return message loader buffer in case of OOM (FDO Bug#12666)John (J5) Palmieri1-0/+4
2008-01-14 John (J5) Palmieri <johnp@redhat.com> * patch by Kimmo Hämäläinen <kimmo dot hamalainen at nokia dot com> * dbus/dbus-transport-socket.c(do_reading): return message loader buffer in case of OOM (FDO Bug#12666)
2007-10-11Use DBUS_ERROR_INIT instead of dbus_error_init wherever it's clearly equivalentSimon McVittie1-2/+1
2007-09-20Add support for compacting DBusStrings to release wasted memory.Ryan Lortie1-0/+2
2007-09-19 Ryan Lortie <desrt@desrt.ca> * dbus/dbus-string.[ch] (compact, _dbus_string_compact, _dbus_string_lock): new compact function to free up allocated memory that is no longer used. * dbus/dbus-message.c (load_message): call _dbus_string_compact on the message loader buffer. * dbus/dbus-transport-socket.c (do_reading, do_writing): call _dbus_string_compact on the incoming/outgoing "encoded" buffers. * dbus/dbus-string-util.c (_dbus_string_test): add a few tests for string compacting.
2007-07-25Switch over to using getaddrinfo for TCP clients & servers to enable IPv6Daniel P. Berrange1-24/+21
2007-07-142007-07-13 Havoc Pennington <hp@redhat.com>Havoc Pennington1-1/+1
* Add indent-tabs-mode: nil to all file headers.
2007-06-182007-06-18 Havoc Pennington <hp@redhat.com>Havoc Pennington1-1/+7
* dbus/dbus-sysdeps-unix.c (_dbus_read_credentials_socket): clean this up a little bit, to try and understand why telnet'ing to a server and sending a non-nul byte didn't disconnect immediately; now it seems that it does disconnect immediately as it should, though I don't understand what has changed.
2007-06-182007-06-18 Havoc Pennington <hp@redhat.com>Havoc Pennington1-1/+1
* dbus/dbus-watch.c (dbus_watch_get_socket) (dbus_watch_get_unix_fd): new API to match DBusConnection (dbus_watch_get_fd): deprecate this Throughout: just s/dbus_watch_get_fd/dbus_watch_get_socket/g for now since all the transports use sockets anyway
2007-06-152007-06-15 Havoc Pennington <hp@redhat.com>Havoc Pennington1-16/+12
* dbus/dbus-sysdeps.c (_dbus_set_errno_to_zero) (_dbus_get_is_errno_nonzero, _dbus_get_is_errno_eintr) (_dbus_strerror_from_errno): family of functions to abstract errno, though these are somewhat bogus (really we should make our socket wrappers not use errno probably - the issue is that any usage of errno that isn't socket-related probably is not cross-platform, so should either be in a unix-only file that can use errno directly, or is a bug - these general errno wrappers hide issues of this nature in non-socket code, while socket-specific API changes would not since sockets are allowed cross-platform)
2007-06-092007-06-09 Havoc Pennington <hp@redhat.com>Havoc Pennington1-10/+21
* bus/dispatch.c (check_get_connection_unix_process_id): adapt since sysdeps-unix.h stuff isn't included anymore * bus/bus.c (bus_context_new): use more abstract functions to change user, so they can be no-ops on Windows * dbus/dbus-credentials.c, dbus/dbus-credentials.h, dbus/dbus-credentials-util.c: new files containing a fully opaque DBusCredentials data type to replace the old not opaque one. * configure.in (DBUS_UNIX): define DBUS_UNIX to match DBUS_WIN on windows * dbus/dbus-userdb.h: prohibit on Windows, next step is to clean up the uses of it in bus/*.c and factor out the parts of cookie auth that depend on it
2006-10-202006-10-19 Havoc Pennington <hp@redhat.com>Havoc Pennington1-0/+8
* Fix a pile of Doxygen warnings and missing docs
2006-10-13* dbus-transport-socket.c (exchange_credentials):John (J5) Palmieri1-4/+11
Print out more detailed errors if reading or sending credentials fail (Patch from Julio M. Merino Vidal <jmmv at NetBSD dot org>)
2006-09-162006-09-16 Havoc Pennington <hp@redhat.com>Havoc Pennington1-0/+54
* dbus/dbus-transport.c (_dbus_transport_open): modify to delegate to _dbus_transport_open_platform_specific, _dbus_transport_open_socket, and _dbus_transport_open_debug_pipe * dbus/dbus-transport-protected.h: add _dbus_transport_open_platform_specific
2006-09-16voc Pennington <hp@redhat.com>Havoc Pennington1-0/+1255
* dbus/dbus-server.c (dbus_server_listen): change how this works to be able to delegate to a set of handlers that can succeed, fail, or choose not to handle. Allows us to have dbus_server_listen_platform_specific. * dbus/dbus-server-socket.c (_dbus_server_new_for_tcp_socket): factor out the tcp socket stuff to be used on windows, leaving unix domain socket only in dbus-socket-unix.c * dbus/dbus-transport-socket.c (_dbus_transport_new_for_tcp_socket): factor out the tcp socket stuff to be used on windows, leaving unix domain socket only in dbus-transport-unix.c * dbus/dbus-connection.c (dbus_connection_get_unix_user): insert temporary hack to be sure this fails on windows (dbus_connection_get_unix_process_id): ditto