D-Bus  1.13.16
Todo List
Global _dbus_append_user_from_current_process (DBusString *str)
to which class belongs this
Global _dbus_auth_decode_data (DBusAuth *auth, const DBusString *encoded, DBusString *plaintext)
1.0? We need to be able to distinguish "out of memory" error from "the data is hosed" error.
Global _dbus_concat_dir_and_file (DBusString *dir, const DBusString *next_component)

it might be cute to collapse multiple '/' such as "foo//" concat "//bar"

it might be cute to collapse multiple '/' such as "foo//" concat "//bar"

Global _dbus_connection_block_pending_call (DBusPendingCall *pending)
could use performance improvements (it keeps scanning the whole message queue for example)
Global _dbus_connection_handle_watch (DBusWatch *watch, unsigned int condition, void *data)
This is basically a hack - we could delete _dbus_transport_handle_watch() and the virtual handle_watch in DBusTransport if we got rid of it. The reason this is some work is threading, see the _dbus_connection_handle_watch() implementation.
Global _dbus_credentials_add_from_user (DBusCredentials *credentials, const DBusString *username, DBusCredentialsAddFlags flags, DBusError *error)
this is broken because it treats OOM and parse error the same way. Needs a DBusError.
Global _dbus_error_from_errno (int error_number)
should cover more errnos, specifically those from open().
Global _dbus_keyring_validate_context (const DBusString *context)
this is the most inefficient implementation imaginable.
Global _dbus_message_loader_get_buffer (DBusMessageLoader *loader, DBusString **buffer, int *max_to_read, dbus_bool_t *may_read_fds)

this function can be a lot more clever. For example it can probably always return a buffer size to read exactly the body of the next message, thus avoiding any memory wastage or reallocs.

we need to enforce a max length on strings in header fields.

Global _dbus_message_loader_queue_messages (DBusMessageLoader *loader)

we need to check that the proper named header fields exist for each message type.

If a message has unknown type, we should probably eat it right here rather than passing it out to applications. However it's not an error to see messages of unknown type.

Global _dbus_object_tree_dispatch_and_unlock (DBusObjectTree *tree, DBusMessage *message, dbus_bool_t *found_object)
thread problems
Global _dbus_string_ends_with_c_str (const DBusString *a, const char *c_str)
memcmp might make this faster.
Global _dbus_string_equal (const DBusString *a, const DBusString *b)
memcmp is probably faster
Global _dbus_string_equal_len (const DBusString *a, const DBusString *b, int len)

write a unit test

memcmp is probably faster

Global _dbus_string_equal_substring (const DBusString *a, int a_start, int a_len, const DBusString *b, int b_start)

write a unit test

memcmp is probably faster

Global _dbus_string_pop_line (DBusString *source, DBusString *dest)
owen correctly notes that this is a stupid function (it was written purely for test code, e.g. dbus-message-builder.c). Probably should be enforced as test code only with ifdef DBUS_ENABLE_EMBEDDED_TESTS
Global _dbus_string_validate_ascii (const DBusString *str, int start, int len)
this is inconsistent with most of DBusString in that it allows a start,len range that extends past the string end.
Global _dbus_string_validate_nul (const DBusString *str, int start, int len)
this is inconsistent with most of DBusString in that it allows a start,len range that extends past the string end.
Global _dbus_string_validate_utf8 (const DBusString *str, int start, int len)
this is inconsistent with most of DBusString in that it allows a start,len range that extends past the string end.
Global _dbus_transport_new_for_domain_socket (const char *path, dbus_bool_t abstract, DBusError *error)
once we add a way to escape paths in a dbus address, this function needs to do escaping.
Global _dbus_transport_try_to_authenticate (DBusTransport *transport)
we drop connection->mutex when calling the unix_user_function, and windows_user_function, which may not be safe really.
Global _dbus_type_reader_delete (DBusTypeReader *reader, const DBusTypeReader *realign_root)
for now this does not delete the typecodes associated with the value, so this function should only be used for array elements.
Global _dbus_type_reader_set_basic (DBusTypeReader *reader, const void *value, const DBusTypeReader *realign_root)

DBusTypeReader currently takes "const" versions of the type and value strings, and this function modifies those strings by casting away the const, which is of course bad if we want to get picky. (To be truly clean you'd have an object which contained the type and value strings and set_basic would be a method on that object... this would also make DBusTypeReader the same thing as DBusTypeMark. But since DBusMessage is effectively that object for D-Bus it doesn't seem worth creating some random object.)

optimize this by only rewriting until the old and new values are at the same alignment. Frequently this should result in only replacing the value that's immediately at hand.

Global _dbus_validate_bus_name (const DBusString *str, int start, int len)
this is inconsistent with most of DBusString in that it allows a start,len range that extends past the string end.
Global _dbus_validate_bus_namespace (const DBusString *str, int start, int len)
this is inconsistent with most of DBusString in that it allows a start,len range that extends past the string end.
Global _dbus_validate_error_name (const DBusString *str, int start, int len)
this is inconsistent with most of DBusString in that it allows a start,len range that extends past the string end.
Global _dbus_validate_interface (const DBusString *str, int start, int len)
this is inconsistent with most of DBusString in that it allows a start,len range that extends past the string end.
Global _dbus_validate_member (const DBusString *str, int start, int len)
this is inconsistent with most of DBusString in that it allows a start,len range that extends past the string end.
Global _dbus_validate_path (const DBusString *str, int start, int len)

