All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] add name field when process chap authentication
@ 2011-05-11  9:19 Caiwen Zhang
  2011-05-12  1:25 ` Denis Kenzior
  0 siblings, 1 reply; 2+ messages in thread
From: Caiwen Zhang @ 2011-05-11  9:19 UTC (permalink / raw)
  To: ofono

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

Some systems require name field, otherwise chap authentication will fail.

---
 gatchat/ppp_auth.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/gatchat/ppp_auth.c b/gatchat/ppp_auth.c
index b73f320..f2b8c31 100644
--- a/gatchat/ppp_auth.c
+++ b/gatchat/ppp_auth.c
@@ -60,6 +60,7 @@ static void chap_process_challenge(struct ppp_chap *chap, const guint8 *packet)
 	struct chap_header *response;
 	GChecksum *checksum;
 	const char *secret = g_at_ppp_get_password(chap->ppp);
+	const char *username = g_at_ppp_get_username(chap->ppp);
 	guint16 response_length;
 	struct ppp_header *ppp_packet;
 	gsize digest_len;
@@ -83,6 +84,8 @@ static void chap_process_challenge(struct ppp_chap *chap, const guint8 *packet)
 	 */
 	digest_len = g_checksum_type_get_length(chap->method);
 	response_length = digest_len + sizeof(*header) + 1;
+	if (username != NULL)
+		response_length += strlen(username);
 	ppp_packet = ppp_packet_new(response_length, CHAP_PROTOCOL);
 	if (ppp_packet == NULL)
 		goto challenge_out;
@@ -98,6 +101,10 @@ static void chap_process_challenge(struct ppp_chap *chap, const guint8 *packet)
 		/* leave the name empty? */
 	}
 
+	if (username != NULL)
+		memcpy(response->data + digest_len + 1, username,
+				strlen(username));
+
 	/* transmit the packet */
 	ppp_transmit(chap->ppp, (guint8 *) ppp_packet, response_length);
 	g_free(ppp_packet);
-- 
1.7.5


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] add name field when process chap authentication
  2011-05-11  9:19 [PATCH] add name field when process chap authentication Caiwen Zhang
@ 2011-05-12  1:25 ` Denis Kenzior
  0 siblings, 0 replies; 2+ messages in thread
From: Denis Kenzior @ 2011-05-12  1:25 UTC (permalink / raw)
  To: ofono

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

Hi Caiwen,

On 05/11/2011 04:19 AM, Caiwen Zhang wrote:
> Some systems require name field, otherwise chap authentication will fail.
> 
> ---
>  gatchat/ppp_auth.c |    7 +++++++
>  1 files changed, 7 insertions(+), 0 deletions(-)
> 

Patch has been applied with a minor style fix and a reworded commit
message.  Thanks for that.

Regards,
-Denis

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-05-12  1:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-11  9:19 [PATCH] add name field when process chap authentication Caiwen Zhang
2011-05-12  1:25 ` Denis Kenzior

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.