aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@lanedo.com>2013-04-14 13:45:11 +0200
committerAleksander Morgado <aleksander@lanedo.com>2013-04-17 15:19:50 +0200
commit6cbb3e9fc9caf24e09e476ec86e5041d7a1f6dbb (patch)
tree276e4c74d8a03e199e12b3708fc2c4a8e14fdada
parenta9f20e90be74bd53bfaeeda93b68b1bfa49ae9fe (diff)
bearer-mbim: no auth protocol if neither user nor password given
-rw-r--r--src/mm-bearer-mbim.c52
1 files changed, 28 insertions, 24 deletions
diff --git a/src/mm-bearer-mbim.c b/src/mm-bearer-mbim.c
index 62f87d2c..e5fa09f7 100644
--- a/src/mm-bearer-mbim.c
+++ b/src/mm-bearer-mbim.c
@@ -307,7 +307,6 @@ connect_context_step (ConnectContext *ctx)
const gchar *user;
const gchar *password;
MbimAuthProtocol auth;
- MMBearerAllowedAuth bearer_auth;
MbimContextIpType ip_type;
GError *error = NULL;
@@ -317,31 +316,36 @@ connect_context_step (ConnectContext *ctx)
user = mm_bearer_properties_get_user (ctx->properties);
password = mm_bearer_properties_get_password (ctx->properties);
- bearer_auth = mm_bearer_properties_get_allowed_auth (ctx->properties);
- if (bearer_auth == MM_BEARER_ALLOWED_AUTH_UNKNOWN) {
- mm_dbg ("Using default (PAP) authentication method");
- auth = MBIM_AUTH_PROTOCOL_PAP;
- } else if (bearer_auth & MM_BEARER_ALLOWED_AUTH_PAP) {
- auth = MBIM_AUTH_PROTOCOL_PAP;
- } else if (bearer_auth & MM_BEARER_ALLOWED_AUTH_CHAP) {
- auth = MBIM_AUTH_PROTOCOL_CHAP;
- } else if (bearer_auth & MM_BEARER_ALLOWED_AUTH_MSCHAPV2) {
- auth = MBIM_AUTH_PROTOCOL_MSCHAPV2;
- } else if (bearer_auth & MM_BEARER_ALLOWED_AUTH_NONE) {
+ if (!user && !password) {
auth = MBIM_AUTH_PROTOCOL_NONE;
} else {
- gchar *str;
-
- str = mm_bearer_allowed_auth_build_string_from_mask (bearer_auth);
- g_simple_async_result_set_error (
- ctx->result,
- MM_CORE_ERROR,
- MM_CORE_ERROR_UNSUPPORTED,
- "Cannot use any of the specified authentication methods (%s)",
- str);
- g_free (str);
- connect_context_complete_and_free (ctx);
- return;
+ MMBearerAllowedAuth bearer_auth;
+ bearer_auth = mm_bearer_properties_get_allowed_auth (ctx->properties);
+ if (bearer_auth == MM_BEARER_ALLOWED_AUTH_UNKNOWN) {
+ mm_dbg ("Using default (PAP) authentication method");
+ auth = MBIM_AUTH_PROTOCOL_PAP;
+ } else if (bearer_auth & MM_BEARER_ALLOWED_AUTH_PAP) {
+ auth = MBIM_AUTH_PROTOCOL_PAP;
+ } else if (bearer_auth & MM_BEARER_ALLOWED_AUTH_CHAP) {
+ auth = MBIM_AUTH_PROTOCOL_CHAP;
+ } else if (bearer_auth & MM_BEARER_ALLOWED_AUTH_MSCHAPV2) {
+ auth = MBIM_AUTH_PROTOCOL_MSCHAPV2;
+ } else if (bearer_auth & MM_BEARER_ALLOWED_AUTH_NONE) {
+ auth = MBIM_AUTH_PROTOCOL_NONE;
+ } else {
+ gchar *str;
+
+ str = mm_bearer_allowed_auth_build_string_from_mask (bearer_auth);
+ g_simple_async_result_set_error (
+ ctx->result,
+ MM_CORE_ERROR,
+ MM_CORE_ERROR_UNSUPPORTED,
+ "Cannot use any of the specified authentication methods (%s)",
+ str);
+ g_free (str);
+ connect_context_complete_and_free (ctx);
+ return;
+ }
}
switch (mm_bearer_properties_get_ip_type (ctx->properties)) {