Skip to content

Commit 3fbba25

Browse files
schwabecron2
authored andcommitted
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 <[email protected]> Found-by: ZeroPath (https://zeropath.com/) Change-Id: I6c502508026c6b85bb092ada4d16d985b20dd41f Signed-off-by: Arne Schwabe <[email protected]> Acked-by: Gert Doering <[email protected]> Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1326 Message-Id: <[email protected]> URL: https://www.mail-archive.com/[email protected]/msg34069.html Signed-off-by: Gert Doering <[email protected]>
1 parent cd4cac1 commit 3fbba25

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/openvpn/ssl_verify.c

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1329,7 +1329,7 @@ verify_user_pass_script(struct tls_session *session, struct tls_multi *multi,
13291329
}
13301330
else
13311331
{
1332-
setenv_str(session->opt->es, "username", up->username);
1332+
/* username env is already set by set_verify_user_pass_env */
13331333
setenv_str(session->opt->es, "password", up->password);
13341334
}
13351335

@@ -1377,10 +1377,6 @@ verify_user_pass_script(struct tls_session *session, struct tls_multi *multi,
13771377
/* purge auth control filename (and file itself) for non-deferred returns */
13781378
key_state_rm_auth_control_files(&ks->script_auth);
13791379
}
1380-
if (!session->opt->auth_user_pass_verify_script_via_file)
1381-
{
1382-
setenv_del(session->opt->es, "password");
1383-
}
13841380

13851381
done:
13861382
if (tmp_file && strlen(tmp_file) > 0)
@@ -1389,6 +1385,11 @@ verify_user_pass_script(struct tls_session *session, struct tls_multi *multi,
13891385
}
13901386

13911387
error:
1388+
if (!session->opt->auth_user_pass_verify_script_via_file)
1389+
{
1390+
setenv_del(session->opt->es, "password");
1391+
}
1392+
13921393
argv_free(&argv);
13931394
gc_free(&gc);
13941395
return retval;

0 commit comments

Comments
 (0)