diff options
Diffstat (limited to 'branches/gpgme-1-0-branch/gpgme')
-rw-r--r-- | branches/gpgme-1-0-branch/gpgme/ChangeLog | 41 | ||||
-rw-r--r-- | branches/gpgme-1-0-branch/gpgme/data-user.c | 13 | ||||
-rw-r--r-- | branches/gpgme-1-0-branch/gpgme/engine-gpgsm.c | 24 | ||||
-rw-r--r-- | branches/gpgme-1-0-branch/gpgme/gpgme.c | 10 | ||||
-rw-r--r-- | branches/gpgme-1-0-branch/gpgme/gpgme.h | 3 | ||||
-rw-r--r-- | branches/gpgme-1-0-branch/gpgme/w32-io.c | 2 | ||||
-rw-r--r-- | branches/gpgme-1-0-branch/gpgme/wait-global.c | 18 |
7 files changed, 91 insertions, 20 deletions
diff --git a/branches/gpgme-1-0-branch/gpgme/ChangeLog b/branches/gpgme-1-0-branch/gpgme/ChangeLog index ac759a05..19d23a9b 100644 --- a/branches/gpgme-1-0-branch/gpgme/ChangeLog +++ b/branches/gpgme-1-0-branch/gpgme/ChangeLog @@ -1,7 +1,46 @@ +2005-05-28 Marcus Brinkmann <[email protected]> + + * data-user.c: Include <errno.h>. + +2005-05-17 Marcus Brinkmann <[email protected]> + + * gpgme.c (gpgme_new): Set the CTX->include_certs default to the + default. + +2005-05-11 Marcus Brinkmann <[email protected]> + + * w32-io.c (_gpgme_io_select): Fix loop increment. + +2005-05-05 Marcus Brinkmann <[email protected]> + + * data-user.c (user_release): Only call user hook if provided. + (user_seek): Return EBADF if no user hook is provided. + (user_read): Likewise. + (user_write): Likewise. + +2005-04-28 Marcus Brinkmann <[email protected]> + + * gpgme.h (GPGME_INCLUDE_CERTS_DEFAULT): New macro. + * engine-gpgsm.c (gpgsm_sign): Send the include-certs option after + the reset, just for cleanliness, and do not sent it at all if the + default is requested. + * gpgme.c (gpgme_set_include_certs): Allow to use + GPGME_INCLUDE_CERTS_DEFAULT. + 2005-04-21 Werner Koch <[email protected]> * verify.c (calc_sig_summary): Set the key revoked bit. +2005-04-14 Marcus Brinkmann <[email protected]> + + * wait-global.c (gpgme_wait): Use LI->ctx when checking a context + in the list, not the user-provided CTX. + Reported by Igor Belyi <[email protected]>. + + * wait-global.c (gpgme_wait): If no context is found, and we + should not hang, set *status to 0 and return NULL. + Reported by Igor Belyi <[email protected]>. + 2004-12-11 Marcus Brinkmann <[email protected]> * util.h [HAVE_CONFIG_H && HAVE_TTYNAME_R] (ttyname_r): Define @@ -4570,7 +4609,7 @@ * data.c (gpgme_data_rewind): Allow to rewind data_type_none. - Copyright 2001, 2002, 2003, 2004 g10 Code GmbH + Copyright 2001, 2002, 2003, 2004, 2005 g10 Code GmbH This file is free software; as a special exception the author gives unlimited permission to copy and/or distribute it, with or without diff --git a/branches/gpgme-1-0-branch/gpgme/data-user.c b/branches/gpgme-1-0-branch/gpgme/data-user.c index 8a71b885..f3deb32f 100644 --- a/branches/gpgme-1-0-branch/gpgme/data-user.c +++ b/branches/gpgme-1-0-branch/gpgme/data-user.c @@ -23,6 +23,7 @@ #endif #include <sys/types.h> +#include <errno.h> #include "data.h" @@ -30,6 +31,9 @@ static ssize_t user_read (gpgme_data_t dh, void *buffer, size_t size) { + if (!dh->data.user.cbs->read) + return EBADF; + return (*dh->data.user.cbs->read) (dh->data.user.handle, buffer, size); } @@ -37,6 +41,9 @@ user_read (gpgme_data_t dh, void *buffer, size_t size) static ssize_t user_write (gpgme_data_t dh, const void *buffer, size_t size) { + if (!dh->data.user.cbs->write) + return EBADF; + return (*dh->data.user.cbs->write) (dh->data.user.handle, buffer, size); } @@ -44,6 +51,9 @@ user_write (gpgme_data_t dh, const void *buffer, size_t size) static off_t user_seek (gpgme_data_t dh, off_t offset, int whence) { + if (!dh->data.user.cbs->seek) + return EBADF; + return (*dh->data.user.cbs->seek) (dh->data.user.handle, offset, whence); } @@ -51,7 +61,8 @@ user_seek (gpgme_data_t dh, off_t offset, int whence) static void user_release (gpgme_data_t dh) { - (*dh->data.user.cbs->release) (dh->data.user.handle); + if (dh->data.user.cbs->release) + (*dh->data.user.cbs->release) (dh->data.user.handle); } diff --git a/branches/gpgme-1-0-branch/gpgme/engine-gpgsm.c b/branches/gpgme-1-0-branch/gpgme/engine-gpgsm.c index 7a71b5ab..804d8fc1 100644 --- a/branches/gpgme-1-0-branch/gpgme/engine-gpgsm.c +++ b/branches/gpgme-1-0-branch/gpgme/engine-gpgsm.c @@ -1,6 +1,6 @@ /* engine-gpgsm.c - GpgSM engine. Copyright (C) 2000 Werner Koch (dd9jn) - Copyright (C) 2001, 2002, 2003, 2004 g10 Code GmbH + Copyright (C) 2001, 2002, 2003, 2004, 2005 g10 Code GmbH This file is part of GPGME. @@ -1433,19 +1433,27 @@ gpgsm_sign (void *engine, gpgme_data_t in, gpgme_data_t out, if (!gpgsm) return gpg_error (GPG_ERR_INV_VALUE); - if (asprintf (&assuan_cmd, "OPTION include-certs %i", include_certs) < 0) - return gpg_error_from_errno (errno); - err = gpgsm_assuan_simple_command (gpgsm->assuan_ctx, assuan_cmd, NULL,NULL); - free (assuan_cmd); - if (err) - return err; - /* We must send a reset because we need to reset the list of signers. Note that RESET does not reset OPTION commands. */ err = gpgsm_assuan_simple_command (gpgsm->assuan_ctx, "RESET", NULL, NULL); if (err) return err; + if (include_certs != GPGME_INCLUDE_CERTS_DEFAULT) + { + /* FIXME: Make sure that if we run multiple operations, that we + can reset any previously set value in case the default is + requested. */ + + if (asprintf (&assuan_cmd, "OPTION include-certs %i", include_certs) < 0) + return gpg_error_from_errno (errno); + err = gpgsm_assuan_simple_command (gpgsm->assuan_ctx, assuan_cmd, + NULL, NULL); + free (assuan_cmd); + if (err) + return err; + } + for (i = 0; (key = gpgme_signers_enum (ctx, i)); i++) { const char *s = key->subkeys ? key->subkeys->fpr : NULL; diff --git a/branches/gpgme-1-0-branch/gpgme/gpgme.c b/branches/gpgme-1-0-branch/gpgme/gpgme.c index 568194d2..d3eac1ff 100644 --- a/branches/gpgme-1-0-branch/gpgme/gpgme.c +++ b/branches/gpgme-1-0-branch/gpgme/gpgme.c @@ -52,7 +52,7 @@ gpgme_new (gpgme_ctx_t *r_ctx) if (!ctx) return gpg_error_from_errno (errno); ctx->keylist_mode = GPGME_KEYLIST_MODE_LOCAL; - ctx->include_certs = 1; + ctx->include_certs = GPGME_INCLUDE_CERTS_DEFAULT; ctx->protocol = GPGME_PROTOCOL_OpenPGP; _gpgme_fd_table_init (&ctx->fdt); @@ -211,12 +211,14 @@ gpgme_get_textmode (gpgme_ctx_t ctx) /* Set the number of certifications to include in an S/MIME message. - The default is 1 (only the cert of the sender). -1 means all - certs, and -2 means all certs except the root cert. */ + The default is GPGME_INCLUDE_CERTS_DEFAULT. -1 means all certs, + and -2 means all certs except the root cert. */ void gpgme_set_include_certs (gpgme_ctx_t ctx, int nr_of_certs) { - if (nr_of_certs < -2) + if (nr_of_certs == GPGME_INCLUDE_CERTS_DEFAULT) + ctx->include_certs = GPGME_INCLUDE_CERTS_DEFAULT; + else if (nr_of_certs < -2) ctx->include_certs = -2; else ctx->include_certs = nr_of_certs; diff --git a/branches/gpgme-1-0-branch/gpgme/gpgme.h b/branches/gpgme-1-0-branch/gpgme/gpgme.h index 88d7603a..b7ccedce 100644 --- a/branches/gpgme-1-0-branch/gpgme/gpgme.h +++ b/branches/gpgme-1-0-branch/gpgme/gpgme.h @@ -705,6 +705,9 @@ void gpgme_set_textmode (gpgme_ctx_t ctx, int yes); /* Return non-zero if text mode is set in CTX. */ int gpgme_get_textmode (gpgme_ctx_t ctx); +/* Use whatever the default of the backend crypto engine is. */ +#define GPGME_INCLUDE_CERTS_DEFAULT -256 + /* Include up to NR_OF_CERTS certificates in an S/MIME message. */ void gpgme_set_include_certs (gpgme_ctx_t ctx, int nr_of_certs); diff --git a/branches/gpgme-1-0-branch/gpgme/w32-io.c b/branches/gpgme-1-0-branch/gpgme/w32-io.c index 5b64120b..5919343e 100644 --- a/branches/gpgme-1-0-branch/gpgme/w32-io.c +++ b/branches/gpgme-1-0-branch/gpgme/w32-io.c @@ -1085,7 +1085,7 @@ _gpgme_io_select ( struct io_select_fd_s *fds, size_t nfds, int nonblock ) int k, j = handle_to_fd (waitbuf[i]); DEBUG1 ("WFMO invalid handle %d removed\n", j); - for (k=0 ; k < nfds; i++ ) { + for (k=0 ; k < nfds; k++ ) { if ( fds[k].fd == j ) { fds[k].for_read = fds[k].for_write = 0; goto restart; diff --git a/branches/gpgme-1-0-branch/gpgme/wait-global.c b/branches/gpgme-1-0-branch/gpgme/wait-global.c index 6d75d3d1..f3a5b430 100644 --- a/branches/gpgme-1-0-branch/gpgme/wait-global.c +++ b/branches/gpgme-1-0-branch/gpgme/wait-global.c @@ -1,6 +1,6 @@ /* wait-global.c Copyright (C) 2000 Werner Koch (dd9jn) - Copyright (C) 2001, 2002, 2003, 2004 g10 Code GmbH + Copyright (C) 2001, 2002, 2003, 2004, 2005 g10 Code GmbH This file is part of GPGME. @@ -331,13 +331,15 @@ gpgme_wait (gpgme_ctx_t ctx, gpgme_error_t *status, int hang) LOCK (ctx_list_lock); for (li = ctx_active_list; li; li = li->next) { - for (i = 0; i < ctx->fdt.size; i++) - if (ctx->fdt.fds[i].fd != -1) + gpgme_ctx_t actx = li->ctx; + + for (i = 0; i < actx->fdt.size; i++) + if (actx->fdt.fds[i].fd != -1) break; - if (i == ctx->fdt.size) + if (i == actx->fdt.size) { gpgme_error_t err = 0; - _gpgme_engine_io_event (ctx->engine, GPGME_EVENT_DONE, &err); + _gpgme_engine_io_event (actx->engine, GPGME_EVENT_DONE, &err); } } UNLOCK (ctx_list_lock); @@ -350,6 +352,12 @@ gpgme_wait (gpgme_ctx_t ctx, gpgme_error_t *status, int hang) ctx = dctx; hang = 0; } + else if (!hang) + { + ctx = NULL; + if (status) + *status = 0; + } } } while (hang); |