summaryrefslogtreecommitdiffstats
path: root/test/name-test
Commit message (Collapse)AuthorAgeFilesLines
* Merge commit '3d6abf64d0abb2718e082e120f14f8f923a4af59' into dbus-1.2Colin Walters2008-12-161-24/+27
|\
| * Clean up and clarify default system policyColin Walters2008-12-121-24/+27
| | | | | | | | | | The former was too reliant on old bugs and was generally unclear. This one makes explicit exactly what is allowed and not.
* | Add syslog of security denials and configuration file reloadsColin Walters2008-12-121-3/+1
|/ | | | | We need to start logging denials so that they become more easily trackable and debuggable.
* Bug 18229: Allow signalsColin Walters2008-12-094-1/+58
| | | | | | | Our previous fix went too far towards lockdown; many things rely on signals to work, and there's no really good reason to restrict which signals can be emitted on the bus because we can't tie them to a particular sender.
* Infrastructure for testing a "system like" bus in test suiteColin Walters2008-12-053-1/+121
| | | | | | The tmp-session-like-system.conf bus configuration has a security policy intended to mirror that of the system bus. This allows testing policy rules.
* Bug 16839: Fix bus names in test case so it actually works.Scott James Remnant2008-07-242-7/+7
| | | | | | * test/name-test/test-privserver.c (filter_session_message, main), * test/name-test/test-privserver-client.c (open_shutdown_private_connection): Replace TestServer with PrivServer to match the service definition files.
* Bug 15571: Clean up GUID-less connections correctly (Scott James Remnant)Colin Walters2008-05-301-5/+21
| | | | | | | | | * dbus/dbus-connection.c (connection_forget_shared_unlocked): Remove shared connections which lack a GUID from the list that caches those, otherwise references to them will remain after they have been freed. * test/name-test/test-privserver-client.c: Update test to try GUID-less connections too.
* Bug 15570: Reset initialized state on dbus_shutdown (Scott James Remnant)Colin Walters2008-05-301-2/+0
| | | | | | | | * dbus/dbus-bus.c (addresses_shutdown_func): Reset initialized back to FALSE after cleaning up the address list so that it will be reinitialized again if D-Bus is used after dbus_shutdown() * test/name-test/test-privserver-client.c: Uncomment part of test which should now pass.
* Add "PrivServer" test which exercises DBusServer and dbus_shutdownColin Walters2008-05-304-1/+243
| | | | | | | | | | | | | | * test/data/valid-service-files/org.freedesktop.DBus.TestSuite.PrivServer.service.in: New service file for PrivServer. * configure.in: Generate it. * test/name-test/Makefile.am: Build test-privserver and test-privserver-client. * test/name-test/test-privserver.c: Use DBusServer to serve a private connection. * test/name-test/test-privserver-client.c: Connect via session bus and get address of private server, exercise dbus_shutdown(). * test/name-test/run-test.sh: Run it.
* Add noinst convenience test library, add a test-shutdownColin Walters2008-05-303-3/+79
| | | | | | | | | | | | | * test/Makefile.am: New convenience library libdbus_testutils_la. Reorder build so that test/ gets built before test/name-test so name-test files can depend on it. * test/name-test/test-shutdown.c: New file, exercises dbus_shutdown () a bit. * test/name-test/run-test.sh Run test-shutdown. * test/test-utils.h: In some cases we already have DBUS_COMPILATION defined, avoid double definition warning.
* make shell script more portable (FDO Bug #11667)John (J5) Palmieri2008-01-151-5/+6
| | | | | | 2008-01-15 John (J5) Palmieri <johnp@redhat.com> * tests/name-test/run-test.sh: make more portable (FDO Bug #11667)
* Bring .gitignore files up to date; add *.o, *~ etc. to top-level .gitignoreSimon McVittie2007-10-101-0/+2
| | | | | CVS ignores these automatically, so they weren't in the .cvsignore when Ryan converted the repository.
* migrate from cvs to git (cvs2svn -> git-svnimport).Ryan Lortie2007-09-131-0/+0
| | | | | | | | | | | 2007-09-13 Ryan Lortie <desrt@desrt.ca> migrate from cvs to git (cvs2svn -> git-svnimport). * HACKING: update release/branch/tag instructions * */.cvsignore: rename to .gitignore also, clean up tags and branch names to conform to HACKING
* 2007-07-26 Havoc Pennington <hp@redhat.com>Havoc Pennington2007-07-261-2/+8
| | | | | | | | | | | | | | | * bus/config-parser-trivial.c (check_return_values): disable a test that hardcoded the bus user's name * bus/dispatch.c (bus_dispatch_test_conf): remove the "if (!use_launcher)" around the tests, they were only failing because we didn't pass through all the expected errors from the helper. * bus/activation-exit-codes.h (BUS_SPAWN_EXIT_CODE_CHILD_SIGNALED): add a code for child segfaulting (BUS_SPAWN_EXIT_CODE_GENERIC_FAILURE): make "1" be a generic failure code, so if a third party launch helper were written it could just always return 1 on failure.
* fix whitespaceHavoc Pennington2007-07-261-121/+121
|
* 2007-06-18 Havoc Pennington <hp@redhat.com>Havoc Pennington2007-06-183-5/+69
| | | | | | | | | | | | | | * doc/dbus-specification.xml: document org.freedesktop.DBus.GetId() * bus/driver.c (bus_driver_handle_get_id): implement org.freedesktop.DBus.GetId() * bus/bus.c (bus_context_new): generate a unique ID for each bus context * dbus/dbus-connection.c (dbus_connection_get_server_id): new function * dbus/dbus-bus.c (dbus_bus_get_id): new function * dbus/dbus-server.c (dbus_server_get_id): new function
* tools/.cvsignore: Ignore all currently built files.Simon McVittie2007-05-211-0/+7
| | | | test/name-test/.cvsignore: New file, ditto.
* * configure.in,test/test-sleep-forever.c,test/test-names.c:Ralf Habacker2007-03-041-1/+3
| | | | added configure check for unistd.h.
* * dbus/dbus-threads.h: fix DBUS_THREAD_FUNCTIONS_ALL_MASK to haveJohn (J5) Palmieri2006-11-141-1/+1
| | | | | | | | the correct value so we don't assert when initalizing recursive threads * test/name-test/test-thread-init.c: call dbus_threads_init_default instead of _dbus_threads_init_debug since it is more of a real world test
* * configure.in, dbus-1.pc.in: Check to see if thread methodsJohn (J5) Palmieri2006-10-261-3/+3
| | | | | are in glibc or libpthread and add -lpthread to the link stage if it is the latter
* * test/name-test/Makefile.am: don't link against both libdbus andJohn (J5) Palmieri2006-10-111-3/+3
| | | | libdbus-convenience
* 2006-10-01 Havoc Pennington <hp@redhat.com>Havoc Pennington2006-10-012-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * dbus/dbus-connection.c (_dbus_connection_close_if_only_one_ref): Add a hack to make DBusNewConnectionFunction work right. * dbus/dbus-server-socket.c (handle_new_client_fd_and_unlock): use the hack here. Also, fix the todo about refcount leak. * dbus/dbus-server-debug-pipe.c (_dbus_transport_debug_pipe_new): and use the hack here * dbus/dbus-connection.c: Kill the "shared" flag vs. the "shareable" flag; this was completely broken, since it meant dbus_connection_open() returned a connection of unknown shared-ness. Now, we always hold a ref on anything opened as shareable. Move the call to notify dbus-bus.c into connection_forget_shared_unlocked, so libdbus consistently forgets all its knowledge of a connection at once. This exposed numerous places where things were totally broken if we dropped a ref inside get_dispatch_status_unlocked where connection_forget_shared_unlocked was previously, so move connection_forget_shared_unlocked into _dbus_connection_update_dispatch_status_and_unlock. Also move the exit_on_disconnect here. (shared_connections_shutdown): this assumed weak refs to the shared connections; since we have strong refs now, the assertion was failing and stuff was left in the hash. Fix it to close still-open shared connections. * bus/dispatch.c: fixup to use dbus_connection_open_private on the debug pipe connections * dbus/dbus-connection.c (dbus_connection_dispatch): only notify dbus-bus.c if the closed connection is in fact shared (_dbus_connection_close_possibly_shared): rename from _dbus_connection_close_internal (dbus_connection_close, dbus_connection_open, dbus_connection_open_private): Improve docs to explain the deal with when you should close or unref or both * dbus/dbus-bus.c (_dbus_bus_notify_shared_connection_disconnected_unlocked): rename from _dbus_bus_check_connection_and_unref_unlocked and modify to loop over all connections * test/test-utils.c (test_connection_shutdown): don't try to close shared connections. * test/name-test/test-threads-init.c (main): fix warnings in here * dbus/dbus-sysdeps.c (_dbus_abort): support DBUS_BLOCK_ON_ABORT env variable to cause blocking waiting for gdb; drop DBUS_PRINT_BACKTRACE and just call _dbus_print_backtrace() unconditionally. * configure.in: add -export-dynamic to libtool flags if assertions enabled so _dbus_print_backtrace works. * dbus/dbus-sysdeps-unix.c (_dbus_print_backtrace): use fprintf instead of _dbus_verbose to print the backtrace, and diagnose lack of -rdynamic/-export-dynamic
* * configure.in, dbus/Makefile.am, test/name-test/run-test.sh,John (J5) Palmieri2006-08-252-4/+2
| | | | | | test/name-test/Makefile.am: Fixed some issues with getting get dbus to build with builddir != srcdir (Taken from a patch by Bernard Leak <bernard at brenda-arkle dot demon dot co dot uk>)
* * dbus/dbus-threads.c: Add static DBusList *uninitialized_mutex_list andJohn (J5) Palmieri2006-08-163-2/+191
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | static DBusList *uninitialized_condvar_list to support new late initialization threading model. In this model threads can be initialized even after the D-Bus API has been used but still needs to be initialized before the second thread has been started. Mutexes and condvar addresses are stored in the two static lists and are replaced with actuall locks when threads are initalized. (_dbus_mutex_new_at_location): New method for creating a mutex and placing the location into the static list (_dbus_mutex_free_at_location): New method for removing a mutex location from the static list and freeing the mutex (_dbus_condvar_new_at_location): New method for creating a conditional variable and placing the location into the static list (_dbus_condvar_free_at_location): New method for removing a conditional variable location from the static list and freeing the conditional variable (init_uninitialized_locks): Atomic method which goes through the static lists of mutex and condvar location and updates them with actuall locks (init_global_locks): changed to init_locks * dbus/dbus-connection.c: (_dbus_connection_test_get_locks): New method for tests to check connections (_dbus_connection_new_for_transport): Use the new at_location mutex and condvar API (dbus_connection_allocate_data_slot): Pass in the global lock address to _dbus_data_slot_allocator_alloc * dbus/dbus-dataslot.c: (_dbus_data_slot_allocator_alloc): Use the address of the mutex instead of the mutex itself * dbus/dbus-message.c: (dbus_message_allocate_data_slot): Pass in the global lock address to _dbus_data_slot_allocator_alloc * dbus/dbus-pending-call.c: (dbus_pending_call_allocate_data_slot): Pass in the global lock address to _dbus_data_slot_allocator_alloc * dbus/dbus-server.c: (_dbus_server_init_base): Use the new at_location mutex API (dbus_server_allocate_data_slot): Pass in the global lock address to _dbus_data_slot_allocator_alloc * test/name-test/test-threads-init.c: New test case for late thread initialization
* Patches by Kjartan Maraas <kmaraas at gnome dot org>John (J5) Palmieri2006-08-142-20/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * bus/services.c (bus_service_list_queued_owners): Add a pointer cast to fix compiler warning * dbus/dbus-dataslot.c (_dbus_data_slot_list_get): return a NULL instead of FALSE since the return type is not expecting a boolean * dbus/dbus-marshal-basic.c (_dbus_marshal_test): Remove unused variable * dbus/dbus-marshal-recursive-util.c (node_new): return a NULL instead of FALSE since the return type is not expecting a boolean * dbus/dbus-server-debug-pipe.c (_dbus_transport_debug_pipe_new): Send a NULL into _dbus_transport_new_for_fd instead of a FALSE because we are expecting a pointer not a boolean * dbus/dbus-sysdeps-util.c (_dbus_get_tmpdir): add void as the parameter so some compilers don't complain * dbus/dbus-transport-unix.c (_dbus_transport_new_for_domain_socket, _dbus_transport_new_for_tcp_socket): Send a NULL into _dbus_transport_new_for_fd instead of a FALSE because we are expecting a pointer not a boolean * test/shell-test.c (test_command_line): cast the second argument to _dbus_list_append to avoid compiler warnings * test/test-names.c (main): remove unused variable * test/test-service.c (check_hello_from_self_reply): Initialize echo_message and echo_reply to NULL * test/test-shell-service.c (handle_echo): Remove unused variable and cast the third parameter passed to dbus_connection_get_object_path_data to avoid compiler warrnings * test/name-test/test-names.c (clear_message_queue): Remove unused function * test/name-test/test-pending-call-dispatch.c: Fix format string in printf
* * dbus/dbus-bus.c:John (J5) Palmieri2006-08-141-10/+8
| | | | | | | * test/name-test/test-names.c: Remove test method dbus_bus_connection_get_unique_name because we already have public method dbus_bus_get_unique_name that does the exact same thing
* * tools/run-with-tmp-session-bus.sh:John (J5) Palmieri2006-08-101-2/+2
| | | | | | * test/name-test/run-test.sh: Remove bashisms (patch from Julio M. Merino Vidal <jmmv at NetBSD dot org>)
* 2006-03-02 John (J5) Palmieri <johnp@redhat.com>John (J5) Palmieri2006-03-023-1/+134
| | | | | | | | | | | | | | | * dbus/dbus-connection.c: (_dbus_connection_block_pending_call): Check to see if our data has already been read off the connection by another blocking pending call before we block in poll. (check_for_reply_and_update_dispatch_unlocked): Code taken from _dbus_connection_block_pending_call - checks for an already read reply and updates the dispatch if there is one. * test/name-test/test-pending-call-dispatch.c: New test for making sure we don't get stuck polling a dbus connection which has no data on the socket when blocking out of order on two or more pending calls.
* * configure.in: Add test/name-test/Makefile to the generatedJohn (J5) Palmieri2005-11-223-0/+634
Makefile list * dbus/dbus-shared.h (#define DBUS_NAME_FLAG_ALLOW_REPLACEMENT): New flag which replaces DBUS_NAME_FLAG_PROHIBIT_REPLACEMENT (#define DBUS_NAME_FLAG_DO_NOT_QUEUE): New flag for specifying not to queue an ower if it can't be the primary owner * bus/bus.h: Add new internal BusOwner struct * bus/driver.c (bus_driver_handle_hello): Send flags (0 for default) to bus_registry_ensure and don't set the prohibit_replacement flag since they are now set per BusOwner and not per name. (bus_driver_handle_list_queued_owners): bus method (ListQueuedOwners) that returns the list of connections in a name's connection queue * bus/services.c (struct BusService): remove prohibit_replacement field (struct BusOwner): new struct for keeping track of queued connections and their associated flags for the queue (struct BusRegistry): add a BusOwner memory pool (bus_registry_new): initialize the BusOwner memory pool (bus_registry_unref): free the BusOwner memory pool (_bus_service_find_owner_link): new internal method for searching the queue for a specific connection (bus_owner_set_flags): new method for adding setting the flags on a bus owner (bus_owner_new): new method that creates a BusOwner object from the pool and sets its flags (bus_owner_ref, bus_owner_unref): ref counting for BusOwner objects (bus_registry_ensure): Add the flags parameter (bus_registry_acquire_service): Switch from using raw connections to using the BusOwner struct Add new state machine for dealing with the new set of flags (bus_registry_set_service_context_table, struct OwnershipCancelData, cancel_ownership, free_ownership_cancel_data, add_cancel_ownership_to_transaction, struct OwnershipRestoreData, restore_ownership, free_ownership_restore_data, add_restore_ownership_to_transaction): Switch to using BusOwner instead of raw connections (bus_service_add_owner): Add flags parameter Switch to using BusOwner instead of raw connections Add state machine for dealing with the new set of flags (bus_service_swap_owner): Swaps the first and second owners in the queue. Used to make sure proper signals are sent when a service looses or gains primary ownership. We never insert an owner at the top of the queue. Instead we insert it in the second position and then swap. (bus_service_remove_owner): Remove the owner from the queue sending out the NameLost and NameOwnerChanged signals if the we were the primary owner (bus_service_get_primary_owners_connection): New method that extracts the connection from the primary owner (bus_service_get_primary_owner): Returns the BusOwner instead of the connection (bus_service_get_allow_replacement): Changed from the old bus_service_get_prohibit_replacement method. Checks the flags of the primary owner and returns if it can be replaced or not (bus_service_set_prohibit_replacement): removed (bus_service_has_owner): returns TRUE if and owner with the specified connection exists in the queue * dbus/dbus-bus.c (dbus_bus_connection_get_unique_name): New helper method that only compiles if tests are enabled. Allows us to get the unique name of a connection so we can check it against the queue when doing regression tests * bus/activation.c (bus_activation_send_pending_auto_activate), bus/dispatch.c (bus_dispatch), bus/driver.c (bus_driver_handle_get_service_owner, bus_driver_handle_get_connection_unix_user, bus_driver_handle_get_connection_unix_process_id, bus_driver_handle_get_connection_selinux_security_context), bus/signals.c (connection_is_primary_owner): use bus_service_get_primary_owners_connection instead of bus_service_get_primary_owner * dbus/dbus-sysdeps.c (_dbus_connect_unix_socket, _dbus_listen_unix_socket): Calculate the length of the socket path and use that instead of using a fixed length which was causing socket names to contain many trailing Nul bytes. * dbus/dbus-glib-lowlevel.h, glib/dbus-gobject.c (dbus_g_method_get_sender): New method for extracting the sender from a DBusGMethodInvocation (dbus_g_method_return_get_reply): changed name to dbus_g_method_get_reply (dbus_g_method_return_send_reply): changed name to dbus_g_method_send reply * doc/dbus-specification.xml: New docs that describe how the new queueing system works and talks about the changes to the how we specify socket names * glib/examples/example-service.c, glib/examples/example-signal-emitter.c, glib/examples/statemachine/statemachine-server.c: Changed the RequestName flags to the new system * test/name-test/ (test-names.c, run-test.sh, Makefile.am): New regression test suite for testing various states of the new queueing system