mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-09-27 17:52:58 +02:00
gdbusauth: empty DATA does not need a trailing space
This is an interoperability fix. If the line is exactly "DATA\r\n",
the reference implementation of D-Bus treats this as equivalent to
"DATA \r\n", meaning the data block consists of zero hex-encoded bytes.
In practice, D-Bus clients send empty data blocks as "DATA\r\n", and
in fact sd-bus only accepts that, rejecting "DATA \r\n".
[Originally part of a larger commit; commit message added by smcv]
Signed-off-by: Giuseppe Scrivano <giuseppe@scrivano.org>
Co-authored-by: Simon McVittie <smcv@collabora.com>
Signed-off-by: Simon McVittie <smcv@collabora.com>
(cherry-picked from commit 764f071909
)
This commit is contained in:
committed by
Marco Trevisan (Treviño)
parent
b54cce6cdd
commit
0dfffca862
@@ -784,13 +784,13 @@ _g_dbus_auth_run_client (GDBusAuth *auth,
|
||||
if (line == NULL)
|
||||
goto out;
|
||||
debug_print ("CLIENT: WaitingForData, read='%s'", line);
|
||||
if (g_str_has_prefix (line, "DATA "))
|
||||
if (g_str_equal (line, "DATA") || g_str_has_prefix (line, "DATA "))
|
||||
{
|
||||
gchar *encoded;
|
||||
gchar *decoded_data;
|
||||
gsize decoded_data_len = 0;
|
||||
|
||||
encoded = g_strdup (line + 5);
|
||||
encoded = g_strdup (line + 4);
|
||||
g_free (line);
|
||||
g_strstrip (encoded);
|
||||
decoded_data = hexdecode (encoded, &decoded_data_len, error);
|
||||
@@ -1265,13 +1265,13 @@ _g_dbus_auth_run_server (GDBusAuth *auth,
|
||||
debug_print ("SERVER: WaitingForData, read '%s'", line);
|
||||
if (line == NULL)
|
||||
goto out;
|
||||
if (g_str_has_prefix (line, "DATA "))
|
||||
if (g_str_equal (line, "DATA") || g_str_has_prefix (line, "DATA "))
|
||||
{
|
||||
gchar *encoded;
|
||||
gchar *decoded_data;
|
||||
gsize decoded_data_len = 0;
|
||||
|
||||
encoded = g_strdup (line + 5);
|
||||
encoded = g_strdup (line + 4);
|
||||
g_free (line);
|
||||
g_strstrip (encoded);
|
||||
decoded_data = hexdecode (encoded, &decoded_data_len, error);
|
||||
|
Reference in New Issue
Block a user