0
0
mirror of https://github.com/OpenVPN/openvpn.git synced 2024-09-19 19:42:30 +02:00

Initialize before use struct user_pass in ui_reader()

This was missed in commit 3512e8d3ad
Also add a comment to clarify how pem_password_callback is accessed
in ui_reader().

Change-Id: I82835ff8e1e31e067efd81bfb6e8cd19ee004d9c
Signed-off-by: Selva Nair <selva.nair@gmail.com>
Acked-by: Gert Doering <gert@greenie.muc.de>
Message-Id: <20240908224220.478684-1-selva.nair@gmail.com>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg29114.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
This commit is contained in:
Selva Nair 2024-09-08 18:42:20 -04:00 committed by Gert Doering
parent f086a49b55
commit 67124dcf31

View File

@ -776,7 +776,9 @@ tls_ctx_load_ecdh_params(struct tls_root_ctx *ctx, const char *curve_name)
#if defined(HAVE_OPENSSL_STORE_API)
/**
* A wrapper for pem_password_callback for use with OpenSSL UI_METHOD.
* A wrapper for password callback for use with OpenSSL UI_METHOD.
* The callback is obtained using SSL_CTX_get_default_passwd_cb()
* which is set to pem_password_callback() in tls_ctx_set_options().
*/
static int
ui_reader(UI *ui, UI_STRING *uis)
@ -791,6 +793,7 @@ ui_reader(UI *ui, UI_STRING *uis)
if (strstr(prompt, "PKCS#11"))
{
struct user_pass up;
CLEAR(up);
get_user_pass(&up, NULL, "PKCS#11 token", GET_USER_PASS_MANAGEMENT|GET_USER_PASS_PASSWORD_ONLY);
UI_set_result(ui, uis, up.password);
purge_user_pass(&up, true);