assuan_inquire_ext()
Marcus Brinkmann
marcus.brinkmann at ruhr-uni-bochum.de
Mon Nov 12 15:27:23 CET 2007
At Sun, 11 Nov 2007 11:38:01 -0500,
Ben Kibbey <bjk at luxsci.net> wrote:
>
> I'm having problems with assuan_inquire_ext() from version 1.0.3. The
> After reading the inquire from the client I call assuan_process_done().
What do you mean by reading? After assuan_inquire_ext, you should
loop over assuan_process_next until the callback handler you
registered is invoked. At that point, the internal variable
in_inquire will be set to 0 and you can call assuan_process_done and
continue normally.
> When a new inquire is needed using the same ctx, assuan_inquire_ext()
> returns ASSUAN_Nested_Commands because ctx->in_inquire isn't reset after
> assuan_process_done().
The documentation in the manual says this:
It is not possible to use @code{assuan_inquire} in a command
handler, as this function blocks on receiving the inquired data from
the client. Instead, the asynchronous version
@code{assuan_inquire_ext} needs to be used (see below), which
invokes a callback when the client provided the inquired data. A
typical usage would be for the command handler to register a
continuation with @code{assuan_inquire_ext} and return 0.
Eventually, the continuation would be invoked by
@code{assuan_process_next} when the client data arrived. The
continuation could complete the command and eventually call
@code{assuan_process_done}.
> Also after closing a ctx with assuan_deinit_server() after a
> assuan_inquire_ext(), a segfault occurs because
> _assuan_inquire_release() tries to free ctx->inquire_membuf which was
> already freed from _assuan_inquire_ext_cb().
Thanks, I committed the following fix (untested):
Index: assuan-inquire.c
===================================================================
--- assuan-inquire.c (revision 276)
+++ assuan-inquire.c (working copy)
@@ -321,6 +321,7 @@
rc = _assuan_error (ASSUAN_Out_Of_Core);
free_membuf (mb);
free (mb);
+ ctx->inquire_membuf = NULL;
}
ctx->in_inquire = 0;
(ctx->inquire_cb) (ctx->inquire_cb_data, rc, buf, buf_len);
Thanks,
Marcus
More information about the Gnupg-devel
mailing list