Commit graph

1974 commits

Author SHA1 Message Date
John (J5) Palmieri
254524928a * dbus/dbus-sysdeps-util-unix.c (dirent_buf_size): Add check for
MAXNAMELEN for Mac OSX.  (Patch from Jonas B <sanoix at gmail dot com>)
2006-10-02 15:43:48 +00:00
Thiago Macieira
c6e066ff82 * tools/dbus-launch.c (main): make it complain and abort
execution in case an unknown option is given. Also, process
	the '--' argument as the end of arguments.
2006-10-01 22:21:30 +00:00
Havoc Pennington
10fe37f582 2006-10-01 Havoc Pennington <hp@redhat.com>
* tools/dbus-launch.c (print_variables): if no syntax is given,
	don't print something that's sort-of-half-sh-syntax, just print
	a plain key-value pairs thing.

	* tools/dbus-launch-x11.c: use machine ID rather than hostname for
	the local machine representation (but still have the hostname in
	the display). Remove the hostname from the display if it is
	localhost. Change session files to be named
	~/.dbus/session-bus/machine-display. Change X atoms to be
	underscore-prefixed so nobody whines about ICCCM compliance.
	Otherwise name them the same as the env variables.
	Change session file format to include key-value pairs and an
	explanatory comment. Keys are the same as the env variables.
	(set_address_in_x11): X property format can't depend on
	sizeof(pid_t) on a particular machine, fix to always be 32 bits

	* tools/dbus-launch.c: make --autolaunch take a machine id
	argument. If --autolaunch is used with a program to run, complain
	for now (but add a FIXME). Also, don't look for existing bus if
	there's a program to run (but add a FIXME).

	* dbus/dbus-sysdeps-unix.c (_dbus_get_autolaunch_address): pass
	machine uuid to dbus-launch (avoids linking dbus-launch to libdbus
	just to get this, and avoids duplicating uuid-reading code).

	* tools/dbus-launch.1: clarify various things
2006-10-01 20:05:39 +00:00
Havoc Pennington
7020b57376 2006-10-01 Havoc Pennington <hp@redhat.com>
* test/test-service.c (path_message_func): remove broken extra
	unref that was hidden by the bugs in dbus-connection.c/dbus-bus.c

	* test/test-shell-service.c (path_message_func): same fix

	* dbus/dbus-connection.c
	(_dbus_connection_get_dispatch_status_unlocked): break up the
	function a little for clarity and fix the notification of
	dbus-bus.c to not require dispatch to be complete

	* dbus/dbus-connection.c (dbus_connection_unref): improve the
	warning when you try to finalize an open connection.
2006-10-01 17:21:03 +00:00
Havoc Pennington
eb1e11babd 2006-10-01 Havoc Pennington <hp@redhat.com>
* dbus/dbus-bus.c
	(internal_bus_get): only weak ref the connection; this means
	_dbus_bus_notify_shared_connection_disconnected_unlocked can be
	called safely in any context
	(_dbus_bus_notify_shared_connection_disconnected_unlocked): don't
	unref

	* dbus/dbus-connection.c
	(_dbus_connection_get_dispatch_status_unlocked): move
	_dbus_bus_notify_shared_connection_disconnected_unlocked here
	when queuing Disconnected instead of when the Disconnected message
	arrives, so dbus_bus_get() won't return closed connections.
