Commit graph

66 commits

Author SHA1 Message Date
Colin Walters
6b2af67ae1 2005-06-16 Colin Walters <walters@verbum.org>
* bus/bus.c (bus_context_new): Set parser to NULL
	after we unref it (Patch from Chris Boscolo, #2174).
2005-06-16 06:05:09 +00:00
David Zeuthen
1d19fc62e9 2005-06-14 David Zeuthen <davidz@redhat.com>
* bus/bus.c (process_config_every_time): Drop existing conf-dir
        watches (if applicable) and add new watches

        * bus/main.c (signal_handler): Handle SIGIO if using D_NOTIFY
        (main): Setup SIGIO signal handler if using D_NOTIFY

        * bus/config-parser.h: Add prototype bus_config_parser_get_conf_dirs

        * bus/config-parser.c (struct BusConfigParser): Add conf_dirs list
        (merge_included): Also merge conf_dirs list
        (bus_config_parser_unref): Clear conf_dirs list
        (include_dir): Add directory to conf_dirs list
        (bus_config_parser_get_conf_dirs): New function

        * bus/dir-watch.[ch]: New files

        * bus/Makefile.am (BUS_SOURCES): Add dir-watch.[ch]

        * configure.in: Add checks for D_NOTIFY on Linux
2005-06-15 02:31:38 +00:00
John (J5) Palmieri
11fd3b965f * dbus/dbus-connection.c, dbus/dbus-connection.h
(dbus_connection_disconnect): renamed to dbus_connection_close
	for API symmetry with dbus_connection_open
	(_dbus_connection_open_internal):
	s/dbus_connection_disconnect/dbus_connection_close

	* dbus/dbus-bus.c (dbus_bus_get):
	s/dbus_connection_disconnect/dbus_connection_close

	* bus/connection.c (bus_connections_unref,
	bus_connections_setup_connection, bus_connections_expire_incomplete):
	s/dbus_connection_disconnect/dbus_connection_close

	* bus/dispatch.c (bus_dispatch, kill_client_connection,
	kill_client_connection_unchecked, check_hello_connection):
	s/dbus_connection_disconnect/dbus_connection_close

	* bus/bus.c (new_connection_callback):
	s/dbus_connection_disconnect/dbus_connection_close
2005-06-02 17:41:04 +00:00
David Zeuthen
44656f538f 2005-04-13 David Zeuthen <davidz@redhat.com>
* bus/selinux.c: Add c-file-style to top of file
	(log_audit_callback): Don't free the data here anymore
	(bus_selinux_check): Don't take spid and tpid since appending
	that to auxdata may OOM.
	(bus_selinux_allows_acquire_service): Handle OOM and signal back
	to the caller if we are OOM by taking an error object.
	(bus_selinux_allows_send): -do-

	* bus/selinux.h: Fix prototypes for bus_selinux_allows_acquire_service
	and bus_selinux_allows_send

	* bus/bus.c (bus_context_check_security_policy): Pass error and
	pass on OOM thrown by bus_selinux_allows_send()

	* bus/services.c (bus_registry_acquire_service): Pass error and
	pass on OOM thrown by bus_selinux_allows_acquire_service()
2005-04-13 14:27:11 +00:00
Colin Walters
248895207d 2005-02-17 Colin Walters <walters@verbum.org>
* dbus/dbus-protocol.h (DBUS_SERVICE_ORG_FREEDESKTOP_DBUS):
	Rename to DBUS_SERVICE_DBUS.
	(DBUS_PATH_ORG_FREEDESKTOP_DBUS): Rename to DBUS_PATH_DBUS.
	(DBUS_PATH_ORG_FREEDESKTOP_LOCAL): Rename to DBUS_PATH_LOCAL.
	(DBUS_INTERFACE_ORG_FREEDESKTOP_DBUS): Rename to DBUS_INTERFACE_DBUS.
	(DBUS_INTERFACE_ORG_FREEDESKTOP_INTROSPECTABLE): Rename to
	DBUS_INTERFACE_INTROSPECTABLE.
	(DBUS_INTERFACE_ORG_FREEDESKTOP_PROPERTIES): Rename to
	DBUS_INTERFACE_PROPERTIES.
	(DBUS_INTERFACE_ORG_FREEDESKTOP_PEER): Rename to
	DBUS_INTERFACE_PEER.
	(DBUS_INTERFACE_ORG_FREEDESKTOP_LOCAL):
	DBUS_INTERFACE_LOCAL.

	All other users of those constants have been changed.

	* bus/driver.c (bus_driver_handle_introspect): Use constants.

	* glib/dbus-gobject.c (handle_introspect): Use constants.

	* doc/dbus-faq.xml, doc/dbus-specification.xml: Update for rename.
2005-02-17 21:19:49 +00:00
Colin Walters
935a41a04c 2004-11-09 Colin Walters <walters@verbum.org>
* dbus/dbus-string.c (_dbus_string_get_length): New
	function, writes DBusString to C buffer.

	* dbus/dbus-string.h: Prototype it.

	* dbus/dbus-message.c (dbus_message_type_to_string): New
	function, converts message type into C string.

	* dbus/dbus-message.h: Prototype it.

	* bus/selinux.c (bus_selinux_check): Take source pid,
	target pid, and audit data.  Pass audit data to
	avc_has_perm.
	(log_audit_callback): New function, appends extra
	audit information.
	(bus_selinux_allows_acquire_service): Also take
	service name, add it to audit data.
	(bus_selinux_allows_send): Also take message
	type, interface, method member, error name,
	and destination, and add them to audit data.
	(log_cb): Initialize func_audit.

	* bus/selinux.h (bus_selinux_allows_acquire_service)
	(bus_selinux_allows_send): Update prototypes

	* bus/services.c (bus_registry_acquire_service): Pass
	service name to bus_selinux_allows_acquire_service.

	* bus/bus.c (bus_context_check_security_policy): Pass
	additional audit data.  Move assignment of dest
	to its own line.
2004-11-09 06:11:33 +00:00
Colin Walters
cdac3e058b 2004-11-07 Colin Walters <walters@verbum.org>
* bus/bus.c (load_config): Break into three
	separate functions: process_config_first_time_only,
	process_config_every_time, and process_config_postinit.
	(process_config_every_time): Move call of
	bus_registry_set_service_context_table into
	process_config_postinit.
	(process_config_postinit): New function, does
	any processing that needs to happen late
	in initialization (and also on reload).
	(bus_context_new): Instead of calling load_config,
	open config parser here and call process_config_first_time_only
	and process_config_every_time directly.  Later, after
	we have forked but before changing UID,
	invoke bus_selinux_full_init, and then call
	process_config_postinit.
	(bus_context_reload_config): As in bus_context_new,
	load parse file inside here, and call process_config_every_time
	and process_config_postinit.

	* bus/services.h, bus/services.c
	(bus_registry_set_service_context_table): Rename
	from bus_registry_set_sid_table.  Take string hash from config
	parser, and convert them here into SIDs.

	* bus/config-parser.c (struct BusConfigParser): Have
	config parser only store a mapping of service->context
	string.
	(merge_service_context_hash): New function.
	(merge_included): Merge context string hashes instead
	of using bus_selinux_id_table_union.
	(bus_config_parser_new): Don't use bus_selinux_id_table_new;
	simply create a new string hash.
	(bus_config_parser_unref): Unref it.
	(start_selinux_child): Simply insert strings into hash,
	don't call bus_selinux_id_table_copy_over.

	* bus/selinux.h, bus/selinux.c (bus_selinux_id_table_union)
	(bus_selinux_id_table_copy_over): Delete.
2004-11-07 17:05:19 +00:00
Colin Walters
e430788a6b 2004-10-29 Colin Walters <walters@redhat.com>
* dbus/dbus-sysdeps.h (_dbus_become_daemon): Also take
	parameter for fd to write pid to.

	* dbus/dbus-sysdeps.c (_dbus_become_daemon): Implement it.

	* bus/bus.c (bus_context_new): Pass print_pid_fd
	to _dbus_become_daemon (bug #1720)
2004-10-29 19:59:15 +00:00
David Zeuthen
a24270a451 2004-09-12 David Zeuthen <david@fubar.dk>
Patch from Kay Sievers <kay.sievers@vrfy.org>

	* bus/bus.c (bus_context_new):
	* bus/bus.h:
	* bus/main.c (usage)
	(main):
	Add commandline option --nofork to override configuration file
	setting.
2004-09-12 10:23:42 +00:00
Olivier Andrieu
eb37885909 * bus/bus.c (process_config_first_time_only): get rid of an unused
DBusError that was causing a memoy leak (bug #989).

* dbus/dbus-keyring.c, dbus/dbus-message.c: fix compilation on
  Solaris/Forte C (bug #974)

* bus/main.c (main): plug two minuscule memleaks.
2004-08-10 21:32:25 +00:00
Havoc Pennington
43605a6f4e 2004-08-09 Havoc Pennington <hp@redhat.com>
* COPYING: switch to Academic Free License version 2.1 instead of
	2.0, to resolve complaints about patent termination clause.
2004-08-10 03:07:01 +00:00
Havoc Pennington
1e9b185b0c 2004-07-24 Havoc Pennington <hp@redhat.com>
SELinux support from Matthew Rickard <mjricka@epoch.ncsc.mil>

	* bus/selinux.c, bus/selinux.h: new file encapsulating selinux
	functionality

	* configure.in: add --enable-selinux

	* bus/policy.c (bus_policy_merge): add FIXME to a comment

	* bus/main.c (main): initialize and shut down selinux

	* bus/connection.c: store SELinux ID on each connection, to avoid
	repeated getting of the string context and converting it into
	an ID

	* bus/bus.c (bus_context_get_policy): new accessor, though it
	isn't used
	(bus_context_check_security_policy): check whether the security
	context of sender connection can send to the security context of
	recipient connection

	* bus/config-parser.c: add parsing for <selinux> and <associate>

	* dbus/dbus-transport.c (_dbus_transport_get_unix_fd): to
	implement dbus_connection_get_unix_fd()

	* dbus/dbus-connection.c (dbus_connection_get_unix_fd): new
	function, used by the selinux stuff
2004-07-30 05:59:34 +00:00
Havoc Pennington
7c77664c5a 2004-05-29 Havoc Pennington <hp@redhat.com>
* bus/config-parser.c (process_test_valid_subdir): temporarily
	stop testing config parser OOM handling, since expat has issues
	http://freedesktop.org/pipermail/dbus/2004-May/001153.html

	* bus/dbus-daemon-1.1.in: change requested_reply to
	send_requested_reply/receive_requested_reply so we can send the
	replies, not just receive them.

	* bus/config-parser.c: parse the new
	send_requested_reply/receive_requested_reply

	* bus/policy.c (bus_client_policy_check_can_send): add
	requested_reply argument and use it

	* bus/bus.c (bus_context_check_security_policy): pass through
	requested_reply status to message send check

	* bus/system.conf.in: adapt to requested_reply change
2004-05-29 04:17:17 +00:00
Olivier Andrieu
dd8b1b1d65 * dbus/dbus-message.c (decode_header_data, decode_string_field):
fix incorrect setting of .name_offset in the HeaderField (it was
off by two bytes, positioned right after the name and typecode)

* bus/bus.c (bus_context_new, bus_context_unref): test before
calling dbus_server_free_data_slot and _dbus_user_database_unref
in case of an error.

* tools/Makefile.am: add $(DBUS_GLIB_TOOL_LIBS), xml libs needed
by libdbus-gtool.
2004-04-21 21:29:07 +00:00
Jon Trowbridge
600e411f25 2004-04-15 Jon Trowbridge <trow@ximian.com>
* bus/main.c (signal_handler): Reload the configuration files
	    on SIGHUP.
	    (main): Set up our SIGHUP handler.

	    * bus/bus.c (struct BusContext): Store the config file, user and
	    fork flag in the BusContext.
	    (process_config_first_time_only): Added.  Contains the code
	    (previously in bus_context_new) for setting up the BusContext from
	    the BusConfigParser that should only be run the first time the
	    config files are read.
	    (process_config_every_time): Added.  Contains the code (previously
	    in bus_context_new) for setting up the BusContext from the
	    BusConfigParser that should be run every time the config files are
	    read.
	    (load_config): Added.  Builds a BusConfigParser from the config
	    files and passes the resulting structure off to
	    process_config_first_time_only (assuming this is the first time)
	    and process_config_every_time.
	    (bus_context_new): All of the config-related code has been moved
	    to process_config_first_time_only and process_config_every_time.
	    Now this function just does the non-config-related initializations
	    and calls load_config.
	    (bus_context_reload_config): Added.
2004-04-16 15:01:25 +00:00
Jon Trowbridge
e039be5838 2004-04-09 Jon Trowbridge <trow@ximian.com>
* bus/config-parser.c (bus_config_parser_new): Added a 'parent'
	    argument.  If non-null, the newly-constructed BusConfigParser will
	    be initialized with the parent's BusLimits instead of the default
	    values.
	    (include_file): When including a config file, pass in
	    the current parser as the parent and then copy the BusLimits
	    from the included BusConfigParser pack to the current parser.
	    (process_test_valid_subdir): Renamed from process_test_subdir.
	    (process_test_equiv_subdir): Added.  Walks through a directory,
	    descending into each subdirectory and loading the config files
	    it finds there.  If any subdirectory contains two config files
	    that don't produce identical BusConfigParser structs, fail.
	    For now, the BusConfigParser's BusPolicies are not compared.
	    (bus_config_parser_test): Call both process_test_valid_subdir and
	    process_test_equiv_subdir.

	    * bus/config-loader-libxml.c (bus_config_load): Take a parent
	    argument and pass it along to the call to bus_config_parser_new.
	    Also made a few small changes to allow this code to compile.

	    * bus/config-loader-expat.c (bus_config_load): Take a parent
	    argument and pass it along to the call to bus_config_parser_new.

	    * bus/bus.c (bus_context_new): Load the config file
	    with a NULL parent argument.
2004-04-09 19:50:29 +00:00
Richard Hult
a1df3040f2 2003-12-02 Richard Hult <richard@imendio.com>
* Update AFL version to 2.0 throughout the source files to reflect
	the update that was done a while ago.
2003-12-02 10:44:22 +00:00
Mikael Hallendal
9f1a60dbba 2003-11-26 Mikael Hallendal <micke@imendio.com>
* bus/*.[ch]:
	* dbus/*.[ch]:
	* glib/*.[ch]: Made ref functions return the pointer
2003-11-27 01:25:50 +00:00
Havoc Pennington
eb9aa9da95 2003-10-22 Havoc Pennington <hp@redhat.com>
* bus/bus.c (bus_context_check_security_policy): fix up assertion

	* bus/connection.c (bus_transaction_send_from_driver): set the
	destination to the connection's base service
2003-10-22 16:01:08 +00:00
Havoc Pennington
7574224200 2003-10-20 Havoc Pennington <hp@redhat.com>
hmm, make check is currently not passing.

	* doc/dbus-specification.xml: add requirement that custom type
	names follow the same rules as interface names.

	* dbus/dbus-protocol.h: change some of the byte codes, to avoid
	duplication and allow 'c' to be 'custom'; dict is now 'm' for
	'map'

	* doc/dbus-specification.xml: update type codes to match
	dbus-protocol.h, using the ASCII byte values. Rename type NAMED to
	CUSTOM. Add type OBJECT_PATH to the spec.

2003-10-17  Havoc Pennington  <hp@redhat.com>

	* bus/driver.c (create_unique_client_name): use "." as separator
	in base service names instead of '-'

	* dbus/dbus-string.c (_dbus_string_get_byte): allow getting nul
	byte at the end of the string

	* dbus/dbus-internals.h (_DBUS_LIKELY, _DBUS_UNLIKELY): add
	optimization macros since string validation seems to be a slow
	point.

	* doc/dbus-specification.xml: restrict valid
	service/interface/member/error names. Add test suite code for the
	name validation.

	* dbus/dbus-string.c: limit service/interface/member/error names
	to [0-9][A-Z][a-z]_

	* dbus/dbus-connection.c (dbus_connection_dispatch): add missing
	format arg to verbose spew

	* glib/dbus-gproxy.c (dbus_gproxy_call_no_reply): if not out of
	memory, return instead of g_error

	* test/test-service.c (path_message_func): support emitting a
	signal on request

	* dbus/dbus-bus.c (init_connections_unlocked): only fill in
	activation bus type if DBUS_BUS_ACTIVATION was set; default to
	assuming the activation bus was the session bus so that services
	started manually will still register.
	(init_connections_unlocked): fix so that in OOM situation we get
	the same semantics when retrying the function

	* test/test-service.c (main): change to use path registration, to
	test those codepaths; register with DBUS_BUS_ACTIVATION rather
	than DBUS_BUS_SESSION
2003-10-21 05:46:52 +00:00
Havoc Pennington
c20c4181f2 2003-10-16 Havoc Pennington <hp@redhat.com>
* bus/bus.c (struct BusContext): remove struct field I didn't mean
	to put there
2003-10-16 06:43:32 +00:00
Havoc Pennington
d6e1b2adb3 2003-10-16 Havoc Pennington <hp@redhat.com>
* bus/connection.c (bus_pending_reply_expired): either cancel or
	execute, not both
	(bus_connections_check_reply): use unlink, not remove_link, as we
	don't want to free the link; fixes double free mess

	* dbus/dbus-pending-call.c (dbus_pending_call_block): fix in case
	where no reply was received

	* dbus/dbus-connection.c (_dbus_pending_call_complete_and_unlock):
	fix a refcount leak

	* bus/signals.c (match_rule_matches): add special cases for the
	bus driver, so you can match on sender/destination for it.

	* dbus/dbus-sysdeps.c (_dbus_abort): print backtrace if
	DBUS_PRINT_BACKTRACE is set

	* dbus/dbus-internals.c: add pid to assertion failure messages

	* dbus/dbus-connection.c: add message type code to the debug spew

	* glib/dbus-gproxy.c (gproxy_get_match_rule): match rules want
	sender=foo not service=foo

	* dbus/dbus-bus.c (dbus_bus_get): if the activation bus is the
	session bus but DBUS_SESSION_BUS_ADDRESS isn't set, use
	DBUS_ACTIVATION_ADDRESS instead

	* bus/activation.c: set DBUS_SESSION_BUS_ADDRESS,
	DBUS_SYSTEM_BUS_ADDRESS if appropriate

	* bus/bus.c (bus_context_new): handle OOM copying bus type into
	context struct

	* dbus/dbus-message.c (dbus_message_iter_get_object_path): new function
	(dbus_message_iter_get_object_path_array): new function (half
	finished, disabled for the moment)

	* glib/dbus-gproxy.c (dbus_gproxy_end_call): properly handle
	DBUS_MESSAGE_TYPE_ERROR

	* tools/dbus-launch.c (babysit): support DBUS_DEBUG_OUTPUT to
	avoid redirecting stderr to /dev/null
	(babysit): close stdin if not doing the "exit_with_session" thing

	* dbus/dbus-sysdeps.c (_dbus_become_daemon): delete some leftover
	debug code; change DBUS_DEBUG_OUTPUT to only enable stderr, not
	stdout/stdin, so things don't get confused

	* bus/system.conf.in: fix to allow replies, I modified .conf
	instead of .conf.in again.
2003-10-16 06:34:51 +00:00
Havoc Pennington
3251264ac4 2003-10-14 Havoc Pennington <hp@redhat.com>
* bus/bus.c (bus_context_check_security_policy): revamp this to
	work more sanely with new policy-based requested reply setup

	* bus/connection.c (bus_transaction_send_from_driver): set bus
	driver messages as no reply

	* bus/policy.c (bus_client_policy_check_can_receive): handle a
	requested_reply attribute on allow/deny rules

	* bus/system.conf: add <allow requested_reply="true"/>

	* bus/driver.c (bus_driver_handle_message): fix check for replies
	sent to the bus driver, which was backward. How did this ever work
	at all though? I think I'm missing something.

	* dbus/dbus-message.c (decode_header_data): require error and
	method return messages to have a reply serial field to be valid
	(_dbus_message_loader_queue_messages): break up this function;
	validate that reply serial and plain serial are nonzero;
	clean up the OOM/error handling.
	(get_uint_field): don't return -1 from this
	(dbus_message_create_header): fix signed/unsigned bug

	* bus/connection.c (bus_connections_expect_reply): save serial of
	the incoming message, not reply serial
2003-10-14 22:16:03 +00:00
Havoc Pennington
64f5ae1a79 2003-10-14 Havoc Pennington <hp@redhat.com>
* bus/connection.c: implement pending reply tracking using
	BusExpireList

	* bus/bus.c (bus_context_check_security_policy): verify that a
	reply is pending in order to allow a reply to be sent. Deny
	messages of unknown type.

	* bus/dbus-daemon-1.1.in: update to mention new resource limits

	* bus/bus.c (bus_context_get_max_replies_per_connection): new
	(bus_context_get_reply_timeout): new
2003-10-14 05:16:56 +00:00
Havoc Pennington
6a65f4802e 2003-10-09 Havoc Pennington <hp@redhat.com>
Make matching rules theoretically work (add parser).

	* bus/bus.c (bus_context_check_security_policy): fix up to handle
	the case where destination is explicitly specified as bus driver
	and someone else is eavesdropping.

	* bus/policy.c (bus_client_policy_check_can_receive): fix up
	definition of eavesdropping and assertion

	* tools/dbus-send.c (main): use dbus_message_type_from_string

	* bus/signals.c (bus_match_rule_parse): implement

	* dbus/dbus-message.c (dbus_message_type_from_string): new

	* dbus/dbus-errors.h (DBUS_ERROR_MATCH_RULE_INVALID): add
2003-10-10 02:42:21 +00:00
Havoc Pennington
a683a80c40 2003-09-21 Havoc Pennington <hp@pobox.com>
Get matching rules mostly working in the bus; only actually
	parsing the rule text remains. However, the client side of
	"signal connections" hasn't been started, this patch is only the
	bus side.

	* dbus/dispatch.c: fix for the matching rules changes

	* bus/driver.c (bus_driver_handle_remove_match)
	(bus_driver_handle_add_match): send an ack reply from these
	method calls

	* glib/dbus-gproxy.c (dbus_gproxy_begin_call): fix order of
	arguments, reported by Seth Nickell

	* bus/config-parser.c (append_rule_from_element): support
	eavesdrop=true|false attribute on policies so match rules
	can be prevented from snooping on the system bus.

	* bus/dbus-daemon-1.1.in: consistently use terminology "sender"
	and "destination" in attribute names; fix some docs bugs;
	add eavesdrop=true|false attribute

	* bus/driver.c (bus_driver_handle_add_match)
	(bus_driver_handle_remove_match): handle AddMatch, RemoveMatch
	messages

	* dbus/dbus-protocol.h (DBUS_SERVICE_ORG_FREEDESKTOP_BROADCAST): get
	rid of broadcast service concept, signals are just always broadcast

	* bus/signals.c, bus/dispatch.c, bus/connection.c, bus/bus.c:
	mostly implement matching rules stuff (currently only exposed as signal
	connections)
2003-09-21 19:53:56 +00:00
Havoc Pennington
68a3c593b9 2003-08-18 Havoc Pennington <hp@redhat.com>
* dbus/dbus-hash.c (_dbus_hash_table_insert_two_strings): fix

	* dbus/dbus-message.c (_dbus_message_loader_queue_messages): fix
	dumb bug created earlier (wrong order of args to
	decode_header_data())

	* tools/dbus-send.c: port

	* tools/dbus-print-message.c (print_message): port

        * test/data/*messages: port all messages over

        * dbus/dbus-message-builder.c: support including
	message type

        * bus/driver.c: port over

	* bus/dispatch.c: port over to new stuff

	* dbus/dbus-connection.c (_dbus_connection_new_for_transport):
	rename disconnect signal to "Disconnected"
2003-08-18 22:43:30 +00:00
Havoc Pennington
95717a938b 2003-08-17 Havoc Pennington <hp@pobox.com>
This doesn't compile yet, but syncing up so I can hack on it from
	work. What are branches for if not broken code? ;-)

	* dbus/dbus-protocol.h: remove DBUS_HEADER_FIELD_NAME, add
	DBUS_HEADER_FIELD_INTERFACE, DBUS_HEADER_FIELD_MEMBER,
	DBUS_HEADER_FIELD_ERROR_NAME

	* dbus/dbus-hash.c: Introduce DBUS_HASH_TWO_STRINGS as hack to use
	for the interface+member pairs
	(string_hash): change to use g_str_hash algorithm
	(find_direct_function, find_string_function): refactor these to
	share most code.

	* dbus/dbus-message.c: port all of this over to support
	interface/member fields instead of name field

	* dbus/dbus-object-registry.c: port over

	* dbus/dbus-string.c (_dbus_string_validate_interface): rename
	from _dbus_string_validate_name

	* bus/dbus-daemon-1.1: change file format for the
	<deny>/<allow> stuff to match new message naming scheme

	* bus/policy.c: port over

	* bus/config-parser.c: parse new format
2003-08-18 15:27:33 +00:00
Havoc Pennington
6843ad3176 2003-06-22 Havoc Pennington <hp@pobox.com>
* dbus/dbus-dataslot.c (_dbus_data_slot_allocator_unref)
	(_dbus_data_slot_allocator_alloc): rework these to keep a
	reference count on each slot and automatically manage a global
	slot ID variable passed in by address

	* bus/bus.c: convert to new dataslot API

	* dbus/dbus-bus.c: convert to new dataslot API

	* dbus/dbus-connection.c: convert to new dataslot API

	* dbus/dbus-server.c: convert to new dataslot API

	* glib/dbus-gmain.c: ditto

	* bus/test.c: ditto

	* bus/connection.c: ditto
2003-06-22 19:39:47 +00:00
Havoc Pennington
306eab3e3d 2003-05-16 Havoc Pennington <hp@redhat.com>
* dbus/dbus-connection.c: disable verbose lock spew

	* tools/dbus-send.c: add --print-reply command line option

	* tools/dbus-print-message.h (print_message): new util function
	shared by dbus-send and dbus-monitor

	* tools/dbus-monitor.c (handler_func): exit on disconnect

	* dbus/dbus-transport-unix.c (do_reading): if the transport is
	disconnected, don't try to use the read_watch

	* dbus/dbus-watch.c (dbus_watch_get_enabled): assert watch != NULL
	so we can find this bug more easily
2003-05-16 20:09:25 +00:00
Havoc Pennington
df01c98cc7 2003-05-04 Havoc Pennington <hp@pobox.com>
* tools/dbus-launch.c: implement

	* bus/main.c (main), bus/bus.c (bus_context_new):
	implement --print-pid and --fork
2003-05-04 08:54:24 +00:00
Havoc Pennington
893d859ed4 2003-04-28 Havoc Pennington <hp@redhat.com>
* configure.in: 0.10

	* NEWS: update

	* bus/system.conf.in: add <includedir>system.d</includedir>

	* dbus/dbus-userdb.c (_dbus_user_database_lookup): fix bug when
	username was provided but not uid

	* bus/config-parser.c (struct BusConfigParser): keep track of
	whether the parser is toplevel or was included; change some
	of the error handling if it's included.
2003-04-28 19:29:42 +00:00
Havoc Pennington
e8d396efef 2003-04-27 Havoc Pennington <hp@pobox.com>
Unbreak my code...

	* dbus/dbus-transport.c (_dbus_transport_get_dispatch_status):
	report correct status if we finish processing authentication
	inside this function.

	* bus/activation.c (try_send_activation_failure): use
	bus_transaction_send_error_reply

	* bus/connection.c (bus_connection_get_groups): return an error
	explaining the problem

	* bus/bus.c (bus_context_check_security_policy): implement
	restriction here that inactive connections can only send the
	hello message. Also, allow bus driver to send anything to
	any recipient.

	* bus/connection.c (bus_connection_complete): create the
	BusClientPolicy here instead of on-demand.
	(bus_connection_get_policy): don't return an error

	* dbus/dbus-message.c (dbus_message_new_error_reply): allow NULL
	sender field in message being replied to

	* bus/bus.c (bus_context_check_security_policy): fix silly typo
	causing it to return FALSE always

	* bus/policy.c (bus_client_policy_check_can_send): fix bug where
	we checked sender rather than destination
2003-04-27 06:25:42 +00:00
Havoc Pennington
b3bd48edfc 2003-04-25 Havoc Pennington <hp@redhat.com>
test suite is slightly hosed at the moment, will fix soon

	* bus/connection.c (bus_connections_expire_incomplete): fix to
	properly disable the timeout when required
	(bus_connection_set_name): check whether we can remove incomplete
	connections timeout after we complete each connection.

	* dbus/dbus-mainloop.c (check_timeout): fix this up a bit,
	probably still broken.

	* bus/services.c (bus_registry_acquire_service): implement max
	number of services owned, and honor allow/deny rules on which
	services a connection can own.

	* bus/connection.c (bus_connection_get_policy): report errors here

	* bus/activation.c: implement limit on number of pending
	activations
2003-04-25 23:50:34 +00:00
Havoc Pennington
3185d7edde 2003-04-24 Havoc Pennington <hp@redhat.com>
* test/data/valid-config-files/basic.conf: add <limit> tags to
	this test

	* bus/config-parser.h, bus/config-parser.c, bus/bus.c: Implement
	<limit> tag in configuration file.
2003-04-24 22:30:38 +00:00
Havoc Pennington
e8bf15b23a 2003-04-24 Havoc Pennington <hp@redhat.com>
* dbus/dbus-message.c (dbus_message_name_is): rename
	(dbus_message_service_is): rename
	(dbus_message_sender_is): rename
	(dbus_message_get_service): rename
2003-04-24 19:35:11 +00:00
Havoc Pennington
983200f912 2003-04-19 Havoc Pennington <hp@pobox.com>
* bus/driver.c (bus_driver_handle_hello): check limits and
	return an error if they are exceeded.

	* bus/connection.c: maintain separate lists of active and inactive
	connections, and a count of each. Maintain count of completed
	connections per user. Implement code to check connection limits.

	* dbus/dbus-list.c (_dbus_list_unlink): export

	* bus/bus.c (bus_context_check_security_policy): enforce a maximum
	number of bytes in the message queue for a connection
2003-04-19 16:16:24 +00:00
Havoc Pennington
3df260c071 2003-04-18 Havoc Pennington <hp@pobox.com>
* glib/dbus-gmain.c: adapt to watch changes

	* bus/bus.c, bus/activation.c, etc.: adjust to watch changes

	* dbus/dbus-server.h: remove dbus_server_handle_watch

	* dbus/dbus-connection.h: remove dbus_connection_handle_watch

	* dbus/dbus-watch.c (dbus_watch_handle): change DBusWatch to work
	like DBusTimeout, so we don't need dbus_connection_handle_watch
	etc.
2003-04-18 04:18:57 +00:00
Havoc Pennington
7c022a80c9 2003-04-15 Havoc Pennington <hp@pobox.com>
* bus/bus.c: create and keep around a shared DBusUserDatabase
	object.

	* bus/connection.c (bus_connection_get_groups): don't cache
	groups for user in the connection object, since user database
	object now does that.
2003-04-17 00:46:36 +00:00
Havoc Pennington
777707ed8d 2003-04-13 Havoc Pennington <hp@pobox.com>
* dbus/dbus-mainloop.c: fix some reentrancy issues by refcounting
	callbacks

	* test/data/valid-config-files/debug-allow-all.conf.in: allow all
	users

	* dbus/dbus-transport.c (_dbus_transport_get_dispatch_status):
	fix to only recover unused bytes if we're already authenticated
	(_dbus_transport_get_is_authenticated): fix to still mark us
	authenticated if there are unused bytes.

	* bus/dispatch.c: implement security policy checking

	* bus/connection.c (bus_transaction_send_from_driver): new

	* bus/bus.c (bus_context_check_security_policy): new

	* bus/dispatch.c (send_service_nonexistent_error): delete this,
	now we just set the DBusError and it gets converted to an error
	reply.

	* bus/connection.c (allow_user_function): enable code using actual
	data from the config file

	* bus/policy.c (list_allows_user): handle wildcard rules for
	user/group connection perms
2003-04-14 02:29:21 +00:00
Havoc Pennington
bc983ecf15 2003-04-12 Havoc Pennington <hp@pobox.com>
* bus/policy.h: change BusPolicy to be the thing from the config
	file, and rename old BusPolicy to BusClientPolicy

	* bus/bus.c, bus/connection.c, bus/config-parser.c: change to
	match change in how policy works

	* dbus/dbus-internals.h: mark assert_not_reached as
	__attribute((noreturn))__
2003-04-12 18:32:11 +00:00
Havoc Pennington
fff4709be6 2003-04-11 Havoc Pennington <hp@redhat.com>
* bus/bus.c (bus_context_new): move credentials change after
	creating pidfile
2003-04-11 20:10:36 +00:00
Havoc Pennington
0e1945b388 2003-04-08 Colin Walters <walters@gnu.org>
* bus/bus.c (struct BusContext) [pidfile]: New member, to store
 	the pid file.
 	(bus_context_new): Set it.
 	(bus_context_unref): Use it to delete the pid file.
2003-04-09 00:27:41 +00:00
Havoc Pennington
df008ef97d 2003-04-06 Havoc Pennington <hp@pobox.com>
* dbus/Makefile.am: split lists of sources into stuff that goes in
	the library, util functions that go in the lib and are also used
	elsewhere, and util functions that are used in tests/daemon but
	don't go in the lib.

	* dbus/dbus-mainloop.h, dbus/dbus-mainloop.c: move bus/loop.[hc]
	here so it can be used in test binaries also
2003-04-06 23:53:27 +00:00
Havoc Pennington
856361ff5b 2003-04-06 Havoc Pennington <hp@pobox.com>
* dbus/dbus-sysdeps.c (_dbus_become_daemon): write the pidfile
	here in the parent process, so we can return an error if it
	fails. Also, move some of the code into the child so the parent
	is less hosed if we fail midway through.

	* bus/bus.c (bus_context_new): move pidfile detection further up
	in the function, before we start overwriting sockets and such.

	* bus/messagebus.in: adjust this a bit, not sure if it will work.

	* configure.in: add --with-system-pid-file and --with-system-socket

2003-04-06  Colin Walters  <walters@verbum.org>

	* configure.in (DBUS_SYSTEM_PID_FILE): New variable.

	* bus/system.conf.in: Declare a pidfile.

	* bus/bus.c (bus_context_new): Test for an existing pid file, and
	create one (if appropriate).

	* bus/config-parser.c (enum ElementType) [ELEMENT_PIDFILE]: New.
	(struct BusConfigParser) [pidfile]: New.
	(element_type_to_name, merge_included, start_busconfig_child)
	(bus_config_parser_end_element, bus_config_parser_content): Handle it.
	(bus_config_parser_unref): Free it.
	(bus_config_parser_get_pidfile): New function.

	* bus/config-parser.h (_dbus_write_pid_file): Prototype.

	* dbus/dbus-errors.h (DBUS_ERROR_PIDFILE_EXISTS): New error.

	* dbus/dbus-sysdeps.c (_dbus_write_pid_file): New function.

	* dbus/dbus-sysdeps.h: Prototype it.
2003-04-06 23:15:41 +00:00
Havoc Pennington
c8991b0f95 2003-04-06 Havoc Pennington <hp@pobox.com>
* bus/bus.c (bus_context_new): print the address in here, rather
	than in main(), because we need to do it before forking the daemon

	* bus/dispatch.c (send_service_nonexistent_error): set the sender
	on the service nonexistent error

	* bus/driver.c (bus_driver_handle_acquire_service): set the
	sender on the AcquireService reply

	* test/data/valid-config-files/debug-allow-all.conf.in: Make test
	server also listen on a UNIX socket so services can connect to it.
2003-04-06 20:04:47 +00:00
Havoc Pennington
e45e438227 2003-04-06 Havoc Pennington <hp@pobox.com>
* bus/bus.c (bus_context_new): fix wrong handling of
	server_data_slot_unref() in the error case.

	* dbus/dbus-internals.h (_dbus_assert): change so it passes
	"(condition) != 0" to _dbus_real_assert so that
	"_dbus_assert (pointer)" doesn't cause a warning

	* bus/main.c (main): accept --print-address option to print out
	the message bus address

	* dbus/dbus-sysdeps.c (_dbus_generate_random_ascii): export this

	* dbus/dbus-transport.c (_dbus_transport_open): special error for
	"tmpdir" option to unix: address on client side

	* dbus/dbus-server.c (dbus_server_listen): handle "tmpdir" option
	to unix: address

	* configure.in (TEST_SOCKET_DIR): locate a temporary directory
	we can use to create sockets in the test suite.

	* bus/main.c (signal_handler): on SIGTERM, exit the daemon
	cleanly. To be used for testing.

	* dbus/dbus-spawn.c (babysit): use _dbus_set_signal_handler()

	* dbus/dbus-sysdeps.c (_dbus_set_signal_handler): new

	* dbus/dbus-server-debug-pipe.c (_dbus_transport_debug_pipe_new):
	handle trying to call this when there's no servers active
2003-04-06 18:03:03 +00:00
Havoc Pennington
07e3f76f8e 2003-04-05 Havoc Pennington <hp@pobox.com>
* bus/bus.c (setup_server): fix this so dbus-daemon-1 doesn't
	crash on startup. Need to get "try starting the daemon"
	in the test suite I guess. ;-)

	* dbus/dbus-server.h, dbus/dbus-server.c: remove the stuff that
	tracked the number of open connections; it's better done in
	application-specific code as you want it to span all servers etc.
2003-04-05 23:50:47 +00:00
Havoc Pennington
2250539aee 2003-04-05 Havoc Pennington <hp@pobox.com>
* bus/loop.c (bus_loop_iterate): fix the timeout code, using
	magic from GLib

	* dbus/dbus-spawn.c (_dbus_babysitter_unref): set sitter_pid
	to -1 once we've reaped the babysitter
	(_dbus_babysitter_handle_watch): do as much work as we can, not
	just one go of it

	* bus/activation.c: add code using DBusBabysitter so that we
	handle it when a service fails to start up properly.
	(bus_activation_service_created): don't remove the activation
	entries as we go, just let them get removed when we free the pending
	activation. Unref reply messages after sending them.
2003-04-05 19:03:40 +00:00
Havoc Pennington
1b08036103 2003-04-03 Havoc Pennington <hp@redhat.com>
* bus/loop.h, bus/loop.c: make the mainloop an object so we can
	have multiple ones

	* bus/*.[hc]: adapt to mainloop change
2003-04-04 00:39:22 +00:00