Skip to contentSkip to conversation

Change in openvpn[master]: Log when writing username/password to TLS buffer fails

Openvpn-devel In review selvanair (Code Review) 3 participants 9 messages Mar 31 – Apr 14 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): gerrit.1774983232000.I9468811fd434e17645957fc12770aa2b9ed98fb8@...2715...

#1 lore raw

Attention is currently required from: plaisthos.

Hello plaisthos,

I'd like you to do a code review.
Please visit

    http://gerrit.openvpn.net/c/openvpn/+/1600?usp=email

to review the following change.

Change subject: Log when writing username/password to TLS buffer fails
......................................................................

Log when writing username/password to TLS buffer fails

Currently we get an unhelpful "Key Method #2 failed" error. Add a more specific warning message.

Change-Id I9468811fd434e17645957fc12770aa2b9ed98fb8

---
M src/openvpn/ssl.c

1 file changed, 2 insertions(+), 0 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/00/1600/1

src/openvpn/ssl.c +2 -0
index 576157d..5868d53 100644
@@ -2125,10 +2125,12 @@
 
         if (!write_string(buf, up->username, -1))
         {
+            msg(M_WARN, "WARNING: Failed to write auth username to TLS buffer");
             goto error;
         }
         else if (!write_string(buf, up->password, -1))
         {
+            msg(M_WARN, "WARNING: Failed to write auth password to TLS buffer");
             goto error;
         }
         /* save username for auth-token which may get pushed later */

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1600?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I9468811fd434e17645957fc12770aa2b9ed98fb8
Gerrit-Change-Number: 1600
Gerrit-PatchSet: 1
Gerrit-Owner: selvanair <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>

#2 lore raw
In reply to a message not in the archive

Attention is currently required from: plaisthos.

selvanair has posted comments on this change by selvanair. ( http://gerrit.openvpn.net/c/openvpn/+/1600?usp=email )

Change subject: Log when writing username/password to TLS buffer fails
......................................................................

Patch Set 1:

(1 comment)

Patchset:

PS1:
I think this should be a M_FATAL but, for some reason, the current behaviour is to continue. That leads to repeated retries that never succeeds.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1600?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I9468811fd434e17645957fc12770aa2b9ed98fb8
Gerrit-Change-Number: 1600
Gerrit-PatchSet: 1
Gerrit-Owner: selvanair <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Comment-Date: Tue, 31 Mar 2026 18:57:31 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No

#3 lore raw
In reply to a message not in the archive

Attention is currently required from: selvanair.

plaisthos has posted comments on this change by selvanair. ( http://gerrit.openvpn.net/c/openvpn/+/1600?usp=email )

Change subject: Log when writing username/password to TLS buffer fails
......................................................................

Patch Set 1: Code-Review+2

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1600?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I9468811fd434e17645957fc12770aa2b9ed98fb8
Gerrit-Change-Number: 1600
Gerrit-PatchSet: 1
Gerrit-Owner: selvanair <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: selvanair <[email protected]...>
Gerrit-Comment-Date: Mon, 13 Apr 2026 21:29:58 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes

#4 lore raw

PATCH 1/1 Log when writing username/password to TLS buffer fails

In reply to a message not in the archive

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

Currently we get an unhelpful "Key Method #2 failed" error. Add a more specific warning message.

Change-Id I9468811fd434e17645957fc12770aa2b9ed98fb8

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1600
---

This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1600
This mail reflects revision 1 of this Change.

Acked-by according to Gerrit (reflected above):
Arne Schwabe <[email protected]...>

src/openvpn/ssl.c +2 -0
index 576157d..5868d53 100644
@@ -2125,10 +2125,12 @@
 
         if (!write_string(buf, up->username, -1))
         {
+            msg(M_WARN, "WARNING: Failed to write auth username to TLS buffer");
             goto error;
         }
         else if (!write_string(buf, up->password, -1))
         {
+            msg(M_WARN, "WARNING: Failed to write auth password to TLS buffer");
             goto error;
         }
         /* save username for auth-token which may get pushed later */
#5 lore raw

[Openvpn-devel] [PATCH applied] Re: Log when writing username/password to TLS buffer fails

Thanks, this makes sense - if we fail, we want to tell the user what happened (even if we then continue to run in silly circles).

I have not tested it - I guess one needs a GUI with "long password" support to trigger it :-) - but since the code path is clear enough and the patch only adds msg() calls, I guess a compile test is fine.

Your patch has been applied to the master and release/2.7 branch (I put this into "documentation improvement").

commit fd1fd077ea7781be8be6e05f2a2b657619c7e437 (master) commit 784ba7a2019539db028cd98beaa42e8921394cdf (release/2.7)

Author: Selva Nair
Date:   Tue Apr 14 07:57:14 2026 +0200
     Log when writing username/password to TLS buffer fails

     Signed-off-by: Selva Nair <[email protected]...>
     Acked-by: Arne Schwabe <[email protected]...>
     Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1600
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg36604.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#6 lore raw

Re: [Openvpn-devel] [PATCH applied] Re: Log when writing username/password to TLS buffer fails

Quoted 1 line

I have not tested it - I guess one needs a GUI with "long password"

support to trigger it :-)

