Open Source Telephony
 help / color / mirror / Atom feed
From: Denis Kenzior <denkenz@gmail.com>
To: ofono@ofono.org
Subject: Re: [PATCH 5/5] drivers: support for auth NONE
Date: Tue, 09 Oct 2018 12:41:48 -0500	[thread overview]
Message-ID: <9110ae75-3245-7131-8a3e-92fb83fef5ce@gmail.com> (raw)
In-Reply-To: <20181006054520.26737-5-gciofono@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 4216 bytes --]

Hi Giacinto,

I applied a modified version of this patch, see below:

> diff --git a/drivers/mbimmodem/gprs-context.c b/drivers/mbimmodem/gprs-context.c
> index 79793c92..be256e43 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;

These were changed to const char *

>   
>   	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),
> diff --git a/drivers/mbmmodem/gprs-context.c b/drivers/mbmmodem/gprs-context.c
> index e961afa1..fa8b44b6 100644
> --- a/drivers/mbmmodem/gprs-context.c
> +++ b/drivers/mbmmodem/gprs-context.c
> @@ -394,11 +394,12 @@ static void mbm_gprs_activate_primary(struct ofono_gprs_context *gc,
>   	 * Set username and password, this should be done after CGDCONT
>   	 * or an error can occur.  We don't bother with error checking
>   	 * here
> -	 * */
> -	snprintf(buf, sizeof(buf), "AT*EIAAUW=%d,1,\"%s\",\"%s\"",
> -			ctx->cid, ctx->username, ctx->password);
> -
> -	g_at_chat_send(gcd->chat, buf, none_prefix, NULL, NULL, NULL);
> +	 */
> +	if (ctx->auth_method != OFONO_GPRS_AUTH_METHOD_NONE) {
> +		snprintf(buf, sizeof(buf), "AT*EIAAUW=%d,1,\"%s\",\"%s\"",
> +				ctx->cid, ctx->username, ctx->password);
> +		g_at_chat_send(gcd->chat, buf, none_prefix, NULL, NULL, NULL);
> +	}
>   
>   	return;
>   

I dropped this part entirely.  The reason is that we can have profiles 
with username/password & without operating on the same CID.  Since the 
setting is permanent on the modem, we need to set it/clear it even when 
AUTH_METHOD_NONE is used.

If you disagree, please send a follow up series.

> diff --git a/drivers/stemodem/gprs-context.c b/drivers/stemodem/gprs-context.c
> index 18b2bfa4..32facd8c 100644
> --- a/drivers/stemodem/gprs-context.c
> +++ b/drivers/stemodem/gprs-context.c
> @@ -307,10 +307,11 @@ static void ste_gprs_activate_primary(struct ofono_gprs_context *gc,
>   	 * or an error can occur.  We don't bother with error checking
>   	 * here
>   	 */
> -	snprintf(buf, sizeof(buf), "AT*EIAAUW=%d,1,\"%s\",\"%s\"",
> -			ctx->cid, ctx->username, ctx->password);
> -
> -	g_at_chat_send(gcd->chat, buf, none_prefix, NULL, NULL, NULL);
> +	if (ctx->auth_method != OFONO_GPRS_AUTH_METHOD_NONE) {
> +		snprintf(buf, sizeof(buf), "AT*EIAAUW=%d,1,\"%s\",\"%s\"",
> +				ctx->cid, ctx->username, ctx->password);
> +		g_at_chat_send(gcd->chat, buf, none_prefix, NULL, NULL, NULL);
> +	}
>   
>   	return;
>   

Dropped for the same reason as above

Regards,
-Denis

  reply	other threads:[~2018-10-09 17:41 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-06  5:45 [PATCH 1/5] connman-api: added "none" auth_method Giacinto Cifelli
2018-10-06  5:45 ` [PATCH 2/5] gprs-context: added OFONO_GPRS_AUTH_METHOD_NONE Giacinto Cifelli
2018-10-06  5:45 ` [PATCH 3/5] src/gprs: support for NONE auth Giacinto Cifelli
2018-10-09 17:37   ` Denis Kenzior
2018-10-09 18:49     ` Giacinto Cifelli
2018-10-06  5:45 ` [PATCH 4/5] plugins/provisioning and mbpi: support for auth NONE Giacinto Cifelli
2018-10-09 17:38   ` Denis Kenzior
2018-10-06  5:45 ` [PATCH 5/5] drivers: " Giacinto Cifelli
2018-10-09 17:41   ` Denis Kenzior [this message]
2018-10-09 18:51     ` Giacinto Cifelli
2018-10-09 17:37 ` [PATCH 1/5] connman-api: added "none" auth_method Denis Kenzior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9110ae75-3245-7131-8a3e-92fb83fef5ce@gmail.com \
    --to=denkenz@gmail.com \
    --cc=ofono@ofono.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox