Page MenuHome GnuPG

Assuan Context for inquiry callback not set if gpg-agent is just started
Closed, ResolvedPublic

Description

GnuPG 2.1.14, file sm/call-agent.c

Many functions contain this declaration:

  struct default_inq_parm_s inq_parm = { ctrl, agent_ctx };

And later these statements:

  rc = start_agent (ctrl);
  if (rc)
    return rc;

When the agent is not already started, the initialization of inq_parm is done
too early because agent_ctx is NULL at that time.

agent_ctx becomes non-NULL in start_agent(), but this non-NULL value is not
copied to inq_parm->ctx.

(This causes effects like not being able to import a PKCS#12 file with
pinentry-mode=loopback if the agent has not been started before.)

Fix:

Each time you see the lines above, add this line after the »return rc;«:

  inq_parm->ctx = agent_ctx;

Thank you.

Details

Version
2.1.14, 2.1.15

Event Timeline

perske set Version to 2.1.14.
perske added a subscriber: perske.

Same in current version 2.1.15 (file is identical)

perske changed Version from 2.1.14 to 2.1.14, 2.1.15.Sep 23 2016, 11:46 AM

Correction (not "->" but "."): Add this line:

  inq_parm.ctx = agent_ctx;

Patch attached. Works for me for 2.1.14.
(Should work for 2.1.15, too, but I cannot test due to T2698.)

gniibe added a project: Restricted Project.

If a apply that fix to an unmodified 2.1.15, my problem is solved:
My test case (importing a PKCS#12 file with pinentry-mode=loopback if the agent
has not been started before) now works. Thank you!

werner removed a project: Restricted Project.