ofono.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: s.e.golubtsov@gmail.com
To: ofono@ofono.org
Subject: [PATCH v2] gsmdial: adding support for selection of authentication method
Date: Thu, 07 Jan 2021 23:40:15 +0300	[thread overview]
Message-ID: <20210107204017.3382-1-s.e.golubtsov@gmail.com> (raw)

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

From: Sergei Golubtsov <s.e.golubtsov@gmail.com>

Selection capability for authentication method via a command line
argument has been added
---
 gatchat/gsmdial.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/gatchat/gsmdial.c b/gatchat/gsmdial.c
index 60e4f245..23f9c2d9 100644
--- a/gatchat/gsmdial.c
+++ b/gatchat/gsmdial.c
@@ -53,6 +53,7 @@ static gint option_cid = 0;
 static gchar *option_apn = NULL;
 static gint option_offmode = 0;
 static gboolean option_legacy = FALSE;
+static gchar *option_auth_method;
 static gchar *option_username = NULL;
 static gchar *option_password = NULL;
 static gchar *option_pppdump = NULL;
@@ -369,6 +370,17 @@ static void connect_cb(gboolean ok, GAtResult *result, gpointer user_data)
 	}
 	g_at_ppp_set_debug(ppp, gsmdial_debug, "PPP");
 
+	GAtPPPAuthMethod auth_method;
+
+	if (strcmp(option_auth_method, "PAP") == 0)
+		auth_method = G_AT_PPP_AUTH_METHOD_PAP;
+	else if (strcmp(option_auth_method, "NONE") == 0)
+		auth_method = G_AT_PPP_AUTH_METHOD_NONE;
+	else
+		auth_method = G_AT_PPP_AUTH_METHOD_CHAP;
+
+	g_at_ppp_set_auth_method(ppp, auth_method);
+
 	g_at_ppp_set_credentials(ppp, option_username, option_password);
 
 	g_at_ppp_set_acfc_enabled(ppp, option_acfc);
@@ -677,6 +689,10 @@ static GOptionEntry options[] = {
 				"Use ATD*99***<cid>#" },
 	{ "bluetooth", 'b', 0, G_OPTION_ARG_NONE, &option_bluetooth,
 				"Use only ATD*99" },
+	{ "auth", 'A', 0, G_OPTION_ARG_STRING, &option_auth_method,
+				"Specify the authentication method for the PPP"
+				" connection: CHAP, PAP or NONE. CHAP is used"
+				" by default." },
 	{ "username", 'u', 0, G_OPTION_ARG_STRING, &option_username,
 				"Specify PPP username" },
 	{ "password", 'w', 0, G_OPTION_ARG_STRING, &option_password,
-- 
2.17.1

             reply	other threads:[~2021-01-07 20:40 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-07 20:40 s.e.golubtsov [this message]
2021-01-07 20:40 ` [PATCH v2] ppp: using RX ACCM = 0 by default s.e.golubtsov
2021-01-08  5:20   ` Denis Kenzior
2021-01-07 20:40 ` [PATCH v2] quectel: adding support for the Quectel EC200 USB modem series s.e.golubtsov
2021-01-08  5:26   ` Denis Kenzior
2021-01-08  5:17 ` [PATCH v2] gsmdial: adding support for selection of authentication 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=20210107204017.3382-1-s.e.golubtsov@gmail.com \
    --to=s.e.golubtsov@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;
as well as URLs for NNTP newsgroup(s).