1. 31 Mar, 2003 1 commit
    • Havoc Pennington's avatar
      2003-03-30 Havoc Pennington <hp@pobox.com> · bc86794f
      Havoc Pennington authored
      	* bus/config-parser.c: hacking
      
      	* dbus/dbus-memory.c: don't use DBusList for the list of stuff
      	to shut down, since it could cause weirdness with the DBusList
      	lock
      
      	* dbus/dbus-list.c (_dbus_list_test): add tests for the
      	link-oriented stack routines
      	(alloc_link): free the mempool if the first alloc from it fails
      
      	* dbus/dbus-mempool.c (struct DBusMemBlock): fix alignment issue
      
      	* dbus/dbus-string.c (UNICODE_VALID): sync new version of this
      	from GLib
      	(_dbus_string_skip_white): new
      
      	* doc/config-file.txt (Elements): add <includedir>
      bc86794f
  2. 28 Mar, 2003 1 commit
    • Havoc Pennington's avatar
      2003-03-28 Havoc Pennington <hp@pobox.com> · bf993813
      Havoc Pennington authored
      	* bus/test.c (bus_test_flush_bus): remove the sleep from here,
      	I think it may have just been superstition. Not sure.
      
      	* dbus/dbus-string.c (_dbus_string_base64_decode): catch some OOM
      	failures that were not being handled.
      
      	* dbus/dbus-auth.c (process_auth): fix a memleak in OOM handling
      
      	* dbus/dbus-memory.c: add ability to set number of mallocs in a
      	row that will fail on out-of-memory.
      
      	* dbus/dbus-internals.c (_dbus_test_oom_handling): convenience
      	function for testing out-of-memory handling.
      
      	* bus/config-loader-expat.c (memsuite): don't wrap the dbus
      	allocation functions, they do map exactly to the expat ones.
      bf993813
  3. 25 Mar, 2003 1 commit
    • Havoc Pennington's avatar
      2003-03-24 Havoc Pennington <hp@redhat.com> · ce4fd314
      Havoc Pennington authored
      	* dbus/dbus-sysdeps.c (_dbus_set_fd_nonblocking): move to this
      	file
      
      	* dbus/dbus-errors.c (dbus_set_error, dbus_set_error_const): allow
      	NULL argument for "message" if the error is a well-known one,
      	fill in a generic message in this case.
      
      	* dbus/dbus-errors.h (DBusResultCode): Kill DBusResultCode in
      	favor of DBusError
      
      	* bus/test.c (bus_test_flush_bus): add
      
      	* bus/policy.c (bus_policy_test): test code stub
      ce4fd314
  4. 24 Mar, 2003 1 commit
    • Havoc Pennington's avatar
      2003-03-23 Havoc Pennington <hp@pobox.com> · c3af5ccd
      Havoc Pennington authored
      	* dbus/dbus-threads.c (dbus_mutex_new, dbus_condvar_new): with
      	DBUS_BUILD_TESTS, actually alloc/free a block of memory for
      	the mutex, so we can check for proper memory management
      	and OOM handling.
      
      	* dbus/dbus-dataslot.c: remove the mutex from
      	DBusDataSlotAllocator and lock it manually when using it,
      	to simplify fitting it into the global slots framework.
      
      	* dbus/dbus-threads.c (init_static_locks): rework how we're
      	handling global locks so they are easily shut down.
      
      	* bus/policy.c (bus_policy_append_rule): fix
      
      	* bus/test-main.c (main): check for memleaks
      
      	* dbus/dbus-test.c (dbus_internal_do_not_use_run_tests): make
      	test suite check for memleaks
      
      	* dbus/dbus-memory.c: add support in test mode for tracking
      	number of outstanding blocks
      c3af5ccd
  5. 16 Mar, 2003 1 commit
    • Havoc Pennington's avatar
      2003-03-16 Havoc Pennington <hp@pobox.com> · ce173b29
      Havoc Pennington authored
      	Oops - test code was only testing failure of around 30 of the
      	mallocs in the test path, but it turns out there are 500+
      	mallocs. I believe this was due to misguided linking setup such
      	that there was one copy of dbus_malloc etc. in the daemon and one
      	in the shared lib, and only daemon mallocs were tested. In any
      	case, the test case now tests all 500+ mallocs, and doesn't pass
      	yet, though there are lots of fixes in this patch.
      
      	* dbus/dbus-connection.c (dbus_connection_dispatch_message): fix
      	this so that it doesn't need to allocate memory, since it
      	has no way of indicating failure due to OOM (and would be
      	annoying if it did).
      
      	* dbus/dbus-list.c (_dbus_list_pop_first_link): new function
      
      	* bus/Makefile.am: rearrange to create two self-contained
      	libraries, to avoid having libraries with overlapping symbols.
      	that was resulting in weirdness, e.g. I'm pretty sure there
      	were two copies of global static variables.
      
      	* dbus/dbus-internals.c: move the malloc debug stuff to
      	dbus-memory.c
      
      	* dbus/dbus-list.c (free_link): free list mempool if it becomes
      	empty.
      
      	* dbus/dbus-memory.c (_dbus_disable_mem_pools): new function
      
      	* dbus/dbus-address.c (dbus_parse_address): free list nodes
      	on failure.
      
      	* bus/dispatch.c (bus_dispatch_add_connection): free
      	message_handler_slot when no longer using it, so
      	memory leak checkers are happy for the test suite.
      
      	* dbus/dbus-server-debug-pipe.c (debug_finalize): free server name
      
      	* bus/bus.c (new_connection_callback): disconnect in here if
      	bus_connections_setup_connection fails.
      
      	* bus/connection.c (bus_connections_unref): fix to free the
      	connections
      	(bus_connections_setup_connection): if this fails, don't
      	disconnect the connection, just be sure there are no side
      	effects.
      
      	* dbus/dbus-string.c (undo_alignment): unbreak this
      
      	* dbus/dbus-auth.c (_dbus_auth_unref): free some stuff we were
      	leaking
      	(_dbus_auth_new): fix the order in which we free strings
      	on OOM failure
      
      	* bus/connection.c (bus_connection_disconnected): fix to
      	not send ServiceDeleted multiple times in case of memory
      	allocation failure
      
      	* dbus/dbus-bus.c (dbus_bus_get_base_service): new function to
      	get the base service name
      	(dbus_bus_register_client): don't return base service name,
      	instead store it on the DBusConnection and have an accessor
      	function for it.
      	(dbus_bus_register_client): rename dbus_bus_register()
      
      	* bus/dispatch.c (check_hello_message): verify that other
      	connections on the bus also got the correct results, not
      	just the one sending hello
      ce173b29
  6. 13 Mar, 2003 1 commit
    • Havoc Pennington's avatar
      2003-03-12 Havoc Pennington <hp@redhat.com> · 29560adc
      Havoc Pennington authored
              Mega-patch that gets the message bus daemon initially handling
      	out-of-memory. Work still needed. Also lots of random
      	moving stuff to DBusError instead of ResultCode.
      
      	* dbus/dbus-list.c (_dbus_list_length_is_one): new function
      
      	* dbus/dbus-connection.c
      	(dbus_connection_send_with_reply_and_block): use DBusError
      
      	* dbus/dbus-bus.c: adapt to API changes, make it use DBusError not
      	DBusResultCode
      
      	* dbus/dbus-connection.c (dbus_connection_send): drop the result
      	code here, as the only failure possible is OOM.
      
      	* bus/connection.c (bus_connection_disconnect):
      	rename bus_connection_disconnected as it's a notification only
      
      	* bus/driver.c (bus_driver_handle_acquire_service): don't free
      	"name" on get_args failure, should be done by get_args;
      	don't disconnect client for bad args, just return an error.
      	(bus_driver_handle_service_exists): ditto
      
      	* bus/services.c (bus_services_list): NULL-terminate returned array
      
      	* bus/driver.c (bus_driver_send_service_lost)
      	(bus_driver_send_service_acquired): send messages from driver to a
      	specific client to the client's unique name, not to the broadcast
      	service.
      
      	* dbus/dbus-message.c (decode_header_data): reject messages that
      	contain no name field
      	(_dbus_message_get_client_serial): rename to
      	dbus_message_get_serial and make public
      	(_dbus_message_set_serial): rename from set_client_serial
      	(_dbus_message_set_reply_serial): make public
      	(_dbus_message_get_reply_serial): make public
      
      	* bus/connection.c (bus_connection_foreach): allow stopping
      	iteration by returning FALSE from foreach function.
      
      	* dbus/dbus-connection.c (dbus_connection_send_preallocated)
      	(dbus_connection_free_preallocated_send)
      	(dbus_connection_preallocate_send): new API for sending a message
      	without possibility of malloc failure.
      	(dbus_connection_send_message): rename to just
      	dbus_connection_send (and same for whole function family)
      
      	* dbus/dbus-errors.c (dbus_error_free): make this reinit the error
      
      	* dbus/dbus-sysdeps.c (_dbus_exit): new function
      
      	* bus/activation.c: handle/return errors
      
      	* dbus/dbus-errors.h: add more DBUS_ERROR #define
      
      	* dbus/dbus-sysdeps.c (_dbus_directory_open) (_dbus_file_get_contents)
      	(_dbus_directory_get_next_file): use DBusError instead of DBusResultCode
      	(_dbus_result_from_errno): move to this file
      29560adc
  7. 24 Feb, 2003 2 commits
    • Anders Carlsson's avatar
      2003-02-24 Anders Carlsson <andersca@codefactory.se> · c8769e0b
      Anders Carlsson authored
      	* dbus/dbus-internals.c: (_dbus_type_to_string):
      	* dbus/dbus-marshal.c: (_dbus_marshal_get_arg_end_pos),
      	(_dbus_marshal_validate_arg):
      	* dbus/dbus-message-builder.c: (_dbus_message_data_load):
      	* dbus/dbus-message.c: (dbus_message_append_args_valist),
      	(dbus_message_append_boolean), (dbus_message_append_boolean_array),
      	(dbus_message_get_args_valist), (dbus_message_iter_get_boolean),
      	(dbus_message_iter_get_int32), (dbus_message_iter_get_uint32),
      	(dbus_message_iter_get_double),
      	(dbus_message_iter_get_boolean_array), (message_iter_test):
      	* dbus/dbus-message.h:
      	* dbus/dbus-protocol.h:
      	* doc/dbus-specification.sgml:
      	* test/data/valid-messages/lots-of-arguments.message:
      	Add support for boolean and boolean array types.
      c8769e0b
    • Havoc Pennington's avatar
      2003-02-23 Havoc Pennington <hp@pobox.com> · 2f38c959
      Havoc Pennington authored
      	* dbus/dbus-keyring.c: finish most of this implementation and
      	simple unit test
      
      	* dbus/dbus-errors.c (dbus_set_error_const, dbus_set_error): make
      	these barf if the error isn't cleared to NULL
      
      	* dbus/dbus-sysdeps.c (_dbus_delete_file): set error on failure
      	(_dbus_create_directory): new function
      
      	* dbus/dbus-errors.c (dbus_set_error): fix warning
      
      	* dbus/dbus-string.c (_dbus_string_hex_encode): new function
      	(_dbus_string_hex_decode): new function
      	(test_hex_roundtrip): test code
      
      	* dbus/dbus-sha.c (_dbus_sha_compute): use dbus_string_hex_encode
      
      	* dbus/dbus-md5.c (_dbus_md5_compute): use dbus_string_hex_encode
      
      	* dbus/dbus-sysdeps.c (_dbus_string_save_to_file): make this use
      	the save-to-temp/rename trick to atomically write the new file
      	(_dbus_string_parse_uint): new function
      2f38c959
  8. 14 Feb, 2003 1 commit
    • Havoc Pennington's avatar
      2003-02-14 Havoc Pennington <hp@pobox.com> · 07a795f1
      Havoc Pennington authored
      	* dbus/dbus-mempool.c: fail if the debug functions so indicate
      
      	* dbus/dbus-memory.c: fail if the debug functions indicate we
      	should
      
      	* dbus/dbus-internals.c (_dbus_set_fail_alloc_counter)
      	(_dbus_decrement_fail_alloc_counter): debug functions to
      	simulate memory allocation failures
      07a795f1
  9. 31 Jan, 2003 1 commit
    • Anders Carlsson's avatar
      2003-01-31 Anders Carlsson <andersca@codefactory.se> · 8ab042b9
      Anders Carlsson authored
      	* dbus/dbus-address.c: (dbus_address_entry_free):
      	Free key and value lists.
      
      	* dbus/dbus-internals.c: (_dbus_type_to_string):
      	Add the types we didn't have.
      
      	* dbus/dbus-marshal.c: (_dbus_marshal_get_arg_end_pos),
      	(_dbus_marshal_validate_arg):
      	Add NIL types.
      
      	* dbus/dbus-message.c: (dbus_message_set_sender):
      	Remove todo about being able to set sender to NULL.
      
      	(dbus_message_set_is_error_reply),
      	(dbus_message_get_is_error_reply):
      	* dbus/dbus-message.h:
      	New functions.
      
      	* dbus/dbus-protocol.h:
      	Add error reply flag.
      
      	* test/data/valid-messages/opposite-endian.message:
      	Add NIL type to test.
      8ab042b9
  10. 26 Jan, 2003 1 commit
    • Havoc Pennington's avatar
      2003-01-26 Havoc Pennington <hp@pobox.com> · 9a0b07f2
      Havoc Pennington authored
      	* dbus/dbus-sysdeps.c (_dbus_file_get_contents): new function
      
      	* dbus/dbus-errors.c (dbus_result_to_string): add
      	file errors
      
      	* dbus/dbus-message-builder.c: new file, will contain code to load
      	up messages from files. Not implemented yet.
      9a0b07f2
  11. 18 Jan, 2003 1 commit
    • Havoc Pennington's avatar
      2003-01-18 Havoc Pennington <hp@pobox.com> · 6ac750b0
      Havoc Pennington authored
              Building --disable-verbose-mode --disable-asserts --disable-tests
      	cuts the library from 112K to 45K or so
      
      	* configure.in: check for varargs macro support,
      	add --enable-verbose-mode, --enable-asserts.
      
      	* dbus/dbus-internals.h (_dbus_assert): support
      	DBUS_DISABLE_ASSERT
      	(_dbus_verbose): support DBUS_ENABLE_VERBOSE_MODE
      6ac750b0
  12. 09 Jan, 2003 1 commit
    • Havoc Pennington's avatar
      2003-01-08 Havoc Pennington <hp@pobox.com> · 993be105
      Havoc Pennington authored
      	* dbus/dbus-string.c (_dbus_string_align_length): new function
      
      	* dbus/dbus-test-main.c: move main() for test app here
      	* dbus/dbus-test.c
      	(dbus_internal_symbol_do_not_use_run_tests): we have to export a
      	symbol to run tests, because dbus-test isn't in the main
      	library
      
              Code review nitpicks.
      
      	* dbus/dbus-message.c (dbus_message_write_header): add newlines
      	for people with narrow emacs ;-). Assert client_serial was filled
      	in. Assert message->name != NULL.
      	(dbus_message_append_fields): have "first_field_type" arg separate
      	from va list, needed for C++ binding that also uses varargs IIRC
      	and helps with type safety
      	(dbus_message_new): add @todo about using DBusString to store
      	service/name internally
      	(dbus_message_new): don't leak ->service and ->name on OOM later
      	in the function
      	(dbus_message_unref): free the service name
      	(dbus_message_get_fields): same change to varargs
      	i.e. first_field_type
      	(_dbus_message_loader_return_buffer): assert that the message data
      	is aligned (if not it's a bug in our code). Put in verbose griping
      	about why we set corrupted = TRUE.
      	(decode_header_data): add FIXME that char* is evil.  Was going to
      	add FIXME about evil locale-specific string.h strncmp, but just
      	switched to wacky string-as-uint32 optimization. Move check for
      	"no room for field name" above get_const_data_len() to avoid
      	assertion failure in get_const_data_len if we have trailing 2
      	bytes or the like. Check for service and name fields being
      	provided twice. Don't leak service/name on error. Require field
      	names to be aligned to 4 bytes.
      
      	* dbus/dbus-marshal.c: move byte swap stuff to header
      	(_dbus_pack_int32): uscore-prefix
      	(_dbus_unpack_int32): uscore-prefix
      	(_dbus_unpack_uint32): export
      	(_dbus_demarshal_string): add @todo complaining about use of
      	memcpy()
      	(_dbus_marshal_get_field_end_pos): add @todo about bad error
      	handling allowing corrupt data to go unchecked
      993be105
  13. 07 Jan, 2003 2 commits
    • Anders Carlsson's avatar
      2003-01-08 Anders Carlsson <andersca@codefactory.se> · 000d29a2
      Anders Carlsson authored
      	* dbus/dbus-internals.c: (_dbus_type_to_string):
      	New function that returns a string describing a type.
      
      	* dbus/dbus-marshal.c: (_dbus_demarshal_byte_array):
      	* dbus/dbus-marshal.h:
      	* dbus/dbus-message.c: (dbus_message_get_fields_valist),
      	(dbus_message_iter_get_field_type), (dbus_message_iter_get_double),
      	(dbus_message_iter_get_byte_array):
      	* dbus/dbus-message.h:
      	Add new convenience functions for appending and getting message fields.
      	Also add demarshalling routines for byte arrays.
      000d29a2
    • Anders Carlsson's avatar
      2003-01-08 Anders Carlsson <andersca@codefactory.se> · 1f23ea99
      Anders Carlsson authored
      	reviewed by: <delete if not using a buddy>
      
      	* dbus/dbus-internals.c: (_dbus_type_to_string):
      	New function that returns a string describing a type.
      
      	* dbus/dbus-internals.h:
      	* dbus/dbus-message.c: (dbus_message_append_fields),
      	(dbus_message_append_fields_valist), (dbus_message_get_fields),
      	(dbus_message_get_fields_valist), (_dbus_message_test):
      	* dbus/dbus-message.h:
      	Add new convenience functions for appending and getting message fields.
      	Also add a test for those.
      1f23ea99
  14. 12 Dec, 2002 1 commit
    • Havoc Pennington's avatar
      2002-12-11 Havoc Pennington <hp@pobox.com> · d4b870e7
      Havoc Pennington authored
      	* dbus/dbus-types.h: add dbus_unichar
      
      	* dbus/dbus-internals.c (_dbus_verbose): use _dbus_getenv
      
      	* dbus/dbus-connection.c (dbus_connection_send_message): return
      	TRUE on success
      
      	* dbus/dbus-transport.c: include dbus-watch.h
      
      	* dbus/dbus-connection.c: include dbus-message-internal.h
      
      	* HACKING: add file with coding guidelines stuff.
      
      	* dbus/dbus-string.h, dbus/dbus-string.c: Encapsulate all string
      	handling here, for security purposes (as in vsftpd). Not actually
      	using this class yet.
      
      	* dbus/dbus-sysdeps.h, dbus/dbus-sysdeps.c: Encapsulate all
      	system/libc usage here, as in vsftpd, for ease of auditing (and
      	should also simplify portability). Haven't actually moved all the
      	system/libc usage into here yet.
      d4b870e7
  15. 25 Nov, 2002 2 commits
    • Havoc Pennington's avatar
      2002-11-25 Havoc Pennington <hp@pobox.com> · 4a74f8fc
      Havoc Pennington authored
      	* dbus/dbus-internals.c (_dbus_verbose): fix to not
      	always print the first verbose message.
      4a74f8fc
    • Havoc Pennington's avatar
      2002-11-24 Havoc Pennington <hp@pobox.com> · 041b0767
      Havoc Pennington authored
              * test/echo-client.c, test/echo-server.c: cheesy test
      	clients.
      
      	* configure.in (AC_CHECK_FUNCS): check for writev
      
      	* dbus/dbus-message.c (_dbus_message_get_network_data): new
      	function
      
      	* dbus/dbus-list.c (_dbus_list_foreach): new function
      
      	* dbus/dbus-internals.c (_dbus_verbose): new function
      
      	* dbus/dbus-server.c, dbus/dbus-server.h: public object
      	representing a server that listens for connections.
      
      	* dbus/.cvsignore: create
      
      	* dbus/dbus-errors.h, dbus/dbus-errors.c:
      	public API for reporting errors
      
      	* dbus/dbus-connection.h, dbus/dbus-connection.c:
      	public object representing a connection that
      	sends/receives messages. (Same object used for
      	both client and server.)
      
      	* dbus/dbus-transport.h, dbus/dbus-transport.c:
      	Basic abstraction for different kinds of stream
      	that we might read/write messages from.
      041b0767
  16. 23 Nov, 2002 2 commits
    • Havoc Pennington's avatar
      2002-11-23 Havoc Pennington <hp@pobox.com> · 576cdb6e
      Havoc Pennington authored
      	* dbus/dbus-internals.h (_DBUS_INT_MAX): add _DBUS_INT_MIN
      	_DBUS_INT_MAX
      
      	* dbus/dbus-test.c (main): add list test, and include
      	dbus-test.h as intended
      
      	* dbus/dbus-hash.c (_dbus_hash_table_remove_string)
      	(_dbus_hash_table_remove_int): return value indicates
      	whether the entry existed to remove
      
      	* dbus/dbus-list.c: add linked list utility class,
      	with docs and tests
      
      	* dbus/dbus-hash.c: add TODO item about shrinking the hash bucket
      	array sometimes.
      576cdb6e
    • Havoc Pennington's avatar
      commit missing files · 954c4c75
      Havoc Pennington authored
      954c4c75