Commit 0fb9eaa3 authored by Simon McVittie's avatar Simon McVittie
Browse files

tests: Assert that dbus-daemon filters unknown header fields

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=100317

Reviewed-by: Philip Withnall's avatarPhilip Withnall <withnall@endlessm.com>
Signed-off-by: Simon McVittie's avatarSimon McVittie <smcv@collabora.com>
parent 9bb330d8
...@@ -1594,6 +1594,7 @@ check_features (DBusMessageIter *var_iter) ...@@ -1594,6 +1594,7 @@ check_features (DBusMessageIter *var_iter)
{ {
DBusMessageIter arr_iter; DBusMessageIter arr_iter;
gboolean have_systemd_activation = FALSE; gboolean have_systemd_activation = FALSE;
gboolean have_header_filtering = FALSE;
g_assert_cmpint (dbus_message_iter_get_arg_type (var_iter), ==, g_assert_cmpint (dbus_message_iter_get_arg_type (var_iter), ==,
DBUS_TYPE_ARRAY); DBUS_TYPE_ARRAY);
...@@ -1611,12 +1612,15 @@ check_features (DBusMessageIter *var_iter) ...@@ -1611,12 +1612,15 @@ check_features (DBusMessageIter *var_iter)
g_test_message ("Feature: %s", feature); g_test_message ("Feature: %s", feature);
if (g_strcmp0 (feature, "SystemdActivation") == 0) if (g_strcmp0 (feature, "HeaderFiltering") == 0)
have_header_filtering = TRUE;
else if (g_strcmp0 (feature, "SystemdActivation") == 0)
have_systemd_activation = TRUE; have_systemd_activation = TRUE;
dbus_message_iter_next (&arr_iter); dbus_message_iter_next (&arr_iter);
} }
g_assert_true (have_header_filtering);
/* We pass --systemd-activation to the daemon for this unit test on Unix /* We pass --systemd-activation to the daemon for this unit test on Unix
* (it can only work in practice on Linux, but there's nothing * (it can only work in practice on Linux, but there's nothing
* inherently Linux-specific about the protocol). */ * inherently Linux-specific about the protocol). */
......
...@@ -625,10 +625,7 @@ test_weird_header_field (void *user_data, ...@@ -625,10 +625,7 @@ test_weird_header_field (void *user_data,
==, DBUS_TYPE_BYTE); ==, DBUS_TYPE_BYTE);
_dbus_type_reader_read_basic (&sub, &field_code); _dbus_type_reader_read_basic (&sub, &field_code);
if (field_code == NOT_A_HEADER_FIELD) g_assert_cmpuint (field_code, !=, NOT_A_HEADER_FIELD);
{
g_test_message ("TODO: header field was passed through");
}
_dbus_type_reader_next (&array); _dbus_type_reader_next (&array);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment