aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2020-07-06 16:53:08 +0200
committerAleksander Morgado <aleksander@aleksander.es>2020-07-06 16:54:07 +0200
commita131c6953a0a24a6ed8c365cb5e398fa5e52afcf (patch)
tree4fdee404bc93b690ead24b337718195d05d32952
parent0a89a9ae4ee62ba36b616fc444a866d61c203696 (diff)
cinterion: quote user/password strings in AT^SGAUTH calls
The ELS61 doesn't like authentication given without quotes: [modem3/ttyACM1/at] --> 'AT^SGAUTH=8,1,tm,t-mobile<CR>' [modem3/ttyACM1/at] <-- '<CR><LF>+CME ERROR: 4<CR><LF>' Only when user/pass strings are quoted it works: [modem6/ttyACM1/at] --> 'AT^SGAUTH=8,1,"t-mobile","tm"<CR>' [modem6/ttyACM1/at] <-- '<CR><LF>OK<CR><LF>'
-rw-r--r--plugins/cinterion/mm-broadband-bearer-cinterion.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/plugins/cinterion/mm-broadband-bearer-cinterion.c b/plugins/cinterion/mm-broadband-bearer-cinterion.c
index a4ee87d2..b3b1d240 100644
--- a/plugins/cinterion/mm-broadband-bearer-cinterion.c
+++ b/plugins/cinterion/mm-broadband-bearer-cinterion.c
@@ -203,12 +203,14 @@ build_auth_string (MMBroadbandBearerCinterion *self,
MMBearerProperties *config,
guint cid)
{
- const gchar *user;
- const gchar *passwd;
- gboolean has_user;
- gboolean has_passwd;
MMBearerAllowedAuth auth;
BearerCinterionAuthType encoded_auth = BEARER_CINTERION_AUTH_UNKNOWN;
+ gboolean has_user;
+ gboolean has_passwd;
+ const gchar *user;
+ const gchar *passwd;
+ g_autofree gchar *quoted_user = NULL;
+ g_autofree gchar *quoted_passwd = NULL;
user = mm_bearer_properties_get_user (config);
passwd = mm_bearer_properties_get_password (config);
@@ -236,11 +238,14 @@ build_auth_string (MMBroadbandBearerCinterion *self,
encoded_auth = BEARER_CINTERION_AUTH_PAP;
}
+ quoted_user = mm_port_serial_at_quote_string (user ? user : "");
+ quoted_passwd = mm_port_serial_at_quote_string (passwd ? passwd : "");
+
return g_strdup_printf ("^SGAUTH=%u,%d,%s,%s",
cid,
encoded_auth,
- passwd ? passwd : "",
- user ? user : "");
+ quoted_passwd,
+ quoted_user);
}
/******************************************************************************/