Hi again,
After spending a second day debugging this problem, I think I've
narrowed it down. (Sorry for the top-post, but the original post isn't
too relevant anymore!)
I still have not found a case where passphrase_cb is actually used. In
the gpg2 manpage, the description of the '--{no-}use-agent' options
indicate that the gpg agent is *always* used, which would imply that
there is no way for gpg2 to read in a passphrase through a file descriptor.
The gpgme test cases work because they create a 'gpg-agent.conf' file in
$GNUPGHOME pointing to the simple but workable 'pinentry' script in the
same directory. Although there is a 'passphrase_cb' function defined in
t-support.h, it is presumably never used with gpg2, even though it is
set up and ready to go.
The pygpgme test cases fail because, although there is a working
passphrase_cb, it is never called, and there is no gpg-agent configured
capable of supplying the passphrase.
All the above seems to be true, and yet the application I'm having
trouble with (sigul) was working well a couple of months ago. Can
anyone confirm or deny the above?
Thanks-
John
On 09/06/2012 06:34 PM, John Morris wrote:
Hi,
I'm having trouble with passphrase_cb seemingly being ignored. The
GPG_AGENT_INFO environment variable is unset.
It could be similar to this bug here, and I am indeed using pygpgme:
https://bugs.launchpad.net/pygpgme/+bug/49
Can someone eyeball this trace and see if anything obvious sticks out?
I've gone through both the pygpgme and gpgme code to some degree and
can't seem to figure out why the supplied passphrase_cb isn't ever
executed.
The point in the trace where passphrase_cb is set is quite clear, and
the value stays the same until the end:
passphrase_cb=0x2e30e0/0xb7435194
However, instead of the pygpgme callback function executing, the gnome
pinentry window pops up.
I've pasted a bunch of debugging statements into the code of pygpgme.
They confirm that up until the line where gpgme_op_sign is called, the
passphrase_cb is set as expected. It is also set as expected coming out
of op_sign. However, the debug statements planted in the callback
function itself are never touched.
I tried instrumenting t-sign.c and t-support.h the same way, but the
data types are opaque there and wasn't able to get hex pointer values
for the cb function. The cb function in t-support.h does seem never to
be called, but there's no gnome pinentry dialog either, and the tests
pass, so I'm quite confused. (My crude instrumentation appends lines to
a debug file in /tmp, opening and closing after each write, so that
there's no confusion about stderr/stdout getting swallowed or lines
being written out of order.)
Thanks-
John
GPGME 2012-09-06 17:43:28 0x464e gpgme_debug: level=5
GPGME 2012-09-06 17:43:28 0x464e gpgme_check_version: call: 0=(nil),
req_version=(null), VERSION=1.3.0
GPGME 2012-09-06 17:43:28 0x464e gpgme_check_version_internal: call:
0=(nil), req_version=(null), offset_sig_validity=32
GPGME 2012-09-06 17:43:28 0x464e gpgme_new: enter: r_ctx=0xb77550a8
GPGME 2012-09-06 17:43:28 0x464e gpgme_new: leave: ctx=0x96811f8
GPGME 2012-09-06 17:43:28 0x464e gpgme_data_new_from_cbs: enter:
r_dh=0xbffd4d10, handle=0xb742a498
GPGME 2012-09-06 17:43:28 0x464e gpgme_data_new_from_cbs: leave:
dh=0x96aa890
GPGME 2012-09-06 17:43:28 0x464e gpgme_op_import: enter:
ctx=0x96811f8, keydata=0x96aa890
GPGME 2012-09-06 17:43:28 0x464e gpgme_data_get_encoding: call:
dh=0x96aa890, dh-encoding=0
GPGME 2012-09-06 17:43:28 0x464e _gpgme_add_io_cb: call:
ctx=0x96811f8, fd 5, dir=1 - tag=0x969e588
GPGME 2012-09-06 17:43:28 0x464e _gpgme_add_io_cb: call:
ctx=0x96811f8, fd 9, dir=0 - tag=0x95d2b48
GPGME 2012-09-06 17:43:28 0x464e gpgme:gpg_io_event: call:
gpg=0x9674040, event 0x4b87dcf0, type 0, type_data (nil)
GPGME 2012-09-06 17:43:28 0x464e _gpgme_run_io_cb: call:
item=0x95d2b58, need to check
GPGME 2012-09-06 17:43:28 0x464e _gpgme_run_io_cb: call:
item=0x95d2b58, handler (0x96aa890, 9)
GPGME 2012-09-06 17:43:28 0x464e _gpgme_data_outbound_handler:
enter: dh=0x96aa890, fd=0x9
GPGME 2012-09-06 17:43:28 0x464e gpgme_data_read: enter:
dh=0x96aa890, buffer=0x96aa898, size=4096
GPGME 2012-09-06 17:43:28 0x464e gpgme_data_read: leave: result=908
GPGME 2012-09-06 17:43:28 0x464e _gpgme_data_outbound_handler: leave
GPGME 2012-09-06 17:43:28 0x464e _gpgme_run_io_cb: call:
item=0x95d2b58, need to check
GPGME 2012-09-06 17:43:28 0x464e _gpgme_run_io_cb: call:
item=0x95d2b58, handler (0x96aa890, 9)
GPGME 2012-09-06 17:43:28 0x464e _gpgme_data_outbound_handler:
enter: dh=0x96aa890, fd=0x9
GPGME 2012-09-06 17:43:28 0x464e gpgme_data_read: enter:
dh=0x96aa890, buffer=0x96aa898, size=4096
GPGME 2012-09-06 17:43:28 0x464e gpgme_data_read: leave: result=0
GPGME 2012-09-06 17:43:28 0x464e _gpgme_remove_io_cb: call:
data=0x95d2b48, setting fd 0x9 (item=0x95d2b58) done
GPGME 2012-09-06 17:43:28 0x464e _gpgme_data_outbound_handler: leave
GPGME 2012-09-06 17:43:28 0x464e