summaryrefslogtreecommitdiffstats
path: root/bus/dispatch.c
diff options
context:
space:
mode:
authorHavoc Pennington <hp@redhat.com>2003-04-14 23:52:40 +0000
committerHavoc Pennington <hp@redhat.com>2003-04-14 23:52:40 +0000
commitfe1cb3a9a1fc6bcbfa1b3be74ac9d5867005210f (patch)
treeaed4dfc46cfa3791a06f6f2ac3b465f0d5a5dd2f /bus/dispatch.c
parent7c434a849a161c4514f3759659ac7af9ecddc721 (diff)
2003-04-14 Havoc Pennington <hp@redhat.com>
* dbus/dbus-userdb.c: user database abstraction, mostly to get caching, but at some point we might want to be able to use a different database. * bus/dispatch.c (bus_dispatch_sha1_test): add a test that uses SHA1 conf file to test the sha1 auth mechanism, since the regular test always uses EXTERNAL when available. * configure.in, test/data/valid-config-files/debug-allow-all-sha1.conf.in: add conf file that requires use of sha1 auth
Diffstat (limited to 'bus/dispatch.c')
-rw-r--r--bus/dispatch.c50
1 files changed, 47 insertions, 3 deletions
diff --git a/bus/dispatch.c b/bus/dispatch.c
index 3ce7731c..595db33b 100644
--- a/bus/dispatch.c
+++ b/bus/dispatch.c
@@ -1878,13 +1878,13 @@ bus_dispatch_test (const DBusString *test_data_dir)
DBusConnection *bar;
DBusConnection *baz;
DBusError error;
+
+ dbus_error_init (&error);
context = bus_context_new_test (test_data_dir,
"valid-config-files/debug-allow-all.conf");
if (context == NULL)
return FALSE;
-
- dbus_error_init (&error);
foo = dbus_connection_open ("debug-pipe:name=test-server", &error);
if (foo == NULL)
@@ -1922,7 +1922,7 @@ bus_dispatch_test (const DBusString *test_data_dir)
_dbus_assert_not_reached ("initial connection setup failed");
}
- check1_try_iterations (context, "create_and_hello",
+ check1_try_iterations (context, "create_and_hello_sha1",
check_hello_connection);
check2_try_iterations (context, foo, "nonexistent_service_activation",
@@ -1944,4 +1944,48 @@ bus_dispatch_test (const DBusString *test_data_dir)
return TRUE;
}
+
+dbus_bool_t
+bus_dispatch_sha1_test (const DBusString *test_data_dir)
+{
+ BusContext *context;
+ DBusConnection *foo;
+ DBusError error;
+
+ dbus_error_init (&error);
+
+ /* Test SHA1 authentication */
+ _dbus_verbose ("Testing SHA1 context\n");
+
+ context = bus_context_new_test (test_data_dir,
+ "valid-config-files/debug-allow-all.conf");
+ if (context == NULL)
+ return FALSE;
+
+ foo = dbus_connection_open ("debug-pipe:name=test-server", &error);
+ if (foo == NULL)
+ _dbus_assert_not_reached ("could not alloc connection");
+
+ if (!bus_setup_debug_client (foo))
+ _dbus_assert_not_reached ("could not set up connection");
+
+ if (!check_hello_message (context, foo))
+ _dbus_assert_not_reached ("hello message failed");
+
+ if (!check_no_leftovers (context))
+ {
+ _dbus_warn ("Messages were left over after setting up initial SHA-1 connection");
+ _dbus_assert_not_reached ("initial connection setup failed");
+ }
+
+ check1_try_iterations (context, "create_and_hello",
+ check_hello_connection);
+
+ kill_client_connection_unchecked (foo);
+
+ bus_context_unref (context);
+
+ return TRUE;
+}
+
#endif /* DBUS_BUILD_TESTS */