From 6b267c56fd6e54fb1c254455c04495534260b547 Mon Sep 17 00:00:00 2001 From: Andre Heinecke Date: Thu, 26 Apr 2018 14:11:19 +0200 Subject: [PATCH 1/5] qt: Fix filename handling in cryptoconfig * src/qgpgmenewcryptoconfig.cpp (QGpgMENewCryptoConfigEntry::urlValue): Build url from local file. (QGpgMENewCryptoConfigEntry::setURLValue): Set native seperated path. -- This fixes setting files through cryptoconfig on Windows. GnuPG-Bug-Id: T3939 --- lang/qt/src/qgpgmenewcryptoconfig.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lang/qt/src/qgpgmenewcryptoconfig.cpp b/lang/qt/src/qgpgmenewcryptoconfig.cpp index ba028a97..070ab697 100644 --- a/lang/qt/src/qgpgmenewcryptoconfig.cpp +++ b/lang/qt/src/qgpgmenewcryptoconfig.cpp @@ -42,6 +42,7 @@ #include "gpgme_backend_debug.h" #include +#include #include "global.h" #include "error.h" @@ -521,8 +522,7 @@ QUrl QGpgMENewCryptoConfigEntry::urlValue() const Q_ASSERT(type == FilenameType || type == LdapServerType); Q_ASSERT(!isList()); if (type == FilenameType) { - QUrl url; - url.setPath(QFile::decodeName(m_option.currentValue().stringValue())); + QUrl url = QUrl::fromLocalFile(m_option.currentValue().stringValue()); return url; } return parseURL(type, stringValue()); @@ -635,7 +635,7 @@ void QGpgMENewCryptoConfigEntry::setURLValue(const QUrl &url) if (str.isEmpty() && !isOptional()) { m_option.resetToDefaultValue(); } else if (type == FilenameType) { - m_option.setNewValue(m_option.createStringArgument(QFile::encodeName(str).constData())); + m_option.setNewValue(m_option.createStringArgument(QDir::toNativeSeparators(url.toLocalFile()).toUtf8().constData())); } else { m_option.setNewValue(m_option.createStringArgument(str.toUtf8().constData())); } From 26820ba62920acfe2775bce8fc2bc8b3f17b1c10 Mon Sep 17 00:00:00 2001 From: Andre Heinecke Date: Fri, 4 May 2018 10:03:42 +0200 Subject: [PATCH 2/5] qt: Respect --disable-gpg-test for tests * lang/qt/Makefile.am: Respect --disable-gpg-test -- This is similar to the core switch to disable the tests. --- lang/qt/Makefile.am | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lang/qt/Makefile.am b/lang/qt/Makefile.am index ab859609..a1b83e8d 100644 --- a/lang/qt/Makefile.am +++ b/lang/qt/Makefile.am @@ -19,6 +19,12 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA -SUBDIRS = src tests doc +if RUN_GPG_TESTS +tests = tests +else +tests = +endif + +SUBDIRS = src ${tests} doc EXTRA_DIST = README From 46da79e3de99a7b65748994921d6aab73b9974e7 Mon Sep 17 00:00:00 2001 From: Ben McGinnes Date: Sat, 5 May 2018 12:27:17 +1000 Subject: [PATCH 3/5] python: key expiration datetime stamp tests * Changed the expiration date for the generated test key to NYE this century, rather than the NYE this millennium as originally suggested in job #3815. * This covers the lifetimes of current users (except, maybe, some very healthy millennials) as well as the 32-bit clock end date in 2038; without falling foul of OpenPGP's 2106 expiration. --- lang/python/tests/t-callbacks.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lang/python/tests/t-callbacks.py b/lang/python/tests/t-callbacks.py index 9a70cdae..b311e3d4 100755 --- a/lang/python/tests/t-callbacks.py +++ b/lang/python/tests/t-callbacks.py @@ -88,7 +88,7 @@ Name-Real: Joe Tester Name-Comment: with stupid passphrase Name-Email: joe+gpg@example.org Passphrase: Crypt0R0cks -Expire-Date: 2020-12-31 +Expire-Date: 2099-12-31 """ From e2a8a87bf9cfae5d4e8a5953c2a5303b44feb398 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Wed, 9 May 2018 16:39:30 +0200 Subject: [PATCH 4/5] core: Make the status-fd monitor work for all gpgsm commands. * src/engine-gpgsm.c (status_handler): Call the status monitor also here. Signed-off-by: Werner Koch --- src/engine-gpgsm.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/engine-gpgsm.c b/src/engine-gpgsm.c index da7e524f..7b221831 100644 --- a/src/engine-gpgsm.c +++ b/src/engine-gpgsm.c @@ -1013,8 +1013,17 @@ status_handler (void *opaque, int fd) *(rest++) = 0; r = _gpgme_parse_status (line + 2); + if (gpgsm->status.mon_cb && r != GPGME_STATUS_PROGRESS) + { + /* Note that we call the monitor even if we do + * not know the status code (r < 0). */ + err = gpgsm->status.mon_cb (gpgsm->status.mon_cb_value, + line + 2, rest); + } + else + err = 0; - if (r >= 0) + if (r >= 0 && !err) { if (gpgsm->status.fnc) { From e54b110aec3165a32ff9551d0c5227b88aa3dd4f Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Wed, 9 May 2018 16:41:05 +0200 Subject: [PATCH 5/5] json: Improve auto-base64 encoding to not split UTF-8 chars. * src/gpgme-json.c (make_data_object): Switch to Base64 also for UTF-8 characters. Signed-off-by: Werner Koch --- src/gpgme-json.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/gpgme-json.c b/src/gpgme-json.c index f1e9f256..fb5f149b 100644 --- a/src/gpgme-json.c +++ b/src/gpgme-json.c @@ -610,7 +610,8 @@ make_data_object (cjson_t result, gpgme_data_t data, size_t chunksize, { gpg_error_t err; char *buffer; - size_t buflen; + const char *s; + size_t buflen, n; int c; if (!base64 || base64 == -1) /* Make sure that we really have a string. */ @@ -629,13 +630,18 @@ make_data_object (cjson_t result, gpgme_data_t data, size_t chunksize, base64 = 0; if (!buflen) log_fatal ("Appended Nul byte got lost\n"); - if (memchr (buffer, 0, buflen-1)) - { - buflen--; /* Adjust for the extra nul byte. */ - base64 = 1; - } - /* Fixme: We might want to do more advanced heuristics than to - * only look for a Nul. */ + /* Figure out if there is any Nul octet in the buffer. In that + * case we need to Base-64 the buffer. Due to problems with the + * browser's Javascript we use Base-64 also in case an UTF-8 + * character is in the buffer. This is because the chunking may + * split an UTF-8 characters and JS can't handle this. */ + for (s=buffer, n=0; n < buflen -1; s++, n++) + if (!*s || (*s & 0x80)) + { + buflen--; /* Adjust for the extra nul byte. */ + base64 = 1; + break; + } } /* Adjust the chunksize if we need to do base64 conversion. */