1
0
mirror of git://git.gnupg.org/gnupg.git synced 2024-12-22 10:19:57 +01:00

tests: Fix fake-pinentry for Windows.

* tests/openpgp/fake-pinentry.c (main): Override PINENTRY_USER_DATA,
by the option.

--

In the Assuan implementation for Windows, spawn function doesn't call
the atfork callback.  Thus, the environment variable is not updated by
gpg-agent when it spawns pinentry.  Reliable way is the interaction
to override the option.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
NIIBE Yutaka 2022-12-02 16:16:07 +09:00
parent 7663fdd983
commit 7c6b014d3b
No known key found for this signature in database
GPG Key ID: 640114AF89DE6054

View File

@ -201,7 +201,6 @@ main (int argc, char **argv)
{ {
char *args; char *args;
char *option_user_data = NULL; char *option_user_data = NULL;
int got_environment_user_data;
char *logfile; char *logfile;
char *passphrasefile; char *passphrasefile;
char *passphrase; char *passphrase;
@ -213,7 +212,6 @@ main (int argc, char **argv)
setvbuf (stdout, NULL, _IOLBF, BUFSIZ); setvbuf (stdout, NULL, _IOLBF, BUFSIZ);
args = getenv ("PINENTRY_USER_DATA"); args = getenv ("PINENTRY_USER_DATA");
got_environment_user_data = !!args;
if (! args) if (! args)
args = ""; args = "";
@ -290,12 +288,7 @@ main (int argc, char **argv)
} }
else if (strncmp (buffer, OPT_USER_DATA, strlen (OPT_USER_DATA)) == 0) else if (strncmp (buffer, OPT_USER_DATA, strlen (OPT_USER_DATA)) == 0)
{ {
if (got_environment_user_data) /* Prefer interactive data to the one from environment variable. */
{
reply ("OK - I already got the data from the environment.\n");
continue;
}
if (log_stream) if (log_stream)
fclose (log_stream); fclose (log_stream);
log_stream = NULL; log_stream = NULL;