From: Werner Koch Date: Fri, 3 May 2002 18:20:06 +0000 (+0000) Subject: * engine-gpgsm.c (_gpgme_gpgsm_new): Redirect any gpgsm error X-Git-Tag: V0-3-6~2 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=506ae142900ffb7aaf745ce79e6e9465fda4630b;p=gpgme.git * 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 --- diff --git a/gpgme/ChangeLog b/gpgme/ChangeLog index d22b361..9ece8fb 100644 --- a/gpgme/ChangeLog +++ b/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/gpgme/data.c b/gpgme/data.c index ac82757..fb94f32 100644 --- a/gpgme/data.c +++ b/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/gpgme/engine-gpgsm.c b/gpgme/engine-gpgsm.c index a4675ac..7ecbf43 100644 --- a/gpgme/engine-gpgsm.c +++ b/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/gpgme/gpgme.c b/gpgme/gpgme.c index 21578ca..50546de 100644 --- a/gpgme/gpgme.c +++ b/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/gpgme/gpgme.h b/gpgme/gpgme.h index 976eb8b..e945383 100644 --- a/gpgme/gpgme.h +++ b/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/gpgme/verify.c b/gpgme/verify.c index 5c6a3f7..d00800f 100644 --- a/gpgme/verify.c +++ b/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)