summaryrefslogtreecommitdiff
path: root/dbus/dbus-sysdeps-unix.h
Commit message (Collapse)AuthorAgeFilesLines
* Split _dbus_fd_set_close_on_exec into Unix and Windows versionsSimon McVittie2014-09-151-0/+2
| | | | | | | | | | | | | | | | | | | | | On Unix, the thing that can be made close-on-exec is a file descriptor, which is an int. On Windows, the thing that can be made close-on-exec is a HANDLE, which is pointer-sized (but not necessarily a pointer!). In practice, on Windows we only called _dbus_fd_set_close_on_exec() on socket pseudo-file-descriptors (SOCKET, which is an unsigned int); every SOCKET can validly be cast to HANDLE, but not every HANDLE is a SOCKET. Before this commit we used an intptr_t as a sort of fake union { int; HANDLE; }, which just obscures what's going on. In practice, everything that called _dbus_fd_set_close_on_exec() is really platform-specific anyway, so let's just have two separate functions and call this solved. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=39610
* Set correct address when using --address=systemd:Simon Peeters2012-10-081-0/+4
| | | | | | | | | | | | | | | When dbus gets launched through systemd, we need to create an address string based on the sockets passed. The _dbus_append_addres_from_socket() function is responsible for extracting the address information from the file-descriptor and formatting it in a dbus friendly way. This fixes bus activation when running dbus under a systemd session. https://bugs.freedesktop.org/show_bug.cgi?id=50962 Signed-off-by: Simon Peeters <peeters.simon@gmail.com>
* transport: add new unixexec transport on UnixLennart Poettering2012-03-121-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The "unixexec:" transport will create a local AF_UNIX socket with socketpair(), then fork and execute a binary on one side with STDIN and STDOUT connected to it and then use the other side. This is useful to implement D-Bus tunneling schemes, for example to get a D-Bus connection to the system bus on a different host, similar how udisks is already doing it. (udisks uses SSH TCP tunneling for this, which is a bit ugly and less secure than this solution). Suggested use is with connection strings like the following: unixexec:path=ssh,argv1=foobar,argv2=system-bus-bridge or: unixexec:path=pkexec,argv1=system-bus-bridge or even: unixexec:path=sudo,argv1=system-bus-bridge The first line would execute the binary 'system-bus-bridge' on host 'foobar' and then pass D-Bus traffic to it. This (hypothetical) bridge binary would then forward the information to the local system bus. The second and third line use this scheme locally to acquire a privileged connection through pkexec resp. sudo: instead of connecting directly to the bus, they use the same bridge binary which will forward all information to the system bus. The arguments of the protocol are 'path' for the first execlp() argument, and argv0, argv1, and so on for the following arguments. argv0 can be left out in which case path will be used. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=35230 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
* sysdeps-unix: introduce dbus_close_all() and make use of it where appropriateLennart Poettering2012-03-121-0/+2
| | | | | | | | This is optimized on Linux and enumerates through /proc/self/fd with a fallback on brute-force closing of fds, in case /proc is not available. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=35230 Reviewed-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
* _dbus_getgid: remove, unusedSimon McVittie2012-02-101-1/+0
| | | | | | Bug: https://bugs.freedesktop.org/show_bug.cgi?id=39759 Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk> Reviewed-by: Lennart Poettering <lennart@poettering.net>
* _dbus_open_unix_socket: make staticSimon McVittie2011-07-181-2/+0
| | | | It isn't called from outside its translation unit.
* Enable launchd.Benjamin Reed2010-12-061-0/+4
| | | | | | | This patch enables support for Mac OS X's launch daemon for startup as well as sharing of the DBus session bus environment. It includes a LaunchAgent plist for automatic start of the session bus.
* systemd: add systemd-style socket-activationLennart Poettering2010-07-091-6/+9
| | | | | | This is a pretty straightforward implementation of systemd-style socket activation using the reference implementation of the $LISTEN_FDS/$LISTEN_PID env var parsing as supplied by systemd upstream.
* Consistently include <config.h> in all C source files and never in header files.Marcus Brinkmann2010-03-191-1/+0
|
* Merge branch 'fd-passing'Thiago Macieira2009-07-161-1/+3
|\ | | | | | | | | | | | | Conflicts: dbus/dbus-connection.c dbus/dbus-message-util.c dbus/dbus-sysdeps-unix.c
| * sysdeps-unix: introduce _dbus_dup()Lennart Poettering2009-05-201-1/+3
| | | | | | | | | | | | | | This is a simple wrapper around dup()-like functionality. Also handles CLOEXEC and makes sure we don't interfere with the standard I/O file descriptors 0, 1 and 2.
* | Bug 21161 - Update the FSF addressTobias Mueller2009-07-101-1/+1
|/ | | | | | No comment. Signed-off-by: Colin Walters <walters@verbum.org>
* add _dbus_geteuid to fix EXTERNAL authentication in setuid applicationsJohn (J5) Palmieri2008-01-141-0/+1
| | | | | | | | | | | | | | | | | | | | | | 2008-01-14 John (J5) Palmieri <johnp@redhat.com> * Patch by Andrea Luzzardi <scox at sig11 dot org>: creates a _dbus_geteuid function to fix EXTERNAL authentication in setuid applications * dbus/dbus-sysdeps-unix.c (_dbus_geteuid): used to get the effective uid of the running program (_dbus_credentials_add_from_current_process): use geteuid instead of getuid (_dbus_append_user_from_current_process): use geteuid instead of getuid * dbus/dbus-sysdeps-util-unix.c (_dbus_change_to_daemon_user): use geteuid instead of getuid (_dbus_unix_user_is_at_console): use geteuid instead of getuid * dbus/dbus-sysdeps-win.c (_dbus_geteuid): add a windows equivilant that returns DBUS_UID_UNSET
* 2007-07-13 Havoc Pennington <hp@redhat.com>Havoc Pennington2007-07-141-1/+1
| | | | * Add indent-tabs-mode: nil to all file headers.
* 2007-06-09 Havoc Pennington <hp@redhat.com>Havoc Pennington2007-06-091-2/+0
| | | | | | | | | | | | | | | | | | | * bus/policy.c (bus_policy_create_client_policy): gracefully continue if the connection has no unix user - just don't apply any unix user dependent rules. * bus/config-parser.c: remove dbus-userdb.h usage * bus/bus.c: remove dbus-userdb.h usage * dbus/dbus-transport.c (_dbus_transport_get_is_authenticated): support Windows user function; also, fix the logic for checking auth as root in the default auth code (broken in the previous commit) * dbus/dbus-connection.c (dbus_connection_set_windows_user_function): new function (dbus_connection_get_windows_user): new function
* 2007-06-09 Havoc Pennington <hp@redhat.com>Havoc Pennington2007-06-091-0/+57
| | | | | | | | | | | | | | | | | | | * 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-21 Havoc Pennington <hp@redhat.com>Havoc Pennington2006-10-211-0/+9
| | | | | | | * Clean up Doxygen group markers for public API so Doxygen finds everything (not comprehensively fixed for private API). Means all remaining Doxygen warnings are just about missing docs and thus pretty simple to resolve.
* voc Pennington <hp@redhat.com>Havoc Pennington2006-09-161-0/+13
| | | | | | | | | | | | | | | | | | | | * 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
* add forgotten dbus-sydeps-unix.hHavoc Pennington2006-09-161-0/+56