Not really.. long passwords work via the console even in pre-2.6 ! A password longer than about 1700 bytes will trigger it.

Selva

Quoted 31 lines · Gert Doering

Thanks, this makes sense - if we fail, we want to tell the user what happened (even if we then continue to run in silly circles).

I have not tested it - I guess one needs a GUI with "long password" support to trigger it :-) - but since the code path is clear enough and the patch only adds msg() calls, I guess a compile test is fine.

Your patch has been applied to the master and release/2.7 branch (I put this into "documentation improvement").

commit fd1fd077ea7781be8be6e05f2a2b657619c7e437 (master) commit 784ba7a2019539db028cd98beaa42e8921394cdf (release/2.7)

Author: Selva Nair
Date:   Tue Apr 14 07:57:14 2026 +0200
     Log when writing username/password to TLS buffer fails

     Signed-off-by: Selva Nair <[email protected]...>
     Acked-by: Arne Schwabe <[email protected]...>
     Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1600
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg36604.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#7 lore raw

Re: [Openvpn-devel] [PATCH applied] Re: Log when writing username/password to TLS buffer fails

Hi,

Quoted 5 lines · Selva Nair
Quoted 1 line

I have not tested it - I guess one needs a GUI with "long password"

support to trigger it :-)

Not really.. long passwords work via the console even in pre-2.6 ! A password longer than about 1700 bytes will trigger it.

Amazing :-) - and indeed, being prodded to start thinking, this USER_PASS_LEN being set to 4096 must have some sort of effect... - thanks.

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]...
#8 lore raw
In reply to a message not in the archive

cron2 has uploaded a new patch set (#2) to the change originally created by selvanair. ( http://gerrit.openvpn.net/c/openvpn/+/1600?usp=email )

The following approvals got outdated and were removed:
Code-Review+2 by plaisthos

Change subject: Log when writing username/password to TLS buffer fails
......................................................................

Log when writing username/password to TLS buffer fails

Currently we get an unhelpful "Key Method #2 failed" error. Add a more specific warning message.

Change-Id I9468811fd434e17645957fc12770aa2b9ed98fb8

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1600
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg36604.html

---
M src/openvpn/ssl.c

1 file changed, 2 insertions(+), 0 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/00/1600/2

src/openvpn/ssl.c +2 -0
index 576157d..5868d53 100644
@@ -2125,10 +2125,12 @@
 
         if (!write_string(buf, up->username, -1))
         {
+            msg(M_WARN, "WARNING: Failed to write auth username to TLS buffer");
             goto error;
         }
         else if (!write_string(buf, up->password, -1))
         {
+            msg(M_WARN, "WARNING: Failed to write auth password to TLS buffer");
             goto error;
         }
         /* save username for auth-token which may get pushed later */

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1600?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I9468811fd434e17645957fc12770aa2b9ed98fb8
Gerrit-Change-Number: 1600
Gerrit-PatchSet: 2
Gerrit-Owner: selvanair <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>

#9 lore raw
In reply to a message not in the archive

cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1600?usp=email )

Change subject: Log when writing username/password to TLS buffer fails
......................................................................

Log when writing username/password to TLS buffer fails

Currently we get an unhelpful "Key Method #2 failed" error. Add a more specific warning message.

Change-Id I9468811fd434e17645957fc12770aa2b9ed98fb8

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1600
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg36604.html

---
M src/openvpn/ssl.c

1 file changed, 2 insertions(+), 0 deletions(-)
src/openvpn/ssl.c +2 -0
index 576157d..5868d53 100644
@@ -2125,10 +2125,12 @@
 
         if (!write_string(buf, up->username, -1))
         {
+            msg(M_WARN, "WARNING: Failed to write auth username to TLS buffer");
             goto error;
         }
         else if (!write_string(buf, up->password, -1))
         {
+            msg(M_WARN, "WARNING: Failed to write auth password to TLS buffer");
             goto error;
         }
         /* save username for auth-token which may get pushed later */

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1600?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I9468811fd434e17645957fc12770aa2b9ed98fb8
Gerrit-Change-Number: 1600
Gerrit-PatchSet: 2
Gerrit-Owner: selvanair <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>