this is inconsistent with most of DBusString in that it allows a start,len range that extends past the string end.

change spec to disallow more things, such as spaces in the path name

Global _dbus_watch_set_handler (DBusWatch *watch, DBusWatchHandler handler, void *data, DBusFreeFunction free_data_function)
this function only exists because of the weird way connection watches are done, see the note in docs for _dbus_connection_handle_watch().
Global dbus_connection_add_filter (DBusConnection *connection, DBusHandleMessageFunction function, void *user_data, DBusFreeFunction free_data_function)
we don't run filters on messages while blocking without entering the main loop, since filters are run as part of dbus_connection_dispatch(). This is probably a feature, as filters could create arbitrary reentrancy. But kind of sucks if you're trying to filter METHOD_RETURN for some reason.
Global dbus_connection_dispatch (DBusConnection *connection)
some FIXME in here about handling DBUS_HANDLER_RESULT_NEED_MEMORY
Global dbus_connection_get_windows_user (DBusConnection *connection, char **windows_sid_p)
We would like to be able to say "You can ask the bus to tell you the user of another connection though if you like; this is done with dbus_bus_get_windows_user()." But this has to be implemented in bus/driver.c and dbus/dbus-bus.c, and is pointless anyway since on Windows we only use the session bus for now.
Global dbus_message_append_args (DBusMessage *message, int first_arg_type,...)

support DBUS_TYPE_STRUCT and DBUS_TYPE_VARIANT and complex arrays

If this fails due to lack of memory, the message is hosed and you have to start over building the whole message.

Global dbus_message_append_args_valist (DBusMessage *message, int first_arg_type, va_list var_args)
for now, if this function fails due to OOM it will leave the message half-written and you have to discard the message and start over.
Global dbus_message_copy (const DBusMessage *message)
This function can't be used in programs that try to recover from OOM errors.
Global dbus_message_get_args (DBusMessage *message, DBusError *error, int first_arg_type,...)
support DBUS_TYPE_STRUCT and DBUS_TYPE_VARIANT and complex arrays
Global dbus_message_get_path_decomposed (DBusMessage *message, char ***path)
this could be optimized by using the len from the message instead of calling strlen() again
Global dbus_message_iter_append_basic (DBusMessageIter *iter, int type, const void *value)
If this fails due to lack of memory, the message is hosed and you have to start over building the whole message.
Global dbus_message_iter_append_fixed_array (DBusMessageIter *iter, int element_type, const void *value, int n_elements)
If this fails due to lack of memory, the message is hosed and you have to start over building the whole message.
Global dbus_message_iter_close_container (DBusMessageIter *iter, DBusMessageIter *sub)
If this fails due to lack of memory, the message is hosed and you have to start over building the whole message.
Global dbus_message_iter_init_append (DBusMessage *message, DBusMessageIter *iter)
If appending any of the arguments fails due to lack of memory, the message is hosed and you have to start over building the whole message.
Global dbus_message_iter_open_container (DBusMessageIter *iter, int type, const char *contained_signature, DBusMessageIter *sub)
If this fails due to lack of memory, the message is hosed and you have to start over building the whole message.
Global dbus_message_new_error_printf (DBusMessage *reply_to, const char *error_name, const char *error_format,...)
add _DBUS_GNUC_PRINTF to this (requires moving _DBUS_GNUC_PRINTF to public header, see DBUS_DEPRECATED for an example)
Global dbus_pending_call_block (DBusPendingCall *pending)
when you start blocking, the timeout is reset, but it should really only use time remaining since the pending call was created. This requires storing timestamps instead of intervals in the timeout
Module DBusAuth

some SASL profiles require sending the empty string as a challenge/response, but we don't currently allow that in our protocol.

right now sometimes both ends will block waiting for input from the other end, e.g. if there's an error during DBUS_COOKIE_SHA1.

the cookie keyring needs to be cached globally not just per-auth (which raises threadsafety issues too)

grep FIXME in dbus-auth.c

Module DBusBus
right now the default address of the system bus is hardcoded, so if you change it in the global config file suddenly you have to set DBUS_SYSTEM_BUS_ADDRESS env variable. Might be nice if the client lib somehow read the config file, or if the bus on startup somehow wrote out its address to a well-known spot, but might also not be worth it.
Global DBusGUID
rename to UUID instead of GUID
Module DBusKeyring
there's a memory leak on some codepath in here, I saw it once when running make check - probably some specific initial cookies present in the cookie file, then depending on what we do with them.
Global DBusMessageLoader
write tests for break-loader that a) randomly delete header fields and b) set string fields to zero-length and other funky values.
Module DBusServer

Thread safety hasn't been tested much for DBusServer

Need notification to apps of disconnection, may matter for some transports

Module DBusString
DBusString needs a lot of cleaning up; some of the API is no longer used, and the API is pretty inconsistent. In particular all the "append" APIs, especially those involving alignment but probably lots of them, are no longer used by the marshaling code which always does "inserts" now.
Global INITIAL_LOADER_DATA_LEN
this should be based on min header size plus some average body size, or something. Or rather, the min header size only, if we want to try to read only the header, store that in a DBusMessage, then read only the body and store that, etc., depends on how we optimize _dbus_message_loader_get_buffer() and what the exact message format is.