iface-modem-simple: fix Simple.Disconnect() when bearer path given

The Simple.Disconnect() method handler was totally broken when a
specific bearer path was given, because the user-provided bearer path
was never being stored in the DisconnectionContext struct...

This is an extremely bad error, but it also gives us an indication
that no one is really using this method to disconnect one single
bearer, mainly because we also have the Bearer.Disconnect() method,
which makes more sense. mmcli didn't even allow passing a bearer path
to --simple-disconnect.
This commit is contained in:
Aleksander Morgado
2019-10-09 12:12:38 +02:00
parent 3a9c553184
commit 15b8156061

View File

@@ -878,11 +878,15 @@ handle_disconnect (MmGdbusModemSimple *skeleton,
ctx->self = g_object_ref (self);
ctx->invocation = g_object_ref (invocation);
if (bearer_path &&
bearer_path[0] == '/' &&
bearer_path[1]) {
ctx->bearer_path = g_strdup (ctx->bearer_path);
}
/* The Disconnect() method expects a valid object path given in bearer path,
* it cannot be NULL, so we assume we get '/' when we're asked to disconnect
* all connected bearers, as that is what mm_modem_simple_disconnect() does
* when a NULL bearer path is given to that method.
*
* We will detect the '/' string and set the bearer path as NULL in the
* context if so, and otherwise use the given input string as path */
if (g_strcmp0 (bearer_path, "/") != 0)
ctx->bearer_path = g_strdup (bearer_path);
mm_base_modem_authorize (MM_BASE_MODEM (self),
invocation,