All of lore.kernel.org
 help / color / mirror / Atom feed
From: Giacinto Cifelli <gciofono@gmail.com>
To: ofono@ofono.org
Subject: [PATCH 4/5] plugins/provisioning and mbpi: support for auth NONE
Date: Sat, 06 Oct 2018 07:45:19 +0200	[thread overview]
Message-ID: <20181006054520.26737-4-gciofono@gmail.com> (raw)
In-Reply-To: <20181006054520.26737-1-gciofono@gmail.com>

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

support of 'none' in file-provisioning:
the default authentication method is set to NONE

support of 'none' in mbpi:
the default method remains CHAP, but it is overridden by NONE after
parsing the entire key for the apn and detecting no username/password
---
 plugins/file-provision.c | 7 +++++--
 plugins/mbpi.c           | 6 ++++++
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/plugins/file-provision.c b/plugins/file-provision.c
index d4846a65..3a1a5a68 100644
--- a/plugins/file-provision.c
+++ b/plugins/file-provision.c
@@ -93,18 +93,21 @@ static int config_file_provision_get_settings(const char *mcc,
 	if (value != NULL)
 		(*settings)[0].password = value;
 
-	(*settings)[0].auth_method = OFONO_GPRS_AUTH_METHOD_CHAP;
+	/* select default authentication method */
+	(*settings)[0].auth_method = OFONO_GPRS_AUTH_METHOD_NONE;
+
 	value = g_key_file_get_string(key_file, setting_group,
 					"internet.AuthenticationMethod", NULL);
 
 	if (value != NULL) {
+
 		if (g_strcmp0(value, "chap") == 0)
 			(*settings)[0].auth_method =
 						OFONO_GPRS_AUTH_METHOD_CHAP;
 		else if (g_strcmp0(value, "pap") == 0)
 			(*settings)[0].auth_method =
 						OFONO_GPRS_AUTH_METHOD_PAP;
-		else
+		else if (g_strcmp0(value, "none") != 0)
 			DBG("Unknown auth method: %s", value);
 
 		g_free(value);
diff --git a/plugins/mbpi.c b/plugins/mbpi.c
index ae92c762..433f1b55 100644
--- a/plugins/mbpi.c
+++ b/plugins/mbpi.c
@@ -325,6 +325,8 @@ static void apn_handler(GMarkupParseContext *context, struct gsm_data *gsm,
 	ap->apn = g_strdup(apn);
 	ap->type = OFONO_GPRS_CONTEXT_TYPE_INTERNET;
 	ap->proto = OFONO_GPRS_PROTO_IP;
+
+	/* pre-select default authentication method */
 	ap->auth_method = OFONO_GPRS_AUTH_METHOD_CHAP;
 
 	g_markup_parse_context_push(context, &apn_parser, ap);
@@ -395,6 +397,10 @@ static void gsm_end(GMarkupParseContext *context, const gchar *element_name,
 	if (ap == NULL)
 		return;
 
+	/* select authentication method NONE if fit */
+	if (!ap->username || !ap->password)
+		ap->auth_method = OFONO_GPRS_AUTH_METHOD_NONE;
+
 	if (gsm->allow_duplicates == FALSE) {
 		GSList *l;
 
-- 
2.17.1


  parent reply	other threads:[~2018-10-06  5:45 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 ` Giacinto Cifelli [this message]
2018-10-09 17:38   ` [PATCH 4/5] plugins/provisioning and mbpi: support for auth NONE Denis Kenzior
2018-10-06  5:45 ` [PATCH 5/5] drivers: " Giacinto Cifelli
2018-10-09 17:41   ` Denis Kenzior
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=20181006054520.26737-4-gciofono@gmail.com \
    --to=gciofono@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.