From: "plaisthos (Code Review)" Date: Wed, 29 Oct 2025 13:17:15 +0000 References: Reply-To: arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net, frank@...2641... Message-ID: <0a0d2a0ddb850b8564a772236320f422add9257d-HTML@...2715...> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="1tx5lnyQsaE="; 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: flichtenheld Cc: openvpn-devel --1tx5lnyQsaE= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Attention is currently required from: flichtenheld. Hello flichtenheld, I'd like you to do a code review. Please visit http://gerrit.openvpn.net/c/openvpn/+/1326?usp=3Demail to review the following change. 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 --- M src/openvpn/ssl_verify.c 1 file changed, 6 insertions(+), 5 deletions(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/26/1326/1 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: newchange Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I6c502508026c6b85bb092ada4d16d985b20dd41f Gerrit-Change-Number: 1326 Gerrit-PatchSet: 1 Gerrit-Owner: plaisthos Gerrit-Reviewer: flichtenheld Gerrit-CC: openvpn-devel Gerrit-Attention: flichtenheld --1tx5lnyQsaE= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is cur= rently required from: flichtenheld.

plaisthos would like flichtenheld to review this change.

V= iew Change

clean up environment variable handling in v=
erify_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.<= br>
Reported-by: Joshua Rogers <contact@...2949...>
Found-by: Z= eroPath (https://zeropath.com/)
Change-Id: I6c502508026c6b85bb092ada4d16= d985b20dd41f
---
M src/openvpn/ssl_verify.c
1 file changed, 6 inse= rtions(+), 5 deletions(-)

git pull ssh://gerrit.=
openvpn.net:29418/openvpn refs/changes/26/1326/1
diff --git a/src/o=
penvpn/ssl_verify.c b/src/openvpn/ssl_verify.c
index 04ef27= e..993d22c 100644
--- a/src/openvpn/ssl_verify.c
= +++ b/src/openvpn/ssl_verify.c
@@ -1329,7 +1329,7 @@<= /span>
}
else
{
- setenv_str(sessio= n->opt->es, "username", up->username);
+ /* username env is already se= t by set_verify_user_pass_env */
setenv_str(sessio= n->opt->es, "password", up->password);
= }

@@ -1377,10 +1377,6 @@
/* purge auth control filename (and file itself) for non-defer= red returns */

key_state_rm_auth_control_files(&am= p;ks->script_auth);
}
- if (!session->opt->auth_user_pass_verify_= script_via_file)
- {=
- setenv_del(se= ssion->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 v= iew, visit change 1326. To unsubscribe, or for help writing mail filters, visit= settings.

Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I6c502508026c6b85bb092ada4d1= 6d985b20dd41f
Gerrit-Change-Number: 1326
Gerrit-PatchSet: 1
Gerrit-Owner: plaisthos <arne-openvpn@...1711...= 27...>
Gerrit-Reviewer: flichtenheld <frank@...2716...= 1...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-Attention: flichtenheld <frank@...2375...= 41...>
= --1tx5lnyQsaE=--