From 1be418fb1d831e5c445478b07344f3aef3d61036 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Fri, 3 May 2002 18:20:06 +0000 Subject: [PATCH] * engine-gpgsm.c (_gpgme_gpgsm_new): Redirect any gpgsm error output to /dev/null. * verify.c (gpgme_get_sig_key): Set the protocol of the listctx. * gpgme.c (gpgme_get_protocol): New. * data.c (gpgme_data_write): Changed type of BUFFER to void*. (gpgme_data_read): Ditto. * verify.c (_gpgme_verify_status_handler): Handle TRUST_* status lines so that a claim can be made without looking up the key. (gpgme_get_sig_string_attr): New. (gpgme_get_sig_ulong_attr): New. * gpgme.h (GpgmeAttr): Added GPGME_ATTR_SIG_STATUS. * gpgme.h (GpgmeSigStat): Add _GOOD_EXP and _GOOD_EXPKEY. * verify.c (_gpgme_verify_status_handler, finish_sig): Handle these new status codes. Store the expiration time --- trunk/gpgme/ChangeLog | 9 +++++++++ trunk/gpgme/data.c | 6 +++--- trunk/gpgme/engine-gpgsm.c | 5 +++-- trunk/gpgme/gpgme.c | 10 ++++++++++ trunk/gpgme/gpgme.h | 7 +++++-- trunk/gpgme/verify.c | 1 + 6 files changed, 31 insertions(+), 7 deletions(-) diff --git a/trunk/gpgme/ChangeLog b/trunk/gpgme/ChangeLog index d22b361..9ece8fb 100644 --- a/trunk/gpgme/ChangeLog +++ b/trunk/gpgme/ChangeLog @@ -1,5 +1,14 @@ 2002-05-03 Werner Koch + * engine-gpgsm.c (_gpgme_gpgsm_new): Redirect any gpgsm error + output to /dev/null. + + * verify.c (gpgme_get_sig_key): Set the protocol of the listctx. + * gpgme.c (gpgme_get_protocol): New. + + * data.c (gpgme_data_write): Changed type of BUFFER to void*. + (gpgme_data_read): Ditto. + * verify.c (_gpgme_verify_status_handler): Handle TRUST_* status lines so that a claim can be made without looking up the key. (gpgme_get_sig_string_attr): New. diff --git a/trunk/gpgme/data.c b/trunk/gpgme/data.c index ac82757..fb94f32 100644 --- a/trunk/gpgme/data.c +++ b/trunk/gpgme/data.c @@ -557,7 +557,7 @@ gpgme_data_rewind (GpgmeData dh) * error code GPGME_EOF. **/ GpgmeError -gpgme_data_read (GpgmeData dh, char *buffer, size_t length, size_t *nread) +gpgme_data_read (GpgmeData dh, void *buffer, size_t length, size_t *nread) { size_t nbytes; @@ -679,12 +679,12 @@ _gpgme_data_get_as_string (GpgmeData dh) * Return value: 0 on success or an error code **/ GpgmeError -gpgme_data_write (GpgmeData dh, const char *buffer, size_t length) +gpgme_data_write (GpgmeData dh, const void *buffer, size_t length) { if (!dh || !buffer) return mk_error (Invalid_Value); - return _gpgme_data_append (dh, buffer, length ); + return _gpgme_data_append (dh, (const char *)buffer, length ); } diff --git a/trunk/gpgme/engine-gpgsm.c b/trunk/gpgme/engine-gpgsm.c index a4675ac..7ecbf43 100644 --- a/trunk/gpgme/engine-gpgsm.c +++ b/trunk/gpgme/engine-gpgsm.c @@ -300,8 +300,9 @@ _gpgme_gpgsm_new (GpgsmObject *r_gpgsm) argv[1] = "--server"; argv[2] = NULL; - err = assuan_pipe_connect (&gpgsm->assuan_ctx, - _gpgme_get_gpgsm_path (), argv, child_fds); + err = assuan_pipe_connect2 (&gpgsm->assuan_ctx, + _gpgme_get_gpgsm_path (), argv, child_fds, + 1 /* dup stderr to /dev/null */); dft_display = getenv ("DISPLAY"); if (dft_display) diff --git a/trunk/gpgme/gpgme.c b/trunk/gpgme/gpgme.c index 21578ca..50546de 100644 --- a/trunk/gpgme/gpgme.c +++ b/trunk/gpgme/gpgme.c @@ -212,6 +212,16 @@ gpgme_set_protocol (GpgmeCtx ctx, GpgmeProtocol protocol) return 0; } +GpgmeProtocol +gpgme_get_protocol (GpgmeCtx ctx) +{ + if (!ctx) + return 0; /* well, this is OpenPGP */ + if (ctx->use_cms) + return GPGME_PROTOCOL_CMS; + return GPGME_PROTOCOL_OpenPGP; +} + /** * gpgme_set_armor: diff --git a/trunk/gpgme/gpgme.h b/trunk/gpgme/gpgme.h index 976eb8b..e945383 100644 --- a/trunk/gpgme/gpgme.h +++ b/trunk/gpgme/gpgme.h @@ -233,6 +233,9 @@ char *gpgme_get_notation (GpgmeCtx ctx); /* Set the protocol to be used by CTX to PROTO. */ GpgmeError gpgme_set_protocol (GpgmeCtx ctx, GpgmeProtocol proto); +/* Get the protocol used with CTX */ +GpgmeProtocol gpgme_get_protocol (GpgmeCtx ctx); + /* If YES is non-zero, enable armor mode in CTX, disable it otherwise. */ void gpgme_set_armor (GpgmeCtx ctx, int yes); @@ -409,11 +412,11 @@ GpgmeError gpgme_data_rewind (GpgmeData dh); /* Read LENGTH bytes from the data object DH and store them in the memory starting at BUFFER. The number of bytes actually read is returned in NREAD. */ -GpgmeError gpgme_data_read (GpgmeData dh, char *buffer, +GpgmeError gpgme_data_read (GpgmeData dh, void *buffer, size_t length, size_t *nread); /* Write LENGTH bytes starting from BUFFER into the data object DH. */ -GpgmeError gpgme_data_write (GpgmeData dh, const char *buffer, size_t length); +GpgmeError gpgme_data_write (GpgmeData dh, const void *buffer, size_t length); /* Key and trust functions. */ diff --git a/trunk/gpgme/verify.c b/trunk/gpgme/verify.c index 5c6a3f7..d00800f 100644 --- a/trunk/gpgme/verify.c +++ b/trunk/gpgme/verify.c @@ -553,6 +553,7 @@ gpgme_get_sig_key (GpgmeCtx c, int idx, GpgmeKey *r_key) err = gpgme_new (&listctx); if (err) return err; + gpgme_set_protocol (listctx, gpgme_get_protocol (c)); gpgme_set_keylist_mode (listctx, c->keylist_mode); err = gpgme_op_keylist_start (listctx, result->fpr, 0); if (!err) -- 2.26.2