aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/huawei/mm-broadband-bearer-huawei.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/plugins/huawei/mm-broadband-bearer-huawei.c b/plugins/huawei/mm-broadband-bearer-huawei.c
index a23d95cf..2f365d89 100644
--- a/plugins/huawei/mm-broadband-bearer-huawei.c
+++ b/plugins/huawei/mm-broadband-bearer-huawei.c
@@ -285,11 +285,25 @@ connect_3gpp_context_step (Connect3gppContext *ctx)
auth = mm_bearer_properties_get_allowed_auth (mm_bearer_peek_config (MM_BEARER (ctx->self)));
encoded_auth = huawei_parse_auth_type (auth);
- command = g_strdup_printf ("AT^NDISDUP=1,1,\"%s\",\"%s\",\"%s\",%d",
- apn == NULL ? "" : apn,
- user == NULL ? "" : user,
- passwd == NULL ? "" : passwd,
- encoded_auth == MM_BEARER_HUAWEI_AUTH_UNKNOWN ? MM_BEARER_HUAWEI_AUTH_NONE : encoded_auth);
+ /* Default to no authentication if not specified */
+ if ((encoded_auth = huawei_parse_auth_type (auth)) == MM_BEARER_HUAWEI_AUTH_UNKNOWN)
+ encoded_auth = MM_BEARER_HUAWEI_AUTH_NONE;
+
+ if (!user && !passwd)
+ command = g_strdup_printf ("AT^NDISDUP=1,1,\"%s\"",
+ apn == NULL ? "" : apn);
+ else if (encoded_auth == MM_BEARER_HUAWEI_AUTH_NONE)
+ command = g_strdup_printf ("AT^NDISDUP=1,1,\"%s\",\"%s\",\"%s\"",
+ apn == NULL ? "" : apn,
+ user == NULL ? "" : user,
+ passwd == NULL ? "" : passwd);
+ else
+ command = g_strdup_printf ("AT^NDISDUP=1,1,\"%s\",\"%s\",\"%s\",%d",
+ apn == NULL ? "" : apn,
+ user == NULL ? "" : user,
+ passwd == NULL ? "" : passwd,
+ encoded_auth);
+
mm_base_modem_at_command_full (ctx->modem,
ctx->primary,
command,