summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2016-07-01 10:46:50 +0200
committerAleksander Morgado <aleksander@aleksander.es>2016-07-01 10:48:04 +0200
commita0578e5e15228999d1215df1bdadfb8774c5ecc3 (patch)
treedf479a092d769484a231f5fb1b029faaa1015518
parent3f4e777e4a2af7fcf8b020accb8949d0bcd91c5b (diff)
downloadlibmbim-a0578e5e15228999d1215df1bdadfb8774c5ecc3.tar.gz
mbimcli: allow passing empty APN in --connect
-rw-r--r--src/mbimcli/mbimcli-basic-connect.c38
1 files changed, 17 insertions, 21 deletions
diff --git a/src/mbimcli/mbimcli-basic-connect.c b/src/mbimcli/mbimcli-basic-connect.c
index 260d14c..e1d40d1 100644
--- a/src/mbimcli/mbimcli-basic-connect.c
+++ b/src/mbimcli/mbimcli-basic-connect.c
@@ -923,7 +923,8 @@ static gboolean connect_activate_properties_handle (const gchar *key,
{
ConnectActivateProperties *props = user_data;
- if (!value || !value[0]) {
+ /* APN may be empty */
+ if ((g_ascii_strcasecmp (key, "apn") != 0) && (!value || !value[0])) {
g_set_error (error,
MBIM_CORE_ERROR,
MBIM_CORE_ERROR_FAILED,
@@ -1008,27 +1009,22 @@ set_connect_activate_parse (const gchar *str,
goto error;
}
- if (g_strv_length (split) < 1) {
- g_printerr ("error: couldn't parse input string, missing arguments\n");
- goto error;
- }
-
- /* APN */
- props.apn = g_strdup (split[0]);
-
- /* Use authentication method */
- if (split[1]) {
- if (!mbim_auth_protocol_from_string (split[1], &props.auth_protocol)) {
- g_printerr ("error: couldn't parse input string, unknown auth protocol '%s'\n", split[1]);
- goto error;
- }
-
- /* Username */
- if (split[2]) {
- props.username = g_strdup (split[2]);
+ if (g_strv_length (split) > 0) {
+ /* APN */
+ props.apn = g_strdup (split[0]);
- /* Password */
- props.password = g_strdup (split[3]);
+ /* Use authentication method */
+ if (split[1]) {
+ if (!mbim_auth_protocol_from_string (split[1], &props.auth_protocol)) {
+ g_printerr ("error: couldn't parse input string, unknown auth protocol '%s'\n", split[1]);
+ goto error;
+ }
+ /* Username */
+ if (split[2]) {
+ props.username = g_strdup (split[2]);
+ /* Password */
+ props.password = g_strdup (split[3]);
+ }
}
}
}