diff options
author | Aleksander Morgado <aleksander@lanedo.com> | 2012-02-28 23:24:53 +0100 |
---|---|---|
committer | Aleksander Morgado <aleksander@lanedo.com> | 2012-03-16 14:53:18 +0100 |
commit | 64f49c0c7261d7de2eae03477cd69cf540184041 (patch) | |
tree | 864c3eb49201373b58478f9f31de5cd135443cba | |
parent | 952b9164b9ae2af4d1fd18f77d4b97bfa4d78eab (diff) |
iface-modem: the Command() method is only allowed when running in debug mode
-rw-r--r-- | introspection/org.freedesktop.ModemManager1.Modem.xml | 9 | ||||
-rw-r--r-- | src/mm-iface-modem.c | 12 |
2 files changed, 18 insertions, 3 deletions
diff --git a/introspection/org.freedesktop.ModemManager1.Modem.xml b/introspection/org.freedesktop.ModemManager1.Modem.xml index eb9d9050..8ab5ad75 100644 --- a/introspection/org.freedesktop.ModemManager1.Modem.xml +++ b/introspection/org.freedesktop.ModemManager1.Modem.xml @@ -148,11 +148,14 @@ <!-- Command - @cmd The command string, e.g. "AT+GCAP" or "+GCAP" (leading AT is inserted if necessary) - @timeout The number of seconds to wait for a response - @response The modem's response + @cmd The command string, e.g. "AT+GCAP" or "+GCAP" (leading AT is inserted if necessary). + @timeout The number of seconds to wait for a response. + @response The modem's response. Send an arbitrary AT command to a modem and get the response. + + Note that using this interface call is only allowed when running + ModemManager in debug mode. --> <method name="Command"> <arg name="cmd" type="s" direction="in" /> diff --git a/src/mm-iface-modem.c b/src/mm-iface-modem.c index 31b575a1..f4b29fef 100644 --- a/src/mm-iface-modem.c +++ b/src/mm-iface-modem.c @@ -24,6 +24,7 @@ #include "mm-sim.h" #include "mm-bearer-list.h" #include "mm-log.h" +#include "mm-context.h" #define SIGNAL_QUALITY_RECENT_TIMEOUT_SEC 60 #define SIGNAL_QUALITY_CHECK_TIMEOUT_SEC 30 @@ -367,6 +368,17 @@ handle_command_auth_ready (MMBaseModem *self, return; } + /* If we are not in Debug mode, report an error */ + if (!mm_context_get_debug ()) { + g_dbus_method_invocation_return_error (ctx->invocation, + MM_CORE_ERROR, + MM_CORE_ERROR_UNAUTHORIZED, + "Cannot send AT command to modem: " + "operation only allowed in debug mode"); + handle_command_context_free (ctx); + return; + } + /* If command is not implemented, report an error */ if (!MM_IFACE_MODEM_GET_INTERFACE (self)->command || !MM_IFACE_MODEM_GET_INTERFACE (self)->command_finish) { |