1
0
mirror of git://git.gnupg.org/gnupg.git synced 2025-01-03 12:11:33 +01:00

gpg,sm: Set confidential in assuan communication for password.

* g10/call-agent.c (default_inq_cb): Call assuan_begin_confidential
and assuan_end_confidential.
* sm/call-agent.c (default_inq_cb): Likewise.

--

Cherry pick from master commit of:
	ec1446f9446506b5fbdf90cdeb9cbe1f410a657e

GnuPG-bug-id: 6654
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
NIIBE Yutaka 2023-11-09 13:36:12 +09:00 committed by Werner Koch
parent 77fb089835
commit 3654fee3a4
No known key found for this signature in database
GPG Key ID: E3FDFF218E45B72B
2 changed files with 4 additions and 0 deletions

View File

@ -149,6 +149,7 @@ default_inq_cb (void *opaque, const char *line)
|| has_leading_keyword (line, "NEW_PASSPHRASE")) || has_leading_keyword (line, "NEW_PASSPHRASE"))
&& opt.pinentry_mode == PINENTRY_MODE_LOOPBACK) && opt.pinentry_mode == PINENTRY_MODE_LOOPBACK)
{ {
assuan_begin_confidential (parm->ctx);
if (have_static_passphrase ()) if (have_static_passphrase ())
{ {
const char *s = get_static_passphrase (); const char *s = get_static_passphrase ();
@ -175,6 +176,7 @@ default_inq_cb (void *opaque, const char *line)
err = assuan_send_data (parm->ctx, pw, strlen (pw)); err = assuan_send_data (parm->ctx, pw, strlen (pw));
xfree (pw); xfree (pw);
} }
assuan_end_confidential (parm->ctx);
} }
else else
log_debug ("ignoring gpg-agent inquiry '%s'\n", line); log_debug ("ignoring gpg-agent inquiry '%s'\n", line);

View File

@ -246,7 +246,9 @@ default_inq_cb (void *opaque, const char *line)
&& have_static_passphrase ()) && have_static_passphrase ())
{ {
const char *s = get_static_passphrase (); const char *s = get_static_passphrase ();
assuan_begin_confidential (parm->ctx);
err = assuan_send_data (parm->ctx, s, strlen (s)); err = assuan_send_data (parm->ctx, s, strlen (s));
assuan_end_confidential (parm->ctx);
} }
else else
log_error ("ignoring gpg-agent inquiry '%s'\n", line); log_error ("ignoring gpg-agent inquiry '%s'\n", line);