2006-10-01 16:11:24 +00:00
Havoc Pennington
a2129f7ccc 2006-10-01 Havoc Pennington <hp@redhat.com>
* dbus/dbus-connection.c (_dbus_connection_close_if_only_one_ref):
	Add a hack to make DBusNewConnectionFunction work right.

	* dbus/dbus-server-socket.c (handle_new_client_fd_and_unlock): use
	the hack here. Also, fix the todo about refcount leak.

	* dbus/dbus-server-debug-pipe.c (_dbus_transport_debug_pipe_new):
	and use the hack here

        * dbus/dbus-connection.c: Kill the "shared" flag vs. the
	"shareable" flag; this was completely broken, since it meant
	dbus_connection_open() returned a connection of unknown
	shared-ness. Now, we always hold a ref on anything opened
	as shareable.

	Move the call to notify dbus-bus.c into
	connection_forget_shared_unlocked, so libdbus consistently forgets
	all its knowledge of a connection at once. This exposed numerous
	places where things were totally broken if we dropped a ref inside
	get_dispatch_status_unlocked where
	connection_forget_shared_unlocked was previously, so move
	connection_forget_shared_unlocked into
	_dbus_connection_update_dispatch_status_and_unlock. Also move the
	exit_on_disconnect here.

	(shared_connections_shutdown): this assumed weak refs to the
	shared connections; since we have strong refs now, the assertion
	was failing and stuff was left in the hash. Fix it to close
	still-open shared connections.

	* bus/dispatch.c: fixup to use dbus_connection_open_private on the
	debug pipe connections

	* dbus/dbus-connection.c (dbus_connection_dispatch): only notify
	dbus-bus.c if the closed connection is in fact shared
	(_dbus_connection_close_possibly_shared): rename from
	_dbus_connection_close_internal
	(dbus_connection_close, dbus_connection_open,
	dbus_connection_open_private): Improve docs to explain the deal
	with when you should close or unref or both

	* dbus/dbus-bus.c
	(_dbus_bus_notify_shared_connection_disconnected_unlocked): rename
	from _dbus_bus_check_connection_and_unref_unlocked and modify to
	loop over all connections

	* test/test-utils.c (test_connection_shutdown): don't try to close
	shared connections.

	* test/name-test/test-threads-init.c (main): fix warnings in here

	* dbus/dbus-sysdeps.c (_dbus_abort): support DBUS_BLOCK_ON_ABORT
	env variable to cause blocking waiting for gdb; drop
	DBUS_PRINT_BACKTRACE and just call _dbus_print_backtrace()
	unconditionally.

	* configure.in: add -export-dynamic to libtool flags if assertions enabled
	so _dbus_print_backtrace works.

	* dbus/dbus-sysdeps-unix.c (_dbus_print_backtrace): use fprintf
	instead of _dbus_verbose to print the backtrace, and diagnose lack
	of -rdynamic/-export-dynamic
2006-10-01 15:36:19 +00:00
Havoc Pennington
eef10bc3c4 2006-09-30 Havoc Pennington <hp@redhat.com>
* dbus/dbus-bus.c (dbus_bus_get_private, dbus_bus_get)
	(internal_bus_get): fix screwy code formatting. whoever committed
	that was not paying attention!
2006-10-01 03:34:21 +00:00
Havoc Pennington
d8155bf51b 2006-09-30 Havoc Pennington <hp@redhat.com>
* configure.in (LT_CURRENT, LT_AGE): increment current and age to
	reflect addition of interfaces.

	* doc/dbus-specification.xml: describe a new
	org.freedesktop.DBus.Peer.GetMachineId method

	* dbus/dbus-string.c (_dbus_string_skip_white_reverse): new function
	(_dbus_string_skip_white, _dbus_string_skip_blank): use new
	DBUS_IS_ASCII_BLANK, DBUS_IS_ASCII_WHITE macros and fix assertion
	at end of skip_white
	(_dbus_string_chop_white): new function

	* bus/connection.c (bus_connections_setup_connection): call
	dbus_connection_set_route_peer_messages.

	* dbus/dbus-connection.c
	(_dbus_connection_peer_filter_unlocked_no_update): modify to
	support a GetMachineId method.

	Also, support a new flag to let the bus pass peer methods through
	to apps on the bus, which can be set with
	dbus_connection_set_route_peer_messages.

	Finally, handle and return an error for anything unknown on the
	Peer interface, which will allow us to extend the Peer interface
	in the future without fear that we're now intercepting something
	apps were wanting to see.

	* tools/dbus-uuidgen.c: a thin wrapper around the functions in
	dbus/dbus-uuidgen.c

	* dbus/dbus-uuidgen.c: implement the bulk of the dbus-uuidgen
	binary here, since most of the code is already in libdbus

	* dbus/dbus-sysdeps.c (_dbus_read_local_machine_uuid): read the
	uuid from the system config file

	* dbus/dbus-internals.c (_dbus_generate_uuid, _dbus_uuid_encode)
	(_dbus_read_uuid_file_without_creating)
	(_dbus_create_uuid_file_exclusively, _dbus_read_uuid_file): new
	uuid-related functions, partly factored out from dbus-server.c

	* dbus/dbus-sysdeps.c (_dbus_error_from_errno): convert EEXIST to
	DBUS_ERROR_FILE_EXISTS instead of EEXIST

	* dbus/dbus-protocol.h (DBUS_ERROR_FILE_EXISTS): add file exists error

	* tools/dbus-cleanup-sockets.1: explain what the point of this
	thing is a bit more

	* autogen.sh (run_configure): add --config-cache to default
	configure args

	* dbus/dbus-internals.h (_DBUS_ASSERT_ERROR_IS_SET): disable the
	error set/clear assertions when DBUS_DISABLE_CHECKS is defined

	* tools/dbus-launch.c (main): if xdisplay hasn't been opened,
	don't try to save address, fixes crash in make check
