diff options
author | Giacinto Cifelli <gciofono@gmail.com> | 2018-10-06 07:45:20 +0200 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2018-10-09 12:35:44 -0500 |
commit | bd6f807849c4be4f430e499c8c36d03d00f8c48d (patch) | |
tree | 7b8d115a70688feb2d9e41916334fa4503aa8c77 /drivers/mbimmodem | |
parent | a5bdf48ca7be70a9b33a47dae0ea03bf842efdd2 (diff) | |
download | ofono-bd6f807849c4be4f430e499c8c36d03d00f8c48d.tar.gz |
drivers: support for auth NONE
Added the explicit support for auth NONE.
It needs to be added in all drivers/*/gprs-context.c atoms.
This method is already supported by all atoms that support
authentication (ie, all but Sierra' swmodem driver).
The behavior is left unchanged in case of inconsistent parameters:
if username is empty, then fallback to auth NONE.
Diffstat (limited to 'drivers/mbimmodem')
-rw-r--r-- | drivers/mbimmodem/gprs-context.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/drivers/mbimmodem/gprs-context.c b/drivers/mbimmodem/gprs-context.c index 79793c92..a2c14d4e 100644 --- a/drivers/mbimmodem/gprs-context.c +++ b/drivers/mbimmodem/gprs-context.c @@ -75,9 +75,11 @@ static uint32_t auth_method_to_auth_protocol(enum ofono_gprs_auth_method method) return 2; /* MBIMAuthProtocolChap */ case OFONO_GPRS_AUTH_METHOD_PAP: return 1; /* MBIMAuthProtocolPap */ + case OFONO_GPRS_AUTH_METHOD_NONE: + return 0; /* MBIMAUthProtocolNone */ } - return 0; + return 0; /* MBIMAUthProtocolNone */ } static void mbim_deactivate_cb(struct mbim_message *message, void *user) @@ -345,6 +347,8 @@ static void mbim_gprs_activate_primary(struct ofono_gprs_context *gc, { struct gprs_context_data *gcd = ofono_gprs_context_get_data(gc); struct mbim_message *message; + const char *username = NULL; + const char *password = NULL; DBG("cid %u", ctx->cid); @@ -354,6 +358,12 @@ static void mbim_gprs_activate_primary(struct ofono_gprs_context *gc, gcd->active_context = ctx->cid; gcd->proto = ctx->proto; + if (ctx->auth_method != OFONO_GPRS_AUTH_METHOD_NONE && ctx->username[0]) + username = ctx->username; + + if (ctx->auth_method != OFONO_GPRS_AUTH_METHOD_NONE && ctx->password[0]) + password = ctx->password; + message = mbim_message_new(mbim_uuid_basic_connect, MBIM_CID_CONNECT, MBIM_COMMAND_TYPE_SET); @@ -361,8 +371,8 @@ static void mbim_gprs_activate_primary(struct ofono_gprs_context *gc, ctx->cid, 1, /* MBIMActivationCommandActivate */ ctx->apn, - ctx->username[0] ? ctx->username : NULL, - ctx->password[0] ? ctx->password : NULL, + username, + password, 0, /*MBIMCompressionNone */ auth_method_to_auth_protocol(ctx->auth_method), proto_to_context_ip_type(ctx->proto), |