From 454bf545342d73be90e4107591351a81f826b55a Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Tue, 16 Jan 2018 13:32:49 +0000 Subject: [PATCH 07/11] loopback test: Display credentials received Signed-off-by: Simon McVittie --- test/loopback.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/test/loopback.c b/test/loopback.c index 59f4a28b..c6dc764e 100644 --- a/test/loopback.c +++ b/test/loopback.c @@ -31,6 +31,7 @@ #include #include +#include "dbus/dbus-connection-internal.h" #include #include @@ -163,6 +164,8 @@ test_connect (Fixture *f, const char *listening_address = addr; char *address; DBusAddressEntry **entries; + DBusCredentials *creds; + DBusString cred_string; int n_entries; dbus_bool_t ok; @@ -258,6 +261,27 @@ test_connect (Fixture *f, test_main_context_iterate (f->ctx, TRUE); } + creds = _dbus_connection_get_credentials (f->server_conn); + + while (creds == NULL) + { + test_progress ('.'); + test_main_context_iterate (f->ctx, TRUE); + creds = _dbus_connection_get_credentials (f->server_conn); + } + + g_assert_nonnull (creds); + + if (!_dbus_string_init (&cred_string) || + !_dbus_credentials_to_string_append (creds, &cred_string)) + g_error ("OOM"); + + g_test_message ("Credentials: %s", + _dbus_string_get_const_data (&cred_string)); + g_assert_cmpstr (_dbus_string_get_const_data (&cred_string), !=, NULL); + _dbus_string_free (&cred_string); + _dbus_clear_credentials (&creds); + dbus_free (address); } -- 2.15.1