2006-10-01 03:18:47 +00:00
Thiago Macieira
f6fa010403 * configure.in: add DBUS_BINDIR as a #define to C source code.
* tools/dbus-launch.c
	* tools/dbus-launch.h
	* tools/dbus-launch-x11.c:
	* tools/dbus-launch.1: Add the --autolaunch option to
	dbus-launch, which makes it scan for an existing session
	started with --autolaunch. With that option, it also creates
	an X11 window and saves the bus address and PID to it.

	* dbus/dbus-sysdeps.h:
	* dbus/dbus-sysdeps-unix.c (_dbus_get_autolaunch_address): Add
	a function that runs "dbus-launch --autolaunch" to retrieve
	the running D-Bus session address (or start one if none was running)

	* dbus/dbus-transport.c: Add the handler for the "autolaunch:"
        address protocol, which tries to get the running session from
        dbus-launch.

	* dbus/dbus-bus.c:
	* dbus/dbus-internals.h: Make "autolaunch:" be the default
	D-Bus session bus address.

	* dbus/dbus-connection.c: Fix horrible typo in error message.
2006-09-30 19:38:34 +00:00
John (J5) Palmieri
5f292c611f * tools/Makefile.am: use @EXPANDED_DATADIR@ instead of @DATADIRNAME@ 2006-09-18 17:17:41 +00:00
Havoc Pennington
1ececca7e1 2006-09-17 Havoc Pennington <hp@redhat.com>
* dbus/dbus-transport.c (_dbus_transport_get_is_authenticated):
	fix so that if unix_user_function is set on windows, we still
	do the default check that the auth identity matches the bus identity
2006-09-17 17:11:31 +00:00
Havoc Pennington
fe4715b656 2006-09-16 Havoc Pennington <hp@redhat.com>
* 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-16 19:24:08 +00:00
Havoc Pennington
e001455a03 2006-09-16 Havoc Pennington <hp@redhat.com>
Attempt auditing public API to remove all cases where a Unix
	function returns weird emulated goo to Windows. This probably
	breaks the bus daemon on Windows, to fix it again we may
	need to stop processing unix-specific config options on Windows,
	and may need to add Windows-specific public API or config options.

	* configure.in (LT_CURRENT, LT_AGE): increment current and age,
	to reflect added interfaces; should not break soname.

	* dbus/dbus-transport.c (_dbus_transport_get_is_authenticated): do
	not invoke unix user function on Windows. Kind of a hacky fix, but
	we don't want a "unix uid" leaking out on Windows.

	* dbus/dbus-connection.c (dbus_connection_get_socket): add new API
	to get the socket fd on Windows or UNIX
	(dbus_connection_get_unix_fd): make this always fail on Windows
