summaryrefslogtreecommitdiffstats
path: root/dbus/dbus-sysdeps-unix.c
Commit message (Collapse)AuthorAgeFilesLines
* desktop-file: fix stat() raceLennart Poettering2009-10-171-192/+193
| | | | | | | | | | | | | | _dbus_desktop_file_load() used to stat the desktop file before reading it, to verify its size. This is both racy and unnecessary since _dbus_file_get_contents() which it uses stats the file anyway -- does that however in a race-free fashion with fstat() instead of stat(). This patch gets rid of the redundant stat(). Also, since the desktop file change logic requires the mtime of the file it read we now export that in _dbus_file_get_contents(). This patch probably breaks Win32 builds, but afaik those are broken anyway.
* Fix compilation on non-Linux: the F_DUPFD_CLOEXEC check was reversedBenjamin Reed2009-07-291-1/+1
| | | | Signed-off-by: Thiago Macieira <thiago@kde.org>
* Merge branch 'fd-passing'Thiago Macieira2009-07-161-37/+463
|\ | | | | | | | | | | | | Conflicts: dbus/dbus-connection.c dbus/dbus-message-util.c dbus/dbus-sysdeps-unix.c
| * atomic: implement atomic operations based on gcc's __sync extensionLennart Poettering2009-05-201-24/+5
| | | | | | | | | | | | | | | | | | | | | | Newer gccs and intel ccs support a __sync extension for making use of atomic operations. This patch replaces the handcrafted x86 atomic operation support with usage of __sync. __sync is supported by more processors and by more compilers than the old assembler code. Also, this extension has been available on gcc for quite a while now for x86, so replacing the old assembler code should only be a loss when very old compiilers are used.
| * memset: replace memset() by _DBUS_ZERO where applicableLennart Poettering2009-05-201-4/+4
| |
| * cloexec: set all sockets that are created with SOCK_CLOEXECLennart Poettering2009-05-201-5/+57
| | | | | | | | | | | | 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.
| * build-system: define _GNU_SOURCE centrallyLennart Poettering2009-05-201-1/+1
| | | | | | | | | | Instead of having everyone define _GNU_SOURCE and similar macros seperately, simply do so centrally by using AC_USE_SYSTEM_EXTENSIONS
| * cloexec: set FD_CLOEXEC for all full duplex pipesLennart Poettering2009-05-201-3/+26
| | | | | | | | | | | | | | All users of full duplex pipes enable FD_CLOEXEC later anyway so let's just do it as part of _dbus_full_duplex_pipe. By side effect this allows to make use of SOCK_CLOEXEC which fixes a race when forking/execing from a different thread at the same time as we ar in this function.
| * sysdeps-unix: add basic IO primitives for unix fd passingLennart Poettering2009-05-201-1/+236
| | | | | | | | | | | | | | | | | | | | | | | | This introduces three new functions: _dbus_read_socket_with_unix_fds _dbus_write_socket_with_unix_fds _dbus_read_socket_with_unix_fds_two These work exactly like their counterpart sans 'with_unix_fds' except that they also send/recieve file descriptors along with the actual payload data.
| * sysdeps-unix: introduce _dbus_socket_can_pass_unix_fd()Lennart Poettering2009-05-201-0/+32
| | | | | | | | | | | | This function can be used to check if a socket can be used to pass file descriptors. On platforms that don't support this at all this is hardcoded to return FALSE.
| * sysdeps-unix: introduce _dbus_dup()Lennart Poettering2009-05-201-0/+42
| | | | | | | | | | | | | | 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.
| * sysdeps-unix: Use MSG_NOSIGNAL when availableLennart Poettering2009-05-151-0/+61
| | | | | | | | | | | | | | | | | | On Linux send()/sendmsg() know the special flag MSG_NOSIGNAL which if set makes sure that no SIGPIPE signal is raised when we write to a socket that has been disconnected. By using this flag we don't have to play games with SIGPIPE which is pretty ugly stuff since it touches the global process context.
* | Cope with dbus-launch not being in DBUS_BINDIRColin Walters2009-07-141-11/+19
| | | | | | | | | | | | | | | | | | This is a temporary hack for systems which use DBUS_BINDIR=/bin, but then move dbus-launch back into /usr/bin. Longer term, we should explicitly support this in upstream code, or even better figure out how to move dbus-launch into /bin (e.g. dynamically load libX11 if available), or have a --with-x11-tools configure option.
* | Bug 19432 - Fix handling of HAVE_CMSGCRED case (FreeBSD)Hasso Tepper2009-07-131-15/+19
| | | | | | | | | | | | | | | | Fixes dbus on FreeBSD and DragonFly systems. The patch is obtained from FreeBSD ports tree. Signed-off-by: Colin Walters <walters@verbum.org>
* | Bug 14259 - Refactor _dbus_get_autolaunch_addressColin Walters2009-07-131-70/+114
| | | | | | | | | | | | Split out the process-launching code, which can be reused for other applications; in particular, a forthcoming patch to parse output from launchd for MacOS X.
* | Bug 14259 - Make session address lookup system-dependentColin Walters2009-07-131-0/+31
| | | | | | | | | | | | | | On some platforms such as MacOS X and Windows, we can't depend on an environment variable to determine the address of the session bus. Create a sysdep function dbus_lookup_session_address which can be filled in with platform-specific code.
* | Bug 14259 - Work around broken getgrouplist on MacOS XBenjamin Reed2009-07-131-11/+39
| | | | | | | | | | | | | | We don't get the number of groups, so allocate an arbitrary larger array. Signed-off-by: Colin Walters <walters@space-ghost.verbum.org>
* | Bug 21161 - Update the FSF addressTobias Mueller2009-07-101-1/+1
| | | | | | | | | | | | No comment. Signed-off-by: Colin Walters <walters@verbum.org>
* | Bug 21347 - Don't fail autolaunching if process has SIGCHLD handlerKurt Miller2009-07-101-0/+13
|/ | | | | | | | | If other code in the process set a global SIGCHLD handler, it will make autolaunching fail spuriously due to waitpid() failing. This fix will temporarily block SIGCHLD delivery. Signed-off-by: Colin Walters <walters@verbum.org>
* Various compiler warning fixesColin Walters2008-12-191-1/+1
|
* Add syslog of security denials and configuration file reloadsColin Walters2008-12-121-1/+0
| | | | | We need to start logging denials so that they become more easily trackable and debuggable.
* Bug 16755: Ensure we use the correct errnoTor Lillqvist2008-09-181-11/+17
| | | | | | | | * dbus/dbus-sysdeps-unix.c: Save errno across cleanup and use it for errors to ensure we display the right error message. Signed-off-by: Colin Walters <walters@verbum.org>
* Bug 17061: Handle error return from sysconf correctlyJoe Marcus Clarke2008-09-041-1/+5
| | | | | | | | | * dbus/dbus-sysdeps-unix.c: * dbus/dbus-sysdeps-util-unix.c: Cast return from sysconf temporarily so we actually see -1. Signed-off-by: Colin Walters <walters@verbum.org>
* Bug 17352: synchronize the file before renamingArtem Bityutskiy2008-09-041-0/+9
| | | | | | | | | | | | | | Dbus is doing atomic file updates by copying them, changing the copy, and re-naming them. However, it does not synchronize the file before re-naming, which results in corruption in case of unclean reboots. The reason for this is that file-systems have write-back cache and they postpone writing data to the media. This patch adds the missed fsync() for the Unix part. I do not have windows so cannot provide a windows port fix. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com> Signed-off-by: Colin Walters <walters@verbum.org>
* Bug 13387: Fix compilation failure with AI_ADDRCONFIGJens Granseuer2008-08-071-2/+2
| | | | Signed-off-by: Colin Walters <walters@verbum.org>
* Bug 15646: Remove spurious debugging fprintf(stderrColin Walters2008-07-281-1/+0
|
* Bug 16727: Handle ERANGE for getgr; fixes user in many groupsMarc Brockschmidt2008-07-281-15/+50
| | | | | | | | | | Patch originally from Noèl Köthe. Modified by Colin Walters <walters@verbum.org> * dbus/dbus-sysdeps-unix.c, dbus/dbus-sysdeps-unix-utils.c: Use a while() loop to reallocate buffer if we get ERANGE return. This fixes the case where a user is in a large number of groups.
* Bug 15740: Solaris/ADT auditing support (simon zheng)Colin Walters2008-06-051-0/+35
| | | | | | | | | | | | | | | | | | | | | | | * bus/driver.c: Add GetAdtAuditSessionData method which returns audit data for a connection. * configure.in: Detect ADT auditing support * dbus/dbus-auth.c: Read ADT auditing creds. * dbus/dbus-connection.c: Implement dbus_connection_get_adt_audit_session_data. * dbus/dbus-connection.h: Export it. * dbus/dbus-credentials.c: Add support for gathering adt_audit_data and retrieving it via _dbus_credentials_get_adt_audit_data. * dbus/dbus-credentials.h: Add DBUS_CREDENTIAL_ADT_AUDIT_DATA_ID. * dbus/dbus-protocol.h: New error DBUS_ERROR_ADT_AUDIT_DATA_UNKNOWN. * dbus/dbus-sysdeps.c: Support for reading audit credentials via ADT API. * dbus/dbus-transport.c: New function _dbus_transport_get_adt_audit_session_data to retrieve credentials. * dbus/dbus-transport.h: Export it.
* Bug 15947: Close file descriptors before execing helper (Markus Rechberger)Colin Walters2008-05-281-4/+13
| | | | | * dbus/dbus-sysdeps-unix.c (_dbus_get_autolaunch_address): Close file descriptors before exec.
* fix broken poll on Mac OSX - build patch by Benjamin ReedJohn (J5) Palmieri2008-03-041-1/+1
| | | | | | * configure.in: check for OSX's deadlocking poll * dbus/dbus-sysdeps-unix.c (_dbus_poll): if we have a broken poll don't use poll
* define _AI_ADDRCONFIG if not defined so that we can compile with an older glibcJohn (J5) Palmieri2008-02-281-0/+4
|
* fix build against the latest gcc/glibcJohn (J5) Palmieri2008-02-211-0/+2
| | | | | | * dbus/dbus-sysdeps-unix.c: define _GNU_SOURCE * bus/selinux.c: include limits.h * Patch by Matthias Clasen <mclasen at redhat.com>
* add OOM handling in various placesJohn (J5) Palmieri2008-01-151-1/+5
| | | | | | | | | | | | | | 2008-01-15 John (J5) Palmieri <johnp@redhat.com> * patches by Kimmo Hämäläinen <kimmo dot hamalainen at nokia dot com> * dbus/dbus-sysdeps-unix (_dbus_get_autolaunch_address): handle OOM (FDO Bug #12945) * dbus/dbus-uuidgen.c (return_uuid): handle OOM (FDO Bug #12928) * dbus/dbus-misc.c (dbus_get_local_machine_id): handle OOM, fix return value to return NULL not FALSE (FDO Bug #12946)
* add _dbus_geteuid to fix EXTERNAL authentication in setuid applicationsJohn (J5) Palmieri2008-01-141-2/+11
| | | | | | | | | | | | | | | | | | | | | | 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
* Fix detection of i486 atomic ops.Simon McVittie2007-10-111-3/+3
| | | | | | Previously, the attempts to determine support at compile-time on Darwin were causing the i486 atomic ops to be used on *all* i386 or x86-64 GCC builds (AH_VERBATIM can't be conditionalized like we were trying to).
* Switch over to using getaddrinfo for TCP clients & servers to enable IPv6Daniel P. Berrange2007-07-251-87/+214
|
* 2007-07-24 Richard Hughes <richard@hughsie.com>Richard Hughes2007-07-241-0/+67
| | | | | | | | | | | * dbus/dbus-sysdeps-unix.c: (_dbus_get_standard_system_servicedirs): * dbus/dbus-sysdeps-win.c: Provide a way to get the standard system servicedirs, just like we do for the session service dirs. These should be seporate, as there may be a security issue starting up some session stuff as root. The use-case for the same binary starting up per-system _and_ per-session is also not valid.
* 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-18 Havoc Pennington <hp@redhat.com>Havoc Pennington2007-06-181-8/+24
| | | | | | | | * 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-15 Havoc Pennington <hp@redhat.com>Havoc Pennington2007-06-151-0/+26
| | | | | | | | | | | * dbus/dbus-sysdeps-unix.c (_dbus_append_session_config_file) (_dbus_append_system_config_file): new functions * bus/main.c (main): use _dbus_append_system_config_file() and _dbus_append_session_config_file() * dbus/Makefile.am (INCLUDES): move DBUS_SYSTEM_CONFIG_FILE and DBUS_SESSION_CONFIG_FILE into this makefile
* 2007-06-15 Havoc Pennington <hp@redhat.com>Havoc Pennington2007-06-151-1/+16
| | | | | | | | | | | | | | * 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-14 Havoc Pennington <hp@redhat.com>Havoc Pennington2007-06-141-27/+0
| | | | | | * dbus/dbus-sysdeps-unix.c (_dbus_credentials_parse_and_add_user): delete this function since it was effectively the same as _dbus_credentials_add_from_username()
* 2007-06-14 Havoc Pennington <hp@redhat.com>Havoc Pennington2007-06-141-6/+87
| | | | | | | | | | | * dbus/dbus-auth.c: adapt to keyring changes * dbus/dbus-keyring.c: change to avoid using user ID and home directory directly; instead use a keyring-location-from-credentials function in dbus-sysdeps * fix to use _dbus_append_user_from_current_process() instead of _dbus_username_from_current_process() or _dbus_append_desired_identity().
* 2007-06-13 Havoc Pennington <hp@redhat.com>Havoc Pennington2007-06-131-22/+32
| | | | | | | | | | | | | * dbus/dbus-server-socket.c (_dbus_server_listen_socket): support all_interfaces=true|false for tcp servers * dbus/dbus-sysdeps-unix.c (_dbus_listen_tcp_socket): support inaddr_any flag * bus/selinux.c: fix some missing includes * dbus/dbus-server-socket.c (_dbus_server_listen_socket): allow port to simply be omitted in addition to specifying 0
* 2007-06-09 Havoc Pennington <hp@redhat.com>Havoc Pennington2007-06-091-0/+13
| | | | | | | | | | | | | | | | | | | * 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-46/+179
| | | | | | | | | | | | | | | | | | | * 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
* 2007-04-27 Havoc Pennington <hp@redhat.com>Havoc Pennington2007-04-271-3/+3
| | | | | | * dbus/dbus-sysdeps-unix.c (_dbus_open_socket): fix #10781 from Tobias Nygren, checking pointer to fd vs. 0 rather than checking the fd itself
* * dbus/dbus-sysdeps.h (_dbus_split_paths_and_append): new prototyp ↵Ralf Habacker2007-03-161-117/+3
| | | | | | (_DBUS_PATH_SEPARATOR): new macro. * dbus/dbus-sysdeps.c (_dbus_split_paths_and_append): merged from dbus/dbus-sysdeps-unix.c and dbus/dbus-sysdeps-win.c.
* * dbus/dbus-sysdeps-win.c: fixed broken DBusPipe on win32.Ralf Habacker2007-03-131-59/+0
| | | | * dbus/dbus-sysdeps-win.c, dbus/dbus-sysdeps-unix.c: moved platform independent DBusPipe function to dbus-sysdeps.c.
* 2007-03-11 Havoc Pennington <hp@redhat.com>Havoc Pennington2007-03-121-19/+59
| | | | | | | | | | | | | | * tools/dbus-launch.c (do_close_stderr): fix C89 problem and formatting problem * Mostly fix the DBusPipe mess. - put line break after function return types - put space before parens - do not pass structs around by value - don't use dbus_strerror after calling supposedly cross-platform api - don't name pipe variables "fd" - abstract special fd numbers like -1 and 1