aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2019-10-09 12:12:38 +0200
committerAleksander Morgado <aleksander@aleksander.es>2019-10-09 12:23:33 +0200
commit15b8156061a072d9c28e82fe785e5863b1fa80cd (patch)
treedca6e00ff19238790f22ae701baad2ef946a795a /src
parent3a9c553184ad1247dad89cfa8ba3f96f8b7195ff (diff)
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.
Diffstat (limited to 'src')
-rw-r--r--src/mm-iface-modem-simple.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/mm-iface-modem-simple.c b/src/mm-iface-modem-simple.c
index ecf0b683..5f96523a 100644
--- a/src/mm-iface-modem-simple.c
+++ b/src/mm-iface-modem-simple.c
@@ -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,