2006-09-16 18:46:48 +00:00
Havoc Pennington
8027efc97b voc Pennington <hp@redhat.com>
* 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
2006-09-16 17:38:24 +00:00
Havoc Pennington
a0a12210e1 add forgotten dbus-sydeps-unix.h 2006-09-16 15:53:30 +00:00
Havoc Pennington
d0971c53df 2006-09-16 Havoc Pennington <hp@redhat.com>
* dbus/dbus-sysdeps-unix.c (_dbus_open_tcp_socket)
	(_dbus_open_unix_socket, _dbus_open_socket): change API for
	_dbus_open_socket so the domain/type/protocol from system headers
	are not required. This is kind of pointless though unless we move
	part of _dbus_connect_tcp_socket into sysdeps.c instead of
	sysdeps-unix.c, which would mean adding a wrapper around
	bind/listen/etc.
	Also, add DBusError to the socket-opening functions so they
	don't require use of errno.
2006-09-16 15:49:27 +00:00
Havoc Pennington
08079a5bde 2006-09-16 Havoc Pennington <hp@redhat.com>
* dbus/dbus-sysdeps-unix.h: small change to Peter's patch to make
	dbus-sysdeps-unix-util.c build, add unix-specific sysdeps header.

	* dbus/dbus-sysdeps.h, dbus-sysdeps-unix.c: patch from Peter
	Kümmel bug #8249 to make the sysdeps.h read/write/open/close
	functions specifically for sockets only, and move generic
	read/write/open/close into unix-specific code.
2006-09-16 15:34:34 +00:00
Havoc Pennington
e24dec0a89 2006-09-14 Havoc Pennington <hp@redhat.com>
* dbus/dbus-transport-unix.c (unix_do_iteration): fix a valgrind
	complaint about accessing revents when poll returns 0, from Julian Seward.
2006-09-14 13:53:16 +00:00
John (J5) Palmieri
d0ddf4a5dc * bump to 0.94 2006-09-14 05:48:35 +00:00
John (J5) Palmieri
a480006b1c * Released 1.0 RC 1 (0.93) 2006-09-14 05:46:22 +00:00
John (J5) Palmieri
d8a9336da0 * dbus/dbus-sysdeps-util-unix.c: Forgot to pass NULL as the second
parameter to  _dbus_close
2006-09-14 05:41:20 +00:00
John (J5) Palmieri
1180691b35 * dbus/dbus-sysdeps-util-unix.c (_dbus_write_pid_file):
use _dbus_close instead of close
2006-09-14 05:20:12 +00:00
John (J5) Palmieri
e7563d502b * dbus/dbus-sysdeps.c: Add support for LOCAL_CREDS socket
credentials.  Fixes "external" authentication under e.g. NetBSD
  which does not support any other socket credentials mechanism.
  (Patch from Julio M. Merino Vidal  <jmmv at NetBSD dot org>)
2006-09-14 05:07:11 +00:00
John (J5) Palmieri
0355d27f27 * dbus/dbus-server.c: remove a todo item 2006-09-14 04:31:31 +00:00
John (J5) Palmieri
57ab23491c * dbus/dbus-threads.c: Allow recursive mutex's to be passed into
dbus_threads_init and be used by the dbus mutex functions to
  avoid deadlocks.

* doc/TODO: Remove recursive mutex dbus_connection_dispatch TODO item
2006-09-14 04:26:00 +00:00
John (J5) Palmieri
f82bdd3ab3 * dbus/dbus-sysdeps-util-unix.c (_dbus_directory_get_next_file):
use threadsafe readdir_r instead of readdir
2006-09-13 19:13:17 +00:00
John (J5) Palmieri
642335f681 * dbus-threads.c (dbus_threads_init_default): New method for
initializing the internal thread implementation (Patch from
  Alexander Larsson <alexl at redhat dot com>)
