From: "cron2 (Code Review)" Date: Thu, 30 Oct 2025 20:55:53 +0000 In-Reply-To: References: Reply-To: gert@...1296..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="PZdwOLyhGvc="; charset=UTF-8 Subject: [Openvpn-devel] [S] Change in openvpn[master]: clean up environment variable handling in verify_user_pass_script List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: plaisthos Cc: flichtenheld , openvpn-devel --PZdwOLyhGvc= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/13= 26?usp=3Demail ) Change subject: clean up environment variable handling in verify_user_pass_= script ...................................................................... clean up environment variable handling in verify_user_pass_script The username environment variable is already set by the set_verify_user_pass_env function before the verify_user_pass_script function is called, so this call is not doing anything but might erroneously made people think that this needs to be cleaned up. Also ensure that the password is clean from the env even in an error case. Reported-by: Joshua Rogers Found-by: ZeroPath (https://zeropath.com/) Change-Id: I6c502508026c6b85bb092ada4d16d985b20dd41f Signed-off-by: Arne Schwabe Acked-by: Gert Doering Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1326 Message-Id: <20251030194402.1729-1-gert@...1296...> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg34= 069.html Signed-off-by: Gert Doering --- M src/openvpn/ssl_verify.c 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/openvpn/ssl_verify.c b/src/openvpn/ssl_verify.c index 04ef27e..993d22c 100644 --- a/src/openvpn/ssl_verify.c +++ b/src/openvpn/ssl_verify.c @@ -1329,7 +1329,7 @@ } else { - setenv_str(session->opt->es, "username", up->username); + /* username env is already set by set_verify_user_pass_env */ setenv_str(session->opt->es, "password", up->password); } @@ -1377,10 +1377,6 @@ /* purge auth control filename (and file itself) for non-deferred = returns */ key_state_rm_auth_control_files(&ks->script_auth); } - if (!session->opt->auth_user_pass_verify_script_via_file) - { - setenv_del(session->opt->es, "password"); - } done: if (tmp_file && strlen(tmp_file) > 0) @@ -1389,6 +1385,11 @@ } error: + if (!session->opt->auth_user_pass_verify_script_via_file) + { + setenv_del(session->opt->es, "password"); + } + argv_free(&argv); gc_free(&gc); return retval; -- To view, visit http://gerrit.openvpn.net/c/openvpn/+/1326?usp=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings?usp=3Demail Gerrit-MessageType: merged Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I6c502508026c6b85bb092ada4d16d985b20dd41f Gerrit-Change-Number: 1326 Gerrit-PatchSet: 2 Gerrit-Owner: plaisthos Gerrit-Reviewer: cron2 Gerrit-Reviewer: flichtenheld Gerrit-CC: openvpn-devel --PZdwOLyhGvc= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

cron2 sub= mitted this change.

View Change

clean up environment variable handling in verify=
_user_pass_script

The username environment variable is already set b= y the
set_verify_user_pass_env function before the verify_user_pass_scri= pt
function is called, so this call is not doing anything but might erro= neously
made people think that this needs to be cleaned up.

Also = ensure that the password is clean from the env even in an error case.
Reported-by: Joshua Rogers <contact@...2949...>
Found-by: ZeroPa= th (https://zeropath.com/)
Change-Id: I6c502508026c6b85bb092ada4d16d985b= 20dd41f
Signed-off-by: Arne Schwabe <arne-openvpn@...1227...>
A= cked-by: Gert Doering <gert@...1296...>
Gerrit URL: https://gerrit= .openvpn.net/c/openvpn/+/1326
Message-Id: <20251030194402.1729-1-gert= @...1296...>
URL: https://www.mail-archive.com/openvpn-devel@...1466...= urceforge.net/msg34069.html
Signed-off-by: Gert Doering <gert@...1726...= ...>
---
M src/openvpn/ssl_verify.c
1 file changed, 6 insertion= s(+), 5 deletions(-)

diff --git a/src/openvpn/ssl_verify.c b/src/openvpn/ssl_verify.c<=
br>index 04ef27e..993d22c 100644
--- a/src/openvpn/ss= l_verify.c
+++ b/src/openvpn/ssl_verify.c
@= @ -1329,7 +1329,7 @@
}
else
{
- = setenv_str(session->opt->es, "username", up->usernam= e);
+ /* usern= ame env is already set by set_verify_user_pass_env */
= setenv_str(session->opt->es, "password", up->passwor= d);
}

@@ -1377,10 +1= 377,6 @@
/* purge auth control filename (and file = itself) for non-deferred returns */
key_state_rm_a= uth_control_files(&ks->script_auth);
}- if (!session->opt->a= uth_user_pass_verify_script_via_file)
- {
-= setenv_del(session->opt->es, "password");- }
<= br> done:
if (tmp_file && strlen(tmp_fil= e) > 0)
@@ -1389,6 +1385,11 @@
}

error:
+ if (!session->opt->auth_user_pass_verify_scri= pt_via_file)
+ {
+ setenv_del(se= ssion->opt->es, "password");
+ }
+
argv_free(&argv);
= gc_free(&gc);
return retval;

To view, visit change 1326. To unsubscribe, or for help writing= mail filters, visit settings.

Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I6c502508026c6b85bb092ada4d1= 6d985b20dd41f
Gerrit-Change-Number: 1326
Gerrit-PatchSet: 2
Gerrit-Owner: plaisthos <arne-openvpn@...1711...= 27...>
Gerrit-Reviewer: cron2 <gert@...1296...>=
Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
= --PZdwOLyhGvc=--