* keylist.c (keylist_colon_handler): Take care when printing a

NULL with the DEBUG.

* engine-gpgsm.c (struct gpgsm_object_s): New member ANY.
(gpgsm_status_handler): Run the colon function to indicate.
(_gpgme_gpgsm_set_colon_line_handler): Better reset ANY here.
This commit is contained in:
Werner Koch 2002-09-30 08:03:27 +00:00
parent f9a1d51756
commit 57add1098d
4 changed files with 26 additions and 2 deletions

View File

@ -1,3 +1,12 @@
2002-09-30 Werner Koch <wk@gnupg.org>
* keylist.c (keylist_colon_handler): Take care when printing a
NULL with the DEBUG.
* engine-gpgsm.c (struct gpgsm_object_s): New member ANY.
(gpgsm_status_handler): Run the colon function to indicate.
(_gpgme_gpgsm_set_colon_line_handler): Better reset ANY here.
2002-09-28 Marcus Brinkmann <marcus@g10code.de> 2002-09-28 Marcus Brinkmann <marcus@g10code.de>
* conversion.c (_gpgme_hextobyte): Prevent superfluous * conversion.c (_gpgme_hextobyte): Prevent superfluous

View File

@ -102,6 +102,7 @@ struct gpgsm_object_s
int linesize; int linesize;
int linelen; int linelen;
} attic; } attic;
int any; /* any data line seen */
} colon; } colon;
struct GpgmeIOCbs io_cbs; struct GpgmeIOCbs io_cbs;
@ -326,6 +327,7 @@ _gpgme_gpgsm_new (GpgsmObject *r_gpgsm)
gpgsm->colon.attic.line = 0; gpgsm->colon.attic.line = 0;
gpgsm->colon.attic.linesize = 0; gpgsm->colon.attic.linesize = 0;
gpgsm->colon.attic.linelen = 0; gpgsm->colon.attic.linelen = 0;
gpgsm->colon.any = 0;
gpgsm->io_cbs.add = NULL; gpgsm->io_cbs.add = NULL;
gpgsm->io_cbs.add_priv = NULL; gpgsm->io_cbs.add_priv = NULL;
@ -1244,6 +1246,16 @@ gpgsm_status_handler (void *opaque, int fd)
if (gpgsm->status.fnc) if (gpgsm->status.fnc)
gpgsm->status.fnc (gpgsm->status.fnc_value, GPGME_STATUS_EOF, ""); gpgsm->status.fnc (gpgsm->status.fnc_value, GPGME_STATUS_EOF, "");
if (gpgsm->colon.fnc && gpgsm->colon.any )
{
/* We must tell a colon fucntion about the EOF. We do
this only when we have seen any data lines. Note
that this inlined use of colon data lines will
eventually be changed into using a regular data
channel. */
gpgsm->colon.any = 0;
gpgsm->colon.fnc (gpgsm->colon.fnc_value, NULL);
}
/* XXX: Try our best to terminate the connection. */ /* XXX: Try our best to terminate the connection. */
if (err) if (err)
@ -1306,6 +1318,7 @@ gpgsm_status_handler (void *opaque, int fd)
/* Terminate the pending line, pass it to the colon /* Terminate the pending line, pass it to the colon
handler and reset it. */ handler and reset it. */
gpgsm->colon.any = 1;
if (*alinelen > 1 && *(dst - 1) == '\r') if (*alinelen > 1 && *(dst - 1) == '\r')
dst--; dst--;
*dst = '\0'; *dst = '\0';
@ -1365,6 +1378,7 @@ _gpgme_gpgsm_set_colon_line_handler (GpgsmObject gpgsm,
gpgsm->colon.fnc = fnc; gpgsm->colon.fnc = fnc;
gpgsm->colon.fnc_value = fnc_value; gpgsm->colon.fnc_value = fnc_value;
gpgsm->colon.any = 0;
} }

View File

@ -43,7 +43,7 @@ extern "C" {
AM_PATH_GPGME macro) check that this header matches the installed AM_PATH_GPGME macro) check that this header matches the installed
library. Warning: Do not edit the next line. configure will do library. Warning: Do not edit the next line. configure will do
that for you! */ that for you! */
#define GPGME_VERSION "0.3.11" #define GPGME_VERSION "0.3.12"
/* The opaque data types used by GPGME. */ /* The opaque data types used by GPGME. */

View File

@ -255,7 +255,8 @@ keylist_colon_handler (GpgmeCtx ctx, char *line)
const char *trust_info = NULL; const char *trust_info = NULL;
struct subkey_s *sk = NULL; struct subkey_s *sk = NULL;
DEBUG3 ("keylist_colon_handler ctx=%p, key=%p, line=%s\n", ctx, key, line); DEBUG3 ("keylist_colon_handler ctx=%p, key=%p, line=%s\n", ctx, key,
line? line: "(null)");
if (ctx->error) if (ctx->error)
return; return;
if (!line) if (!line)