2006-09-13 19:09:45 +00:00
John (J5) Palmieri
15c6023885 * remove a bunch of todo items from the 1.0 list 2006-09-11 17:41:21 +00:00
John (J5) Palmieri
9cfb902807 * bus/activation.c, bus/desktop-file.c: Distinguish between OOM and
key not found
2006-09-11 15:24:10 +00:00
John (J5) Palmieri
05d90f4f20 * dbus/dbus-internal.c: Add dbus_is_verbose so we can have more
complex debugging code

* dbus/dbus-marshal-basic.c (_dbus_marshal_read_fixed_multi): Move
  between the test suite ifdefs
  (_dbus_verbose_bytes): return if verbosity is not enabled
2006-09-11 15:05:21 +00:00
John (J5) Palmieri
eed8a8a7bd * dbus/dbus-marshal-recursive-util.c, dbus/dbus-marshal-recursive.c:
remove DBusMark
2006-09-11 14:42:48 +00:00
Havoc Pennington
8e659dac9f 2006-09-10 Havoc Pennington <hp@redhat.com>
patch mostly by Peter Kümmel, bug #8211

	* dbus/dbus-sysdeps-unix.c: new file, which splits out
	unix-specific stuff in dbus-sysdeps.c

	* dbus/dbus-sysdeps.c: don't include any UNIX-only headers,
	and move unix-specific stuff to dbus-sysdeps-unix.c

	* configure.in: check HAVE_ERRNO_H
2006-09-10 21:37:10 +00:00
John (J5) Palmieri
f61a63cefb * bus/test-main.c (main): Initialize threading during tests
* dbus/dbus-connection.c (_dbus_connection_new_for_transport):
  Unlock connection on error
  (generate_local_error_message): static method for generating
  an error message when we don't have a message to reply to
  (_dbus_connection_block_pending_call): Send a disconnect error
  instead of just a timeout (NULL) when the bus gets disconnected
  while blocking for a reply.
2006-09-08 17:21:37 +00:00
John (J5) Palmieri
b4d571bba3 * dbus/dbus-connection.c (dbus_connection_dispatch): Properly remove
filters (Patch from Kimmo Hämäläinen <kimmo dot hamalainen at nokia dot com>)
2006-09-08 15:23:50 +00:00
John (J5) Palmieri
b19511946f * dbus/dbus-connection-internal.h: Add prototype for
_dbus_connection_test_get_locks to remove warning
2006-09-07 19:02:22 +00:00
John (J5) Palmieri
14b178a222 * dbus/dbus-spawn.c (_dbus_spawn_async_with_babysitter): Make sure we
close child_err_report_pipe[WRITE_END] on exec (Patch from
  Kimmo Hämäläinen <kimmo dot hamalainen at nokia dot com>)
2006-09-07 18:28:13 +00:00
John (J5) Palmieri
d3ae852746 * Clean up close calls to use _dbus_close (Patch from
Kimmo Hämäläinen <kimmo dot hamalainen at nokia dot com>)
2006-09-07 18:24:11 +00:00
John (J5) Palmieri
1eae184450 * doc/TODO:
- Remove pending call locking todo item
- dbus_connection_open now holds hard ref.  Remove todo item
- do proper locking on _dbus_bus_check_connection_and_unref
  and handle DBUS_BUS_STARTER. Remove todo item
- Warn on closing of a shared connection.  Remove todo item

* bus/bus.c, bus/connection.c, bus/dispatch.c, dbus/dbus-bus.c,
  dbus/dbus-connection.c: Use the dbus_connection_close_internal
  so we don't get the warning when closing shared connections

* test/test-service.c, test/test-shell-service.c: Applications
  don't close shared connections themselves so we unref instead of
  close

* test/test-utils.c (test_connection_shutdown): Close the connection

* dbus/dbus-bus.c (_dbus_bus_check_connection_and_unref): Changed to
  _dbus_bus_check_connection_and_unref_unlocked since we only call this
  method on a locked connection.
  Make sure we call _dbus_connection_unref_unlocked instead of
  dbus_connection_unref also.
  Handle DBUS_BUS_STARTER correctly

