summaryrefslogtreecommitdiffstats
path: root/dbus/dbus-auth.c
Commit message (Collapse)AuthorAgeFilesLines
* 2005-05-05 Havoc Pennington <hp@redhat.com>Havoc Pennington2005-05-051-11/+85
| | | | | | | | | | | | | | | | | * configure.in (LT_*): add notes on how the libtool versioning works to save thinking. Increment soname to indicate protocol breakage (though really the library interface hasn't changed I guess) * dbus/dbus-transport.c (_dbus_transport_get_is_authenticated): verify the GUID received from server matches what we were expecting, if we had an expectation * dbus/dbus-auth.c (send_ok): send GUID along with the OK command (_dbus_auth_get_guid_from_server): new function (send_begin): parse the OK args * doc/dbus-specification.xml: add GUID to the auth protocol
* 2005-02-26 Havoc Pennington <hp@redhat.com>Havoc Pennington2005-02-261-3/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * doc/TODO: remove the "guid" item * test/glib/test-profile.c (no_bus_thread_func): use open_private (with_bus_thread_func): use open_private * dbus/dbus-connection.c (dbus_connection_open_private): new function that works like the old dbus_connection_open() (dbus_connection_open): now returns an existing connection if possible * dbus/dbus-server-unix.c (handle_new_client_fd_and_unlock): pass through the GUID to the transport * dbus/dbus-server.c (_dbus_server_init_base): keep around the GUID in hex-encoded form. * dbus/dbus-server-debug-pipe.c (_dbus_transport_debug_pipe_new): pass GUID argument in to the transport * dbus/dbus-transport-unix.c (_dbus_transport_new_for_fd): add guid argument * dbus/dbus-transport.c (_dbus_transport_init_base): add guid argument * dbus/dbus-auth.c (_dbus_auth_server_new): add guid argument
* 2005-02-07 Havoc Pennington <hp@redhat.com>Havoc Pennington2005-02-071-0/+4
| | | | | | | * doc/dbus-specification.xml: some more language cleanups; add stuff about how to deal with invalid protocol and extension points; add _ to allowed chars in auth commands; add EXTENSION_ auth command prefix
* 2005-01-16 Havoc Pennington <hp@redhat.com>Havoc Pennington2005-01-171-136/+1
| | | | | | | | | | | | | | | | | | | | | | | | This is about it on what can be disabled/deleted from libdbus easily, back below 150K anyhow. Deeper cuts are more work than just turning the code off as I've done here. * dbus/dbus-marshal-basic.c (_dbus_pack_int32): we don't need the signed int convenience funcs * dbus/dbus-internals.c (_dbus_verbose_real): omit when not in verbose mode * dbus/dbus-string-util.c, dbus/dbus-string.c: more breaking things out of libdbus * dbus/dbus-sysdeps.c, dbus/dbus-sysdeps-util.c: same * dbus/dbus-hash.c: purge the TWO_STRINGS crap (well, make it tests-enabled-only, though it should probably be deleted) * dbus/dbus-message-util.c: same stuff * dbus/dbus-auth-util.c: same stuff
* 2005-01-16 Havoc Pennington <hp@redhat.com>Havoc Pennington2005-01-171-3/+3
| | | | | | | | * dbus/dbus-userdb-util.c: split out part of dbus-userdb.c * dbus/dbus-sysdeps.c (_dbus_uid_from_string): move here to pave way for stripping down dbus-userdb.c stuff included in libdbus. Rename _dbus_parse_uid for consistency.
* 2004-08-09 Havoc Pennington <hp@redhat.com>Havoc Pennington2004-08-101-1/+1
| | | | | * COPYING: switch to Academic Free License version 2.1 instead of 2.0, to resolve complaints about patent termination clause.
* 2004-07-19 David Zeuthen <david@fubar.dk>David Zeuthen2004-07-191-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * dbus/dbus-protocol.h: Add DBUS_ERROR_UNIX_PROCESS_ID_UNKNOWN * bus/dispatch.c: (check_get_connection_unix_user): Debug says GetProperty; but the method is called GetConnectionUnixUser (check_get_connection_unix_process_id): New function (bus_dispatch_test): Actually call check_get_connection_unix_user(); also call check_get_connection_unix_process_id() * bus/driver.c: (bus_driver_handle_get_connection_unix_process_id): New function, handles GetConnectionUnixProcessID on the org.freedesktop.DBus interface * dbus/dbus-auth.c: (handle_server_data_external_mech): Set pid from the credentials obtained from the socket * dbus/dbus-connection.c: (dbus_connection_get_unix_process_id): New function * dbus/dbus-connection.h: Add prototype for dbus_connection_get_unix_process_id * dbus/dbus-transport.c: (_dbus_transport_get_unix_process_id): New function * dbus/dbus-transport.h: Add prototype for _dbus_transport_get_unix_process_id
* 2004-06-20 Havoc Pennington <hp@redhat.com>Havoc Pennington2004-06-201-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | * dbus/dbus-glib-error-enum.h: autogenerate the GError enum codes from the dbus error names * glib/dbus-glib.h: move to subdir dbus/ since it's included as dbus/dbus-glib.h and that breakage is now visible due to including dbus/dbus-glib.h in dbus-glib-lowlevel.h * glib/dbus-glib.h: s/gproxy/g_proxy/ * dbus/dbus-shared.h: new header to hold stuff shared with binding APIs * dbus/dbus-protocol.h (DBUS_ERROR_*): move errors here rather than dbus-errors.h * glib/dbus-glib.h (dbus_set_g_error): move to dbus-glib-lowlevel.h * glib/dbus-glib.h: remove dbus/dbus.h from here; change a bunch of stuff to enable this * dbus/dbus-glib-lowlevel.h: put dbus/dbus.h here * a bunch of other changes with the same basic "separate glib bindings from dbus.h" theme
* 2004-06-02 Kristian Høgsberg <krh@redhat.com>Kristian Høgsberg2004-06-021-350/+391
| | | | | | | | | | * dbus/dbus-auth.c: Rewrite auth protocol handling to use a state machine approach. A state is implemented as a function that handles incoming events as specified for that state. * doc/dbus-specification.xml: Update auth protocol state machine specification to match implementation. Remove some leftover base64 examples.
* * dbus/dbus-auth.c (client_try_next_mechanism): Remove logic toKristian Høgsberg2004-05-171-53/+10
| | | | | | | | | | | | | | | | | | | | | | | | filter against auth->allowed_mechs; we only add allowed mechs in record_mechanisms(). * dbus/dbus-auth-script.c (_dbus_auth_script_run): Add an ALLOWED_MECHS to auth-script format so we can set the list of allowed mechanisms. * data/auth/client-out-of-mechanisms.auth-script: New test to check client disconnects when it is out of mechanisms to try. * dbus/dbus-auth.c (process_command): Remove check for lines longer that 1 MB; we only buffer up maximum 16 kB. * dbus/dbus-transport.c, dbus/dbus-transport-unix.c, dbus/dbus-auth-script.c, dbus/dbus-auth.c, dbus/dbus-auth.h: Remove auth state AUTHENTICATED_WITH_UNUSED_BYTES, instead always assume there might be unused bytes. * dbus/dbus-auth.c (_dbus_auth_do_work): Remove check for client-out-of-mechs, it is handled in process_reject(). Move check for max failures to send_rejected(), as it's a server-only thing.
* 2004-05-18 Kristian Høgsberg <krh@redhat.com>Kristian Høgsberg2004-05-171-131/+151
| | | | | | * dbus/dbus-auth.c: Factor out protocol reply code into functions send_auth(), send_data(), send_rejected(), send_error(), send_ok(), send_begin() and send_cancel().
* 2004-05-17 Kristian Høgsberg <krh@redhat.com>Kristian Høgsberg2004-05-171-27/+62
| | | | | | | | | | | | | | | | | | Remove base64 encoding, replace with hex encoding. Original patch from trow@ximian.com, added error handling. * dbus/dbus-string.c (_dbus_string_base64_encode) (_dbus_string_base64_decode): Remove. (_dbus_string_hex_decode): Add end_return argument so we can distinguish between OOM and invalid hex encoding. (_dbus_string_test): Remove base64 tests and add test case for invalid hex. * dbus/dbus-keyring.c, dbus/dbus-auth-script.c, dbus/dbus-auth.c: Replace base64 with hex. * test/data/auth/invalid-hex-encoding.auth-script: New test case for invalid hex encoded data in auth protocol.
* 2003-12-02 Richard Hult <richard@imendio.com>Richard Hult2003-12-021-1/+1
| | | | | * Update AFL version to 2.0 throughout the source files to reflect the update that was done a while ago.
* 2003-11-26 Mikael Hallendal <micke@imendio.com>Mikael Hallendal2003-11-271-1/+4
| | | | | | * bus/*.[ch]: * dbus/*.[ch]: * glib/*.[ch]: Made ref functions return the pointer
* 2003-09-25 Mark McLoughlin <mark@skynet.ie>Mark McLoughlin2003-09-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * doc/dbus-specification.sgml: don't require header fields to be 4-byte aligned and specify that fields should be distinguished from padding by the fact that zero is not a valid field name. * doc/TODO: remove re-alignment item and add item to doc the OBJECT_PATH type. * dbus/dbus-message.c: (HeaderField): rename the original member to value_offset and introduce a name_offset member to keep track of where the field actually begins. (adjust_field_offsets): remove. (append_int_field), (append_uint_field), (append_string_field): don't align the start of the header field to a 4-byte boundary. (get_next_field): impl finding the next marhsalled field after a given field. (re_align_field_recurse): impl re-aligning a number of already marshalled fields. (delete_field): impl deleting a field of any type and re-aligning any following fields. (delete_int_or_uint_field), (delete_string_field): remove. (set_int_field), (set_uint_field): no need to re-check that we have the correct type for the field. (set_string_field): ditto and impl re-aligning any following fields. (decode_header_data): update to take into account that the fields aren't 4-byte aligned any more and the new way to distinguish padding from header fields. Also, don't exit when there is too much header padding. (process_test_subdir): print the directory. (_dbus_message_test): add test to make sure a following field is re-aligned correctly after field deletion. * dbus/dbus-string.[ch]: (_dbus_string_insert_bytes): rename from insert_byte and allow the insert of multiple bytes. (_dbus_string_test): test inserting multiple bytes. * dbus/dbus-marshal.c: (_dbus_marshal_set_string): add warning note to docs about having to re-align any marshalled values following the string. * dbus/dbus-message-builder.c: (append_string_field), (_dbus_message_data_load): don't align the header field. * dbus/dbus-auth.c: (process_test_subdir): print the directory. * test/break-loader.c: (randomly_add_one_byte): upd. for insert_byte change. * test/data/invalid-messages/bad-header-field-alignment.message: new test case. * test/data/valid-messages/unknown-header-field.message: shove a dict in the unknown field.
* 2003-09-07 Havoc Pennington <hp@pobox.com>Havoc Pennington2003-09-071-14/+26
| | | | * Make Doxygen contented.
* 2003-08-01 Havoc Pennington <hp@pobox.com>Havoc Pennington2003-08-021-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | * dbus/dbus-protocol.h (DBUS_MESSAGE_TYPE_*): introduce a message type enum to distinguish kinds of message (DBUS_HEADER_FLAG_NO_REPLY_EXPECTED): flag for a message that need not be replied to 2003-08-01 Havoc Pennington <hp@pobox.com> * dbus/dbus-marshal.c: adapt to DBusObjectID changes (unpack_8_octets): fix no-64-bit-int bug * dbus/dbus-object-registry.c (validate_id): validate the connection ID bits, not just the instance ID. * dbus/dbus-connection.c (_dbus_connection_init_id): initialize the connection-global 33 bits of the object ID * dbus/dbus-object-registry.c (info_from_entry): fill in object ID in the new way * dbus/dbus-objectid.h: rather than high/low bits, specifically define server/client/instance bits.
* 2003-05-11 Havoc Pennington <hp@pobox.com>Havoc Pennington2003-05-111-3/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Write a "test-profile" that does echo client-server with threads; profile reveals lock contention, memcpy/realloc of buffers, and UTF-8 validation as hot spots. 20% of lock contention eliminated with dbus_atomic_inc/dec implementation on x86. Much remaining contention is global mempool locks for GList and DBusList. * dbus/dbus-sysdeps.c (_dbus_atomic_inc, _dbus_atomic_dec): add x86 implementation * dbus/dbus-connection.c (struct DBusConnection): use dbus_atomic_t for the reference count * dbus/dbus-message.c (struct DBusMessage): declare dbus_atomic_t values as volatile * configure.in: code to detect ability to use atomic integer operations in assembly, from GLib patch * dbus/dbus-internals.c (_dbus_verbose_real): call getpid every time, tired of it being wrong in threads and forked processes * glib/test-profile.c: a little program to bounce messages back and forth between threads and eat CPU * dbus/dbus-connection.c: add debug spew macros for debugging thread locks; include config.h at top; fix deadlock in dbus_connection_flush()
* 2003-04-18 Havoc Pennington <hp@pobox.com>Havoc Pennington2003-04-181-45/+93
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * dbus/dbus-auth.c (record_mechanisms): memleak fixes * dbus/dbus-sysdeps.c (_dbus_string_save_to_file): fix some memleaks * dbus/dbus-keyring.c (add_new_key): fix a memleak, and on realloc be sure to update the pointer in the keyring * dbus/dbus-string.c (_dbus_string_zero): compensate for align offset to avoid writing to unallocated memory * dbus/dbus-auth.c (process_rejected): return FALSE if we fail to try the next mechanism, so we properly handle OOM * dbus/dbus-keyring.c (_dbus_keyring_new_homedir): fix double-free on OOM. (_dbus_keyring_new): fix OOM bug (_dbus_keyring_new_homedir): always set error; impose a maximum number of keys we'll load from the file, mostly to speed up the test suite and make its OOM checks more useful, but also for general sanity. * dbus/dbus-auth.c (process_error_server): reject authentication if we get an error from the client (process_cancel): on cancel, send REJECTED, per the spec (process_error_client): send CANCEL if we get an error from the server.
* 2003-04-18 Havoc Pennington <hp@pobox.com>Havoc Pennington2003-04-181-1/+1
| | | | | | | | | | | | | | | | | | | * dbus/dbus-mainloop.c (_dbus_loop_iterate): fix UMR in verbose debug spew * dbus/dbus-auth.c (handle_client_data_cookie_sha1_mech): fix OOM handling problem * dbus/dbus-keyring.c (_dbus_keyring_new_homedir): only whine about DBUS_TEST_HOMEDIR once * bus/Makefile.am (TESTS_ENVIRONMENT): put DBUS_TEST_HOMEDIR in the environment * bus/dispatch.c (bus_dispatch_sha1_test): actually load sha1 config file so we test the right thing Throughout: assorted docs improvements
* 2003-04-17 Havoc Pennington <hp@redhat.com>Havoc Pennington2003-04-171-5/+6
| | | | | * dbus/dbus-userdb.c, dbus/dbus-sysdeps.c: redo all the passwd database usage so it all goes via the DBusUserDatabase cache.
* 2003-04-12 Havoc Pennington <hp@pobox.com>Havoc Pennington2003-04-131-35/+19
| | | | | | | | | | | * bus/config-parser.c (bus_config_parser_new): fix a memleak * dbus/dbus-sysdeps.c: change DBusCredentials to use longs for the pid/gid/uid, just for paranoia. * test/break-loader.c (randomly_do_n_things): find a byte containing a type code, and randomly change it to a different type code.
* 2003-04-01 Havoc Pennington <hp@pobox.com>Havoc Pennington2003-04-011-7/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | * dbus/dbus-server.c (dbus_server_set_auth_mechanisms): new function * dbus/dbus-auth.c (_dbus_auth_set_mechanisms): new * dbus/dbus-internals.c (_dbus_dup_string_array): new function * dbus/dbus-sysdeps.c (_dbus_listen_unix_socket): chmod the socket 0777, and unlink any existing socket. * bus/bus.c (bus_context_new): change our UID/GID and fork if the configuration file so specifies; set up auth mechanism restrictions * bus/config-parser.c (bus_config_parser_content): add support for <fork> option and fill in code for <auth> * bus/system.conf.in: add <fork/> to default configuration, and limit auth mechanisms to EXTERNAL * doc/config-file.txt (Elements): add <fork> * dbus/dbus-sysdeps.c (_dbus_become_daemon): new function (_dbus_change_identity): new function
* 2003-03-31 Havoc Pennington <hp@redhat.com>Havoc Pennington2003-03-311-68/+44
| | | | | | | | | | | | Fix some annoying DBusString API and fix all affected code. * dbus/dbus-string.c (_dbus_string_init): get rid of annoying max_length argument (_dbus_string_get_data): change to return string instead of using an out param (_dbus_string_get_const_data): ditto (_dbus_string_get_data_len): ditto (_dbus_string_get_const_data_len): ditto
* 2003-03-28 Havoc Pennington <hp@pobox.com>Havoc Pennington2003-03-281-4/+4
| | | | | | | | | | | | | | | | | | | * 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.
* 2003-03-17 Havoc Pennington <hp@pobox.com>Havoc Pennington2003-03-171-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | All tests pass, no memleaks, no valgrind complaints. * bus/test.c: refcount handler_slot * bus/connection.c (bus_connections_new): refcount connection_data_slot * dbus/dbus-auth-script.c (_dbus_auth_script_run): delete unused bytes so that auth scripts pass. * bus/dispatch.c: init message_handler_slot so it gets allocated properly * bus/dispatch.c (message_handler_slot_ref): fix memleak * dbus/dbus-server-debug-pipe.c (_dbus_server_debug_pipe_new): dealloc server_pipe_hash when no longer used for benefit of leak checking * dbus/dbus-auth.c (process_command): memleak fix * bus/dispatch.c (check_hello_message): memleak fix
* 2003-03-16 Havoc Pennington <hp@pobox.com>Havoc Pennington2003-03-171-33/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * dbus/dbus-watch.c (_dbus_watch_new): handle failure to malloc the watch * dbus/dbus-server-debug-pipe.c (_dbus_transport_debug_pipe_new): add some missing dbus_set_result * bus/dispatch.c (bus_dispatch_add_connection): handle failure to alloc the DBusMessageHandler * dbus/dbus-transport.c (_dbus_transport_disconnect): don't ref the transport here, since we call this from the finalizer; it resulted in a double-finalize. * dbus/dbus-transport.c (_dbus_transport_disconnect): fix a bug where we tried to use transport->connection that was NULL, happened when transport was disconnected early on due to OOM * bus/*.c: adapt to handle OOM for watches/timeouts * dbus/dbus-transport-unix.c: port to handle OOM during watch handling * dbus/dbus-auth.c (_dbus_auth_get_unused_bytes): return a reference to unused bytes instead of a copy * dbus/dbus-server.c (dbus_server_handle_watch): return FALSE for out of memory * dbus/dbus-connection.c (dbus_connection_handle_watch): return FALSE on OOM * dbus/dbus-timeout.c (dbus_timeout_handle): return FALSE for out of memory
* 2003-03-16 Havoc Pennington <hp@pobox.com>Havoc Pennington2003-03-161-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* 2003-03-14 Havoc Pennington <hp@pobox.com>Havoc Pennington2003-03-151-2/+3
| | | | | | | | | | | | | | | | | | | | | | * bus/dispatch.c (bus_dispatch_test): do test using debug-pipe transport, tests more of the real codepath. Set up clients with bus_setup_debug_client. * bus/test.c (bus_setup_debug_client): function to set up debug "clients" on the main loop * dbus/dbus-transport.c (_dbus_transport_open): add debug-pipe support * dbus/dbus-server.c (dbus_server_listen): add debug-pipe server type * dbus/dbus-server-debug.c: support a debug server based on pipes * dbus/dbus-sysdeps.c (_dbus_full_duplex_pipe): new function (_dbus_close): new function * configure.in: check for socketpair
* 2003-03-12 Havoc Pennington <hp@redhat.com>Havoc Pennington2003-03-131-11/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* 2003-03-04 Havoc Pennington <hp@pobox.com>Havoc Pennington2003-03-051-77/+693
| | | | | | | | | | | | | | | | | | | | | | | * test/data/auth/*: adapt to changes * dbus/dbus-auth-script.c (_dbus_auth_script_run): add USERID_BASE64 and change USERNAME_BASE64 to put in username not userid * dbus/dbus-keyring.c (_dbus_keyring_validate_context): prevent more stuff from being in a context name, to make the protocol simpler to deal with * dbus/dbus-errors.c (dbus_error_has_name): new function (dbus_error_is_set): new function * dbus/dbus-auth.c: replace DBUS_STUPID_TEST_MECH auth with DBUS_COOKIE_SHA1, implement DBUS_COOKIE_SHA1 * dbus/dbus-connection.c (dbus_connection_flush): also read messages during a flush operation * dbus/Makefile.am: remove dbus-md5 since it isn't currently used.
* 2003-03-05 Anders Carlsson <andersca@codefactory.se>Anders Carlsson2003-03-041-0/+3
| | | | | | | | | * dbus/dbus-auth.c: (send_rejected), (process_test_subdir): * dbus/dbus-keyring.c: (_dbus_keyring_new_homedir), (_dbus_keyring_test): * dbus/dbus-md5.c: (_dbus_md5_compute): * dbus/dbus-sha.c: (_dbus_sha_compute): Plug memory leaks.
* 2003-02-18 Joe Shaw <joe@assbarn.com>Joe Shaw2003-02-181-1/+3
| | | | | | | | | | | | | | | | | | | | | | * dbus/dbus-auth.c (handle_server_data_stupid_test_mech): Just get credentials from our currently running process. (get_word): Fix a buglet where we were copying the entire length instead of relative to our position. * dbus/dbus-hash.c (_dbus_hash_test): Don't try to allocate the keys on the stack... it's 640k of data. * dbus/dbus-sysdeps.c (_dbus_read_credentials_unix_socket): Always read the credentials byte off the socket, even if we don't have SO_PEERCRED. (_dbus_poll): Implement poll() using select() for systems which don't have it. * glib/test-dbus-glib.c (main): Print out an error if no parameters are given. * test/data/auth/fallback.auth-script: Added. Tests that a client can fallback to a secondary auth mechanism if the first fails.
* 2003-02-16 Anders Carlsson <andersca@codefactory.se>Anders Carlsson2003-02-161-0/+2
| | | | | | | | | | | | * dbus/dbus-auth.c: (client_try_next_mechanism): Plug a leak. * dbus/dbus-threads.c: (dbus_condvar_wait_timeout): Return TRUE if there's no thread implementation around. * glib/dbus-gmain.c: (free_source), (dbus_connection_hookup_with_g_main): Make sure to remove the GSource when the connection is finalized.
* 2003-02-13 Havoc Pennington <hp@pobox.com>Havoc Pennington2003-02-131-0/+2
| | | | | | | * test/data/auth/fail-after-n-attempts.auth-script: new test * dbus/dbus-auth.c (send_rejected): shutdown_mech() when we reject the client.
* 2003-02-13 Havoc Pennington <hp@pobox.com>Havoc Pennington2003-02-131-36/+41
| | | | | | | | | | | | | | | | | | | | * dbus/dbus-auth.c (handle_server_data_external_mech): args to dbus_credentials_match were backward * dbus/dbus-auth-script.c (_dbus_auth_script_run): support NO_CREDENTIALS and ROOT_CREDENTIALS * dbus/dbus-auth.c (_dbus_auth_do_work): move get_state() routine into here. Never process more commands after we've reached an end state; store further data as unused bytes. * test/data/auth/*: add more auth tests * dbus/dbus-auth-script.c (_dbus_auth_script_run): support EXPECT command to match exact string and EXPECT_UNUSED to match unused bytes * test/Makefile.am (dist-hook): fix to dist all the test stuff
* 2003-02-12 Havoc Pennington <hp@pobox.com>Havoc Pennington2003-02-131-0/+131
| | | | | | | | | | | * dbus/dbus-string.c (_dbus_string_pop_line): fix to also strip \r off of popped lines * dbus/dbus-auth.c (_dbus_auth_test): write code to run auth scripts * dbus/dbus-auth-script.c (_dbus_auth_script_run): when doing a SEND, append \r\n
* 2003-02-10 Havoc Pennington <hp@pobox.com>Havoc Pennington2003-02-131-2/+15
| | | | | | | | | | * dbus/dbus-auth-script.c, dbus/dbus-auth-script.h: sync initial cut at test framework for DBusAuth from laptop. Doesn't quite work yet but it compiles and I need to get it off the 266mhz laptop. ;-) * dbus/dbus-server-debug.c (_dbus_server_debug_accept_transport): fix a memleak in error case
* 2003-02-02 Havoc Pennington <hp@pobox.com>Havoc Pennington2003-02-051-1/+23
| | | | | | | | | | * dbus/dbus-keyring.c, dbus/dbus-keyring.h: template files for code to manage cookies in your home directory * dbus/dbus-sysdeps.c (_dbus_generate_random_bytes): new function * dbus/dbus-auth.c (get_state): impose a maximum number of tries to authenticate, then disconnect the client.
* 2003-01-30 Havoc Pennington <hp@pobox.com>Havoc Pennington2003-01-311-37/+18
| | | | | | | | * dbus/dbus-auth.c: rework to use only REJECTED, no MECHANISMS * doc/dbus-sasl-profile.txt: drop MECHANISMS and just use REJECTED, suggested by Mark McLoughlin
* 2003-01-26 Anders Carlsson <andersca@codefactory.se>Anders Carlsson2003-01-261-2/+7
| | | | | | | | | | | | | | | | | | * dbus/dbus-auth.c: (process_auth), (_dbus_auth_unref): * dbus/dbus-connection.c: (_dbus_connection_new_for_transport), (dbus_connection_unref): * dbus/dbus-marshal.c: (_dbus_marshal_test): * dbus/dbus-message.c: (dbus_message_unref), Plug memory leaks. (dbus_message_get_fields): Remove debugging printout. (_dbus_message_loader_return_buffer): Don't store the header string. (_dbus_message_test): Plug leaks.
* 2003-01-04 Havoc Pennington <hp@pobox.com>Havoc Pennington2003-01-041-5/+263
| | | | | | | | | | | | | | | | | | | | | | | | | * test/watch.c (error_handler): make it safe if the error handler is called multiple times (if we s/error handler/disconnect handler/ we should just guarantee it's called only once) * dbus/dbus-transport.c (_dbus_transport_disconnect): call the error handler on disconnect (it's quite possible we should just change the error handler to a "disconnect handler," I'm not sure we have any other meaningful errors) * configure.in: check for getpwnam_r * dbus/dbus-transport.c, dbus/dbus-transport-unix.c, dbus/dbus-auth.c: add credentials support, add EXTERNAL auth mechanism as in SASL spec, using socket credentials * dbus/dbus-sysdeps.c (_dbus_read_credentials_unix_socket): new function (_dbus_send_credentials_unix_socket): new function * dbus/dbus-sysdeps.c (_dbus_accept_unix_socket): rename just dbus_accept() (_dbus_write): only check errno if <0 returned (_dbus_write_two): ditto
* 2002-12-26 Havoc Pennington <hp@pobox.com>Havoc Pennington2002-12-271-52/+83
| | | | | | | | | | | * dbus/dbus-auth.c: fixes fixes fixes * dbus/dbus-transport-unix.c: wire up support for encoding/decoding data on the wire * dbus/dbus-auth.c (_dbus_auth_encode_data) (_dbus_auth_decode_data): append to target string instead of nuking it.
* 2002-12-26 Havoc Pennington <hp@pobox.com>Havoc Pennington2002-12-271-28/+112
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * dbus/dbus-marshal.h (DBUS_COMPILER_BYTE_ORDER): #ifdef WORDS_BIGENDIAN then compiler byte order is DBUS_BIG_ENDIAN, doh * dbus/dbus-marshal.c: Add macros to do int swapping in-place and avoid swap_bytes() overhead (ignoring possible assembly stuff for now). Main point is because I wanted unpack_uint32 to implement _dbus_verbose_bytes (_dbus_verbose_bytes): new function * dbus/dbus-string.c (_dbus_string_validate_ascii): new function * dbus/dbus-message.c (_dbus_message_loader_get_is_corrupted): add mechanism to handle a corrupt message stream (_dbus_message_loader_new): fix preallocation to only prealloc, not prelengthen * dbus/dbus-string.c (_dbus_string_skip_blank): fix this function (_dbus_string_test): enhance tests for copy/move and fix the functions * dbus/dbus-transport-unix.c: Hold references in more places to avoid reentrancy problems * dbus/dbus-transport.c: ditto * dbus/dbus-connection.c (dbus_connection_dispatch_message): don't leak reference count in no-message case * test/watch.c (do_mainloop): handle adding/removing watches during iteration over the watches. Also, ref the connection/server stored on a watch, so we don't try to mangle a destroyed one. * dbus/dbus-transport-unix.c (do_authentication): perform authentication * dbus/dbus-auth.c (get_state): add a state AUTHENTICATED_WITH_UNUSED_BYTES and return it if required (_dbus_auth_get_unused_bytes): append the unused bytes to the passed in string, rather than prepend * dbus/dbus-transport.c (_dbus_transport_init_base): create the auth conversation DBusAuth * dbus/dbus-transport-unix.c (_dbus_transport_new_for_fd) (_dbus_transport_new_for_domain_socket): when creating a transport, pass in whether it's a client-side or server-side transport so we know which DBusAuth to create
* 2002-12-25 Havoc Pennington <hp@pobox.com>Havoc Pennington2002-12-251-0/+1215
* doc/dbus-sasl-profile.txt: docs on the authentication protocol, it is a simple protocol that just maps directly to SASL. * dbus/dbus-auth.h, dbus/dbus-auth.c: authentication protocol initial implementation, not actually used yet. * dbus/dbus-string.c (_dbus_string_find): new function (_dbus_string_equal): new function (_dbus_string_base64_encode): new function (_dbus_string_base64_decode): new function