diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mm-bearer-qmi.c | 29 | ||||
-rw-r--r-- | src/mm-broadband-modem-qmi.c | 14 | ||||
-rw-r--r-- | src/mm-modem-helpers-qmi.c | 21 | ||||
-rw-r--r-- | src/mm-modem-helpers-qmi.h | 4 |
4 files changed, 42 insertions, 26 deletions
diff --git a/src/mm-bearer-qmi.c b/src/mm-bearer-qmi.c index 5ab2dc2c..d375fb7f 100644 --- a/src/mm-bearer-qmi.c +++ b/src/mm-bearer-qmi.c @@ -2098,27 +2098,16 @@ _connect (MMBaseBearer *_self, auth = mm_bearer_properties_get_allowed_auth (properties); g_object_unref (properties); - if (auth == MM_BEARER_ALLOWED_AUTH_UNKNOWN) { - /* We'll default to CHAP later if needed */ + if (!ctx->user && !ctx->password) ctx->auth = QMI_WDS_AUTHENTICATION_NONE; - } else if (auth & (MM_BEARER_ALLOWED_AUTH_PAP | - MM_BEARER_ALLOWED_AUTH_CHAP | - MM_BEARER_ALLOWED_AUTH_NONE)) { - /* Only PAP and/or CHAP or NONE are supported */ - ctx->auth = mm_bearer_allowed_auth_to_qmi_authentication (auth); - } else { - gchar *str; - - str = mm_bearer_allowed_auth_build_string_from_mask (auth); - g_task_return_new_error ( - task, - MM_CORE_ERROR, - MM_CORE_ERROR_UNSUPPORTED, - "Cannot use any of the specified authentication methods (%s)", - str); - g_object_unref (task); - g_free (str); - goto out; + else { + auth = mm_bearer_properties_get_allowed_auth (properties); + ctx->auth = mm_bearer_allowed_auth_to_qmi_authentication (auth, self, &error); + if (error) { + g_task_return_error (task, error); + g_object_unref (task); + goto out; + } } multiplex = mm_bearer_properties_get_multiplex (properties); diff --git a/src/mm-broadband-modem-qmi.c b/src/mm-broadband-modem-qmi.c index d10fdf54..bbe7d872 100644 --- a/src/mm-broadband-modem-qmi.c +++ b/src/mm-broadband-modem-qmi.c @@ -6039,8 +6039,16 @@ modem_3gpp_profile_manager_store_profile (MMIfaceModem3gppProfileManager *self, ctx->user = g_strdup (mm_3gpp_profile_get_user (profile)); ctx->password = g_strdup (mm_3gpp_profile_get_password (profile)); allowed_auth = mm_3gpp_profile_get_allowed_auth (profile); - if ((allowed_auth != MM_BEARER_ALLOWED_AUTH_UNKNOWN) || ctx->user || ctx->password) - ctx->qmi_auth = mm_bearer_allowed_auth_to_qmi_authentication (allowed_auth); + if ((allowed_auth != MM_BEARER_ALLOWED_AUTH_UNKNOWN) || ctx->user || ctx->password) { + GError *error = NULL; + + ctx->qmi_auth = mm_bearer_allowed_auth_to_qmi_authentication (allowed_auth, self, &error); + if (error) { + g_task_return_error (task, error); + g_object_unref (task); + return; + } + } ip_type = mm_3gpp_profile_get_ip_type (profile); if (!mm_bearer_ip_family_to_qmi_pdp_type (ip_type, &ctx->qmi_pdp_type)) { @@ -8880,7 +8888,7 @@ set_initial_eps_bearer_modify_profile (GTask *task) allowed_auth = mm_bearer_properties_get_allowed_auth (ctx->settings); if (allowed_auth == MM_BEARER_ALLOWED_AUTH_UNKNOWN) allowed_auth = MM_BEARER_ALLOWED_AUTH_NONE; - auth = mm_bearer_allowed_auth_to_qmi_authentication (allowed_auth); + auth = mm_bearer_allowed_auth_to_qmi_authentication (allowed_auth, self, NULL); qmi_message_wds_modify_profile_input_set_authentication (input, auth, NULL); str = mm_bearer_properties_get_user (ctx->settings); diff --git a/src/mm-modem-helpers-qmi.c b/src/mm-modem-helpers-qmi.c index 2b68ff18..a53fe2fa 100644 --- a/src/mm-modem-helpers-qmi.c +++ b/src/mm-modem-helpers-qmi.c @@ -1467,16 +1467,33 @@ mm_sms_state_from_qmi_message_tag (QmiWmsMessageTagType tag) /*****************************************************************************/ QmiWdsAuthentication -mm_bearer_allowed_auth_to_qmi_authentication (MMBearerAllowedAuth auth) +mm_bearer_allowed_auth_to_qmi_authentication (MMBearerAllowedAuth auth, + gpointer log_object, + GError **error) { - QmiWdsAuthentication out; + QmiWdsAuthentication out; + g_autofree gchar *str = NULL; + if (auth == MM_BEARER_ALLOWED_AUTH_UNKNOWN) { + mm_obj_dbg (log_object, "using default (CHAP) authentication method"); + return QMI_WDS_AUTHENTICATION_CHAP; + } + + if (auth == MM_BEARER_ALLOWED_AUTH_NONE) + return QMI_WDS_AUTHENTICATION_NONE; + + /* otherwise find a bitmask that matches the input bitmask */ out = QMI_WDS_AUTHENTICATION_NONE; if (auth & MM_BEARER_ALLOWED_AUTH_PAP) out |= QMI_WDS_AUTHENTICATION_PAP; if (auth & MM_BEARER_ALLOWED_AUTH_CHAP) out |= QMI_WDS_AUTHENTICATION_CHAP; + /* and if the bitmask cannot be built, error out */ + str = mm_bearer_allowed_auth_build_string_from_mask (auth); + g_set_error (error, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED, + "Unsupported authentication methods (%s)", + str); return out; } diff --git a/src/mm-modem-helpers-qmi.h b/src/mm-modem-helpers-qmi.h index 78be0bb5..835ffe43 100644 --- a/src/mm-modem-helpers-qmi.h +++ b/src/mm-modem-helpers-qmi.h @@ -114,7 +114,9 @@ MMSmsState mm_sms_state_from_qmi_message_tag (QmiWmsMessageTagType tag); /*****************************************************************************/ /* QMI/WDS to MM translations */ -QmiWdsAuthentication mm_bearer_allowed_auth_to_qmi_authentication (MMBearerAllowedAuth auth); +QmiWdsAuthentication mm_bearer_allowed_auth_to_qmi_authentication (MMBearerAllowedAuth auth, + gpointer log_object, + GError **error); MMBearerAllowedAuth mm_bearer_allowed_auth_from_qmi_authentication (QmiWdsAuthentication auth); MMBearerIpFamily mm_bearer_ip_family_from_qmi_ip_support_type (QmiWdsIpSupportType ip_support_type); MMBearerIpFamily mm_bearer_ip_family_from_qmi_pdp_type (QmiWdsPdpType pdp_type); |