From 1a3db20121fb7914fd4dc2c13681b4322e86c497 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Thu, 19 Apr 2001 12:18:40 +0000 Subject: [PATCH] Adjusted for changes --fixed-list-mode in 1.0.4h --- ChangeLog | 4 ++++ configure.in | 4 ++-- gpgme/ChangeLog | 26 ++++++++++++++++++++++++++ gpgme/gpgme.h | 6 ++++-- gpgme/key.c | 16 +++++++++++++++- gpgme/keylist.c | 31 +++---------------------------- gpgme/rungpg.c | 2 +- gpgme/verify.c | 3 ++- gpgme/w32-io.c | 15 +++++++++++---- 9 files changed, 68 insertions(+), 39 deletions(-) diff --git a/ChangeLog b/ChangeLog index d25591b2..1f99d46b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2001-04-05 Werner Koch + + * configure.in (NEED_GPG_VERSION): Set to 1.0.4g + 2001-04-02 Werner Koch Released 0.2.1. diff --git a/configure.in b/configure.in index be971fae..91c1d025 100644 --- a/configure.in +++ b/configure.in @@ -31,11 +31,11 @@ AM_MAINTAINER_MODE # AGE, set REVISION to 0. # 3. Interfaces removed (BAD, breaks upward compatibility): Increment # CURRENT, set AGE and REVISION to 0. -AM_INIT_AUTOMAKE(gpgme,0.2.1) +AM_INIT_AUTOMAKE(gpgme,0.2.1a) LIBGPGME_LT_CURRENT=3 LIBGPGME_LT_AGE=3 LIBGPGME_LT_REVISION=0 -NEED_GPG_VERSION=1.0.4f +NEED_GPG_VERSION=1.0.4h ############################################## AC_SUBST(LIBGPGME_LT_CURRENT) diff --git a/gpgme/ChangeLog b/gpgme/ChangeLog index 2d186d80..017ab28b 100644 --- a/gpgme/ChangeLog +++ b/gpgme/ChangeLog @@ -1,3 +1,29 @@ +2001-04-19 Werner Koch + + * keylist.c (parse_timestamp): Adjusted for the changed + --fixed-list-mode of gpg 1.0.4h. + +2001-04-05 Werner Koch + + * verify.c (gpgme_op_verify_start): Enabled pipemode for detached sigs. + +2001-04-04 Werner Koch + + * w32-io.c (_gpgme_io_select): Don't select on the writer if there + are still bytes pending. Timo found this not easy to track down + race condition. + +2001-04-02 Werner Koch + + * gpgme.h: Add GPGME_ATTR_KEY_{EXPIRED,DISABLED}. + * key.c (gpgme_key_get_ulong_attr): And return those attribs. + + * verify.c (gpgme_get_sig_key): Set keyliosting mode depending on + the mode set in the current context. Suggested by Timo. + + * key.c (gpgme_key_get_ulong_attr): Return can_certify and not + can_encrypt. By Timo. + 2001-03-30 Werner Koch * debug.c (debug_init): Allow to specify a debug file. diff --git a/gpgme/gpgme.h b/gpgme/gpgme.h index 1e998df8..2f95e886 100644 --- a/gpgme/gpgme.h +++ b/gpgme/gpgme.h @@ -44,7 +44,7 @@ extern "C" { * let autoconf (using the AM_PATH_GPGME macro) check that this * header matches the installed library. * Warning: Do not edit the next line. configure will do that for you! */ -#define GPGME_VERSION "0.2.1" +#define GPGME_VERSION "0.2.1a" @@ -138,7 +138,9 @@ typedef enum { GPGME_ATTR_KEY_CAPS = 20, GPGME_ATTR_CAN_ENCRYPT = 21, GPGME_ATTR_CAN_SIGN = 22, - GPGME_ATTR_CAN_CERTIFY = 23 + GPGME_ATTR_CAN_CERTIFY = 23, + GPGME_ATTR_KEY_EXPIRED = 24, + GPGME_ATTR_KEY_DISABLED= 25 } GpgmeAttr; typedef enum { diff --git a/gpgme/key.c b/gpgme/key.c index 2fae0691..f61d2c1c 100644 --- a/gpgme/key.c +++ b/gpgme/key.c @@ -553,6 +553,8 @@ gpgme_key_get_string_attr ( GpgmeKey key, GpgmeAttr what, case GPGME_ATTR_TYPE: case GPGME_ATTR_KEY_REVOKED: case GPGME_ATTR_KEY_INVALID: + case GPGME_ATTR_KEY_EXPIRED: + case GPGME_ATTR_KEY_DISABLED: case GPGME_ATTR_UID_REVOKED: case GPGME_ATTR_UID_INVALID: case GPGME_ATTR_CAN_ENCRYPT: @@ -629,6 +631,18 @@ gpgme_key_get_ulong_attr ( GpgmeKey key, GpgmeAttr what, if (k) val = k->flags.invalid; break; + case GPGME_ATTR_KEY_EXPIRED: + for (k=&key->keys; k && idx; k=k->next, idx-- ) + ; + if (k) + val = k->flags.expired; + break; + case GPGME_ATTR_KEY_DISABLED: + for (k=&key->keys; k && idx; k=k->next, idx-- ) + ; + if (k) + val = k->flags.disabled; + break; case GPGME_ATTR_UID_REVOKED: for (u=key->uids; u && idx; u=u->next, idx-- ) ; @@ -642,7 +656,7 @@ gpgme_key_get_ulong_attr ( GpgmeKey key, GpgmeAttr what, val = u->invalid; break; case GPGME_ATTR_CAN_ENCRYPT: - val = key->gloflags.can_encrypt; + val = key->gloflags.can_certify; break; case GPGME_ATTR_CAN_SIGN: val = key->gloflags.can_sign; diff --git a/gpgme/keylist.c b/gpgme/keylist.c index 9b6279ac..9d7824bb 100644 --- a/gpgme/keylist.c +++ b/gpgme/keylist.c @@ -58,35 +58,10 @@ keylist_status_handler ( GpgmeCtx ctx, GpgStatusCode code, char *args ) static time_t parse_timestamp ( char *p ) { - struct tm tm; - int i; - if (!*p ) return 0; - if (strlen(p) < 10 || p[4] != '-' || p[7] != '-' ) - return (time_t)-1; - p[4] = 0; - p[7] = 0; - p[10] = 0; /* just in case the time part follows */ - memset (&tm, 0, sizeof tm); - - i = atoi (p); - if ( i < 1900 ) - return (time_t)-1; - tm.tm_year = i - 1900; - - i = atoi (p+5); - if ( i < 1 || i > 12 ) - return (time_t)-1; - tm.tm_mon = i-1; - - i = atoi (p+8); - if ( i < 1 || i > 31 ) - return (time_t)-1; - tm.tm_mday = i; - - return mktime (&tm); + return (time_t)strtoul (p, NULL, 10); } @@ -263,7 +238,7 @@ keylist_colon_handler ( GpgmeCtx ctx, char *line ) if ( strlen (p) == DIM(key->keys.keyid)-1 ) strcpy (key->keys.keyid, p); break; - case 6: /* timestamp (1998-02-28) */ + case 6: /* timestamp (seconds) */ key->keys.timestamp = parse_timestamp (p); break; case 7: /* valid for n days */ @@ -303,7 +278,7 @@ keylist_colon_handler ( GpgmeCtx ctx, char *line ) if ( strlen (p) == DIM(sk->keyid)-1 ) strcpy (sk->keyid, p); break; - case 6: /* timestamp (1998-02-28) */ + case 6: /* timestamp (seconds) */ sk->timestamp = parse_timestamp (p); break; case 7: /* valid for n days */ diff --git a/gpgme/rungpg.c b/gpgme/rungpg.c index d68de45a..6f731e51 100644 --- a/gpgme/rungpg.c +++ b/gpgme/rungpg.c @@ -1094,7 +1094,7 @@ read_status ( GpgObject gpg ) if ( *p == '\n' ) { /* (we require that the last line is terminated by a LF) */ *p = 0; - /* fprintf (stderr, "read_status: `%s'\n", buffer); */ + fflush (stdout); fprintf (stderr, "read_status: `%s'\n", buffer); if (!strncmp (buffer, "[GNUPG:] ", 9 ) && buffer[9] >= 'A' && buffer[9] <= 'Z' ) { struct status_table_s t, *r; diff --git a/gpgme/verify.c b/gpgme/verify.c index b611ece2..0d50b8a9 100644 --- a/gpgme/verify.c +++ b/gpgme/verify.c @@ -219,7 +219,7 @@ gpgme_op_verify_start ( GpgmeCtx c, GpgmeData sig, GpgmeData text ) { int rc = 0; int i; - int pipemode = 0 /*!!text*/; /* use pipemode for detached sigs */ + int pipemode = !!text; /* use pipemode for detached sigs */ fail_on_pending_request( c ); c->pending = 1; @@ -434,6 +434,7 @@ gpgme_get_sig_key (GpgmeCtx c, int idx, GpgmeKey *r_key) * an internal context used for such key listings */ if ( (err=gpgme_new (&listctx)) ) return err; + gpgme_set_keylist_mode( listctx, c->keylist_mode ); if ( !(err=gpgme_op_keylist_start (listctx, res->fpr, 0 )) ) err=gpgme_op_keylist_next ( listctx, r_key ); gpgme_release (listctx); diff --git a/gpgme/w32-io.c b/gpgme/w32-io.c index 7d06060d..89e0dd3a 100644 --- a/gpgme/w32-io.c +++ b/gpgme/w32-io.c @@ -1033,11 +1033,18 @@ _gpgme_io_select ( struct io_select_fd_s *fds, size_t nfds ) DEBUG0 ("Too many objects for WFMO!" ); return -1; } - waitidx[nwait] = i; - waitbuf[nwait++] = c->is_empty; + LOCK (c->mutex); + if ( !c->nbytes ) { + waitidx[nwait] = i; + waitbuf[nwait++] = c->is_empty; + DEBUG_ADD1 (dbg_help, "w%d ", fds[i].fd ); + any = 1; + } + else { + DEBUG_ADD1 (dbg_help, "w%d(ignored) ", fds[i].fd ); + } + UNLOCK (c->mutex); } - DEBUG_ADD1 (dbg_help, "w%d ", fds[i].fd ); - any = 1; } } }