modem-helpers-qmi: fix auth validation always returning error

This commit is contained in:
goapunk
2021-05-08 13:23:56 +02:00
committed by Aleksander Morgado
parent ba0701b67d
commit f916d075a7

View File

@@ -1471,8 +1471,7 @@ mm_bearer_allowed_auth_to_qmi_authentication (MMBearerAllowedAuth auth,
gpointer log_object, gpointer log_object,
GError **error) GError **error)
{ {
QmiWdsAuthentication out; QmiWdsAuthentication out;
g_autofree gchar *str = NULL;
if (auth == MM_BEARER_ALLOWED_AUTH_UNKNOWN) { if (auth == MM_BEARER_ALLOWED_AUTH_UNKNOWN) {
mm_obj_dbg (log_object, "using default (CHAP) authentication method"); mm_obj_dbg (log_object, "using default (CHAP) authentication method");
@@ -1490,10 +1489,14 @@ mm_bearer_allowed_auth_to_qmi_authentication (MMBearerAllowedAuth auth,
out |= QMI_WDS_AUTHENTICATION_CHAP; out |= QMI_WDS_AUTHENTICATION_CHAP;
/* and if the bitmask cannot be built, error out */ /* and if the bitmask cannot be built, error out */
str = mm_bearer_allowed_auth_build_string_from_mask (auth); if (out == QMI_WDS_AUTHENTICATION_NONE) {
g_set_error (error, MM_CORE_ERROR, MM_CORE_ERROR_UNSUPPORTED, g_autofree gchar *str = NULL;
"Unsupported authentication methods (%s)",
str); 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; return out;
} }