mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-31 03:10:10 +01:00
nm-sudo: expect unknown interface in _bus_method_call()
GDBus will invoke the method_call callback also for the Get/Set functions. Thus, we need to check the interface_name and handle them (actually, there is nothing to handle, no properties exist). Also, "Ping" method only exists for testing. It is usually not called in production, so check for "GetFD" first.
This commit is contained in:
parent
1e71a00817
commit
dbd459ec92
1 changed files with 17 additions and 5 deletions
|
|
@ -290,14 +290,26 @@ _bus_method_call(GDBusConnection * connection,
|
|||
method_name,
|
||||
g_variant_get_type_string(parameters));
|
||||
|
||||
if (!nm_streq(interface_name, NM_SUDO_DBUS_IFACE_NAME))
|
||||
goto out_unknown_method;
|
||||
|
||||
if (nm_streq(method_name, "GetFD")) {
|
||||
g_variant_get(parameters, "(u)", &arg_u);
|
||||
_handle_get_fd(gl, invocation, arg_u);
|
||||
return;
|
||||
}
|
||||
if (nm_streq(method_name, "Ping")) {
|
||||
g_variant_get(parameters, "(&s)", &arg_s);
|
||||
_handle_ping(gl, invocation, arg_s);
|
||||
} else if (nm_streq(method_name, "GetFD")) {
|
||||
g_variant_get(parameters, "(u)", &arg_u);
|
||||
_handle_get_fd(gl, invocation, arg_u);
|
||||
} else
|
||||
nm_assert_not_reached();
|
||||
return;
|
||||
}
|
||||
|
||||
out_unknown_method:
|
||||
g_dbus_method_invocation_return_error(invocation,
|
||||
G_DBUS_ERROR,
|
||||
G_DBUS_ERROR_UNKNOWN_METHOD,
|
||||
"Unknown method %s",
|
||||
method_name);
|
||||
}
|
||||
|
||||
static GDBusInterfaceInfo *const interface_info = NM_DEFINE_GDBUS_INTERFACE_INFO(
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue