Fix SIGPIPE ignoring regression.
Fix unsupported algorithm detection.
This commit is contained in:
parent
66d0fa1973
commit
92394f92d4
3
NEWS
3
NEWS
@ -1,6 +1,9 @@
|
|||||||
Noteworthy changes in version 1.1.7 (unreleased)
|
Noteworthy changes in version 1.1.7 (unreleased)
|
||||||
------------------------------------------------
|
------------------------------------------------
|
||||||
|
|
||||||
|
* SIGPIPE is now again ignored as described in the manual. Fixes
|
||||||
|
regresion introduced with 1.1.6.
|
||||||
|
|
||||||
* Interface changes relative to the 1.1.7 release:
|
* Interface changes relative to the 1.1.7 release:
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
@ -1,3 +1,11 @@
|
|||||||
|
2008-11-18 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
|
* version.c (do_subsystem_inits): Always initialize I/O
|
||||||
|
subsystem. Fixes regression from 2007-08-02.
|
||||||
|
|
||||||
|
* decrypt.c (_gpgme_decrypt_status_handler): Use
|
||||||
|
_gpgme_map_gnupg_error to parse the error code for decrypt.algorithm.
|
||||||
|
|
||||||
2008-10-30 Marcus Brinkmann <marcus@g10code.de>
|
2008-10-30 Marcus Brinkmann <marcus@g10code.de>
|
||||||
|
|
||||||
* wait-private.c (_gpgme_wait_on_condition): Remove unused
|
* wait-private.c (_gpgme_wait_on_condition): Remove unused
|
||||||
@ -479,9 +487,9 @@
|
|||||||
* w32-io.c (_gpgme_io_spawn): Ditto.
|
* w32-io.c (_gpgme_io_spawn): Ditto.
|
||||||
(_gpgme_io_write): Map ERROR_NO_DATA to EPIPE.
|
(_gpgme_io_write): Map ERROR_NO_DATA to EPIPE.
|
||||||
* debug.c (_gpgme_debug): Enable assuan logging.
|
* debug.c (_gpgme_debug): Enable assuan logging.
|
||||||
(_gpgme_debug_subsystem_init): New. * version.c
|
(_gpgme_debug_subsystem_init): New.
|
||||||
(do_subsystem_inits): Disable assuan logging and initialize de
|
* version.c (do_subsystem_inits): Disable assuan logging and
|
||||||
debug system.
|
initialize the debug system.
|
||||||
(gpgme_check_version): Do not trace before the subsystems are
|
(gpgme_check_version): Do not trace before the subsystems are
|
||||||
initialized.
|
initialized.
|
||||||
|
|
||||||
|
@ -180,7 +180,6 @@ _gpgme_decrypt_status_handler (void *priv, gpgme_status_code_t code,
|
|||||||
related to the backend. */
|
related to the backend. */
|
||||||
{
|
{
|
||||||
const char d_alg[] = "decrypt.algorithm";
|
const char d_alg[] = "decrypt.algorithm";
|
||||||
const char u_alg[] = "Unsupported_Algorithm";
|
|
||||||
const char k_alg[] = "decrypt.keyusage";
|
const char k_alg[] = "decrypt.keyusage";
|
||||||
|
|
||||||
if (!strncmp (args, d_alg, sizeof (d_alg) - 1))
|
if (!strncmp (args, d_alg, sizeof (d_alg) - 1))
|
||||||
@ -189,11 +188,13 @@ _gpgme_decrypt_status_handler (void *priv, gpgme_status_code_t code,
|
|||||||
while (*args == ' ')
|
while (*args == ' ')
|
||||||
args++;
|
args++;
|
||||||
|
|
||||||
if (!strncmp (args, u_alg, sizeof (u_alg) - 1))
|
if (gpg_err_code (_gpgme_map_gnupg_error (args))
|
||||||
|
== GPG_ERR_UNSUPPORTED_ALGORITHM)
|
||||||
{
|
{
|
||||||
char *end;
|
char *end;
|
||||||
|
|
||||||
args += sizeof (u_alg) - 1;
|
while (*args && *args != ' ')
|
||||||
|
args++;
|
||||||
while (*args == ' ')
|
while (*args == ' ')
|
||||||
args++;
|
args++;
|
||||||
|
|
||||||
|
@ -60,8 +60,8 @@ do_subsystem_inits (void)
|
|||||||
assuan_set_assuan_err_source (GPG_ERR_SOURCE_GPGME);
|
assuan_set_assuan_err_source (GPG_ERR_SOURCE_GPGME);
|
||||||
#endif /*HAVE_ASSUAN_H*/
|
#endif /*HAVE_ASSUAN_H*/
|
||||||
_gpgme_debug_subsystem_init ();
|
_gpgme_debug_subsystem_init ();
|
||||||
#if defined(HAVE_W32_SYSTEM) && defined(HAVE_ASSUAN_H)
|
|
||||||
_gpgme_io_subsystem_init ();
|
_gpgme_io_subsystem_init ();
|
||||||
|
#if defined(HAVE_W32_SYSTEM) && defined(HAVE_ASSUAN_H)
|
||||||
/* We need to make sure that the sockets are initialized. */
|
/* We need to make sure that the sockets are initialized. */
|
||||||
{
|
{
|
||||||
WSADATA wsadat;
|
WSADATA wsadat;
|
||||||
|
@ -1,9 +1,17 @@
|
|||||||
|
2008-11-18 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
|
* gpgsm/cms-decrypt.c: New.
|
||||||
|
|
||||||
2008-11-03 Marcus Brinkmann <marcus@g10code.com>
|
2008-11-03 Marcus Brinkmann <marcus@g10code.com>
|
||||||
|
|
||||||
* gpgsm/Makefile.am (INCLUDES, LDADD): Replace gpgme path with src.
|
* gpgsm/Makefile.am (INCLUDES, LDADD): Replace gpgme path with src.
|
||||||
* gpg/Makefile.am (INCLUDES, LDADD, t_thread1_LDADD): Likewise.
|
* gpg/Makefile.am (INCLUDES, LDADD, t_thread1_LDADD): Likewise.
|
||||||
* Makefile.am (LDADD): Likewise.
|
* Makefile.am (LDADD): Likewise.
|
||||||
|
|
||||||
|
2008-10-30 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
|
* gpgsm/cms-keylist.c: New.
|
||||||
|
|
||||||
2008-06-19 Werner Koch <wk@g10code.com>
|
2008-06-19 Werner Koch <wk@g10code.com>
|
||||||
|
|
||||||
* gpg/t-gpgconf.c (dump_arg): Add new types. Print strings in
|
* gpg/t-gpgconf.c (dump_arg): Add new types. Print strings in
|
||||||
|
@ -36,7 +36,7 @@ LDADD = ../../src/libgpgme.la
|
|||||||
|
|
||||||
# We don't run t-genkey in the test suite, because it takes too long
|
# We don't run t-genkey in the test suite, because it takes too long
|
||||||
# and needs a working pinentry.
|
# and needs a working pinentry.
|
||||||
noinst_PROGRAMS = $(TESTS) t-genkey cms-keylist
|
noinst_PROGRAMS = $(TESTS) t-genkey cms-keylist cms-decrypt
|
||||||
|
|
||||||
key_id = 32100C27173EF6E9C4E9A25D3D69F86D37A4F939
|
key_id = 32100C27173EF6E9C4E9A25D3D69F86D37A4F939
|
||||||
|
|
||||||
|
108
tests/gpgsm/cms-decrypt.c
Normal file
108
tests/gpgsm/cms-decrypt.c
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
/* cms-decrypt.c - Helper to debug the decrupt operation.
|
||||||
|
Copyright (C) 2008 g10 Code GmbH
|
||||||
|
|
||||||
|
This file is part of GPGME.
|
||||||
|
|
||||||
|
GPGME is free software; you can redistribute it and/or modify it
|
||||||
|
under the terms of the GNU Lesser General Public License as
|
||||||
|
published by the Free Software Foundation; either version 2.1 of
|
||||||
|
the License, or (at your option) any later version.
|
||||||
|
|
||||||
|
GPGME is distributed in the hope that it will be useful, but
|
||||||
|
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU Lesser General Public
|
||||||
|
License along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* We need to include config.h so that we know whether we are building
|
||||||
|
with large file system (LFS) support. */
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include <config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <gpgme.h>
|
||||||
|
|
||||||
|
#define PGM "cms-decrypt"
|
||||||
|
|
||||||
|
#include "t-support.h"
|
||||||
|
|
||||||
|
static const char *
|
||||||
|
nonnull (const char *s)
|
||||||
|
{
|
||||||
|
return s? s :"[none]";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
main (int argc, char **argv)
|
||||||
|
{
|
||||||
|
gpgme_error_t err;
|
||||||
|
gpgme_ctx_t ctx;
|
||||||
|
gpgme_data_t in, out;
|
||||||
|
gpgme_decrypt_result_t result;
|
||||||
|
gpgme_recipient_t recp;
|
||||||
|
|
||||||
|
if (argc)
|
||||||
|
{ argc--; argv++; }
|
||||||
|
|
||||||
|
if (argc != 1)
|
||||||
|
{
|
||||||
|
fputs ("usage: " PGM " FILE\n", stderr);
|
||||||
|
exit (1);
|
||||||
|
}
|
||||||
|
|
||||||
|
init_gpgme (GPGME_PROTOCOL_CMS);
|
||||||
|
|
||||||
|
err = gpgme_new (&ctx);
|
||||||
|
fail_if_err (err);
|
||||||
|
gpgme_set_protocol (ctx, GPGME_PROTOCOL_CMS);
|
||||||
|
|
||||||
|
|
||||||
|
err = gpgme_data_new_from_file (&in, *argv, 1);
|
||||||
|
fail_if_err (err);
|
||||||
|
|
||||||
|
err = gpgme_data_new (&out);
|
||||||
|
fail_if_err (err);
|
||||||
|
|
||||||
|
err = gpgme_op_decrypt (ctx, in, out);
|
||||||
|
printf ("gpgme_op_decrypt: %s <%s> (%u)\n",
|
||||||
|
gpg_strerror (err), gpg_strsource (err), err);
|
||||||
|
result = gpgme_op_decrypt_result (ctx);
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
fputs (PGM ": error: decryption result missing\n", stderr);
|
||||||
|
exit (1);
|
||||||
|
}
|
||||||
|
|
||||||
|
printf ("unsupported_algorithm: %s\n",
|
||||||
|
nonnull (result->unsupported_algorithm));
|
||||||
|
printf ("wrong_key_usage: %u\n", result->wrong_key_usage);
|
||||||
|
printf ("file_name: %s\n", nonnull (result->file_name));
|
||||||
|
for (recp = result->recipients; recp; recp = recp->next)
|
||||||
|
{
|
||||||
|
printf ("recipient.status: %s <%s> (%u)\n",
|
||||||
|
gpg_strerror (recp->status), gpg_strsource (recp->status),
|
||||||
|
recp->status);
|
||||||
|
printf ("recipient.pkalgo: %d\n", recp->pubkey_algo);
|
||||||
|
printf ("recipient.keyid : %s\n", nonnull (recp->keyid));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!err)
|
||||||
|
{
|
||||||
|
puts ("plaintext:");
|
||||||
|
print_data (out);
|
||||||
|
gpgme_data_release (out);
|
||||||
|
}
|
||||||
|
|
||||||
|
gpgme_data_release (in);
|
||||||
|
|
||||||
|
gpgme_release (ctx);
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user