Skip to contentSkip to conversation

Do not copy auth_token username to itself

PATCH In review [email protected]... 2 participants 3 messages Oct 27, 2022 – Oct 28, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Do not copy auth_token username to itself

From: Selva Nair <[email protected]...>

- Fixes a potential mis-behaviour (strncpy with dest == src) introduced by commits ecad4839c (2.6) and 3d792ae955 (2.5).
Reported by: Gert Doering <[email protected]...>

---
 src/openvpn/ssl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/openvpn/ssl.c +1 -1
index 3106c738..24e8ba63 100644
@@ -2180,7 +2180,7 @@ key_method_2_write(struct buffer *buf, struct tls_multi *multi, struct tls_sessi
             goto error;
         }
         /* save username for auth-token which may get pushed later */
-        if (session->opt->pull)
+        if (session->opt->pull && up != &auth_token)
         {
             strncpynt(auth_token.username, up->username, USER_PASS_LEN);
         }
Signature · 1 line
2.30.2
Acked-by on v1 1/1
#1 lore raw

Testing this was fairly easy - I added a msg() call in that if() branch, connected to a server with auth-token and verified that it did the strncpynt() only on the "I have a real username here" call. And that token reauth still works ("username properly copied"), which it all did.

Your patch has been applied to the master branch, for now - it needs to go to 2.5 as well, but we're right in the middle of a 2.5.8 release, and I need to check with Samuli & Frank if anything has been done already that would cause havoc if I change the (preliminary) v2.5.8 tag...

commit dbf142ffe597b21aa09a47677ea2061b74a9354e

Author: Selva Nair
Date:   Thu Oct 27 12:06:19 2022 -0400
     Do not copy auth_token username to itself

     Signed-off-by: Selva Nair <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/search?l=mid&[email protected]...
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#2 lore raw

Hi,

... and here we go:

Quoted 7 lines · Gert Doering

Your patch has been applied to the master branch, for now - it needs to go to 2.5 as well, but we're right in the middle of a 2.5.8 release, and I need to check with Samuli & Frank if anything has been done already that would cause havoc if I change the (preliminary) v2.5.8 tag...

commit dbf142ffe597b21aa09a47677ea2061b74a9354e

commit cd50cf021bcfb797b6dacbe853e4c08b21a8e89d (release/2.5)

briefly tested in a setup with username+password and token, things still work :-) - v2.5.8 has been updated, so this is in.

gert

Signature · 6 lines
"If was one thing all people took for granted, was conviction that if you 
 feed honest figures into a computer, honest figures come out. Never doubted 
 it myself till I met a computer with a sense of humor."
                             Robert A. Heinlein, The Moon is a Harsh Mistress

Gert Doering - Munich, Germany                             [email protected]...