mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-14 05:16:18 +01:00
Return an error for calls into unknown interfaces or unknown objects
Ryan pointed out on IRC that we didn't do anything here. Looking at the code, it's painfully obvious that we should be returning an error here since a comment already says that we've exhausted all possible options. Signed-off-by: David Zeuthen <davidz@redhat.com>
This commit is contained in:
parent
c7f0f2c437
commit
bf24dff88e
@ -5088,6 +5088,7 @@ static void
|
|||||||
distribute_method_call (GDBusConnection *connection,
|
distribute_method_call (GDBusConnection *connection,
|
||||||
GDBusMessage *message)
|
GDBusMessage *message)
|
||||||
{
|
{
|
||||||
|
GDBusMessage *reply;
|
||||||
ExportedObject *eo;
|
ExportedObject *eo;
|
||||||
ExportedSubtree *es;
|
ExportedSubtree *es;
|
||||||
const gchar *object_path;
|
const gchar *object_path;
|
||||||
@ -5154,7 +5155,14 @@ distribute_method_call (GDBusConnection *connection,
|
|||||||
if (handle_generic_unlocked (connection, message))
|
if (handle_generic_unlocked (connection, message))
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
/* if we end up here, the message has not been not handled */
|
/* if we end up here, the message has not been not handled - so return an error saying this */
|
||||||
|
reply = g_dbus_message_new_method_error (message,
|
||||||
|
"org.freedesktop.DBus.Error.UnknownMethod",
|
||||||
|
_("No such interface `%s' on object at path %s"),
|
||||||
|
interface_name,
|
||||||
|
object_path);
|
||||||
|
g_dbus_connection_send_message_unlocked (connection, reply, NULL, NULL);
|
||||||
|
g_object_unref (reply);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
g_free (subtree_path);
|
g_free (subtree_path);
|
||||||
|
@ -824,6 +824,18 @@ test_dispatch_thread_func (gpointer user_data)
|
|||||||
g_error_free (error);
|
g_error_free (error);
|
||||||
g_assert (value == NULL);
|
g_assert (value == NULL);
|
||||||
|
|
||||||
|
error = NULL;
|
||||||
|
value = g_dbus_proxy_call_sync (foo_proxy,
|
||||||
|
"org.example.FooXYZ.NonExistant",
|
||||||
|
NULL,
|
||||||
|
G_DBUS_CALL_FLAGS_NONE,
|
||||||
|
-1,
|
||||||
|
NULL,
|
||||||
|
&error);
|
||||||
|
g_assert_error (error, G_DBUS_ERROR, G_DBUS_ERROR_UNKNOWN_METHOD);
|
||||||
|
g_error_free (error);
|
||||||
|
g_assert (value == NULL);
|
||||||
|
|
||||||
/* user properties */
|
/* user properties */
|
||||||
error = NULL;
|
error = NULL;
|
||||||
value = g_dbus_proxy_call_sync (foo_proxy,
|
value = g_dbus_proxy_call_sync (foo_proxy,
|
||||||
|
Loading…
Reference in New Issue
Block a user