* dbus/dbus-connection.c (connection_record_shared_unlocked):
  Mark as shared and hard ref the connection
  (connection_forget_shared_unlocked): Remove the hard ref from the
  connection
  (_dbus_connection_close_internal_and_unlock):  New internal function
  which takes a locked connection and unlocks it after closing it
  (_dbus_connection_close_internal): New internal function which acts
  like the origonal dbus_connection_close method by grabbing a connection
  lock and calling _dbus_connection_close_internal_and_unlock
  (dbus_connection_close): Public close method, warns when the app
  trys to close a shared connection
2006-09-06 22:00:07 +00:00
John (J5) Palmieri
61316dd897 * bus/driver.c:
(bus_driver_generate_introspect_string): New method for populating
  a DBusString with the introspect data
  (bus_driver_handle_introspect): Move introspect generation code to
  bus_driver_generate_introspect_string

* bus/main.c:
  (introspect): New function which prints out the intropect data and
  exits
  (main): Add a --introspect switch
2006-09-06 21:16:12 +00:00
John (J5) Palmieri
e4f3d0ca17 * doc/TODO: Removed dtd publishing item.
It seems the dtd has already been added at
  http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd
2006-09-06 19:40:54 +00:00
John (J5) Palmieri
88f69757b9 * doc/TODO, various source files: Audited todo's and FIXME's and
prepended the ones we should be looking at with 1.0.  Those
  prepended with 1.0? need clerification or might not be needed
  for 1.0
2006-09-06 00:14:06 +00:00
John (J5) Palmieri
5765788912 * dbus/dbus-pending-call.c: Add some checks so we don't crash on
NULL in the public API (Patch from Kimmo Hämäläinen
  <kimmo dot hamalainen at nokia dot com>)
2006-09-05 22:05:12 +00:00
John (J5) Palmieri
0553d5cd94 * configure.in: Fix for OS-X compile time endian issues (patch from
Benjamin Reed <ranger at befunk dot com>)
2006-09-05 21:56:20 +00:00
John (J5) Palmieri
cb51809e9c * configure.in: Check for no-common compiler flag (OS-X fix from
Benjamin Reed <ranger at befunk dot com>)
2006-09-05 21:51:58 +00:00
John (J5) Palmieri
ee6964d6a0 * tools/dbus-launch.c: Add a sigterm handler (patch from Frederic Crozat
<fcrozat at mandriva dot com>)
2006-09-01 20:47:09 +00:00
Havoc Pennington
afc2a6e56a 2006-08-29 Havoc Pennington <hp@redhat.com>
* test/test-service.c (path_message_func): fix lack of return value

	* dbus/dbus-sysdeps.c (_dbus_printf_string_upper_bound): fix
	formatting, remove #ifdef, and fix docs. #ifdef doesn't make
	any more sense than on anything else in this file.
	(_dbus_get_tmpdir): add const to return value, and keep the
	results of the various getenv around in a static variable.
2006-08-30 01:27:44 +00:00
Havoc Pennington
338c96b4c6 2006-08-29 Havoc Pennington <hp@redhat.com>
* dbus/dbus-sysdeps-util.c, dbus/dbus-sysdeps-util-unix.c: change
	from Ralf Habacker to move UNIX-specific sysdeps into a separate file.
2006-08-30 01:06:28 +00:00
John (J5) Palmieri
c904d4d501 * test/Makefile.am: change find to use syntax that works with non
gnu versions of find
2006-08-25 19:59:49 +00:00
John (J5) Palmieri
5ee4ac1a30 * dbus/dbus-transport.c: fix invalid deref when checking if
a vtable method exists (Patch from Christian Ehrlicher
  <ch dot ehrlicher at gmx dot de>)
2006-08-25 19:56:00 +00:00
John (J5) Palmieri
163f42a8b1 * configure.in, dbus/Makefile.am, test/name-test/run-test.sh,
test/name-test/Makefile.am: Fixed some issues with getting get dbus
  to build with builddir != srcdir (Taken from a patch by Bernard Leak
  <bernard at brenda-arkle dot demon dot co dot uk>)
2006-08-25 19:50:16 +00:00