Hello community, here is the log from the commit of package gmime for openSUSE:Factory checked in at 2020-03-24 22:29:37 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/gmime (Old) and /work/SRC/openSUSE:Factory/.gmime.new.3160 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "gmime" Tue Mar 24 22:29:37 2020 rev:70 rq:787535 version:3.2.7 Changes: -------- --- /work/SRC/openSUSE:Factory/gmime/gmime.changes 2020-02-22 19:00:18.097623401 +0100 +++ /work/SRC/openSUSE:Factory/.gmime.new.3160/gmime.changes 2020-03-24 22:29:49.613013466 +0100 @@ -1,0 +2,16 @@ +Sat Mar 21 15:03:11 UTC 2020 - Bjørn Lie <[email protected]> + +- Update to version 3.2.7: + + Added some configure logic to auto-detect the system shift-jis + charset alias. + + Fixed tests/Makefile.am to exit with a non-negative value. + + Fixed logic to skip expired or revoked gpg subkeys when looking + for the correct subkey to use for signing or encrypting. + + Fixed a regression introduced into 3.2.6 as part of the header + parser rewrite that lost the ability to warn about invalid + headers for non-toplevel MIME parts. + + Fixed S/MIME to always set GPGME_KEYLIST_MODE_VALIDATE when + looking up certificates as this is needed in order to correctly + populate the GMimeCertificates. + +------------------------------------------------------------------- Old: ---- gmime-3.2.6.tar.xz New: ---- gmime-3.2.7.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ gmime.spec ++++++ --- /var/tmp/diff_new_pack.6KFglX/_old 2020-03-24 22:29:50.237013780 +0100 +++ /var/tmp/diff_new_pack.6KFglX/_new 2020-03-24 22:29:50.237013780 +0100 @@ -22,7 +22,7 @@ # NOTE - also update baselibs.conf when bumping this %define so_ver 3_0 Name: gmime -Version: 3.2.6 +Version: 3.2.7 Release: 0 Summary: MIME Parser and Utility Library License: LGPL-2.1-or-later ++++++ gmime-3.2.6.tar.xz -> gmime-3.2.7.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gmime-3.2.6/NEWS new/gmime-3.2.7/NEWS --- old/gmime-3.2.6/NEWS 2020-02-15 16:07:49.000000000 +0100 +++ new/gmime-3.2.7/NEWS 2020-03-20 23:56:15.000000000 +0100 @@ -1,3 +1,18 @@ +### GMime 3.2.7 + +* Added some configure logic to auto-detect the system shift-jis charset alias. (issue #81) + +* Fixed tests/Makefile.am to exit with a non-negative value (issue #82) + +* Fixed logic to skip expired or revoked gpg subkeys when looking for the correct subkey to + use for signing or encrypting. (issue #88) + +* Fixed a regression introduced into 3.2.6 as part of the header parsder rewrite that lost + the ability to warn about invalid headers for non-toplevel MIME parts. (issue #89) + +* Fixed S/MIME to always set GPGME_KEYLIST_MODE_VALIDATE when looking up certificates + as this is needed in order to correctly populate the GMimeCertificates (issue #90) + ### GMime 3.2.6 * Added methods to get 64-bit timestamps for the creation-date and expiration-date of diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gmime-3.2.6/README new/gmime-3.2.7/README --- old/gmime-3.2.6/README 2020-02-15 16:49:27.000000000 +0100 +++ new/gmime-3.2.7/README 2020-03-03 16:19:07.000000000 +0100 @@ -736,6 +736,57 @@ } ``` +## Understanding Memory Management in GMime + +- Functions that return `const char *` return a pointer to a string stored on the `GObject` that will be released +when the object itself is finalized and therefore should *never* be fed to `g_free()` by the caller. + +- Functions that return `char *` are left up to the caller to `g_free()` when the caller is done with them. + +### For functions throughout the GMime API that return an object reference: + +- If the function that returned the object allocated the object, then you need to unref it, otherwise you don't. + +For example, the `stream` in the following code would need to be unreffed (using `g_object_unref()`) because it was +freshly allocated by the function: + +```c +GMimeStream *stream = g_mime_stream_mem_new (); +``` + +The next example shows a function that returns a reference to an *existing* `GMimeStream` object that is stored on +(and therefor managed by) the `GMimeDataWrapper` object: + +```c +GMimeStream *stream = g_mime_data_wrapper_get_stream (wrapper); +``` + +In the above example, the `stream` *should not* be unreffed because the `stream` object's memory is managed by the +`wrapper` object. In other words, when the `wrapper` object is freed, the `stream` will be freed as well. + +Where many developers get confused is when they create a new object and then add it to another object. + +For example: + +```c +GMimeStream *stream = g_mime_stream_mem_new (); +GMimeDataWrapper *wrapper = g_mime_data_wrapper_new_with_stream (stream, GMIME_CONTENT_ENCODING_DEFAULT); +g_object_unref (stream); +``` + +Even in this situation, it is necessary to unref the allocated object because all GMime functions that add an +object to another object will ref that object themselves. + +In other words, in the above example, the `GMimeStream` is being added to the `GMimeDataWrapper`. The +`GMimeDataWrapper` calls `g_object_ref()` on the `stream` which means that the `stream` object now has +a ref count of 2. + +When `g_object_unref()` is called on the stream after adding it to the `GMimeDataWrapper`, the ref count drops +down to 1. + +And when the `wrapper` object is eventually finalized after calling `g_object_unref()` on it, the ref count +on the `stream` object will be reduced to 0 as well, thereby freeing the `stream` object. + ## Documentation This is the README file for GMime. Additional documentation related to diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gmime-3.2.6/README.md new/gmime-3.2.7/README.md --- old/gmime-3.2.6/README.md 2020-02-15 16:49:27.000000000 +0100 +++ new/gmime-3.2.7/README.md 2020-03-03 16:19:07.000000000 +0100 @@ -736,6 +736,57 @@ } ``` +## Understanding Memory Management in GMime + +- Functions that return `const char *` return a pointer to a string stored on the `GObject` that will be released +when the object itself is finalized and therefore should *never* be fed to `g_free()` by the caller. + +- Functions that return `char *` are left up to the caller to `g_free()` when the caller is done with them. + +### For functions throughout the GMime API that return an object reference: + +- If the function that returned the object allocated the object, then you need to unref it, otherwise you don't. + +For example, the `stream` in the following code would need to be unreffed (using `g_object_unref()`) because it was +freshly allocated by the function: + +```c +GMimeStream *stream = g_mime_stream_mem_new (); +``` + +The next example shows a function that returns a reference to an *existing* `GMimeStream` object that is stored on +(and therefor managed by) the `GMimeDataWrapper` object: + +```c +GMimeStream *stream = g_mime_data_wrapper_get_stream (wrapper); +``` + +In the above example, the `stream` *should not* be unreffed because the `stream` object's memory is managed by the +`wrapper` object. In other words, when the `wrapper` object is freed, the `stream` will be freed as well. + +Where many developers get confused is when they create a new object and then add it to another object. + +For example: + +```c +GMimeStream *stream = g_mime_stream_mem_new (); +GMimeDataWrapper *wrapper = g_mime_data_wrapper_new_with_stream (stream, GMIME_CONTENT_ENCODING_DEFAULT); +g_object_unref (stream); +``` + +Even in this situation, it is necessary to unref the allocated object because all GMime functions that add an +object to another object will ref that object themselves. + +In other words, in the above example, the `GMimeStream` is being added to the `GMimeDataWrapper`. The +`GMimeDataWrapper` calls `g_object_ref()` on the `stream` which means that the `stream` object now has +a ref count of 2. + +When `g_object_unref()` is called on the stream after adding it to the `GMimeDataWrapper`, the ref count drops +down to 1. + +And when the `wrapper` object is eventually finalized after calling `g_object_unref()` on it, the ref count +on the `stream` object will be reduced to 0 as well, thereby freeing the `stream` object. + ## Documentation This is the README file for GMime. Additional documentation related to diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gmime-3.2.6/build/vs2008/config-win32.h new/gmime-3.2.7/build/vs2008/config-win32.h --- old/gmime-3.2.6/build/vs2008/config-win32.h 2020-02-15 17:12:55.000000000 +0100 +++ new/gmime-3.2.7/build/vs2008/config-win32.h 2020-03-20 23:58:58.000000000 +0100 @@ -5,7 +5,7 @@ /* #undef ENABLE_WARNINGS */ /* Define to the GMime version */ -#define GMIME_VERSION "3.2.6" +#define GMIME_VERSION "3.2.7" /* Define if libc defines an altzone variable */ /* #undef HAVE_ALTZONE */ @@ -145,13 +145,13 @@ #define PACKAGE_NAME "gmime" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "gmime 3.2.6" +#define PACKAGE_STRING "gmime 3.2.7" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "gmime" /* Define to the version of this package. */ -#define PACKAGE_VERSION "3.2.6" +#define PACKAGE_VERSION "3.2.7" /* The size of `off_t', as computed by sizeof. */ #define SIZEOF_OFF_T 4 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gmime-3.2.6/build/vs2010/config-win32.h new/gmime-3.2.7/build/vs2010/config-win32.h --- old/gmime-3.2.6/build/vs2010/config-win32.h 2020-02-15 17:12:55.000000000 +0100 +++ new/gmime-3.2.7/build/vs2010/config-win32.h 2020-03-20 23:58:58.000000000 +0100 @@ -5,7 +5,7 @@ /* #undef ENABLE_WARNINGS */ /* Define to the GMime version */ -#define GMIME_VERSION "3.2.6" +#define GMIME_VERSION "3.2.7" /* Define if libc defines an altzone variable */ /* #undef HAVE_ALTZONE */ @@ -145,13 +145,13 @@ #define PACKAGE_NAME "gmime" /* Define to the full name and version of this package. */ -#define PACKAGE_STRING "gmime 3.2.6" +#define PACKAGE_STRING "gmime 3.2.7" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "gmime" /* Define to the version of this package. */ -#define PACKAGE_VERSION "3.2.6" +#define PACKAGE_VERSION "3.2.7" /* The size of `off_t', as computed by sizeof. */ #define SIZEOF_OFF_T 4 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gmime-3.2.6/configure new/gmime-3.2.7/configure --- old/gmime-3.2.6/configure 2020-02-15 16:41:56.000000000 +0100 +++ new/gmime-3.2.7/configure 2020-03-20 23:58:37.000000000 +0100 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for gmime 3.2.6. +# Generated by GNU Autoconf 2.69 for gmime 3.2.7. # # Report bugs to <https://github.com/jstedfast/gmime/issues>. # @@ -590,8 +590,8 @@ # Identity of this package. PACKAGE_NAME='gmime' PACKAGE_TARNAME='gmime' -PACKAGE_VERSION='3.2.6' -PACKAGE_STRING='gmime 3.2.6' +PACKAGE_VERSION='3.2.7' +PACKAGE_STRING='gmime 3.2.7' PACKAGE_BUGREPORT='https://github.com/jstedfast/gmime/issues' PACKAGE_URL='' @@ -1450,7 +1450,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures gmime 3.2.6 to adapt to many kinds of systems. +\`configure' configures gmime 3.2.7 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1521,7 +1521,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of gmime 3.2.6:";; + short | recursive ) echo "Configuration of gmime 3.2.7:";; esac cat <<\_ACEOF @@ -1679,7 +1679,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -gmime configure 3.2.6 +gmime configure 3.2.7 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2285,7 +2285,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by gmime $as_me 3.2.6, which was +It was created by gmime $as_me 3.2.7, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3270,7 +3270,7 @@ # Define the identity of the package. PACKAGE='gmime' - VERSION='3.2.6' + VERSION='3.2.7' # Some tools Automake needs. @@ -3540,11 +3540,11 @@ GMIME_MAJOR_VERSION=3 GMIME_MINOR_VERSION=2 -GMIME_MICRO_VERSION=6 -GMIME_INTERFACE_AGE=0 -GMIME_BINARY_AGE=206 +GMIME_MICRO_VERSION=7 +GMIME_INTERFACE_AGE=1 +GMIME_BINARY_AGE=207 GMIME_API_VERSION=3.0 -GMIME_VERSION=3.2.6 +GMIME_VERSION=3.2.7 @@ -3555,13 +3555,13 @@ -$as_echo "#define GMIME_VERSION \"3.2.6\"" >>confdefs.h +$as_echo "#define GMIME_VERSION \"3.2.7\"" >>confdefs.h # libtool versioning LT_RELEASE=3.2 LT_CURRENT=206 -LT_REVISION=0 +LT_REVISION=1 LT_AGE=206 LT_CURRENT_MINUS_AGE=0 @@ -15102,7 +15102,7 @@ Report bugs to <[email protected]>." lt_cl_version="\ -gmime config.lt 3.2.6 +gmime config.lt 3.2.7 configured by $0, generated by GNU Autoconf 2.69. Copyright (C) 2011 Free Software Foundation, Inc. @@ -20278,7 +20278,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by gmime $as_me 3.2.6, which was +This file was extended by gmime $as_me 3.2.7, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -20344,7 +20344,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -gmime config.status 3.2.6 +gmime config.status 3.2.7 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gmime-3.2.6/configure.ac new/gmime-3.2.7/configure.ac --- old/gmime-3.2.6/configure.ac 2020-02-15 16:41:44.000000000 +0100 +++ new/gmime-3.2.7/configure.ac 2020-03-20 23:57:16.000000000 +0100 @@ -12,8 +12,8 @@ # m4_define([gmime_major_version], [3]) m4_define([gmime_minor_version], [2]) -m4_define([gmime_micro_version], [6]) -m4_define([gmime_interface_age], [0]) +m4_define([gmime_micro_version], [7]) +m4_define([gmime_interface_age], [1]) m4_define([gmime_binary_age], [m4_eval(100 * gmime_minor_version + gmime_micro_version)]) m4_define([gmime_version], diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gmime-3.2.6/docs/reference/html/gmime-gmime.html new/gmime-3.2.7/docs/reference/html/gmime-gmime.html --- old/gmime-3.2.6/docs/reference/html/gmime-gmime.html 2020-02-15 17:13:18.000000000 +0100 +++ new/gmime-3.2.7/docs/reference/html/gmime-gmime.html 2020-03-21 00:00:33.000000000 +0100 @@ -232,7 +232,7 @@ <hr> <div class="refsect2"> <a name="GMIME-MICRO-VERSION:CAPS"></a><h3>GMIME_MICRO_VERSION</h3> -<pre class="programlisting">#define GMIME_MICRO_VERSION (6U) +<pre class="programlisting">#define GMIME_MICRO_VERSION (7U) </pre> <p>GMime's micro version.</p> </div> @@ -246,14 +246,14 @@ <hr> <div class="refsect2"> <a name="GMIME-BINARY-AGE:CAPS"></a><h3>GMIME_BINARY_AGE</h3> -<pre class="programlisting">#define GMIME_BINARY_AGE (206U) +<pre class="programlisting">#define GMIME_BINARY_AGE (207U) </pre> <p>GMime's binary age.</p> </div> <hr> <div class="refsect2"> <a name="GMIME-INTERFACE-AGE:CAPS"></a><h3>GMIME_INTERFACE_AGE</h3> -<pre class="programlisting">#define GMIME_INTERFACE_AGE (0U) +<pre class="programlisting">#define GMIME_INTERFACE_AGE (1U) </pre> <p>GMime's interface age.</p> </div> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gmime-3.2.6/gmime/gmime-charset.c new/gmime-3.2.7/gmime/gmime-charset.c --- old/gmime-3.2.6/gmime/gmime-charset.c 2020-02-15 16:26:22.000000000 +0100 +++ new/gmime-3.2.7/gmime/gmime-charset.c 2020-02-16 16:30:48.000000000 +0100 @@ -60,6 +60,7 @@ #define ICONV_ISO_INT_FORMAT "iso-%u-%u" #define ICONV_ISO_STR_FORMAT "iso-%u-%s" #endif /* __aix__, __irix__, __sun__ */ +#define ICONV_SHIFT_JIS "shift-jis" #define ICONV_10646 "iso-10646" #endif /* USE_ICONV_DETECT */ @@ -133,12 +134,14 @@ /* Japanese charsets */ { "eucjp-0", "eucJP" }, /* should this map to "EUC-JP" instead? */ { "ujis-0", "ujis" }, /* we might want to map this to EUC-JP */ - { "jisx0208.1983-0", "SJIS" }, - { "jisx0212.1990-0", "SJIS" }, - { "pck", "SJIS" }, { NULL, NULL } }; +static const char *shiftjis_aliases[] = { + "shift-jis", "shift_jis", "sjis", "shift_jis-2004", "shift_jisx0213", + "jisx0208.1983-0", "jisx0212.1990-0", "pck", NULL +}; + /* map CJKR charsets to their language code */ /* NOTE: only support charset names that will be returned by * g_mime_charset_iconv_name() so that we don't have to keep track of @@ -147,21 +150,20 @@ const char *charset; const char *lang; } cjkr_lang_map[] = { - { "Big5", "zh" }, - { "BIG5HKSCS", "zh" }, - { "gb2312", "zh" }, - { "gb18030", "zh" }, - { "gbk", "zh" }, - { "euc-tw", "zh" }, - { "iso-2022-jp", "ja" }, - { "Shift-JIS", "ja" }, - { "sjis", "ja" }, - { "ujis", "ja" }, - { "eucJP", "ja" }, - { "euc-jp", "ja" }, - { "euc-kr", "ko" }, - { "koi8-r", "ru" }, - { "koi8-u", "uk" } + { "Big5", "zh" }, + { "BIG5HKSCS", "zh" }, + { "gb2312", "zh" }, + { "gb18030", "zh" }, + { "gbk", "zh" }, + { "euc-tw", "zh" }, + { "iso-2022-jp", "ja" }, + { ICONV_SHIFT_JIS, "ja" }, + { "ujis", "ja" }, + { "eucJP", "ja" }, + { "euc-jp", "ja" }, + { "euc-kr", "ko" }, + { "koi8-r", "ru" }, + { "koi8-u", "uk" } }; static GHashTable *iconv_charsets = NULL; @@ -409,6 +411,18 @@ return NULL; } +static gboolean +is_shift_jis (const char *name) +{ + int i; + + for (i = 0; shiftjis_aliases[i] != NULL; i++) { + if (!strcmp (name, shiftjis_aliases[i])) + return TRUE; + } + + return FALSE; +} static const char * strdown (char *str) @@ -483,8 +497,7 @@ iso, codepage); } else { /* codepage is a string - probably iso-2022-jp or something */ - iconv_name = g_strdup_printf (ICONV_ISO_STR_FORMAT, - iso, p); + iconv_name = g_strdup_printf (ICONV_ISO_STR_FORMAT, iso, p); } } else { /* p == buf, which probably means we've @@ -503,6 +516,8 @@ buf += 2; iconv_name = g_strdup_printf ("CP%s", buf); + } else if (is_shift_jis (name)) { + iconv_name = g_strdup (ICONV_SHIFT_JIS); } else { /* assume charset name is ok as is? */ iconv_name = g_strdup (charset); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gmime-3.2.6/gmime/gmime-gpgme-utils.c new/gmime-3.2.7/gmime/gmime-gpgme-utils.c --- old/gmime-3.2.6/gmime/gmime-gpgme-utils.c 2020-02-15 16:26:22.000000000 +0100 +++ new/gmime-3.2.7/gmime/gmime-gpgme-utils.c 2020-03-10 00:47:12.000000000 +0100 @@ -97,18 +97,61 @@ } -#define KEY_IS_OK(k) (!((k)->expired || (k)->revoked || (k)->disabled || (k)->invalid)) +static gboolean +g_mime_gpgme_key_is_usable (gpgme_key_t key, gboolean secret, time_t now, gpgme_error_t *err) +{ + gpgme_subkey_t subkey; + + *err = GPG_ERR_NO_ERROR; + + /* first, check the state of the key itself... */ + if (key->expired) + *err = GPG_ERR_KEY_EXPIRED; + else if (key->revoked) + *err = GPG_ERR_CERT_REVOKED; + else if (key->disabled) + *err = GPG_ERR_KEY_DISABLED; + else if (key->invalid) + *err = GPG_ERR_BAD_KEY; + + if (*err != GPG_ERR_NO_ERROR) + return FALSE; + + /* now check if there is a subkey that we can use */ + subkey = key->subkeys; + + while (subkey) { + if ((secret && subkey->can_sign) || (!secret && subkey->can_encrypt)) { + if (subkey->expired || (subkey->expires != 0 && subkey->expires <= now)) + *err = GPG_ERR_KEY_EXPIRED; + else if (subkey->revoked) + *err = GPG_ERR_CERT_REVOKED; + else if (subkey->disabled) + *err = GPG_ERR_KEY_DISABLED; + else if (subkey->invalid) + *err = GPG_ERR_BAD_KEY; + else + return TRUE; + } + + subkey = subkey->next; + } + + if (*err == GPG_ERR_NO_ERROR) + *err = GPG_ERR_BAD_KEY; + + return FALSE; +} /* Note: this function based on code in Balsa written by Albrecht Dreß. */ static gpgme_key_t g_mime_gpgme_get_key_by_name (gpgme_ctx_t ctx, const char *name, gboolean secret, GError **err) { + gpgme_error_t key_error = GPG_ERR_NO_ERROR; time_t now = time (NULL); gpgme_key_t key = NULL; - gpgme_subkey_t subkey; - gboolean bad = FALSE; + gboolean found = FALSE; gpgme_error_t error; - int errval = 0; if ((error = gpgme_op_keylist_start (ctx, name, secret)) != GPG_ERR_NO_ERROR) { if (secret) { @@ -126,30 +169,11 @@ while ((error = gpgme_op_keylist_next (ctx, &key)) == GPG_ERR_NO_ERROR) { /* check if this key and the relevant subkey are usable */ - if (KEY_IS_OK (key)) { - subkey = key->subkeys; - - while (subkey && ((secret && !subkey->can_sign) || (!secret && !subkey->can_encrypt))) - subkey = subkey->next; - - if (subkey) { - if (KEY_IS_OK (subkey) && (subkey->expires == 0 || subkey->expires > now)) - break; - - if (subkey->expired) - errval = GPG_ERR_KEY_EXPIRED; - else - errval = GPG_ERR_BAD_KEY; - } - } else { - if (key->expired) - errval = GPG_ERR_KEY_EXPIRED; - else - errval = GPG_ERR_BAD_KEY; - } + if (g_mime_gpgme_key_is_usable (key, secret, now, &key_error)) + break; gpgme_key_unref (key); - bad = TRUE; + found = TRUE; key = NULL; } @@ -171,22 +195,22 @@ if (!key) { if (strchr (name, '@')) { - if (bad) { - g_set_error (err, GMIME_GPGME_ERROR, errval, + if (found && key_error != GPG_ERR_NO_ERROR) { + g_set_error (err, GMIME_GPGME_ERROR, key_error, _("A key for %s is present, but it is expired, disabled, revoked or invalid"), name); } else { g_set_error (err, GMIME_GPGME_ERROR, GPG_ERR_NOT_FOUND, - _("Could not find a key for %s"), name); + _("Could not find a suitable key for %s"), name); } } else { - if (bad) { - g_set_error (err, GMIME_GPGME_ERROR, errval, + if (found && key_error != GPG_ERR_NO_ERROR) { + g_set_error (err, GMIME_GPGME_ERROR, key_error, _("A key with id %s is present, but it is expired, disabled, revoked or invalid"), name); } else { g_set_error (err, GMIME_GPGME_ERROR, GPG_ERR_NOT_FOUND, - _("Could not find a key with id %s"), name); + _("Could not find a suitable key with id %s"), name); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gmime-3.2.6/gmime/gmime-parser.c new/gmime-3.2.7/gmime/gmime-parser.c --- old/gmime-3.2.6/gmime/gmime-parser.c 2020-02-15 16:26:22.000000000 +0100 +++ new/gmime-3.2.7/gmime/gmime-parser.c 2020-03-10 00:55:53.000000000 +0100 @@ -1081,13 +1081,15 @@ priv->inptr = start; return FALSE; } - } else if (priv->toplevel && priv->state == GMIME_PARSER_STATE_HEADERS) { + } else if (priv->toplevel) { if (can_warn) warn_invalid_header (parser, options, start, inptr, inend); priv->state = GMIME_PARSER_STATE_ERROR; header_buffer_reset (priv); priv->inptr = start; return FALSE; + } else if (can_warn) { + warn_invalid_header (parser, options, start, inptr, inend); } } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gmime-3.2.6/gmime/gmime-pkcs7-context.c new/gmime-3.2.7/gmime/gmime-pkcs7-context.c --- old/gmime-3.2.6/gmime/gmime-pkcs7-context.c 2020-02-15 16:26:22.000000000 +0100 +++ new/gmime-3.2.7/gmime/gmime-pkcs7-context.c 2020-03-18 23:30:24.000000000 +0100 @@ -382,6 +382,7 @@ g_mime_pkcs7_context_new (void) { #ifdef ENABLE_CRYPTO + gpgme_keylist_mode_t keylist_mode; GMimePkcs7Context *pkcs7; gpgme_ctx_t ctx; @@ -397,6 +398,17 @@ gpgme_set_protocol (ctx, GPGME_PROTOCOL_CMS); gpgme_set_textmode (ctx, FALSE); gpgme_set_armor (ctx, FALSE); + + /* ensure that key listings are correctly validated, since we + use user ID validity to determine what identity to report */ + keylist_mode = gpgme_get_keylist_mode (ctx); + if (!(keylist_mode & GPGME_KEYLIST_MODE_VALIDATE)) { + if (gpgme_set_keylist_mode (ctx, keylist_mode | GPGME_KEYLIST_MODE_VALIDATE) != GPG_ERR_NO_ERROR) { + gpgme_release (ctx); + return NULL; + } + } + pkcs7->ctx = ctx; return (GMimeCryptoContext *) pkcs7; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gmime-3.2.6/gmime/gmime-version.h new/gmime-3.2.7/gmime/gmime-version.h --- old/gmime-3.2.6/gmime/gmime-version.h 2020-02-15 17:12:55.000000000 +0100 +++ new/gmime-3.2.7/gmime/gmime-version.h 2020-03-20 23:58:58.000000000 +0100 @@ -41,21 +41,21 @@ * * GMime's micro version. **/ -#define GMIME_MICRO_VERSION (6U) +#define GMIME_MICRO_VERSION (7U) /** * GMIME_BINARY_AGE: * * GMime's binary age. **/ -#define GMIME_BINARY_AGE (206U) +#define GMIME_BINARY_AGE (207U) /** * GMIME_INTERFACE_AGE: * * GMime's interface age. **/ -#define GMIME_INTERFACE_AGE (0U) +#define GMIME_INTERFACE_AGE (1U) /** diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gmime-3.2.6/gmime.spec new/gmime-3.2.7/gmime.spec --- old/gmime-3.2.6/gmime.spec 2020-02-15 17:13:19.000000000 +0100 +++ new/gmime-3.2.7/gmime.spec 2020-03-21 00:00:34.000000000 +0100 @@ -1,5 +1,5 @@ # Note that this is NOT a relocatable package -%define ver 3.2.6 +%define ver 3.2.7 %define prefix /usr %define enable_gtk_doc 0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gmime-3.2.6/iconv-detect.c new/gmime-3.2.7/iconv-detect.c --- old/gmime-3.2.6/iconv-detect.c 2020-02-15 16:26:22.000000000 +0100 +++ new/gmime-3.2.7/iconv-detect.c 2020-02-16 16:30:48.000000000 +0100 @@ -1,6 +1,6 @@ /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ /* GMime - * Copyright (C) 1999-2017 Jeffrey Stedfast + * Copyright (C) 1999-2020 Jeffrey Stedfast * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License @@ -47,6 +47,12 @@ ISO_DASH_UINT_DASH_STR_LOWER = (1 << 0), ISO_DASH_UINT_DASH_STR = (1 << 1), ISO_UINT_DASH_STR = (1 << 2), + + /* shift-jis */ + SHIFT_DASH_JIS = (1 << 0), + SHIFT_UNDERSCORE_JIS = (1 << 1), + SJIS = (1 << 2), + SHIFT_JISX0213 = (1 << 3), }; @@ -76,6 +82,15 @@ static int num_iso2022_tests = sizeof (iso2022_tests) / sizeof (CharInfo); +static CharInfo shiftjis_tests[] = { + { "shift-jis", "shift-jis", SHIFT_DASH_JIS }, + { "shift_jis", "shift_jis", SHIFT_UNDERSCORE_JIS }, + { "sjis", "sjis", SJIS }, + { "shift_jisx0213", "shift_jisx0213", SHIFT_JISX0213 }, +}; + +static int num_shiftjis_tests = sizeof (shiftjis_tests) / sizeof (CharInfo); + static CharInfo iso10646_tests[] = { { "iso-10646-1", "iso-%u-%u", ISO_DASH_UINT_DASH_UINT_LOWER }, { "ISO-10646-1", "ISO-%u-%u", ISO_DASH_UINT_DASH_UINT }, @@ -91,7 +106,7 @@ int main (int argc, char **argv) { - unsigned int iso8859, iso2022, iso10646; + unsigned int iso8859, iso2022, iso10646, shiftjis; CharInfo *info; iconv_t cd; FILE *fp; @@ -150,6 +165,30 @@ fprintf (fp, "#define ICONV_ISO_STR_FORMAT \"%s\"\n", info[i].format); } + shiftjis = ISO_UNSUPPORTED; + info = shiftjis_tests; + /*printf ("#define ISO_2022_FORMAT(iso,codepage)\t");*/ + for (i = 0; i < num_shiftjis_tests; i++) { + cd = iconv_open (info[i].charset, "UTF-8"); + if (cd != (iconv_t) -1) { + iconv_close (cd); + /*printf ("(\"%s\", (iso), (codepage))\n", info[i].format);*/ + fprintf (stderr, "System prefers %s\n", info[i].charset); + shiftjis = info[i].id; + break; + } + } + + if (shiftjis == ISO_UNSUPPORTED) { + fprintf (stderr, "System doesn't support any SHIFT-JIS aliases\n"); + fprintf (fp, "#define ICONV_SHIFT_JIS \"%s\"\n", info[0].format); +#ifdef CONFIGURE_IN + return EXIT_FAILURE; +#endif + } else { + fprintf (fp, "#define ICONV_SHIFT_JIS \"%s\"\n", info[i].format); + } + iso10646 = ISO_UNSUPPORTED; info = iso10646_tests; /*printf ("#define ISO_10646_FORMAT(iso,codepage)\t");*/ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gmime-3.2.6/tests/Makefile.am new/gmime-3.2.7/tests/Makefile.am --- old/gmime-3.2.6/tests/Makefile.am 2018-11-28 15:53:35.000000000 +0100 +++ new/gmime-3.2.7/tests/Makefile.am 2020-03-10 01:02:43.000000000 +0100 @@ -166,7 +166,7 @@ echo "Results: $${passed} tests passed; $${failed} tests failed."; \ if [ $${failed} -ne 0 ]; then \ echo -e "Failed tests: $${failed_tests}"; \ - exit -1; \ + exit 255; \ fi distclean-local: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gmime-3.2.6/tests/Makefile.in new/gmime-3.2.7/tests/Makefile.in --- old/gmime-3.2.6/tests/Makefile.in 2020-02-15 17:12:41.000000000 +0100 +++ new/gmime-3.2.7/tests/Makefile.in 2020-03-20 23:58:36.000000000 +0100 @@ -1160,7 +1160,7 @@ echo "Results: $${passed} tests passed; $${failed} tests failed."; \ if [ $${failed} -ne 0 ]; then \ echo -e "Failed tests: $${failed_tests}"; \ - exit -1; \ + exit 255; \ fi distclean-local: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/gmime-3.2.6/tests/test-filters.c new/gmime-3.2.7/tests/test-filters.c --- old/gmime-3.2.6/tests/test-filters.c 2020-02-15 16:26:23.000000000 +0100 +++ new/gmime-3.2.7/tests/test-filters.c 2020-02-16 15:44:29.000000000 +0100 @@ -113,12 +113,15 @@ testsuite_check ("%s (%s %s -> %s)", what, base, from, to); + if (!(filter = g_mime_filter_charset_new (from, to))) { + testsuite_check_failed ("%s failed: system does not support conversion from %s to %s", what, from, to); + return; + } + actual = g_byte_array_new (); stream = g_mime_stream_mem_new_with_byte_array (actual); g_mime_stream_mem_set_owner ((GMimeStreamMem *) stream, FALSE); - filter = g_mime_filter_charset_new (from, to); - name = g_strdup_printf ("%s.%s.txt", base, from); path = g_build_filename (datadir, name, NULL); pump_data_through_filter (filter, path, stream, TRUE, TRUE);
