From cvs at cvs.gnupg.org Tue Nov 1 06:38:50 2016 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Tue, 01 Nov 2016 06:38:50 +0100 Subject: [git] GCRYPT - branch, master, updated. libgcrypt-1.7.3-11-gbf6d5b1 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU crypto library". The branch, master has been updated via bf6d5b10cb4173826f47ac080506b68bb001acb2 (commit) from bfd732f53a9b5dfe14217a68a0fa289bf6913ec0 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit bf6d5b10cb4173826f47ac080506b68bb001acb2 Author: NIIBE Yutaka Date: Tue Nov 1 14:34:16 2016 +0900 cipher: Fix IDEA cipher for clearing memory. * cipher/idea.c (invert_key): Use wipememory, since this kind of memset may be removed by compiler optimization. -- Reported-by: Zhaomo Yang and Brian Johannesmeyer Signed-off-by: NIIBE Yutaka diff --git a/cipher/idea.c b/cipher/idea.c index 14234cf..ffe821d 100644 --- a/cipher/idea.c +++ b/cipher/idea.c @@ -152,7 +152,7 @@ invert_key( u16 *ek, u16 dk[IDEA_KEYLEN] ) *--p = t2; *--p = t1; memcpy(dk, temp, sizeof(temp) ); - memset(temp, 0, sizeof(temp) ); /* burn temp */ + wipememory(temp, sizeof(temp)); } ----------------------------------------------------------------------- Summary of changes: cipher/idea.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- The GNU crypto library http://git.gnupg.org From cvs at cvs.gnupg.org Tue Nov 1 10:19:03 2016 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Tue, 01 Nov 2016 10:19:03 +0100 Subject: [git] GPGME - branch, master, updated. gpgme-1.7.1-8-g567123d Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 567123de21247cab05762d799400739a12eb67ae (commit) from 4b3264345084a0c9bf9f97fb233df700d7608e66 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 567123de21247cab05762d799400739a12eb67ae Author: Andre Heinecke Date: Tue Nov 1 10:13:49 2016 +0100 qt, cpp: Install version headers in subdirs * lang/cpp/src/Makefile.am, lang/qt/src/Makefile.am: Install version headers in include subdirs. -- This change was requested on the gnupg-devel mailing list to avoid placing these headers into the top level include directories. There is currently no known user of these headers so changing it now should not break things downstream. diff --git a/lang/cpp/src/Makefile.am b/lang/cpp/src/Makefile.am index 342bdf8..d1f414e 100644 --- a/lang/cpp/src/Makefile.am +++ b/lang/cpp/src/Makefile.am @@ -57,7 +57,7 @@ interface_headers= \ gpgmeppincludedir = $(includedir)/gpgme++ gpgmeppinclude_HEADERS = $(gpgmepp_headers) nobase_gpgmeppinclude_HEADERS = $(interface_headers) -nodist_include_HEADERS = gpgmepp_version.h +nodist_gpgmeppinclude_HEADERS = gpgmepp_version.h libgpgmepp_la_SOURCES = $(main_sources) $(gpgmepp_headers) context_vanilla.cpp \ $(interface_headers) $(private_gpgmepp_headers) diff --git a/lang/qt/src/Makefile.am b/lang/qt/src/Makefile.am index 51fe314..f7610fd 100644 --- a/lang/qt/src/Makefile.am +++ b/lang/qt/src/Makefile.am @@ -203,7 +203,7 @@ qgpgmeincludedir = $(includedir)/qgpgme qgpgmeinclude_HEADERS = $(qgpgme_headers) camelcaseincludedir = $(includedir)/QGpgME camelcaseinclude_HEADERS = $(camelcase_headers) -nodist_include_HEADERS = qgpgme_version.h +nodist_qgpgmeinclude_HEADERS = qgpgme_version.h libqgpgme_la_SOURCES = $(qgpgme_sources) $(qgpgme_headers) $(private_qgpgme_headers) ----------------------------------------------------------------------- Summary of changes: lang/cpp/src/Makefile.am | 2 +- lang/qt/src/Makefile.am | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Tue Nov 1 18:35:24 2016 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Tue, 01 Nov 2016 18:35:24 +0100 Subject: [git] GPGME - branch, master, updated. gpgme-1.7.1-9-g627c5de Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 627c5deed84b4481710b6c0de06b26e886679bbe (commit) from 567123de21247cab05762d799400739a12eb67ae (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 627c5deed84b4481710b6c0de06b26e886679bbe Author: Andre Heinecke Date: Tue Nov 1 18:28:20 2016 +0100 qt: Add Distinguished Name parser from libkleo * lang/qt/src/dn.cpp (DN, DN::Attribute): New public API. * lang/qt/src/dn.h: New. * lang/qt/src/Makefile.am: Update accordingly. -- This is a general useful API to work with X509 distinguished names and is useful when doing CMS with GpgME. Adding this class from libkleo allows kmails messagelib to avoid any KDE UI Frameworks and so can be used more versatile in the future. This class can be combined with libkleos DNAttributeMapper to have the same bevavior as before in libkleo when using DN::prettyDN calls can be converted from: Kleo::DN(uid).prettyDN(); to: QGpgME::DN dn(uid); uid.setAttributeOrder( Kleo::DNAttributeMapper::instance()->attributeOrder()); dn.prettyDN(); diff --git a/NEWS b/NEWS index 2b71a6a..0274f9c 100644 --- a/NEWS +++ b/NEWS @@ -3,10 +3,14 @@ Noteworthy changes in version 1.7.2 (unreleased) * The module of the Python bindings has been renamed to 'gpg'. + * qt: Added Distinguished Name parser from libkleo + * Interface changes relative to the 1.7.1 release: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ gpgme_set_sender NEW. gpgme_get_sender NEW. + qt: DN NEW. + qt: DN::Attribute NEW. Noteworthy changes in version 1.7.1 (2016-10-18) diff --git a/lang/qt/src/Makefile.am b/lang/qt/src/Makefile.am index f7610fd..0dd18fe 100644 --- a/lang/qt/src/Makefile.am +++ b/lang/qt/src/Makefile.am @@ -35,7 +35,8 @@ qgpgme_sources = \ qgpgmeverifyopaquejob.cpp threadedjobmixin.cpp \ qgpgmekeyformailboxjob.cpp gpgme_backend_debug.cpp \ qgpgmetofupolicyjob.cpp \ - defaultkeygenerationjob.cpp qgpgmewkspublishjob.cpp + defaultkeygenerationjob.cpp qgpgmewkspublishjob.cpp \ + dn.cpp # If you add one here make sure that you also add one in camelcase qgpgme_headers= \ @@ -73,7 +74,8 @@ qgpgme_headers= \ verifydetachedjob.h \ defaultkeygenerationjob.h \ tofupolicyjob.h \ - wkspublishjob.h + wkspublishjob.h \ + dn.h camelcase_headers= \ AddUserIDJob \ @@ -84,6 +86,7 @@ camelcase_headers= \ DataProvider \ DecryptJob \ DecryptVerifyJob \ + DN \ DownloadJob \ EncryptJob \ ExportJob \ diff --git a/lang/qt/src/dn.cpp b/lang/qt/src/dn.cpp new file mode 100644 index 0000000..0f81a4c --- /dev/null +++ b/lang/qt/src/dn.cpp @@ -0,0 +1,495 @@ +/* + dn.cpp + + This file is part of qgpgme, the Qt API binding for gpgme + Copyright (c) 2004 Klar?lvdalens Datakonsult AB + Copyright (c) 2016 Intevation GmbH + + QGpgME is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + QGpgME 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 + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + In addition, as a special exception, the copyright holders give + permission to link the code of this program with any edition of + the Qt library by Trolltech AS, Norway (or with modified versions + of Qt that use the same license as Qt), and distribute linked + combinations including the two. You must obey the GNU General + Public License in all respects for all of the code used other than + Qt. If you modify this file, you may extend this exception to + your version of the file, but you are not obligated to do so. If + you do not wish to do so, delete this exception statement from + your version. +*/ + +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + +#include "dn.h" + +static const struct { + const char *name; + const char *oid; +} oidmap[] = { + // keep them ordered by oid: + { "SP", "ST" }, // hack to show the Sphinx-required/desired SP for + // StateOrProvince, otherwise known as ST or even S + { "NameDistinguisher", "0.2.262.1.10.7.20" }, + { "EMAIL", "1.2.840.113549.1.9.1" }, + { "SN", "2.5.4.4" }, + { "SerialNumber", "2.5.4.5" }, + { "T", "2.5.4.12" }, + { "D", "2.5.4.13" }, + { "BC", "2.5.4.15" }, + { "ADDR", "2.5.4.16" }, + { "PC", "2.5.4.17" }, + { "GN", "2.5.4.42" }, + { "Pseudo", "2.5.4.65" }, +}; +static const unsigned int numOidMaps = sizeof oidmap / sizeof * oidmap; + +class QGpgME::DN::Private +{ +public: + Private() : mRefCount(0) {} + Private(const Private &other) + : attributes(other.attributes), + reorderedAttributes(other.reorderedAttributes), + order{"CN", "L", "_X_", "OU", "O", "C"}, + mRefCount(0) + { + } + + int ref() + { + return ++mRefCount; + } + + int unref() + { + if (--mRefCount <= 0) { + delete this; + return 0; + } else { + return mRefCount; + } + } + + int refCount() const + { + return mRefCount; + } + + DN::Attribute::List attributes; + DN::Attribute::List reorderedAttributes; + QStringList order; +private: + int mRefCount; +}; + +namespace +{ +struct DnPair { + char *key; + char *value; +}; +} + +// copied from CryptPlug and adapted to work on DN::Attribute::List: + +#define digitp(p) (*(p) >= '0' && *(p) <= '9') +#define hexdigitp(a) (digitp (a) \ + || (*(a) >= 'A' && *(a) <= 'F') \ + || (*(a) >= 'a' && *(a) <= 'f')) +#define xtoi_1(p) (*(p) <= '9'? (*(p)- '0'): \ + *(p) <= 'F'? (*(p)-'A'+10):(*(p)-'a'+10)) +#define xtoi_2(p) ((xtoi_1(p) * 16) + xtoi_1((p)+1)) + +static char * +trim_trailing_spaces(char *string) +{ + char *p, *mark; + + for (mark = NULL, p = string; *p; p++) { + if (isspace(*p)) { + if (!mark) { + mark = p; + } + } else { + mark = NULL; + } + } + if (mark) { + *mark = '\0'; + } + + return string; +} + +/* Parse a DN and return an array-ized one. This is not a validating + parser and it does not support any old-stylish syntax; gpgme is + expected to return only rfc2253 compatible strings. */ +static const unsigned char * +parse_dn_part(DnPair *array, const unsigned char *string) +{ + const unsigned char *s, *s1; + size_t n; + char *p; + + /* parse attributeType */ + for (s = string + 1; *s && *s != '='; s++) + ; + if (!*s) { + return NULL; /* error */ + } + n = s - string; + if (!n) { + return NULL; /* empty key */ + } + p = (char *)malloc(n + 1); + + memcpy(p, string, n); + p[n] = 0; + trim_trailing_spaces((char *)p); + // map OIDs to their names: + for (unsigned int i = 0; i < numOidMaps; ++i) + if (!strcasecmp((char *)p, oidmap[i].oid)) { + free(p); + p = strdup(oidmap[i].name); + break; + } + array->key = p; + string = s + 1; + + if (*string == '#') { + /* hexstring */ + string++; + for (s = string; hexdigitp(s); s++) { + s++; + } + n = s - string; + if (!n || (n & 1)) { + return NULL; /* empty or odd number of digits */ + } + n /= 2; + array->value = p = (char *)malloc(n + 1); + + for (s1 = string; n; s1 += 2, n--) { + *p++ = xtoi_2(s1); + } + *p = 0; + } else { + /* regular v3 quoted string */ + for (n = 0, s = string; *s; s++) { + if (*s == '\\') { + /* pair */ + s++; + if (*s == ',' || *s == '=' || *s == '+' + || *s == '<' || *s == '>' || *s == '#' || *s == ';' + || *s == '\\' || *s == '\"' || *s == ' ') { + n++; + } else if (hexdigitp(s) && hexdigitp(s + 1)) { + s++; + n++; + } else { + return NULL; /* invalid escape sequence */ + } + } else if (*s == '\"') { + return NULL; /* invalid encoding */ + } else if (*s == ',' || *s == '=' || *s == '+' + || *s == '<' || *s == '>' || *s == '#' || *s == ';') { + break; + } else { + n++; + } + } + + array->value = p = (char *)malloc(n + 1); + + for (s = string; n; s++, n--) { + if (*s == '\\') { + s++; + if (hexdigitp(s)) { + *p++ = xtoi_2(s); + s++; + } else { + *p++ = *s; + } + } else { + *p++ = *s; + } + } + *p = 0; + } + return s; +} + +/* Parse a DN and return an array-ized one. This is not a validating + parser and it does not support any old-stylish syntax; gpgme is + expected to return only rfc2253 compatible strings. */ +static QGpgME::DN::Attribute::List +parse_dn(const unsigned char *string) +{ + if (!string) { + return QVector(); + } + + QVector result; + while (*string) { + while (*string == ' ') { + string++; + } + if (!*string) { + break; /* ready */ + } + + DnPair pair = { 0, 0 }; + string = parse_dn_part(&pair, string); + if (!string) { + goto failure; + } + if (pair.key && pair.value) + result.push_back(QGpgME::DN::Attribute(QString::fromUtf8(pair.key), + QString::fromUtf8(pair.value))); + free(pair.key); + free(pair.value); + + while (*string == ' ') { + string++; + } + if (*string && *string != ',' && *string != ';' && *string != '+') { + goto failure; /* invalid delimiter */ + } + if (*string) { + string++; + } + } + return result; + +failure: + return QVector(); +} + +static QVector +parse_dn(const QString &dn) +{ + return parse_dn((const unsigned char *)dn.toUtf8().data()); +} + +static QString dn_escape(const QString &s) +{ + QString result; + for (unsigned int i = 0, end = s.length(); i != end; ++i) { + const QChar ch = s[i]; + switch (ch.unicode()) { + case ',': + case '+': + case '"': + case '\\': + case '<': + case '>': + case ';': + result += QLatin1Char('\\'); + // fall through + default: + result += ch; + } + } + return result; +} + +static QString +serialise(const QVector &dn, const QString &sep) +{ + QStringList result; + for (QVector::const_iterator it = dn.begin(); it != dn.end(); ++it) + if (!(*it).name().isEmpty() && !(*it).value().isEmpty()) { + result.push_back((*it).name().trimmed() + QLatin1Char('=') + dn_escape((*it).value().trimmed())); + } + return result.join(sep); +} + +static QGpgME::DN::Attribute::List +reorder_dn(const QGpgME::DN::Attribute::List &dn, const QStringList &attrOrder) +{ + QGpgME::DN::Attribute::List unknownEntries; + QGpgME::DN::Attribute::List result; + unknownEntries.reserve(dn.size()); + result.reserve(dn.size()); + + // find all unknown entries in their order of appearance + for (QGpgME::DN::const_iterator it = dn.begin(); it != dn.end(); ++it) + if (!attrOrder.contains((*it).name())) { + unknownEntries.push_back(*it); + } + + // process the known attrs in the desired order + for (QStringList::const_iterator oit = attrOrder.begin(); oit != attrOrder.end(); ++oit) + if (*oit == QLatin1String("_X_")) { + // insert the unknown attrs + std::copy(unknownEntries.begin(), unknownEntries.end(), + std::back_inserter(result)); + unknownEntries.clear(); // don't produce dup's + } else { + for (QGpgME::DN::const_iterator dnit = dn.begin(); dnit != dn.end(); ++dnit) + if ((*dnit).name() == *oit) { + result.push_back(*dnit); + } + } + + return result; +} + +// +// +// class DN +// +// + +QGpgME::DN::DN() +{ + d = new Private(); + d->ref(); +} + +QGpgME::DN::DN(const QString &dn) +{ + d = new Private(); + d->ref(); + d->attributes = parse_dn(dn); +} + +QGpgME::DN::DN(const char *utf8DN) +{ + d = new Private(); + d->ref(); + if (utf8DN) { + d->attributes = parse_dn((const unsigned char *)utf8DN); + } +} + +QGpgME::DN::DN(const DN &other) + : d(other.d) +{ + if (d) { + d->ref(); + } +} + +QGpgME::DN::~DN() +{ + if (d) { + d->unref(); + } +} + +const QGpgME::DN &QGpgME::DN::operator=(const DN &that) +{ + if (this->d == that.d) { + return *this; + } + + if (that.d) { + that.d->ref(); + } + if (this->d) { + this->d->unref(); + } + + this->d = that.d; + + return *this; +} + +QString QGpgME::DN::prettyDN() const +{ + if (!d) { + return QString(); + } + if (d->reorderedAttributes.empty()) { + d->reorderedAttributes = reorder_dn(d->attributes, d->order); + } + return serialise(d->reorderedAttributes, QStringLiteral(",")); +} + +QString QGpgME::DN::dn() const +{ + return d ? serialise(d->attributes, QStringLiteral(",")) : QString(); +} + +QString QGpgME::DN::dn(const QString &sep) const +{ + return d ? serialise(d->attributes, sep) : QString(); +} + +// static +QString QGpgME::DN::escape(const QString &value) +{ + return dn_escape(value); +} + +void QGpgME::DN::detach() +{ + if (!d) { + d = new QGpgME::DN::Private(); + d->ref(); + } else if (d->refCount() > 1) { + QGpgME::DN::Private *d_save = d; + d = new QGpgME::DN::Private(*d); + d->ref(); + d_save->unref(); + } +} + +void QGpgME::DN::append(const Attribute &attr) +{ + detach(); + d->attributes.push_back(attr); + d->reorderedAttributes.clear(); +} + +QString QGpgME::DN::operator[](const QString &attr) const +{ + if (!d) { + return QString(); + } + const QString attrUpper = attr.toUpper(); + for (QVector::const_iterator it = d->attributes.constBegin(); + it != d->attributes.constEnd(); ++it) + if ((*it).name() == attrUpper) { + return (*it).value(); + } + return QString(); +} + +static QVector empty; + +QGpgME::DN::const_iterator QGpgME::DN::begin() const +{ + return d ? d->attributes.constBegin() : empty.constBegin(); +} + +QGpgME::DN::const_iterator QGpgME::DN::end() const +{ + return d ? d->attributes.constEnd() : empty.constEnd(); +} + +void QGpgME::DN::setAttributeOrder (const QStringList &order) const +{ + d->order = order; +} + +const QStringList & QGpgME::DN::attributeOrder () const +{ + return d->order; +} diff --git a/lang/qt/src/dn.h b/lang/qt/src/dn.h new file mode 100644 index 0000000..17b1c30 --- /dev/null +++ b/lang/qt/src/dn.h @@ -0,0 +1,136 @@ +/* + dn.h + + This file is part of qgpgme, the Qt API binding for gpgme + Copyright (c) 2004 Klar?lvdalens Datakonsult AB + Copyright (c) 2016 Intevation GmbH + + QGpgME is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + QGpgME 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 + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + In addition, as a special exception, the copyright holders give + permission to link the code of this program with any edition of + the Qt library by Trolltech AS, Norway (or with modified versions + of Qt that use the same license as Qt), and distribute linked + combinations including the two. You must obey the GNU General + Public License in all respects for all of the code used other than + Qt. If you modify this file, you may extend this exception to + your version of the file, but you are not obligated to do so. If + you do not wish to do so, delete this exception statement from + your version. +*/ +#ifndef QGPGME_DN_H +#define QGPGME_DN_H + +#include "qgpgme_export.h" + +#include +#include + +#include + +namespace QGpgME +{ + +/** + @short DN parser and reorderer +*/ +class QGPGME_EXPORT DN +{ +public: + class Attribute; + typedef QVector AttributeList; + typedef AttributeList::const_iterator const_iterator; + + DN(); + explicit DN(const QString &dn); + explicit DN(const char *utf8DN); + DN(const DN &other); + ~DN(); + + const DN &operator=(const DN &other); + + /** @return the value in rfc-2253-escaped form */ + static QString escape(const QString &value); + + /** @return the DN in a reordered form, according to the settings in + the [DN] group of the application's config file */ + QString prettyDN() const; + /** @return the DN in the original form */ + QString dn() const; + /** + \overload + Uses \a sep as separator (default: ,) + */ + QString dn(const QString &sep) const; + + QString operator[](const QString &attr) const; + + void append(const Attribute &attr); + + const_iterator begin() const; + const_iterator end() const; + + /** Set the order in which prettyDN will reorder the Attirbutes. */ + void setAttributeOrder(const QStringList &order) const; + + /** Get the used attribute order. */ + const QStringList & attributeOrder() const; + +private: + void detach(); +private: + class Private; + Private *d; +}; + +class QGPGME_EXPORT DN::Attribute +{ +public: + typedef DN::AttributeList List; + + explicit Attribute(const QString &name = QString(), const QString &value = QString()) + : mName(name.toUpper()), mValue(value) {} + Attribute(const Attribute &other) + : mName(other.name()), mValue(other.value()) {} + + const Attribute &operator=(const Attribute &other) + { + if (this != &other) { + mName = other.name(); + mValue = other.value(); + } + return *this; + } + + const QString &name() const + { + return mName; + } + const QString &value() const + { + return mValue; + } + + void setValue(const QString &value) + { + mValue = value; + } + +private: + QString mName; + QString mValue; +}; +} // namespace QGpgME +#endif // QGPGME_DN_H ----------------------------------------------------------------------- Summary of changes: NEWS | 4 + lang/qt/src/Makefile.am | 7 +- lang/qt/src/dn.cpp | 495 ++++++++++++++++++++++++++++++++++++++++++++++++ lang/qt/src/dn.h | 136 +++++++++++++ 4 files changed, 640 insertions(+), 2 deletions(-) create mode 100644 lang/qt/src/dn.cpp create mode 100644 lang/qt/src/dn.h hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Tue Nov 1 23:54:08 2016 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Tue, 01 Nov 2016 23:54:08 +0100 Subject: [git] Scute - branch, master, updated. scute-1.3.0-65-g2680826 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "PKCS#11 token on top of gpg-agent". The branch, master has been updated via 26808262a25b64483346d51db56ea82a342a6fbe (commit) from 94eeb2d580f67bd56ba711e055d9ea2ea089ec89 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 26808262a25b64483346d51db56ea82a342a6fbe Author: NIIBE Yutaka Date: Wed Nov 2 07:52:50 2016 +0900 autogen.sh: Update from gnupg. -- Detection of .git should be -e so that git worktree can be used. Signed-off-by: NIIBE Yutaka diff --git a/autogen.sh b/autogen.sh index 3fe24ea..10cc203 100755 --- a/autogen.sh +++ b/autogen.sh @@ -214,7 +214,7 @@ if [ "$myhost" = "find-version" ]; then esac beta=no - if [ -d .git ]; then + if [ -e .git ]; then ingit=yes tmp=$(git describe --match "${matchstr1}" --long 2>/dev/null) if [ -n "$tmp" ]; then @@ -423,7 +423,7 @@ if [ -d .git ]; then [ -z "${SILENT}" ] && cat < This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "PKCS#11 token on top of gpg-agent". The branch, master has been updated via e4bcc781fe2280626d602d0d02702d03a9c2601a (commit) from 26808262a25b64483346d51db56ea82a342a6fbe (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit e4bcc781fe2280626d602d0d02702d03a9c2601a Author: NIIBE Yutaka Date: Wed Nov 2 09:34:30 2016 +0900 Fix formatting. * src/agent.c (scute_agent_get_random): Use '%zu'. -- '%lu' is wrong on some arch where size_t is unsigned int. Since we use gpgrt_snprintf, we can depend on the '%z' feature. Signed-off-by: NIIBE Yutaka diff --git a/src/agent.c b/src/agent.c index 8fc48e0..75d4933 100644 --- a/src/agent.c +++ b/src/agent.c @@ -1331,7 +1331,7 @@ scute_agent_get_random (unsigned char *data, size_t len) gpg_error_t err; struct random_request request; - snprintf (command, sizeof(command), "SCD RANDOM %lu", len); + snprintf (command, sizeof(command), "SCD RANDOM %zu", len); request.buffer = data; request.len = len; ----------------------------------------------------------------------- Summary of changes: src/agent.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- PKCS#11 token on top of gpg-agent http://git.gnupg.org From cvs at cvs.gnupg.org Wed Nov 2 10:09:48 2016 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Wed, 02 Nov 2016 10:09:48 +0100 Subject: [git] GPG-ERROR - branch, master, updated. libgpg-error-1.24-9-g49e32ee Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Error codes used by GnuPG et al.". The branch, master has been updated via 49e32eed4550869644d706352d683ddba5696d4e (commit) from 59855806e11a27c5b63d9c25f7516c8cc74668aa (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 49e32eed4550869644d706352d683ddba5696d4e Author: Werner Koch Date: Wed Nov 2 10:05:37 2016 +0100 Add error codes GPG_ERR_TOO_YOUNG and GPG_ERR_TOO_OLD. Signed-off-by: Werner Koch diff --git a/NEWS b/NEWS index a646c7d..b1c8c6c 100644 --- a/NEWS +++ b/NEWS @@ -10,6 +10,8 @@ Noteworthy changes in version 1.25 (unreleased) [C19/A19/R_) GPG_ERR_USER_ID_EXISTS NEW. GPG_ERR_NAME_EXISTS NEW. GPG_ERR_DUP_NAME NEW. + GPG_ERR_TOO_OLD NEW. + GPG_ERR_TOO_YOUNG NEW. Noteworthy changes in version 1.24 (2016-07-14) [C19/A19/R1) diff --git a/doc/errorref.txt b/doc/errorref.txt index da5df23..0ea7d76 100644 --- a/doc/errorref.txt +++ b/doc/errorref.txt @@ -851,6 +851,14 @@ GPG_ERR_USER_ID_EXISTS (304) User ID already exists GPG_ERR_NAME_EXISTS (305) Name already exists GPG_ERR_DUP_NAME (306) Duplicated name +GPG_ERR_TOO_YOUNG (307) Objects is too young + + For example used if a file is younger than expected. + +GPG_ERR_TOO_OLD (308 Objects is too old + + Used if an object is too old to be used. This is a more generic + code than GPG_ERR_ENGINE_TOO_OLD or GPG_ERR_CRL_TOO_OLD. GPG_ERR_LDAP_GENERAL LDAP General error diff --git a/src/err-codes.h.in b/src/err-codes.h.in index 1bf717d..f29c234 100644 --- a/src/err-codes.h.in +++ b/src/err-codes.h.in @@ -326,6 +326,8 @@ 304 GPG_ERR_USER_ID_EXISTS User ID already exists 305 GPG_ERR_NAME_EXISTS Name already exists 306 GPG_ERR_DUP_NAME Duplicated name +307 GPG_ERR_TOO_YOUNG Objects is too young +308 GPG_ERR_TOO_OLD Objects is too old # This range is free for use. # ----------------------------------------------------------------------- Summary of changes: NEWS | 2 ++ doc/errorref.txt | 8 ++++++++ src/err-codes.h.in | 2 ++ 3 files changed, 12 insertions(+) hooks/post-receive -- Error codes used by GnuPG et al. http://git.gnupg.org From cvs at cvs.gnupg.org Wed Nov 2 12:26:23 2016 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Wed, 02 Nov 2016 12:26:23 +0100 Subject: [git] GPGME - branch, master, updated. gpgme-1.7.1-10-g8486f21 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 8486f213423311174ebff5cba74127cbd9bb3c2a (commit) from 627c5deed84b4481710b6c0de06b26e886679bbe (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 8486f213423311174ebff5cba74127cbd9bb3c2a Author: Andre Heinecke Date: Wed Nov 2 12:24:42 2016 +0100 qt, cpp: Add all generated files to cleanfiles * cpp/src/Makefile.am (CLEANFILES), qt/src/Makefile.am (CLEANFILES): Add all generated files to cleanfiles. diff --git a/lang/cpp/src/Makefile.am b/lang/cpp/src/Makefile.am index d1f414e..8ea99f5 100644 --- a/lang/cpp/src/Makefile.am +++ b/lang/cpp/src/Makefile.am @@ -96,4 +96,5 @@ install-data-local: install-cmake-files uninstall-local: uninstall-cmake-files -CLEANFILES = GpgmeppConfig.cmake +CLEANFILES = GpgmeppConfig.cmake GpgmeppConfigVersion.cmake \ + gpgmepp_version.h GpgmeppConfig.cmake.in diff --git a/lang/qt/src/Makefile.am b/lang/qt/src/Makefile.am index 0dd18fe..e16c489 100644 --- a/lang/qt/src/Makefile.am +++ b/lang/qt/src/Makefile.am @@ -253,7 +253,9 @@ uninstall-local: uninstall-cmake-files BUILT_SOURCES = $(qgpgme_moc_sources) $(camelcase_headers) -CLEANFILES = $(qgpgme_moc_sources) $(camelcase_headers) QGpgmeConfig.cmake +CLEANFILES = $(qgpgme_moc_sources) $(camelcase_headers) QGpgmeConfig.cmake \ + qgpgme_version.h QGpgmeConfig.cmake.in \ + QGpgmeConfigVersion.cmake nodist_libqgpgme_la_SOURCES = $(qgpgme_moc_sources) ----------------------------------------------------------------------- Summary of changes: lang/cpp/src/Makefile.am | 3 ++- lang/qt/src/Makefile.am | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Wed Nov 2 13:12:16 2016 From: cvs at cvs.gnupg.org (by Justus Winter) Date: Wed, 02 Nov 2016 13:12:16 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.1.15-312-g60ad1a7 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via 60ad1a7f37ffc10e601e69a3e2d2bb14af510257 (commit) via 5e693ddfbe44d149ce0d9393d699c613ad5ea706 (commit) via 68b59bbc42ba9ec69496758743924d54a95742f0 (commit) via 5d4f1408d0dd055d412ae44bb4a0f28f74617f05 (commit) from ad491ceec6145b3781a05dc7b4a36052abeeb4b4 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 60ad1a7f37ffc10e601e69a3e2d2bb14af510257 Author: Justus Winter Date: Wed Nov 2 13:06:06 2016 +0100 gpgscm: Fix inclusion of readline header. * tests/gpgscm/ffi.c: Define magic macro to prevent the completion function from redefined. GnuPG-bug-id: 2824 Signed-off-by: Justus Winter diff --git a/tests/gpgscm/ffi.c b/tests/gpgscm/ffi.c index 8e21ba6..305b7a1 100644 --- a/tests/gpgscm/ffi.c +++ b/tests/gpgscm/ffi.c @@ -35,6 +35,7 @@ #include #if HAVE_LIBREADLINE +#define GNUPG_LIBREADLINE_H_INCLUDED #include #include #endif commit 5e693ddfbe44d149ce0d9393d699c613ad5ea706 Author: Daniel Kahn Gillmor Date: Mon Oct 31 20:24:33 2016 -0400 build: Fix misspelled dirmngr. Signed-off-by: Daniel Kahn Gillmor diff --git a/configure.ac b/configure.ac index c211979..47de5f8 100644 --- a/configure.ac +++ b/configure.ac @@ -200,7 +200,7 @@ test -n "$GNUPG_PROTECT_TOOL_PGM" \ && show_gnupg_protect_tool_pgm="$GNUPG_PROTECT_TOOL_PGM" AC_ARG_WITH(dirmngr-ldap-pgm, - [ --with-dirmngr-ldap-pgm=PATH Use PATH as the default for the dirmnge ldap wrapper)], + [ --with-dirmngr-ldap-pgm=PATH Use PATH as the default for the dirmngr ldap wrapper)], GNUPG_DIRMNGR_LDAP_PGM="$withval", GNUPG_DIRMNGR_LDAP_PGM="" ) AC_SUBST(GNUPG_DIRMNGR_LDAP_PGM) AM_CONDITIONAL(GNUPG_DIRMNGR_LDAP_PGM, test -n "$GNUPG_DIRMNGR_LDAP_PGM") commit 68b59bbc42ba9ec69496758743924d54a95742f0 Author: Daniel Kahn Gillmor Date: Fri Oct 28 15:06:11 2016 -0400 Spelling: correct spelling of "passphrase". There were several different variant spellings of "passphrase". This should fix them all for all English text. I did notice that po/it.po contains multiple instances of "passhprase", which also looks suspect to me, but i do not know Italian, so i did not try to correct it. Signed-off-by: Daniel Kahn Gillmor diff --git a/NEWS b/NEWS index 1a780f8..395eca9 100644 --- a/NEWS +++ b/NEWS @@ -343,7 +343,7 @@ Noteworthy changes in version 2.1.9 (2015-10-09) * agent: Fix ssh fingerprint computation for nistp384 and EdDSA. - * agent: Fix crash during passprase entry on some platforms. + * agent: Fix crash during passphrase entry on some platforms. * scd: Change timeout to fix problems with some 2.1 cards. diff --git a/agent/agent.h b/agent/agent.h index a3ec457..1d40386 100644 --- a/agent/agent.h +++ b/agent/agent.h @@ -122,7 +122,7 @@ struct /* If set, a passphrase history will be written and checked at each passphrase change. */ - int enable_passhrase_history; + int enable_passphrase_history; int running_detached; /* We are running detached from the tty. */ diff --git a/agent/gpg-agent.c b/agent/gpg-agent.c index 7294c69..67ef321 100644 --- a/agent/gpg-agent.c +++ b/agent/gpg-agent.c @@ -789,7 +789,7 @@ parse_rereadable_options (ARGPARSE_ARGS *pargs, int reread) opt.min_passphrase_nonalpha = MIN_PASSPHRASE_NONALPHA; opt.check_passphrase_pattern = NULL; opt.max_passphrase_days = MAX_PASSPHRASE_DAYS; - opt.enable_passhrase_history = 0; + opt.enable_passphrase_history = 0; opt.ignore_cache_for_signing = 0; opt.allow_mark_trusted = 1; opt.allow_external_cache = 1; @@ -856,7 +856,7 @@ parse_rereadable_options (ARGPARSE_ARGS *pargs, int reread) opt.max_passphrase_days = pargs->r.ret_ulong; break; case oEnablePassphraseHistory: - opt.enable_passhrase_history = 1; + opt.enable_passphrase_history = 1; break; case oIgnoreCacheForSigning: opt.ignore_cache_for_signing = 1; break; diff --git a/doc/help.be.txt b/doc/help.be.txt index 36c9ffb..d6d07e8 100644 --- a/doc/help.be.txt +++ b/doc/help.be.txt @@ -228,7 +228,7 @@ self-signatures will be advanced by one second. .#gpg.passphrase.enter # fixme: Please translate and remove the hash mark from the key line. -Please enter the passhrase; this is a secret sentence +Please enter the passphrase; this is a secret sentence . diff --git a/doc/help.ca.txt b/doc/help.ca.txt index 36c9ffb..d6d07e8 100644 --- a/doc/help.ca.txt +++ b/doc/help.ca.txt @@ -228,7 +228,7 @@ self-signatures will be advanced by one second. .#gpg.passphrase.enter # fixme: Please translate and remove the hash mark from the key line. -Please enter the passhrase; this is a secret sentence +Please enter the passphrase; this is a secret sentence . diff --git a/doc/help.cs.txt b/doc/help.cs.txt index 36c9ffb..d6d07e8 100644 --- a/doc/help.cs.txt +++ b/doc/help.cs.txt @@ -228,7 +228,7 @@ self-signatures will be advanced by one second. .#gpg.passphrase.enter # fixme: Please translate and remove the hash mark from the key line. -Please enter the passhrase; this is a secret sentence +Please enter the passphrase; this is a secret sentence . diff --git a/doc/help.da.txt b/doc/help.da.txt index 36c9ffb..d6d07e8 100644 --- a/doc/help.da.txt +++ b/doc/help.da.txt @@ -228,7 +228,7 @@ self-signatures will be advanced by one second. .#gpg.passphrase.enter # fixme: Please translate and remove the hash mark from the key line. -Please enter the passhrase; this is a secret sentence +Please enter the passphrase; this is a secret sentence . diff --git a/doc/help.el.txt b/doc/help.el.txt index 36c9ffb..d6d07e8 100644 --- a/doc/help.el.txt +++ b/doc/help.el.txt @@ -228,7 +228,7 @@ self-signatures will be advanced by one second. .#gpg.passphrase.enter # fixme: Please translate and remove the hash mark from the key line. -Please enter the passhrase; this is a secret sentence +Please enter the passphrase; this is a secret sentence . diff --git a/doc/help.eo.txt b/doc/help.eo.txt index 36c9ffb..d6d07e8 100644 --- a/doc/help.eo.txt +++ b/doc/help.eo.txt @@ -228,7 +228,7 @@ self-signatures will be advanced by one second. .#gpg.passphrase.enter # fixme: Please translate and remove the hash mark from the key line. -Please enter the passhrase; this is a secret sentence +Please enter the passphrase; this is a secret sentence . diff --git a/doc/help.et.txt b/doc/help.et.txt index 36c9ffb..d6d07e8 100644 --- a/doc/help.et.txt +++ b/doc/help.et.txt @@ -228,7 +228,7 @@ self-signatures will be advanced by one second. .#gpg.passphrase.enter # fixme: Please translate and remove the hash mark from the key line. -Please enter the passhrase; this is a secret sentence +Please enter the passphrase; this is a secret sentence . diff --git a/doc/help.gl.txt b/doc/help.gl.txt index 36c9ffb..d6d07e8 100644 --- a/doc/help.gl.txt +++ b/doc/help.gl.txt @@ -228,7 +228,7 @@ self-signatures will be advanced by one second. .#gpg.passphrase.enter # fixme: Please translate and remove the hash mark from the key line. -Please enter the passhrase; this is a secret sentence +Please enter the passphrase; this is a secret sentence . diff --git a/doc/help.nb.txt b/doc/help.nb.txt index 36c9ffb..d6d07e8 100644 --- a/doc/help.nb.txt +++ b/doc/help.nb.txt @@ -228,7 +228,7 @@ self-signatures will be advanced by one second. .#gpg.passphrase.enter # fixme: Please translate and remove the hash mark from the key line. -Please enter the passhrase; this is a secret sentence +Please enter the passphrase; this is a secret sentence . diff --git a/doc/help.sv.txt b/doc/help.sv.txt index 36c9ffb..d6d07e8 100644 --- a/doc/help.sv.txt +++ b/doc/help.sv.txt @@ -228,7 +228,7 @@ self-signatures will be advanced by one second. .#gpg.passphrase.enter # fixme: Please translate and remove the hash mark from the key line. -Please enter the passhrase; this is a secret sentence +Please enter the passphrase; this is a secret sentence . diff --git a/doc/help.txt b/doc/help.txt index 4c6df7c..e64656e 100644 --- a/doc/help.txt +++ b/doc/help.txt @@ -312,7 +312,7 @@ self-signatures will be advanced by one second. .gpg.passphrase.enter # (keep a leading empty line) -Please enter the passhrase; this is a secret sentence. +Please enter the passphrase; this is a secret sentence. . diff --git a/g10/ChangeLog-2011 b/g10/ChangeLog-2011 index 31359d8..37da37b 100644 --- a/g10/ChangeLog-2011 +++ b/g10/ChangeLog-2011 @@ -8210,7 +8210,7 @@ to all foo-fd options. * gpgv.c, openfile.c, ringedit.c, tdbio.c: Minor fixes. Mainly replaced hardcoded path separators with EXTSEP_S like macros. - * passprase.c [__riscos__]: Disabled agent stuff + * passphrase.c [__riscos__]: Disabled agent stuff * trustdb.c (check_trust): Changed r_trustlevel to signed int to avoid mismatch problems in pkclist.c * pkclist.c (add_ownertrust): Ditto. @@ -11583,7 +11583,7 @@ Mon May 4 09:35:53 1998 Werner Koch (wk at isil.d.shuttle.de) changed all callers. * passphrase.c (make_dek_from_passphrase): Removed - * (get_passhrase_hash): Changed name to passphrase_to_dek, add arg, + * (get_passphrase_hash): Changed name to passphrase_to_dek, add arg, changed all callers. * all: Introduced the new ELG identifier and added support for the diff --git a/po/ca.po b/po/ca.po index 51f5650..9afadcc 100644 --- a/po/ca.po +++ b/po/ca.po @@ -9798,7 +9798,7 @@ msgstr "" #~ "a la llista actual de prefer?ncies. Les marques de temps de totes les\n" #~ "autosignatures afectades s'avan?aran un segon.\n" -#~ msgid "Please enter the passhrase; this is a secret sentence \n" +#~ msgid "Please enter the passphrase; this is a secret sentence \n" #~ msgstr "Introdu?u la contrasenya; aquesta ha de ser una frase secreta \n" #~ msgid "" diff --git a/po/cs.po b/po/cs.po index d185c57..1ebade0 100644 --- a/po/cs.po +++ b/po/cs.po @@ -9669,7 +9669,7 @@ msgstr "" #~ "na aktu?ln? seznam p?edvoleb. ?asov? raz?tka v?ech dot?en?ch podpis?\n" #~ "kl??? jimi samotn?mi budou posunuty o jednu vte?inu dop?edu.\n" -#~ msgid "Please enter the passhrase; this is a secret sentence \n" +#~ msgid "Please enter the passphrase; this is a secret sentence \n" #~ msgstr "Pros?m, vlo?te heslo; toto je tajn? v?ta \n" #~ msgid "" diff --git a/po/de.po b/po/de.po index 71e5700..cf01be3 100644 --- a/po/de.po +++ b/po/de.po @@ -9616,7 +9616,7 @@ msgstr "" #~ "betroffenen\n" #~ "Eigenbeglaubigungen werden um eine Sekunde vorgestellt.\n" -#~ msgid "Please enter the passhrase; this is a secret sentence \n" +#~ msgid "Please enter the passphrase; this is a secret sentence \n" #~ msgstr "Bitte geben Sie die Passphrase ein. Dies ist ein geheimer Satz \n" #~ msgid "" diff --git a/po/el.po b/po/el.po index 77c81a8..5527de9 100644 --- a/po/el.po +++ b/po/el.po @@ -9605,7 +9605,7 @@ msgstr "" #~ "???? ???????????? ????? ???????????. ? ?????????? ???? ??? ????????????\n" #~ "????-????????? ?? ??????? ???? 1 ????????????.\n" -#~ msgid "Please enter the passhrase; this is a secret sentence \n" +#~ msgid "Please enter the passphrase; this is a secret sentence \n" #~ msgstr "?????????????? ?? ????? ??????? ???? ????? ??? ??????? ??????? \n" #~ msgid "" diff --git a/po/eo.po b/po/eo.po index 63f3882..87331ff 100644 --- a/po/eo.po +++ b/po/eo.po @@ -9488,7 +9488,7 @@ msgstr "" #~ "al la aktuala listo de preferoj. La dato de ?iuj trafitaj\n" #~ "mem-subskriboj estos anta?enigitaj je unu sekundo.\n" -#~ msgid "Please enter the passhrase; this is a secret sentence \n" +#~ msgid "Please enter the passphrase; this is a secret sentence \n" #~ msgstr "Bonvolu doni la pasfrazon; tio estas sekreta frazo \n" #~ msgid "" diff --git a/po/es.po b/po/es.po index 76fae21..f12f9c0 100644 --- a/po/es.po +++ b/po/es.po @@ -9955,7 +9955,7 @@ msgstr "" #~ "seleccionados) a la lista actual de preferencias. El sello de tiempo\n" #~ "de todas las autofirmas afectadas se avanzar? en un segundo.\n" -#~ msgid "Please enter the passhrase; this is a secret sentence \n" +#~ msgid "Please enter the passphrase; this is a secret sentence \n" #~ msgstr "Por favor introduzca la contrase?a: una frase secreta \n" #~ msgid "" diff --git a/po/et.po b/po/et.po index 74426d8..75ded06 100644 --- a/po/et.po +++ b/po/et.po @@ -9492,7 +9492,7 @@ msgstr "" #~ "vastavaks hetkel m??ratud seadetele. K?ikide asjasse puutuvate\n" #~ "ise loodud allkirjade ajatempleid suurendatakse ?he sekundi v?rra.\n" -#~ msgid "Please enter the passhrase; this is a secret sentence \n" +#~ msgid "Please enter the passphrase; this is a secret sentence \n" #~ msgstr "Palun sisestage parool; see on salajane tekst \n" #~ msgid "" diff --git a/po/fi.po b/po/fi.po index 5002410..5063207 100644 --- a/po/fi.po +++ b/po/fi.po @@ -9584,7 +9584,7 @@ msgstr "" #~ "nykyiseen luetteloon valinnoista. Kaikkien muutettujen\n" #~ "oma-allekirjoitusten aikaleima siirret??n yhdell? sekunnilla eteenp?in.\n" -#~ msgid "Please enter the passhrase; this is a secret sentence \n" +#~ msgid "Please enter the passphrase; this is a secret sentence \n" #~ msgstr "Ole hyv? ja sy?t? salasana, t?m?n on salainen lause \n" #~ msgid "" diff --git a/po/gl.po b/po/gl.po index 833533d..f02986f 100644 --- a/po/gl.po +++ b/po/gl.po @@ -9605,7 +9605,7 @@ msgstr "" #~ "sinaturas\n" #~ "afectadas ha avanzar un segundo.\n" -#~ msgid "Please enter the passhrase; this is a secret sentence \n" +#~ msgid "Please enter the passphrase; this is a secret sentence \n" #~ msgstr "Por favor, introduza o contrasinal; esta ? unha frase secreta \n" #~ msgid "" diff --git a/po/hu.po b/po/hu.po index bcfe704..b068e69 100644 --- a/po/hu.po +++ b/po/hu.po @@ -9548,7 +9548,7 @@ msgstr "" #~ "tartoz? preferenci?kat az aktu?lis preferenci?kra. Minden ?rintett\n" #~ "?nal??r?s id?pontj?t egy m?sodperccel n?veli.\n" -#~ msgid "Please enter the passhrase; this is a secret sentence \n" +#~ msgid "Please enter the passphrase; this is a secret sentence \n" #~ msgstr "K?rem, adja meg a jelsz?t! Ezt egy titkos mondat. \n" #~ msgid "" diff --git a/po/id.po b/po/id.po index 015e419..5ee96c7 100644 --- a/po/id.po +++ b/po/id.po @@ -9540,7 +9540,7 @@ msgstr "" #~ "ke daftar preferensi saat ini. Timestamp seluruh self-signature\n" #~ "yang terpengaruh akan bertambah satu detik.\n" -#~ msgid "Please enter the passhrase; this is a secret sentence \n" +#~ msgid "Please enter the passphrase; this is a secret sentence \n" #~ msgstr "Silakan masukkan passphrase; ini kalimat rahasia\n" #~ msgid "" diff --git a/po/it.po b/po/it.po index dfc4f45..c109126 100644 --- a/po/it.po +++ b/po/it.po @@ -9599,7 +9599,7 @@ msgstr "" #~ "coinvolte\n" #~ "sar? aumentato di un secondo.\n" -#~ msgid "Please enter the passhrase; this is a secret sentence \n" +#~ msgid "Please enter the passphrase; this is a secret sentence \n" #~ msgstr "Inserisci la passphrase, cio? una frase segreta \n" #~ msgid "" diff --git a/po/pt.po b/po/pt.po index 1593ff0..40d65f7 100644 --- a/po/pt.po +++ b/po/pt.po @@ -9532,7 +9532,7 @@ msgstr "" #~ "O 'timestamp' de todas as auto-assinaturas afectuadas ser? avan?ado\n" #~ "em um segundo.\n" -#~ msgid "Please enter the passhrase; this is a secret sentence \n" +#~ msgid "Please enter the passphrase; this is a secret sentence \n" #~ msgstr "Por favor digite a frase secreta \n" #~ msgid "" diff --git a/po/ro.po b/po/ro.po index 460223c..12fd6f6 100644 --- a/po/ro.po +++ b/po/ro.po @@ -9639,7 +9639,7 @@ msgstr "" #~ "cele selectate) conform cu lista curent? de preferin?e. Timestamp-urile\n" #~ "tuturor auto-semn?turilor afectate vor fi avansate cu o secund?.\n" -#~ msgid "Please enter the passhrase; this is a secret sentence \n" +#~ msgid "Please enter the passphrase; this is a secret sentence \n" #~ msgstr "" #~ "V? rug?m introduce?i fraza-parol?; aceasta este o propozi?ie secret? \n" diff --git a/po/sk.po b/po/sk.po index 801cfe8..62b220e 100644 --- a/po/sk.po +++ b/po/sk.po @@ -9564,7 +9564,7 @@ msgstr "" #~ "podpisov\n" #~ "k???ov nimi samotn?mi bud? posunut? o jednu sekundu dopredu.\n" -#~ msgid "Please enter the passhrase; this is a secret sentence \n" +#~ msgid "Please enter the passphrase; this is a secret sentence \n" #~ msgstr "Pros?m, vlo?te heslo; toto je tajn? veta \n" #~ msgid "" diff --git a/po/zh_CN.po b/po/zh_CN.po index 5e16c8a..f153d7e 100644 --- a/po/zh_CN.po +++ b/po/zh_CN.po @@ -9408,7 +9408,7 @@ msgstr "" #~ "???????????(????)??????????????????\n" #~ "?????????????\n" -#~ msgid "Please enter the passhrase; this is a secret sentence \n" +#~ msgid "Please enter the passphrase; this is a secret sentence \n" #~ msgstr "??????????????? \n" #~ msgid "" diff --git a/scd/app-nks.c b/scd/app-nks.c index d0b96a9..458516b 100644 --- a/scd/app-nks.c +++ b/scd/app-nks.c @@ -1068,7 +1068,7 @@ do_decipher (app_t app, const char *keyidstr, /* Parse a password ID string. Returns NULL on error or a string - suitable as passpahrse prompt on success. On success stores the + suitable as passphrase prompt on success. On success stores the reference value for the password at R_PWID and a flag indicating that the SigG application is to be used at R_SIGG. If NEW_MODE is true, the returned description is suitable for a new Password. diff --git a/tests/openpgp/ecc.scm b/tests/openpgp/ecc.scm index f2f3b7c..8f38494 100755 --- a/tests/openpgp/ecc.scm +++ b/tests/openpgp/ecc.scm @@ -187,7 +187,7 @@ Rg== ;; ;; Now check that we can encrypt and decrypt our own messages. ;; -;; Note that we don't need to provide a passppharse because we already +;; Note that we don't need to provide a passphrase because we already ;; preset the passphrase into the gpg-agent. ;; (for-each-p commit 5d4f1408d0dd055d412ae44bb4a0f28f74617f05 Author: Justus Winter Date: Wed Nov 2 12:45:18 2016 +0100 g10,w32: Fix build on Windows. * g10/tofu.c (begin_transaction): Use the new 'gnupg_usleep'. Signed-off-by: Justus Winter diff --git a/g10/tofu.c b/g10/tofu.c index 8280321..46d9484 100644 --- a/g10/tofu.c +++ b/g10/tofu.c @@ -192,7 +192,6 @@ begin_transaction (ctrl_t ctrl, int only_batch) && dbs->batch_update_started != gnupg_get_time ()) { struct stat statbuf; - struct timespec ts; /* If we are in a batch update, then batch updates better have been enabled. */ @@ -209,9 +208,7 @@ begin_transaction (ctrl_t ctrl, int only_batch) /* Yield to allow another process a chance to run. Note: * testing suggests that anything less than a 100ms tends to * not result in the other process getting the lock. */ - memset (&ts, 0, sizeof (ts)); - ts.tv_nsec = 100 * 1000 * 1000; - nanosleep (&ts, &ts); + gnupg_usleep (100000); } else dbs->batch_update_started = gnupg_get_time (); ----------------------------------------------------------------------- Summary of changes: NEWS | 2 +- agent/agent.h | 2 +- agent/gpg-agent.c | 4 ++-- configure.ac | 2 +- doc/help.be.txt | 2 +- doc/help.ca.txt | 2 +- doc/help.cs.txt | 2 +- doc/help.da.txt | 2 +- doc/help.el.txt | 2 +- doc/help.eo.txt | 2 +- doc/help.et.txt | 2 +- doc/help.gl.txt | 2 +- doc/help.nb.txt | 2 +- doc/help.sv.txt | 2 +- doc/help.txt | 2 +- g10/ChangeLog-2011 | 4 ++-- g10/tofu.c | 5 +---- po/ca.po | 2 +- po/cs.po | 2 +- po/de.po | 2 +- po/el.po | 2 +- po/eo.po | 2 +- po/es.po | 2 +- po/et.po | 2 +- po/fi.po | 2 +- po/gl.po | 2 +- po/hu.po | 2 +- po/id.po | 2 +- po/it.po | 2 +- po/pt.po | 2 +- po/ro.po | 2 +- po/sk.po | 2 +- po/zh_CN.po | 2 +- scd/app-nks.c | 2 +- tests/gpgscm/ffi.c | 1 + tests/openpgp/ecc.scm | 2 +- 36 files changed, 38 insertions(+), 40 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Wed Nov 2 13:21:49 2016 From: cvs at cvs.gnupg.org (by Daniel Kahn Gillmor) Date: Wed, 02 Nov 2016 13:21:49 +0100 Subject: [git] GnuPG - branch, STABLE-BRANCH-1-4, updated. gnupg-1.4.21-4-g23944d0 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, STABLE-BRANCH-1-4 has been updated via 23944d0249b7a6dc854dcc8b0c7c74cd46b1341e (commit) via f2acaa5d785a29eca629c4b3df739bc474249004 (commit) from 82bc22aa139c7dda5276fc658d4ee40cab27d8e7 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 23944d0249b7a6dc854dcc8b0c7c74cd46b1341e Author: Daniel Kahn Gillmor Date: Mon Aug 29 10:36:33 2016 -0400 spelling: Correct achived to achieved. -- Signed-off-by: Daniel Kahn Gillmor diff --git a/THOUGHTS b/THOUGHTS index 25707c4..aba9402 100644 --- a/THOUGHTS +++ b/THOUGHTS @@ -90,7 +90,7 @@ extension mechanisms in GPG should be enough to try various ways later on. 1) pass an argument string to loadable extension modules (maybe gpg --load-extension foofish=arg1,arg2,arg3 ?) - --> could also be achived by S-Exps + --> could also be achieved by S-Exps 2) allow multiple instances of the same extension module (presumably with different arguments) diff --git a/doc/gpg.texi b/doc/gpg.texi index 12a6d60..e9935c3 100644 --- a/doc/gpg.texi +++ b/doc/gpg.texi @@ -1894,7 +1894,7 @@ opposite meaning. The options are: a formerly deleted key does not automatically gain an ownertrust values merely due to import. On the other hand it is sometimes necessary to re-import a trusted set of keys again but keeping - already assigned ownertrust values. This can be achived by using + already assigned ownertrust values. This can be achieved by using this option. @item repair-pks-subkey-bug commit f2acaa5d785a29eca629c4b3df739bc474249004 Author: Neal H. Walfield Date: Mon Aug 29 10:56:16 2016 -0400 tools: Fix option parsing for gpg-zip. * tools/gpg-zip.in: Correctly set GPG when --gpg is specified. Correctly set TAR when --tar is specified. Pass TAR_ARGS to tar. (cherry-picked by dkg from master branch's 84ebf15b06e435453b2f58775f97a3a1c61a7e55) -- Signed-off-by: Neal H. Walfield Co-authored-by: Michael M?nch GnuPG-bug-id 1351 GnuPG-bug-id 1442 diff --git a/tools/gpg-zip.in b/tools/gpg-zip.in index d27b1f9..a6b4238 100644 --- a/tools/gpg-zip.in +++ b/tools/gpg-zip.in @@ -94,7 +94,8 @@ while test $# -gt 0 ; do exit 0 ;; --gpg) - GPG=$1 + GPG=$2 + shift shift ;; --gpg-args) @@ -103,7 +104,8 @@ while test $# -gt 0 ; do shift ;; --tar) - TAR=$1 + TAR=$2 + shift shift ;; --tar-args) @@ -126,8 +128,8 @@ while test $# -gt 0 ; do done if test x$create = xyes ; then -# echo "$TAR -cf - "$@" | $GPG --set-filename x.tar $gpg_args" 1>&2 - $TAR -cf - "$@" | $GPG --set-filename x.tar $gpg_args +# echo "$TAR $tar_args -cf - "$@" | $GPG --set-filename x.tar $gpg_args" 1>&2 + $TAR $tar_args -cf - "$@" | $GPG --set-filename x.tar $gpg_args elif test x$list = xyes ; then # echo "cat \"$1\" | $GPG $gpg_args | $TAR $tar_args -tf -" 1>&2 cat "$1" | $GPG $gpg_args | $TAR $tar_args -tf - ----------------------------------------------------------------------- Summary of changes: THOUGHTS | 2 +- doc/gpg.texi | 2 +- tools/gpg-zip.in | 10 ++++++---- 3 files changed, 8 insertions(+), 6 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Wed Nov 2 14:51:47 2016 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Wed, 02 Nov 2016 14:51:47 +0100 Subject: [git] GPGME - branch, master, updated. gpgme-1.7.1-13-gbf9aa0c Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via bf9aa0ccf7b0165aa3a1af2bdb18daca7c02ce74 (commit) via b5c4d56cfdcafade3467be100fca6f1c89ecab73 (commit) via 4149194d2e2f2f4d142926ba4d4efbd336b543f2 (commit) from 8486f213423311174ebff5cba74127cbd9bb3c2a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit bf9aa0ccf7b0165aa3a1af2bdb18daca7c02ce74 Author: Andre Heinecke Date: Wed Nov 2 14:43:44 2016 +0100 qt, cpp: Fix versioning in cmake config and header * configure.ac (VERSION_MAJOR, VERSION_MINOR, VERSION_MICRO): New subst variables for the version header. * lang/cpp/src/GpgmeppConfigVersion.cmake.in, lang/cpp/src/gpgmepp_version.h.in, lang/qt/src/QGpgmeConfigVersion.cmake.in, lang/qt/src/qgpgme_version.h.in: Use new variables. -- Using the LT_* variables was just wrong. Reporting the package version also makes more sense then the library version. Having different versions might make ABI breaks more visible by increasing the major version number, but to have different versions in the same package is too confusing imo and gpgme uses a versioning that is unrelated to the library version number. diff --git a/configure.ac b/configure.ac index 600e8ba..b52f214 100644 --- a/configure.ac +++ b/configure.ac @@ -79,6 +79,10 @@ NEED_LIBASSUAN_VERSION=2.0.2 PACKAGE=$PACKAGE_NAME VERSION=$PACKAGE_VERSION +VERSION_MAJOR=mym4_version_major +VERSION_MINOR=mym4_version_minor +VERSION_MICRO=mym4_version_micro + AC_CONFIG_AUX_DIR([build-aux]) AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_SRCDIR(src/gpgme.h.in) @@ -119,6 +123,9 @@ AC_SUBST(LIBQGPGME_LT_REVISION) AC_SUBST(PACKAGE) AC_SUBST(VERSION) +AC_SUBST(VERSION_MAJOR) +AC_SUBST(VERSION_MINOR) +AC_SUBST(VERSION_MICRO) AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this package]) AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version of this package]) VERSION_NUMBER=m4_esyscmd(printf "0x%02x%02x%02x" mym4_version_major \ diff --git a/lang/cpp/src/GpgmeppConfigVersion.cmake.in b/lang/cpp/src/GpgmeppConfigVersion.cmake.in index 43d6512..259bddd 100644 --- a/lang/cpp/src/GpgmeppConfigVersion.cmake.in +++ b/lang/cpp/src/GpgmeppConfigVersion.cmake.in @@ -19,7 +19,7 @@ # 02111-1307, USA # based on a generated file from cmake. -set(PACKAGE_VERSION "@LIBGPGMEPP_LT_CURRENT at .@LIBGPGMEPP_LT_AGE at .@LIBGPGMEPP_LT_REVISION at .@BUILD_REVISION@") +set(PACKAGE_VERSION "@VERSION_MAJOR at .@VERSION_MINOR at .@VERSION_MICRO@") if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" ) set(PACKAGE_VERSION_COMPATIBLE FALSE) diff --git a/lang/cpp/src/gpgmepp_version.h.in b/lang/cpp/src/gpgmepp_version.h.in index 3c33a30..9cf6aeb 100644 --- a/lang/cpp/src/gpgmepp_version.h.in +++ b/lang/cpp/src/gpgmepp_version.h.in @@ -23,10 +23,9 @@ #ifndef GPGMEPP_VERSION_H #define GPGMEPP_VERSION_H -#define GPGMEPP_VERSION_STRING "@LIBGPGMEPP_LT_CURRENT at .@LIBGPGMEPP_LT_AGE at .@LIBGPGMEPP_LT_REVISION@" -#define GPGMEPP_VERSION_MAJOR @LIBGPGMEPP_LT_CURRENT@ -#define GPGMEPP_VERSION_MINOR @LIBGPGMEPP_LT_AGE@ -#define GPGMEPP_VERSION_PATCH @LIBGPGMEPP_LT_REVISION@ -#define GPGMEPP_VERSION ((@LIBGPGMEPP_LT_CURRENT@<<16)|(@LIBGPGMEPP_LT_AGE@<<8)|(@LIBGPGMEPP_LT_REVISION@)) - +#define GPGMEPP_VERSION_STRING "@VERSION_MAJOR at .@VERSION_MINOR at .@VERSION_MICRO@" +#define GPGMEPP_VERSION_MAJOR @VERSION_MAJOR@ +#define GPGMEPP_VERSION_MINOR @VERSION_MINOR@ +#define GPGMEPP_VERSION_PATCH @VERSION_MICRO@ +#define GPGMEPP_VERSION ((@VERSION_MAJOR@<<16)|(@VERSION_MINOR@<<8)|(@VERSION_MICRO@)) #endif diff --git a/lang/qt/src/QGpgmeConfigVersion.cmake.in b/lang/qt/src/QGpgmeConfigVersion.cmake.in index 04a12cb..549a536 100644 --- a/lang/qt/src/QGpgmeConfigVersion.cmake.in +++ b/lang/qt/src/QGpgmeConfigVersion.cmake.in @@ -19,7 +19,7 @@ # 02111-1307, USA # based on a generated file from cmake. -set(PACKAGE_VERSION "@LIBQGPGME_LT_CURRENT at .@LIBQGPGME_LT_AGE at .@LIBQGPGME_LT_REVISION at .@BUILD_REVISION@") +set(PACKAGE_VERSION "@VERSION_MAJOR at .@VERSION_MINOR at .@VERSION_MICRO@") if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}" ) set(PACKAGE_VERSION_COMPATIBLE FALSE) diff --git a/lang/qt/src/qgpgme_version.h.in b/lang/qt/src/qgpgme_version.h.in index 9fbe965..5ec59a8 100644 --- a/lang/qt/src/qgpgme_version.h.in +++ b/lang/qt/src/qgpgme_version.h.in @@ -23,10 +23,10 @@ #ifndef QGPGME_VERSION_H #define QGPGME_VERSION_H -#define QGPGME_VERSION_STRING "@LIBQGPGME_LT_CURRENT at .@LIBQGPGME_LT_AGE at .@LIBQGPGME_LT_REVISION@" -#define QGPGME_VERSION_MAJOR @LIBQGPGME_LT_CURRENT@ -#define QGPGME_VERSION_MINOR @LIBQGPGME_LT_AGE@ -#define QGPGME_VERSION_PATCH @LIBQGPGME_LT_REVISION@ -#define QGPGME_VERSION ((@LIBQGPGME_LT_CURRENT@<<16)|(@LIBQGPGME_LT_AGE@<<8)|(@LIBQGPGME_LT_REVISION@)) +#define QGPGME_VERSION_STRING "@VERSION_MAJOR at .@VERSION_MINOR at .@VERSION_MICRO@" +#define QGPGME_VERSION_MAJOR @VERSION_MAJOR@ +#define QGPGME_VERSION_MINOR @VERSION_MINOR@ +#define QGPGME_VERSION_PATCH @VERSION_MICRO@ +#define QGPGME_VERSION ((@VERSION_MAJOR@<<16)|(@VERSION_MINOR@<<8)|(@VERSION_MICRO@)) #endif commit b5c4d56cfdcafade3467be100fca6f1c89ecab73 Author: Andre Heinecke Date: Wed Nov 2 14:36:56 2016 +0100 qt: Install cmake config into qgpgme subdir * lang/qt/src/Makefile.am: Install cmake config file in qgpgme subdir. -- Putting it together with Gpgmepp was done for historic reasons but the proper way is for each library to have its own subdir. diff --git a/lang/qt/src/Makefile.am b/lang/qt/src/Makefile.am index e16c489..8742bc8 100644 --- a/lang/qt/src/Makefile.am +++ b/lang/qt/src/Makefile.am @@ -236,16 +236,16 @@ $(camelcase_headers): Makefile.am echo ".h\"" >> "$@" install-cmake-files: QGpgmeConfig.cmake QGpgmeConfigVersion.cmake - -$(INSTALL) -d $(DESTDIR)$(libdir)/cmake/Gpgmepp + -$(INSTALL) -d $(DESTDIR)$(libdir)/cmake/QGpgme $(INSTALL) -m 644 QGpgmeConfig.cmake \ - $(DESTDIR)$(libdir)/cmake/Gpgmepp/QGpgmeConfig.cmake + $(DESTDIR)$(libdir)/cmake/QGpgme/QGpgmeConfig.cmake $(INSTALL) -m 644 QGpgmeConfigVersion.cmake \ - $(DESTDIR)$(libdir)/cmake/Gpgmepp/QGpgmeConfigVersion.cmake + $(DESTDIR)$(libdir)/cmake/QGpgme/QGpgmeConfigVersion.cmake uninstall-cmake-files: - -rm $(DESTDIR)$(libdir)/cmake/Gpgmepp/QGpgmeConfigVersion.cmake - -rm $(DESTDIR)$(libdir)/cmake/Gpgmepp/QGpgmeConfig.cmake - -rmdir $(DESTDIR)$(libdir)/cmake/Gpgmepp/ + -rm $(DESTDIR)$(libdir)/cmake/QGpgme/QGpgmeConfigVersion.cmake + -rm $(DESTDIR)$(libdir)/cmake/QGpgme/QGpgmeConfig.cmake + -rmdir $(DESTDIR)$(libdir)/cmake/QGpgme/ install-data-local: install-cmake-files commit 4149194d2e2f2f4d142926ba4d4efbd336b543f2 Author: Andre Heinecke Date: Wed Nov 2 14:31:35 2016 +0100 qt: Require gpgmepp from cmake config script * lang/qt/src/QGpgmeConfig.cmake.in.in: Require cpp. -- This fixes an error if a user only does find_package(QGpgme) diff --git a/lang/qt/src/QGpgmeConfig.cmake.in.in b/lang/qt/src/QGpgmeConfig.cmake.in.in index 5b6c188..a17a19f 100644 --- a/lang/qt/src/QGpgmeConfig.cmake.in.in +++ b/lang/qt/src/QGpgmeConfig.cmake.in.in @@ -96,3 +96,6 @@ unset(_IMPORT_CHECK_TARGETS) # Commands beyond this point should not need to know the version. set(CMAKE_IMPORT_FILE_VERSION) cmake_policy(POP) + +# Gpgmepp is a requirement for qgpgme +find_package(Gpgmepp CONFIG REQUIRED) ----------------------------------------------------------------------- Summary of changes: configure.ac | 7 +++++++ lang/cpp/src/GpgmeppConfigVersion.cmake.in | 2 +- lang/cpp/src/gpgmepp_version.h.in | 11 +++++------ lang/qt/src/Makefile.am | 12 ++++++------ lang/qt/src/QGpgmeConfig.cmake.in.in | 3 +++ lang/qt/src/QGpgmeConfigVersion.cmake.in | 2 +- lang/qt/src/qgpgme_version.h.in | 10 +++++----- 7 files changed, 28 insertions(+), 19 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Wed Nov 2 14:55:51 2016 From: cvs at cvs.gnupg.org (by Andras Mantia) Date: Wed, 02 Nov 2016 14:55:51 +0100 Subject: [git] GPGME - branch, master, updated. gpgme-1.7.1-14-gb4658f6 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via b4658f6a1110bb0b54bd5dfc9df8e8b390e38d61 (commit) from bf9aa0ccf7b0165aa3a1af2bdb18daca7c02ce74 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit b4658f6a1110bb0b54bd5dfc9df8e8b390e38d61 Author: Andras Mantia Date: Wed Nov 2 11:23:42 2016 +0200 qt: Fix build with g++ 4.8.x * lang/qt/src/defaultkeygenerationjob.cpp (DefaultKeyGenerationJob::start): Explicitly connect pointer in the QPointer. -- Commit message written by Andre Heinecke diff --git a/lang/qt/src/defaultkeygenerationjob.cpp b/lang/qt/src/defaultkeygenerationjob.cpp index d26e824..020f4d2 100644 --- a/lang/qt/src/defaultkeygenerationjob.cpp +++ b/lang/qt/src/defaultkeygenerationjob.cpp @@ -105,11 +105,11 @@ GpgME::Error DefaultKeyGenerationJob::start(const QString &email, const QString d->job = openpgp()->keyGenerationJob(); d->job->installEventFilter(this); - connect(d->job, &KeyGenerationJob::result, + connect(d->job.data(), &KeyGenerationJob::result, this, &DefaultKeyGenerationJob::result); - connect(d->job, &KeyGenerationJob::done, + connect(d->job.data(), &KeyGenerationJob::done, this, &DefaultKeyGenerationJob::done); - connect(d->job, &KeyGenerationJob::done, + connect(d->job.data(), &KeyGenerationJob::done, this, &QObject::deleteLater); return d->job->start(args); } ----------------------------------------------------------------------- Summary of changes: lang/qt/src/defaultkeygenerationjob.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Wed Nov 2 18:02:24 2016 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Wed, 02 Nov 2016 18:02:24 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.1.15-314-g0ed6a6d Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via 0ed6a6df5aa421a9c5cdb1e63867f0deee79af9e (commit) via 488b183811fc25c1ae49b4730491accf1adf518e (commit) from 60ad1a7f37ffc10e601e69a3e2d2bb14af510257 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 0ed6a6df5aa421a9c5cdb1e63867f0deee79af9e Author: Werner Koch Date: Wed Nov 2 17:54:32 2016 +0100 gpgconf: Add command --query-swdb. * tools/gpgconf.c (aQuerySWDB): New. (opts): Add --query-swdb. (valid_swdb_name_p): New. (query_swdb): New. (main): Implement command --query-swdb. -- Right now this command is not very useful because dimngr has not yet been changed to create the swdb.lst. For manual tests the swdb.lst file from the Net can be used with these additional lines: .filedate 20161102T130337 .verified 20161102T150000 diff --git a/doc/tools.texi b/doc/tools.texi index 199b11e..2d2ccef 100644 --- a/doc/tools.texi +++ b/doc/tools.texi @@ -250,6 +250,7 @@ throughout this section. * Listing options:: List all options of a component. * Changing options:: Changing options of a component. * Listing global options:: List all global options. +* Querying versions:: Get and compare software versions. * Files used by gpgconf:: What files are used by gpgconf. @end menu @@ -302,6 +303,13 @@ List the global configuration file in a colon separated format. If Run a syntax check on the global configuration file. If @var{filename} is given, check that file instead. + + at item --query-swdb @var{package_name} [@var{version_string}] +Returns the current version for @var{package_name} and if + at var{version_string} is given also an indicator on whether an update +is available. + + @item --reload [@var{component}] @opindex reload Reload all or the given component. This is basically the same as sending @@ -953,6 +961,80 @@ Unknown record types should be ignored. Note that there is intentionally no feature to change the global option file through @command{gpgconf}. + at node Querying versions + at subsection Get and compare software versions. + +The GnuPG Project operates a server to query the current versions of +software packages related to GnuPG. @command{gpgconf} can be used to +access this online database. To allow for offline operations, this +feature works by having @command{dirmngr} download a file from + at code{https://versions.gnupg.org}, checking the signature of that file +and storing the file in the GnuPG home directory. If + at command{gpgconf} is used and @command{dirmngr} is running, it may ask + at command{dirmngr} to refresh that file before itself uses the file. + +The command @option{--query-swdb} returns information for the given +package in a colon delimited format: + + at table @var + + at item name +This is the name of the package as requested. Note that "gnupg" is a +special name which is replaced by the actual package implementing this +version of GnuPG. For this name it is also not required to specify a +version because @command{gpgconf} takes its own version in this case. + + at item status +The status of the software package according to this table: + at table @code + at item - +No information available. This is either because no current version +has been specified or due to an error. + at item ? +The given name is not known in the online database. + at item u +An update of the software is available. + at item c +The specified version of the software is current. + at item n +The specified version is already newer than the released version. + at end table + + at item urgency +If the value (the empty string should be considered as zero) is +greater than zero an important update is available. + + at item error +This returns an @command{gpg-error} error code to distinguish between +various failure modes. + + at item filedate +This gives the date of the file with the version numbers in standard +ISO format (@code{yyyymmddThhmmss}). The date has been extracted by + at command{dirmngr} from the signature of the file. + + at item verified +This gives the date in ISO format the file was downloaded. This value +can be used to evaluate the freshness of the information. + + at item version +This returns the version string for the requested software from the +file. + + at item reldate +This returns the release date in ISO format. + + at item size +This returns the size of the package as decimal number of bytes. + + at item hash +This returns a hexified SHA-2 hash of the package. + + at end table + + at noindent +More fields may be added in future to the output. + @mansect files @node Files used by gpgconf @@ -965,6 +1047,12 @@ no feature to change the global option file through @command{gpgconf}. If this file exists, it is processed as a global configuration file. A commented example can be found in the @file{examples} directory of the distribution. + + at item @var{GNUPGHOME}/swdb.lst + at cindex swdb.lst + A file with current software versions. @command{dirmngr} creates + this file on demand from an online resource. + @end table diff --git a/tools/gpgconf.c b/tools/gpgconf.c index a1ca79f..1f00418 100644 --- a/tools/gpgconf.c +++ b/tools/gpgconf.c @@ -1,5 +1,6 @@ /* gpgconf.c - Configuration utility for GnuPG * Copyright (C) 2003, 2007, 2009, 2011 Free Software Foundation, Inc. + * Copyright (C) 2016 g10 Code GmbH. * * This file is part of GnuPG. * @@ -52,6 +53,7 @@ enum cmd_and_opt_values aApplyDefaults, aListConfig, aCheckConfig, + aQuerySWDB, aListDirs, aLaunch, aKill, @@ -79,6 +81,8 @@ static ARGPARSE_OPTS opts[] = N_("list global configuration file") }, { aCheckConfig, "check-config", 256, N_("check global configuration file") }, + { aQuerySWDB, "query-swdb", 256, + N_("query the software version database") }, { aReload, "reload", 256, N_("reload all or a given component")}, { aLaunch, "launch", 256, N_("launch a given component")}, { aKill, "kill", 256, N_("kill a given component")}, @@ -203,6 +207,235 @@ list_dirs (estream_t fp, char **names) } + +/* Check whether NAME is valid argument for query_swdb(). Valid names + * start with a letter and contain only alphanumeric characters or an + * underscore. */ +static int +valid_swdb_name_p (const char *name) +{ + if (!name || !*name || !alphap (name)) + return 0; + + for (name++; *name; name++) + if (!alnump (name) && *name != '_') + return 0; + + return 1; +} + + +/* Query the SWDB file. If necessary and possible this functions asks + * the dirmngr to load an updated version of that file. The caller + * needs to provide the NAME to query (e.g. "gnupg", "libgcrypt") and + * optional the currently installed version in CURRENT_VERSION. The + * output written to OUT is a colon delimited line with these fields: + * + * name :: The name of the package + * status :: This value tells the status of the software package + * '-' :: No information available + * (error or CURRENT_VERSION not given) + * '?' :: Unknown NAME + * 'u' :: Update available + * 'c' :: The version is Current + * 'n' :: The current version is already Newer than the + * available one. + * urgency :: If the value is greater than zero an urgent update is required. + * error :: 0 on success or an gpg_err_code_t + * Common codes seen: + * GPG_ERR_TOO_OLD :: The SWDB file is to old to be used. + * GPG_ERR_ENOENT :: The SWDB file is not available. + * GPG_ERR_BAD_SIGNATURE :: Currupted SWDB file. + * filedate:: Date of the swdb file (yyyymmddThhmmss) + * verified:: Date we checked the validity of the file (yyyyymmddThhmmss) + * version :: The version string from the swdb. + * reldate :: Release date of that version (yyyymmddThhmmss) + * size :: Size of the package in bytes. + * hash :: SHA-2 hash of the package. + * + */ +static void +query_swdb (estream_t out, const char *name, const char *current_version) +{ + gpg_error_t err; + const char *search_name; + char *fname = NULL; + estream_t fp = NULL; + char *line = NULL; + char *self_version = NULL; + size_t length_of_line = 0; + size_t maxlen; + ssize_t len; + char *fields[2]; + char *p; + gnupg_isotime_t filedate = {0}; + gnupg_isotime_t verified = {0}; + char *value_ver = NULL; + gnupg_isotime_t value_date = {0}; + char *value_size = NULL; + char *value_sha2 = NULL; + unsigned long value_size_ul; + int status, i; + + + if (!valid_swdb_name_p (name)) + { + log_error ("error in package name '%s': %s\n", + name, gpg_strerror (GPG_ERR_INV_NAME)); + goto leave; + } + if (!strcmp (name, "gnupg")) + search_name = "gnupg21"; + else if (!strcmp (name, "gnupg1")) + search_name = "gnupg1"; + else + search_name = name; + + if (!current_version && !strcmp (name, "gnupg")) + { + /* Use our own version but string a possible beta string. */ + self_version = xstrdup (PACKAGE_VERSION); + p = strchr (self_version, '-'); + if (p) + *p = 0; + current_version = self_version; + } + + if (current_version && compare_version_strings (current_version, NULL)) + { + log_error ("error in version string '%s': %s\n", + current_version, gpg_strerror (GPG_ERR_INV_ARG)); + goto leave; + } + + fname = make_filename (gnupg_homedir (), "swdb.lst", NULL); + fp = es_fopen (fname, "r"); + if (!fp) + { + err = gpg_error_from_syserror (); + es_fprintf (out, "%s:-::%u:::::::\n", name, gpg_err_code (err)); + if (gpg_err_code (err) != GPG_ERR_ENOENT) + log_error (_("error opening '%s': %s\n"), fname, gpg_strerror (err)); + goto leave; + } + + /* Note that the parser uses the first occurance of a matching + * values and ignores possible duplicated values. */ + + maxlen = 2048; /* Set limit. */ + while ((len = es_read_line (fp, &line, &length_of_line, &maxlen)) > 0) + { + if (!maxlen) + { + err = gpg_error (GPG_ERR_LINE_TOO_LONG); + log_error (_("error reading '%s': %s\n"), fname, gpg_strerror (err)); + goto leave; + } + /* Strip newline and carriage return, if present. */ + while (len > 0 && (line[len - 1] == '\n' || line[len - 1] == '\r')) + line[--len] = '\0'; + + if (split_fields (line, fields, DIM (fields)) < DIM(fields)) + continue; /* Skip empty lines and names w/o a value. */ + if (*fields[0] == '#') + continue; /* Skip comments. */ + + /* Record the meta data. */ + if (!*filedate && !strcmp (fields[0], ".filedate")) + { + string2isotime (filedate, fields[1]); + continue; + } + if (!*verified && !strcmp (fields[0], ".verified")) + { + string2isotime (verified, fields[1]); + continue; + } + + /* Tokenize the name. */ + p = strrchr (fields[0], '_'); + if (!p) + continue; /* Name w/o an underscore. */ + *p++ = 0; + + /* Wait for the requested name. */ + if (!strcmp (fields[0], search_name)) + { + if (!strcmp (p, "ver") && !value_ver) + value_ver = xstrdup (fields[1]); + else if (!strcmp (p, "date") && !*value_date) + string2isotime (value_date, fields[1]); + else if (!strcmp (p, "size") && !value_size) + value_size = xstrdup (fields[1]); + else if (!strcmp (p, "sha2") && !value_sha2) + value_sha2 = xstrdup (fields[1]); + } + } + if (len < 0 || es_ferror (fp)) + { + err = gpg_error_from_syserror (); + log_error (_("error reading '%s': %s\n"), fname, gpg_strerror (err)); + goto leave; + } + + if (!*filedate || !*verified) + { + err = gpg_error (GPG_ERR_INV_TIME); + es_fprintf (out, "%s:-::%u:::::::\n", name, gpg_err_code (err)); + goto leave; + } + + if (!value_ver) + { + es_fprintf (out, "%s:?:::::::::\n", name); + goto leave; + } + + if (value_size) + { + gpg_err_set_errno (0); + value_size_ul = strtoul (value_size, &p, 10); + if (errno) + value_size_ul = 0; + else if (*p == 'k') + value_size_ul *= 1024; + } + + err = 0; + status = '-'; + if (compare_version_strings (value_ver, NULL)) + err = gpg_error (GPG_ERR_INV_VALUE); + else if (!current_version) + ; + else if (!(i = compare_version_strings (value_ver, current_version))) + status = 'c'; + else if (i > 0) + status = 'u'; + else + status = 'n'; + + es_fprintf (out, "%s:%c::%d:%s:%s:%s:%s:%lu:%s:\n", + name, + status, + err, + filedate, + verified, + value_ver, + value_date, + value_size_ul, + value_sha2? value_sha2 : ""); + + leave: + xfree (value_ver); + xfree (value_size); + xfree (value_sha2); + xfree (line); + es_fclose (fp); + xfree (fname); + xfree (self_version); +} + + /* gpgconf main. */ int main (int argc, char **argv) @@ -250,6 +483,7 @@ main (int argc, char **argv) case aApplyDefaults: case aListConfig: case aCheckConfig: + case aQuerySWDB: case aReload: case aLaunch: case aKill: @@ -417,6 +651,18 @@ main (int argc, char **argv) list_dirs (outfp, argc? argv : NULL); break; + case aQuerySWDB: + /* Query the software version database. */ + if (!fname || argc > 2) + { + es_fprintf (es_stderr, "usage: %s --query-swdb NAME [VERSION]\n", + GPGCONF_NAME); + exit (2); + } + get_outfp (&outfp); + query_swdb (outfp, fname, argc > 1? argv[1] : NULL); + break; + case aCreateSocketDir: { char *socketdir; commit 488b183811fc25c1ae49b4730491accf1adf518e Author: Werner Koch Date: Wed Nov 2 16:24:58 2016 +0100 common: Improve compare_string_versions. * common/stringhelp.c: Include limits.h. (compare_version_strings): Change semantics to behave like strcmp. Include the patch lebel in the comparison. Allow checking a single version string. * common/t-stringhelp.c (test_compare_version_strings): Adjust test vectors and a few new vectors. * g10/call-agent.c (warn_version_mismatch): Adjust to new sematics. * g10/call-dirmngr.c (warn_version_mismatch): Ditto. * sm/call-agent.c (warn_version_mismatch): Ditto. * sm/call-dirmngr.c (warn_version_mismatch): Ditto. Signed-off-by: Werner Koch diff --git a/common/stringhelp.c b/common/stringhelp.c index b5d9f4c..f494bc5 100644 --- a/common/stringhelp.c +++ b/common/stringhelp.c @@ -49,6 +49,7 @@ # include #endif #include +#include #include "util.h" #include "common-defs.h" @@ -1356,9 +1357,9 @@ parse_version_number (const char *s, int *number) /* This function breaks up the complete string-representation of the version number S, which is of the following struture: ... The major, - minor and micro number components will be stored in *MAJOR, *MINOR - and *MICRO. + number>.[.]. The major, + minor, and micro number components will be stored in *MAJOR, *MINOR + and *MICRO. If MICRO is not given 0 is used instead. On success, the last component, the patch level, will be returned; in failure, NULL will be returned. */ @@ -1385,32 +1386,50 @@ parse_version_string (const char *s, int *major, int *minor, int *micro) } -/* Check that the version string MY_VERSION is greater or equal than - REQ_VERSION. Returns true if the condition is satisfied or false - if not. This works with 3 part and two part version strings; for a - two part version string the micor part is assumed to be 0. */ +/* Compare the version string MY_VERSION to the version string + * REQ_VERSION. Returns -1, 0, or 1 if MY_VERSION is found, + * respectively, to be less than, to match, or be greater than + * REQ_VERSION. This function works for three and two part version + * strings; for a two part version string the micro part is assumed to + * be 0. Patch levels are compared as strings. If a version number + * is invalid INT_MIN is returned. If REQ_VERSION is given as NULL + * the function returns 0 if MY_VERSION is parsable version string. */ int compare_version_strings (const char *my_version, const char *req_version) { int my_major, my_minor, my_micro; int rq_major, rq_minor, rq_micro; - - if (!my_version || !req_version) - return 0; - - if (!parse_version_string (my_version, &my_major, &my_minor, &my_micro)) - return 0; - if (!parse_version_string(req_version, &rq_major, &rq_minor, &rq_micro)) - return 0; - - if (my_major > rq_major - || (my_major == rq_major && my_minor > rq_minor) - || (my_major == rq_major && my_minor == rq_minor - && my_micro >= rq_micro)) + const char *my_patch, *rq_patch; + int result; + + if (!my_version) + return INT_MIN; + + my_patch = parse_version_string (my_version, &my_major, &my_minor, &my_micro); + if (!my_patch) + return INT_MIN; + if (!req_version) + return 0; /* MY_VERSION can be parsed. */ + rq_patch = parse_version_string (req_version, &rq_major, &rq_minor,&rq_micro); + if (!rq_patch) + return INT_MIN; + + if (my_major == rq_major) { - return 1; + if (my_minor == rq_minor) + { + if (my_micro == rq_micro) + result = strcmp (my_patch, rq_patch); + else + result = my_micro - rq_micro; + } + else + result = my_minor - rq_minor; } - return 0; + else + result = my_major - rq_major; + + return !result? 0 : result < 0 ? -1 : 1; } diff --git a/common/t-stringhelp.c b/common/t-stringhelp.c index ccadf02..93b014a 100644 --- a/common/t-stringhelp.c +++ b/common/t-stringhelp.c @@ -40,6 +40,7 @@ #endif #include #include +#include #include "t-support.h" #include "stringhelp.h" @@ -903,45 +904,63 @@ static void test_compare_version_strings (void) { struct { const char *a; const char *b; int okay; } tests[] = { - { "1.0.0", "1.0.0", 1 }, + { "1.0.0", "1.0.0", 0 }, { "1.0.0-", "1.0.0", 1 }, { "1.0.0-1", "1.0.0", 1 }, { "1.0.0.1", "1.0.0", 1 }, - { "1.0.0", "1.0.1", 0 }, - { "1.0.0-", "1.0.1", 0 }, - { "1.0.0-1", "1.0.1", 0 }, - { "1.0.0.1", "1.0.1", 0 }, - { "1.0.0", "1.1.0", 0 }, - { "1.0.0-", "1.1.0", 0 }, - { "1.0.0-1", "1.1.0", 0 }, - { "1.0.0.1", "1.1.0", 0 }, - - { "1.0.0", "1.0.0-", 1 }, - { "1.0.0", "1.0.0-1", 1 }, - { "1.0.0", "1.0.0.1", 1 }, + { "1.0.0", "1.0.1", -1 }, + { "1.0.0-", "1.0.1", -1 }, + { "1.0.0-1", "1.0.1", -1 }, + { "1.0.0.1", "1.0.1", -1 }, + { "1.0.0", "1.1.0", -1 }, + { "1.0.0-", "1.1.0", -1 }, + { "1.0.0-1", "1.1.0", -1 }, + { "1.0.0.1", "1.1.0", -1 }, + + { "1.0.0", "1.0.0-", -1 }, + { "1.0.0", "1.0.0-1", -1 }, + { "1.0.0", "1.0.0.1", -1 }, { "1.1.0", "1.0.0", 1 }, { "1.1.1", "1.1.0", 1 }, - { "1.1.2", "1.1.2", 1 }, + { "1.1.2", "1.1.2", 0 }, { "1.1.2", "1.0.2", 1 }, { "1.1.2", "0.0.2", 1 }, - { "1.1.2", "1.1.3", 0 }, + { "1.1.2", "1.1.3", -1 }, { "0.99.1", "0.9.9", 1 }, - { "0.9.1", "0.91.0", 0 }, + { "0.9.1", "0.91.0", -1 }, { "1.5.3", "1.5", 1 }, - { "1.5.0", "1.5", 1 }, - { "1.4.99", "1.5", 0 }, + { "1.5.0", "1.5", 0 }, + { "1.4.99", "1.5", -1 }, { "1.5", "1.4.99", 1 }, - { "1.5", "1.5.0", 1 }, - { "1.5", "1.5.1", 0 }, + { "1.5", "1.5.0", 0 }, + { "1.5", "1.5.1", -1 }, { "1.5.3-x17", "1.5-23", 1 }, { "1.5.3a", "1.5.3", 1 }, - { "1.5.3a", "1.5.3b", 1 }, - - { NULL, NULL, 0 } + { "1.5.3a", "1.5.3b", -1 }, + + { "3.1.4-ab", "3.1.4-ab", 0 }, + { "3.1.4-ab", "3.1.4-ac", -1 }, + { "3.1.4-ac", "3.1.4-ab", 1 }, + { "3.1.4-ab", "3.1.4-abb", -1 }, + { "3.1.4-abb", "3.1.4-ab", 1 }, + + { "", "", INT_MIN }, + { NULL, "", INT_MIN }, + { "1.2.3", "", INT_MIN }, + { "1.2.3", "2", INT_MIN }, + + /* Test cases for validity of A. */ + { "", NULL, INT_MIN }, + { "1", NULL, INT_MIN }, + { "1.", NULL, 0 }, + { "1.0", NULL, 0 }, + { "1.0.", NULL, 0 }, + { "a1.2", NULL, INT_MIN }, + { NULL, NULL, INT_MIN } }; int idx; int res; diff --git a/g10/call-agent.c b/g10/call-agent.c index b17a80f..eeea7bf 100644 --- a/g10/call-agent.c +++ b/g10/call-agent.c @@ -195,7 +195,7 @@ warn_version_mismatch (assuan_context_t ctx, const char *servername, int mode) if (err) log_error (_("error getting version from '%s': %s\n"), servername, gpg_strerror (err)); - else if (!compare_version_strings (serverversion, myversion)) + else if (compare_version_strings (serverversion, myversion) < 0) { char *warn; diff --git a/g10/call-dirmngr.c b/g10/call-dirmngr.c index f739833..66db357 100644 --- a/g10/call-dirmngr.c +++ b/g10/call-dirmngr.c @@ -145,7 +145,7 @@ warn_version_mismatch (assuan_context_t ctx, const char *servername) if (err) log_error (_("error getting version from '%s': %s\n"), servername, gpg_strerror (err)); - else if (!compare_version_strings (serverversion, myversion)) + else if (compare_version_strings (serverversion, myversion) < 0) { char *warn; diff --git a/sm/call-agent.c b/sm/call-agent.c index c0a2081..c9a210f 100644 --- a/sm/call-agent.c +++ b/sm/call-agent.c @@ -97,7 +97,7 @@ warn_version_mismatch (ctrl_t ctrl, assuan_context_t ctx, if (err) log_error (_("error getting version from '%s': %s\n"), servername, gpg_strerror (err)); - else if (!compare_version_strings (serverversion, myversion)) + else if (compare_version_strings (serverversion, myversion) < 0) { char *warn; diff --git a/sm/call-dirmngr.c b/sm/call-dirmngr.c index 03c9a68..6d7053c 100644 --- a/sm/call-dirmngr.c +++ b/sm/call-dirmngr.c @@ -163,7 +163,7 @@ warn_version_mismatch (ctrl_t ctrl, assuan_context_t ctx, if (err) log_error (_("error getting version from '%s': %s\n"), servername, gpg_strerror (err)); - else if (!compare_version_strings (serverversion, myversion)) + else if (compare_version_strings (serverversion, myversion) < 0) { char *warn; ----------------------------------------------------------------------- Summary of changes: common/stringhelp.c | 63 ++++++++----- common/t-stringhelp.c | 65 ++++++++----- doc/tools.texi | 88 ++++++++++++++++++ g10/call-agent.c | 2 +- g10/call-dirmngr.c | 2 +- sm/call-agent.c | 2 +- sm/call-dirmngr.c | 2 +- tools/gpgconf.c | 246 ++++++++++++++++++++++++++++++++++++++++++++++++++ 8 files changed, 421 insertions(+), 49 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Thu Nov 3 09:33:52 2016 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Thu, 03 Nov 2016 09:33:52 +0100 Subject: [git] GPGME - branch, master, updated. gpgme-1.7.1-15-g0c2038c Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 0c2038c0043c1e79547b55e79c3d3e267dae801c (commit) from b4658f6a1110bb0b54bd5dfc9df8e8b390e38d61 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 0c2038c0043c1e79547b55e79c3d3e267dae801c Author: Werner Koch Date: Thu Nov 3 09:31:30 2016 +0100 core: Make use of --homedir in gpgconf. * src/engine-gpgconf.c (struct engine_gpgconf): Add field 'version'. (have_gpgconf_version): New. (gpgconf_release): Free VERSION. (gpgconf_new): Set VERSION. (gpgconf_read, gpgconf_write): Use --homedir with recent gnupg. Signed-off-by: Werner Koch diff --git a/src/engine-gpgconf.c b/src/engine-gpgconf.c index 90f32c7..271a4dd 100644 --- a/src/engine-gpgconf.c +++ b/src/engine-gpgconf.c @@ -52,11 +52,20 @@ struct engine_gpgconf { char *file_name; char *home_dir; + char *version; }; typedef struct engine_gpgconf *engine_gpgconf_t; +/* Return true if the engine's version is at least VERSION. */ +static int +have_gpgconf_version (engine_gpgconf_t gpgconf, const char *version) +{ + return _gpgme_compare_versions (gpgconf->version, version); +} + + static char * gpgconf_get_version (const char *file_name) { @@ -84,6 +93,8 @@ gpgconf_release (void *engine) free (gpgconf->file_name); if (gpgconf->home_dir) free (gpgconf->home_dir); + if (gpgconf->version) + free (gpgconf->version); free (gpgconf); } @@ -96,8 +107,6 @@ gpgconf_new (void **engine, const char *file_name, const char *home_dir, gpgme_error_t err = 0; engine_gpgconf_t gpgconf; - (void)version; /* Not yet used. */ - gpgconf = calloc (1, sizeof *gpgconf); if (!gpgconf) return gpg_error_from_syserror (); @@ -114,6 +123,13 @@ gpgconf_new (void **engine, const char *file_name, const char *home_dir, err = gpg_error_from_syserror (); } + if (!err && version) + { + gpgconf->version = strdup (version); + if (!gpgconf->version) + err = gpg_error_from_syserror (); + } + if (err) gpgconf_release (gpgconf); else @@ -209,7 +225,8 @@ gpgconf_read (void *engine, const char *arg1, char *arg2, char *linebuf; size_t linebufsize; int linelen; - char *argv[4] = { NULL /* file_name */, NULL, NULL, NULL }; + char *argv[6]; + int argc = 0; int rp[2]; struct spawn_fd_item_s cfd[] = { {-1, 1 /* STDOUT_FILENO */, -1, 0}, {-1, -1} }; @@ -217,14 +234,19 @@ gpgconf_read (void *engine, const char *arg1, char *arg2, int nread; char *mark = NULL; - argv[1] = (char*)arg1; - argv[2] = arg2; - + /* _gpgme_engine_new guarantees that this is not NULL. */ + argv[argc++] = gpgconf->file_name; - /* FIXME: Deal with engine->home_dir. */ + if (gpgconf->home_dir && have_gpgconf_version (gpgconf, "2.1.13")) + { + argv[argc++] = (char*)"--homedir"; + argv[argc++] = gpgconf->home_dir; + } - /* _gpgme_engine_new guarantees that this is not NULL. */ - argv[0] = gpgconf->file_name; + argv[argc++] = (char*)arg1; + argv[argc++] = arg2; + argv[argc] = NULL; + assert (argc < DIM (argv)); if (_gpgme_io_pipe (rp, 1) < 0) return gpg_error_from_syserror (); @@ -685,16 +707,26 @@ gpgconf_write (void *engine, const char *arg1, char *arg2, gpgme_data_t conf) #define BUFLEN 1024 char buf[BUFLEN]; int buflen = 0; - char *argv[] = { NULL /* file_name */, (char*)arg1, arg2, 0 }; + char *argv[6]; + int argc = 0; int rp[2]; struct spawn_fd_item_s cfd[] = { {-1, 0 /* STDIN_FILENO */}, {-1, -1} }; int status; int nwrite; - /* FIXME: Deal with engine->home_dir. */ - /* _gpgme_engine_new guarantees that this is not NULL. */ - argv[0] = gpgconf->file_name; + argv[argc++] = gpgconf->file_name; + + if (gpgconf->home_dir && have_gpgconf_version (gpgconf, "2.1.13")) + { + argv[argc++] = (char*)"--homedir"; + argv[argc++] = gpgconf->home_dir; + } + + argv[argc++] = (char*)arg1; + argv[argc++] = arg2; + argv[argc] = NULL; + assert (argc < DIM (argv)); if (_gpgme_io_pipe (rp, 0) < 0) return gpg_error_from_syserror (); ----------------------------------------------------------------------- Summary of changes: src/engine-gpgconf.c | 58 ++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 45 insertions(+), 13 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Thu Nov 3 10:09:41 2016 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Thu, 03 Nov 2016 10:09:41 +0100 Subject: [git] GPGME - branch, master, updated. gpgme-1.7.1-16-g34a4e80 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 34a4e8017be452e8ead6b9c2da84be1ec7929cae (commit) from 0c2038c0043c1e79547b55e79c3d3e267dae801c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 34a4e8017be452e8ead6b9c2da84be1ec7929cae Author: Andre Heinecke Date: Thu Nov 3 09:40:00 2016 +0100 qt: Change license of export / version header * lang/qt/src/qgpgme_export.h, lang/qt/src/qgpgme_version.h: Change license to GPLv2+ -- These files were based on copies from the cpp version/export headers. This change is meant to clarify the licensing by bringing it in line with the overall licesense of the qgpgme library. diff --git a/lang/qt/src/qgpgme_export.h b/lang/qt/src/qgpgme_export.h index ceb3888..48296f7 100644 --- a/lang/qt/src/qgpgme_export.h +++ b/lang/qt/src/qgpgme_export.h @@ -1,22 +1,32 @@ -/*qgpgme_export.h - Export macros for qgpgme - Copyright (C) 2016, Intevation GmbH +/* qgpgme_export.h - Export macros for qgpgme - This file is part of GPGME++. + This file is part of qgpgme, the Qt API binding for gpgme + Copyright (c) 2016 Intevation GmbH - GPGME++ is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. + QGpgME is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 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 Library General Public License for more details. + QGpgME 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 + General Public License for more details. - You should have received a copy of the GNU Library General Public License - along with GPGME++; see the file COPYING.LIB. If not, write to the - Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + In addition, as a special exception, the copyright holders give + permission to link the code of this program with any edition of + the Qt library by Trolltech AS, Norway (or with modified versions + of Qt that use the same license as Qt), and distribute linked + combinations including the two. You must obey the GNU General + Public License in all respects for all of the code used other than + Qt. If you modify this file, you may extend this exception to + your version of the file, but you are not obligated to do so. If + you do not wish to do so, delete this exception statement from + your version. */ #ifndef QGPGME_EXPORT_H diff --git a/lang/qt/src/qgpgme_version.h.in b/lang/qt/src/qgpgme_version.h.in index 5ec59a8..1bc5694 100644 --- a/lang/qt/src/qgpgme_version.h.in +++ b/lang/qt/src/qgpgme_version.h.in @@ -1,22 +1,32 @@ -/*qgpgme_version.h - Version macros for qgpgme - Copyright (C) 2016, Intevation 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 Library General Public - License as published by the Free Software Foundation; either - version 2 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 Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with GPGME++; see the file COPYING.LIB. If not, write to the - Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. +/* qgpgme_version.h - Version macros for qgpgme + + This file is part of qgpgme, the Qt API binding for gpgme + Copyright (c) 2016 Intevation GmbH + + QGpgME is free software; you can redistribute it and/or + modify it under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2 of the + License, or (at your option) any later version. + + QGpgME 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 + General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + + In addition, as a special exception, the copyright holders give + permission to link the code of this program with any edition of + the Qt library by Trolltech AS, Norway (or with modified versions + of Qt that use the same license as Qt), and distribute linked + combinations including the two. You must obey the GNU General + Public License in all respects for all of the code used other than + Qt. If you modify this file, you may extend this exception to + your version of the file, but you are not obligated to do so. If + you do not wish to do so, delete this exception statement from + your version. */ ----------------------------------------------------------------------- Summary of changes: lang/qt/src/qgpgme_export.h | 40 +++++++++++++++++++++------------- lang/qt/src/qgpgme_version.h.in | 48 +++++++++++++++++++++++++---------------- 2 files changed, 54 insertions(+), 34 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Thu Nov 3 11:01:01 2016 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Thu, 03 Nov 2016 11:01:01 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.1.15-315-gd10b67b Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via d10b67b9bc32e8feff1be86e6646fc23e58fe45d (commit) from 0ed6a6df5aa421a9c5cdb1e63867f0deee79af9e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit d10b67b9bc32e8feff1be86e6646fc23e58fe45d Author: Werner Koch Date: Thu Nov 3 10:58:19 2016 +0100 gpgconf: Add a new field to the --query-swdb output. * tools/gpgconf.c (query_swdb): Insert new field with the installed version. Check that the supplied version does not contain a colon. Signed-off-by: Werner Koch diff --git a/doc/tools.texi b/doc/tools.texi index 2d2ccef..6e578a3 100644 --- a/doc/tools.texi +++ b/doc/tools.texi @@ -984,6 +984,11 @@ special name which is replaced by the actual package implementing this version of GnuPG. For this name it is also not required to specify a version because @command{gpgconf} takes its own version in this case. + at item iversion +The currently installed version or an empty string. The value is +taken from the command line argument but may be provided by gpg +if not given. + @item status The status of the software package according to this table: @table @code @@ -995,9 +1000,9 @@ The given name is not known in the online database. @item u An update of the software is available. @item c -The specified version of the software is current. +The installed version of the software is current. @item n -The specified version is already newer than the released version. +The installed version is already newer than the released version. @end table @item urgency diff --git a/tools/gpgconf.c b/tools/gpgconf.c index 1f00418..e43f49d 100644 --- a/tools/gpgconf.c +++ b/tools/gpgconf.c @@ -232,6 +232,7 @@ valid_swdb_name_p (const char *name) * output written to OUT is a colon delimited line with these fields: * * name :: The name of the package + * curvers:: The installed version if given. * status :: This value tells the status of the software package * '-' :: No information available * (error or CURRENT_VERSION not given) @@ -301,7 +302,8 @@ query_swdb (estream_t out, const char *name, const char *current_version) current_version = self_version; } - if (current_version && compare_version_strings (current_version, NULL)) + if (current_version && (strchr (current_version, ':') + || compare_version_strings (current_version, NULL))) { log_error ("error in version string '%s': %s\n", current_version, gpg_strerror (GPG_ERR_INV_ARG)); @@ -313,7 +315,10 @@ query_swdb (estream_t out, const char *name, const char *current_version) if (!fp) { err = gpg_error_from_syserror (); - es_fprintf (out, "%s:-::%u:::::::\n", name, gpg_err_code (err)); + es_fprintf (out, "%s:%s:-::%u:::::::\n", + name, + current_version? current_version : "", + gpg_err_code (err)); if (gpg_err_code (err) != GPG_ERR_ENOENT) log_error (_("error opening '%s': %s\n"), fname, gpg_strerror (err)); goto leave; @@ -381,13 +386,18 @@ query_swdb (estream_t out, const char *name, const char *current_version) if (!*filedate || !*verified) { err = gpg_error (GPG_ERR_INV_TIME); - es_fprintf (out, "%s:-::%u:::::::\n", name, gpg_err_code (err)); + es_fprintf (out, "%s:%s:-::%u:::::::\n", + name, + current_version? current_version : "", + gpg_err_code (err)); goto leave; } if (!value_ver) { - es_fprintf (out, "%s:?:::::::::\n", name); + es_fprintf (out, "%s:%s:?:::::::::\n", + name, + current_version? current_version : ""); goto leave; } @@ -414,8 +424,9 @@ query_swdb (estream_t out, const char *name, const char *current_version) else status = 'n'; - es_fprintf (out, "%s:%c::%d:%s:%s:%s:%s:%lu:%s:\n", + es_fprintf (out, "%s:%s:%c::%d:%s:%s:%s:%s:%lu:%s:\n", name, + current_version? current_version : "", status, err, filedate, ----------------------------------------------------------------------- Summary of changes: doc/tools.texi | 9 +++++++-- tools/gpgconf.c | 21 ++++++++++++++++----- 2 files changed, 23 insertions(+), 7 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Thu Nov 3 15:07:48 2016 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Thu, 03 Nov 2016 15:07:48 +0100 Subject: [git] GpgOL - branch, nomapi, updated. gpgol-1.4.0-135-gada53e4 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG extension for MS Outlook". The branch, nomapi has been updated via ada53e40e5c3907e8ae9539bd3212b57b48aba43 (commit) via 51e12dd2dddcdf91031b4f7eee0cfafbbd5a68ef (commit) via 86b7dcc999038425993dd0ed6b45df50d20a6831 (commit) via 4f2b76c0e1d4bb84e477dbf3fea1f6d23873e3de (commit) via 9a2ef44b0e36537cb91a35a107809a80f46bf499 (commit) via 80e972f8b4260c619c9eaea8c1762917a20c7a33 (commit) via 920a9c0d1a29a3d73b902d15ff6bd061ae414052 (commit) from 1d734d5938224e02236245223cf925a61563e2fc (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit ada53e40e5c3907e8ae9539bd3212b57b48aba43 Author: Andre Heinecke Date: Thu Nov 3 14:46:57 2016 +0100 Add explorer and explorers event handler * explorer-events.cpp: New. Invalidate ui on selection change. * explorers-events.cpp: New. Install event handler for new explorers. * gpgoladdin.cpp (GpgolAddin::~GpgolAddin): Release explorers event handler. (install_explorer_sinks): Install explorers and explorer event handler. (GpgolAddin::OnStartupComplete): call install_explorer_sinks -- This fixes the problem that without another read by outlook the state of the ui might not have matched to the signature state, which is critical as it may have shown the wrong sigstate. diff --git a/src/explorer-events.cpp b/src/explorer-events.cpp new file mode 100644 index 0000000..f48f6ac --- /dev/null +++ b/src/explorer-events.cpp @@ -0,0 +1,91 @@ +/* explorer-events.cpp - Event handling for the application. + * Copyright (C) 2016 Intevation GmbH + * + * This file is part of GpgOL. + * + * GpgOL 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. + * + * GpgOL 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 . + */ + +/* The event handler classes defined in this file follow the + general pattern that they implment the IDispatch interface + through the eventsink macros and handle event invocations + in their invoke methods. +*/ +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "eventsink.h" +#include "ocidl.h" +#include "common.h" +#include "oomhelp.h" +#include "mail.h" +#include "gpgoladdin.h" + +/* Explorer Events */ +BEGIN_EVENT_SINK(ExplorerEvents, IDispatch) +EVENT_SINK_DEFAULT_CTOR(ExplorerEvents) +EVENT_SINK_DEFAULT_DTOR(ExplorerEvents) +typedef enum + { + Activate = 0xF001, + AttachmentSelectionChange = 0xFC79, + BeforeFolderSwitch = 0xF003, + BeforeItemCopy = 0xFA0E, + BeforeItemCut = 0xFA0F, + BeforeItemPaste = 0xFA10, + BeforeMaximize = 0xFA11, + BeforeMinimize = 0xFA12, + BeforeMove = 0xFA13, + BeforeSize = 0xFA14, + BeforeViewSwitch = 0xF005, + Close = 0xF008, + Deactivate = 0xF006, + DisplayModeChange = 0xFC98, + FolderSwitch = 0xF002, + InlineResponse = 0xFC92, + InlineResponseClose = 0xFC96, + SelectionChange = 0xF007, + ViewSwitch = 0xF004 + } ExplorerEvent; + +EVENT_SINK_INVOKE(ExplorerEvents) +{ + USE_INVOKE_ARGS + switch(dispid) + { + case SelectionChange: + { + log_oom_extra ("%s:%s: Selection change in explorer: %p", + SRCNAME, __func__, this); + gpgoladdin_invalidate_ui (); + break; + } + case Close: + { + log_oom_extra ("%s:%s: Deleting event handler: %p", + SRCNAME, __func__, this); + delete this; + return S_OK; + } + default: + break; +#if 0 + log_oom_extra ("%s:%s: Unhandled Event: %lx \n", + SRCNAME, __func__, dispid); +#endif + } + return S_OK; +} +END_EVENT_SINK(ExplorerEvents, IID_ExplorerEvents) diff --git a/src/explorers-events.cpp b/src/explorers-events.cpp new file mode 100644 index 0000000..476e11e --- /dev/null +++ b/src/explorers-events.cpp @@ -0,0 +1,76 @@ +/* explorer-events.cpp - Event handling for the application. + * Copyright (C) 2016 Intevation GmbH + * + * This file is part of GpgOL. + * + * GpgOL 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. + * + * GpgOL 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 . + */ + +/* The event handler classes defined in this file follow the + general pattern that they implment the IDispatch interface + through the eventsink macros and handle event invocations + in their invoke methods. +*/ +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "eventsink.h" +#include "eventsinks.h" +#include "ocidl.h" +#include "common.h" +#include "oomhelp.h" +#include "mail.h" +#include "gpgoladdin.h" + +/* Explorers Events */ +BEGIN_EVENT_SINK(ExplorersEvents, IDispatch) +EVENT_SINK_DEFAULT_CTOR(ExplorersEvents) +EVENT_SINK_DEFAULT_DTOR(ExplorersEvents) +typedef enum + { + NewExplorer = 0xF001, + } ExplorersEvent; + +/* Don't confuse with ExplorerEvents. ExplorerEvents is + the actual event sink for explorer events. This just + ensures that we create such a sink for each new explorer. */ +EVENT_SINK_INVOKE(ExplorersEvents) +{ + USE_INVOKE_ARGS + switch(dispid) + { + case NewExplorer: + { + if (parms->cArgs != 1 || !(parms->rgvarg[0].vt & VT_DISPATCH)) + { + log_debug ("%s:%s: No explorer in new Explorer.", + SRCNAME, __func__); + break; + } + if (!install_ExplorerEvents_sink (parms->rgvarg[0].pdispVal)) + { + log_error ("%s:%s: Failed to install Explorer event sink.", + SRCNAME, __func__); + break; + + } + gpgoladdin_invalidate_ui (); + } + default: + break; + } + return S_OK; +} +END_EVENT_SINK(ExplorersEvents, IID_ExplorersEvents) diff --git a/src/gpgoladdin.cpp b/src/gpgoladdin.cpp index a9623cd..7c0c4e9 100644 --- a/src/gpgoladdin.cpp +++ b/src/gpgoladdin.cpp @@ -171,8 +171,12 @@ STDMETHODIMP GpgolAddinFactory::CreateInstance (LPUNKNOWN punk, REFIID riid, The ref count is set by the factory after creation. */ -GpgolAddin::GpgolAddin (void) : m_lRef(0), m_application(0), - m_addin(0), m_applicationEventSink(0), m_disabled(false) +GpgolAddin::GpgolAddin (void) : m_lRef(0), + m_application(nullptr), + m_addin(nullptr), + m_applicationEventSink(nullptr), + m_explorersEventSink(nullptr), + m_disabled(false) { read_options (); use_mime_ui = opt.mime_ui; @@ -190,6 +194,7 @@ GpgolAddin::~GpgolAddin (void) } log_debug ("%s:%s: Releasing Application Event Sink;", SRCNAME, __func__); + gpgol_release (m_explorersEventSink); gpgol_release (m_applicationEventSink); engine_deinit (); @@ -361,6 +366,50 @@ check_html_preferred() } } +static LPDISPATCH +install_explorer_sinks (LPDISPATCH application) +{ + + LPDISPATCH explorers = get_oom_object (application, "Explorers"); + + if (!explorers) + { + log_error ("%s:%s: No explorers object", + SRCNAME, __func__); + return nullptr; + } + int count = get_oom_int (explorers, "Count"); + + for (int i = 1; i <= count; i++) + { + std::string item = "Item("; + item += std::to_string (i) + ")"; + LPDISPATCH explorer = get_oom_object (explorers, item.c_str()); + if (!explorer) + { + log_error ("%s:%s: failed to get explorer %i", + SRCNAME, __func__, i); + continue; + } + /* Explorers delete themself in the close event of the explorer. */ + LPDISPATCH sink = install_ExplorerEvents_sink (explorer); + if (!sink) + { + log_error ("%s:%s: failed to create eventsink for explorer %i", + SRCNAME, __func__, i); + + } + else + { + log_oom_extra ("%s:%s: created sink %p for explorer %i", + SRCNAME, __func__, sink, i); + } + gpgol_release (explorer); + } + /* Now install the event sink to handle new explorers */ + return install_ExplorersEvents_sink (explorers); +} + STDMETHODIMP GpgolAddin::OnStartupComplete (SAFEARRAY** custom) { @@ -386,7 +435,8 @@ GpgolAddin::OnStartupComplete (SAFEARRAY** custom) ensure_category_exists (m_application, decCategory, 8); ensure_category_exists (m_application, verifyCategory, 5); install_forms (); - m_applicationEventSink = install_ApplicationEvents_sink(m_application); + m_applicationEventSink = install_ApplicationEvents_sink (m_application); + m_explorersEventSink = install_explorer_sinks (m_application); check_html_preferred (); return S_OK; } diff --git a/src/gpgoladdin.h b/src/gpgoladdin.h index d201b75..a871348 100644 --- a/src/gpgoladdin.h +++ b/src/gpgoladdin.h @@ -210,6 +210,7 @@ private: LPDISPATCH m_application; LPDISPATCH m_addin; LPDISPATCH m_applicationEventSink; + LPDISPATCH m_explorersEventSink; LPDISPATCH m_ribbon_control; bool m_disabled; commit 51e12dd2dddcdf91031b4f7eee0cfafbbd5a68ef Author: Andre Heinecke Date: Thu Nov 3 13:39:54 2016 +0100 Add mapi helpers for uuid retrieval * src/mapihelp.cpp, src/mapihelp.h: (get_gpgoluid_tag) (mapi_get_uid): New. -- Used in some experiments regarding UUID structures. diff --git a/src/mapihelp.cpp b/src/mapihelp.cpp index d4407e4..2ebe333 100644 --- a/src/mapihelp.cpp +++ b/src/mapihelp.cpp @@ -281,6 +281,61 @@ get_internetcharsetbody_tag (LPMESSAGE message, ULONG *r_tag) return result; } +/* Return the property tag for GpgOL UUID Info. */ +static int +get_gpgoluid_tag (LPMESSAGE message, ULONG *r_tag) +{ + if (!(*r_tag = create_gpgol_tag (message, L"GpgOL UID", __func__))) + return -1; + *r_tag |= PT_UNICODE; + return 0; +} + +char * +mapi_get_uid (LPDISPATCH mail) +{ + /* If the UUID is not in OOM maybe we find it in mapi. */ + LPMESSAGE msg = get_oom_base_message (mail); + if (!msg) + { + log_debug ("%s:%s: Failed to get message for '%p'", + SRCNAME, __func__, mail); + gpgol_release (msg); + } + ULONG tag; + if (get_gpgoluid_tag (msg, &tag)) + { + log_debug ("%s:%s: Failed to get tag for '%p'", + SRCNAME, __func__, mail); + gpgol_release (msg); + return NULL; + } + LPSPropValue propval = NULL; + HRESULT hr = HrGetOneProp ((LPMAPIPROP)msg, tag, &propval); + gpgol_release (msg); + if (hr) + { + log_debug ("%s:%s: Failed to get prop for '%p'", + SRCNAME, __func__, mail); + return NULL; + } + char *ret = NULL; + if (PROP_TYPE (propval->ulPropTag) == PT_UNICODE) + { + ret = wchar_to_utf8 (propval->Value.lpszW); + log_debug ("%s:%s: Fund uuid in MAPI for %p", + SRCNAME, __func__, mail); + } + else if (PROP_TYPE (propval->ulPropTag) == PT_STRING8) + { + ret = strdup (propval->Value.lpszA); + log_debug ("%s:%s: Fund uuid in MAPI for %p", + SRCNAME, __func__, mail); + } + MAPIFreeBuffer (propval); + return ret; +} + /* A Wrapper around the SaveChanges method. This function should be called indirect through the mapi_save_changes macro. Returns 0 on diff --git a/src/mapihelp.h b/src/mapihelp.h index 63b9d57..9bcd58f 100644 --- a/src/mapihelp.h +++ b/src/mapihelp.h @@ -130,6 +130,8 @@ int mapi_mark_or_create_moss_attach (LPMESSAGE message, msgtype_t msgtype); /* Copy the MAPI body to a PGPBODY type attachment. */ int mapi_body_to_attachment (LPMESSAGE message); + +char * mapi_get_uid (LPDISPATCH mail); #ifdef __cplusplus } #endif commit 86b7dcc999038425993dd0ed6b45df50d20a6831 Author: Andre Heinecke Date: Thu Nov 3 10:50:49 2016 +0100 Allow to reset uuid * src/mail.cpp (Mail::set_uuid): Set uuid even if the mail object already tracks a uuid. * src/oomhelp.cpp (get_unique_id): Extend with uuid param. * src/oomhelp.h: Update accordingly -- This is important if we close with discard changes to set our uuid again after the close. diff --git a/src/mail.cpp b/src/mail.cpp index 2cc7acf..3e2aa88 100644 --- a/src/mail.cpp +++ b/src/mail.cpp @@ -1186,21 +1186,38 @@ Mail::is_signed() int Mail::set_uuid() { + char *uuid; if (!m_uuid.empty()) { - return 0; + /* This codepath is reached by decrypt again after a + close with discard changes. The close discarded + the uuid on the OOM object so we have to set + it again. */ + log_debug ("%s:%s: Resetting uuid for %p to %s", + SRCNAME, __func__, this, + m_uuid.c_str()); + uuid = get_unique_id (m_mailitem, 1, m_uuid.c_str()); + } + else + { + uuid = get_unique_id (m_mailitem, 1, nullptr); } - char *uuid = get_unique_id (m_mailitem, 1); if (!uuid) { - log_debug ("%s:%s: Failed to get uuid for %p", + log_debug ("%s:%s: Failed to get/set uuid for %p", SRCNAME, __func__, m_mailitem); return -1; } - m_uuid = uuid; + if (m_uuid.empty()) + { + m_uuid = uuid; + g_uid_map.insert (std::pair (m_uuid, this)); + log_debug ("%s:%s: uuid for %p is now %s", + SRCNAME, __func__, this, + m_uuid.c_str()); + } xfree (uuid); - g_uid_map.insert (std::pair (m_uuid, this)); return 0; } diff --git a/src/oomhelp.cpp b/src/oomhelp.cpp index 9591f97..bb8df36 100644 --- a/src/oomhelp.cpp +++ b/src/oomhelp.cpp @@ -1603,7 +1603,7 @@ generate_uid () } char * -get_unique_id (LPDISPATCH mail, int create) +get_unique_id (LPDISPATCH mail, int create, const char *uuid) { if (!mail) { @@ -1614,8 +1614,9 @@ get_unique_id (LPDISPATCH mail, int create) char *uid = get_pa_string (mail, GPGOL_UID_DASL); if (!uid) { - log_debug ("%s:%s: No uuid found for '%p'", + log_debug ("%s:%s: No uuid found in oom for '%p'", SRCNAME, __func__, mail); + if (!create) { return NULL; @@ -1627,7 +1628,15 @@ get_unique_id (LPDISPATCH mail, int create) SRCNAME, __func__, uid, mail); return uid; } - char *newuid = generate_uid (); + char *newuid; + if (!uuid) + { + newuid = generate_uid (); + } + else + { + newuid = strdup (uuid); + } int ret = put_pa_string (mail, GPGOL_UID_DASL, newuid); if (ret) diff --git a/src/oomhelp.h b/src/oomhelp.h index f04487b..74e7faf 100644 --- a/src/oomhelp.h +++ b/src/oomhelp.h @@ -290,10 +290,13 @@ remove_category (LPDISPATCH mail, const char *category); a new uuid will be added if none exists and the value of that uuid returned. + The optinal uuid value can be set to be used + as uuid instead of a generated one. + Return value has to be freed by the caller. */ char * -get_unique_id (LPDISPATCH mail, int create); +get_unique_id (LPDISPATCH mail, int create, const char* uuid); #ifdef __cplusplus } commit 4f2b76c0e1d4bb84e477dbf3fea1f6d23873e3de Author: Andre Heinecke Date: Thu Nov 3 10:48:52 2016 +0100 Add close function to Mails * src/mail.cpp (Mail::close): New, close a mail. -- Closing a Mail with discard changes prevents the Save Changes popup without the requirement for a revert. diff --git a/src/mail.cpp b/src/mail.cpp index bc7a985..2cc7acf 100644 --- a/src/mail.cpp +++ b/src/mail.cpp @@ -978,6 +978,35 @@ Mail::close_inspector () return 0; } +int +Mail::close (bool discard) +{ + VARIANT aVariant[1]; + DISPPARAMS dispparams; + + dispparams.rgvarg = aVariant; + dispparams.rgvarg[0].vt = VT_INT; + dispparams.rgvarg[0].intVal = discard ? 1 : 0; + dispparams.cArgs = 1; + dispparams.cNamedArgs = 0; + + int rc = invoke_oom_method_with_parms (m_mailitem, "Close", + NULL, &dispparams); + + /* Reset the uuid after discarding all changes in the oom + so that we can still find ourself. */ + set_uuid (); + + /* Now that we have closed it with discard changes we no + longer need to wipe the mail because the plaintext was + discarded. */ + if (!rc) + { + m_needs_wipe = false; + } + return rc; +} + static const UserID get_uid_for_sender (const Key k, const char *sender) { diff --git a/src/mail.h b/src/mail.h index d150acc..0385fbd 100644 --- a/src/mail.h +++ b/src/mail.h @@ -254,6 +254,10 @@ public: by the caller. */ char ** get_recipients () const; + /** Call close with discard changes true or false + returns the value of the oom call. */ + int close (bool discard); + private: void update_categories (); void update_body (); commit 9a2ef44b0e36537cb91a35a107809a80f46bf499 Author: Andre Heinecke Date: Thu Nov 3 10:47:49 2016 +0100 Add extra debug output for mail destruction * src/mail.cpp (Mail::~Mail): Print uuid in dtor diff --git a/src/mail.cpp b/src/mail.cpp index c03cb3b..bc7a985 100644 --- a/src/mail.cpp +++ b/src/mail.cpp @@ -142,6 +142,8 @@ Mail::~Mail() xfree (m_sender); gpgol_release(m_mailitem); + log_oom_extra ("%s:%s: destroyed: %p uuid: %s", + SRCNAME, __func__, this, m_uuid.c_str()); } Mail * commit 80e972f8b4260c619c9eaea8c1762917a20c7a33 Author: Andre Heinecke Date: Wed Nov 2 11:34:16 2016 +0100 Disable revert all mails on quit * src/application-events.cpp (EVENT_SINK_INVOKE): Disable revert_all_mails. -- Reverting all mails in quit brings outlook into a buggy state in that it syncs the mail endlessly after the next start. diff --git a/src/application-events.cpp b/src/application-events.cpp index dbce53d..f70c44a 100644 --- a/src/application-events.cpp +++ b/src/application-events.cpp @@ -97,7 +97,11 @@ EVENT_SINK_INVOKE(ApplicationEvents) case Quit: { log_debug ("%s:%s: Quit event", SRCNAME, __func__); - Mail::revert_all_mails(); + /* Reverting all mails here can cause outlook to go + into an endless sync state after the next start. + So we can't do it. Needs handling. + Mail::revert_all_mails(); + */ } default: log_oom_extra ("%s:%s: Unhandled Event: %lx \n", commit 920a9c0d1a29a3d73b902d15ff6bd061ae414052 Author: Andre Heinecke Date: Mon Oct 31 12:36:01 2016 +0100 Install forms for InfoPath msg classes. * forms/gpgol-form-encrypted.cfg, forms/gpgol-form-signed.cfg: New. * src/olflange.cpp (install_forms): Install new forms. * src/mimemaker.cpp (finalize_message): Use InfoPath msg classes. -- This fixes that Outlook shows all our Mails as S/MIME signed because we set the S/MIME message class when sending to enable the behavior that it takes the MIME structure from the first attachment. It also fixes the display of reverted mails which was previously wrong. diff --git a/forms/gpgol-form-encrypted.cfg b/forms/gpgol-form-encrypted.cfg new file mode 100644 index 0000000..12f7140 --- /dev/null +++ b/forms/gpgol-form-encrypted.cfg @@ -0,0 +1,34 @@ +[Description] +MessageClass=IPM.Note.InfoPathForm.GpgOL.SMIME.MultipartSigned +DesignerRuntimeGuid={0006F020-0000-0000-C000-000000000046} +CLSID={00061033-0000-0000-C000-000000000046} +DisplayName=Form for GpgOL sent encrypted Mails +Category=Standard +Subcategory=Formular +Comment= +LargeIcon=encr-l.ico +SmallIcon=encr-s.ico +VersionMajor=1 +VersionMinor=0 +Hidden=1 +Owner=Public Domain + +[Properties] + +[Verbs] +Verb1=1 + +[Verb.1] +DisplayName=&Open +Code=0 +Flags=0 +Attribs=2 + +[Extensions] +Extensions1=1 + +[Extension.1] +Type=30 +NmidPropset={00020D0C-0000-0000-C000-000000000046} +NmidInteger=1 +Value=1011111111111111 diff --git a/forms/gpgol-form-signed.cfg b/forms/gpgol-form-signed.cfg new file mode 100644 index 0000000..acb562d --- /dev/null +++ b/forms/gpgol-form-signed.cfg @@ -0,0 +1,34 @@ +[Description] +MessageClass=IPM.Note.InfoPathForm.GpgOLS.SMIME.MultipartSigned +DesignerRuntimeGuid={0006F020-0000-0000-C000-000000000046} +CLSID={00061033-0000-0000-C000-000000000046} +DisplayName=Form for GpgOL sent signed Mails +Category=Standard +Subcategory=Formular +Comment= +LargeIcon=sign-l.ico +SmallIcon=sign-s.ico +VersionMajor=1 +VersionMinor=0 +Hidden=1 +Owner=Public Domain + +[Properties] + +[Verbs] +Verb1=1 + +[Verb.1] +DisplayName=&Open +Code=0 +Flags=0 +Attribs=2 + +[Extensions] +Extensions1=1 + +[Extension.1] +Type=30 +NmidPropset={00020D0C-0000-0000-C000-000000000046} +NmidInteger=1 +Value=1011111111111111 diff --git a/src/mimemaker.cpp b/src/mimemaker.cpp index 39a6a38..edb9980 100644 --- a/src/mimemaker.cpp +++ b/src/mimemaker.cpp @@ -1098,7 +1098,14 @@ finalize_message (LPMESSAGE message, mapi_attach_item_t *att_table, /* Set the message class. */ prop.ulPropTag = PR_MESSAGE_CLASS_A; - prop.Value.lpszA = GpgOLStr ("IPM.Note.SMIME.MultipartSigned"); + if (encrypt) + { + prop.Value.lpszA = GpgOLStr ("IPM.Note.InfoPathForm.GpgOL.SMIME.MultipartSigned"); + } + else + { + prop.Value.lpszA = GpgOLStr ("IPM.Note.InfoPathForm.GpgOLS.SMIME.MultipartSigned"); + } hr = message->SetProps(1, &prop, NULL); if (hr) { diff --git a/src/olflange.cpp b/src/olflange.cpp index 66b5b68..9f51182 100644 --- a/src/olflange.cpp +++ b/src/olflange.cpp @@ -795,6 +795,10 @@ install_forms (void) "gpgol", "gpgol-ms", "gpgol-cs", + /* The InfoPath we use for sending, to get outlook + to do the S/MIME handling. */ + "gpgol-form-signed", + "gpgol-form-encrypted", NULL, }; int formidx; ----------------------------------------------------------------------- Summary of changes: forms/{gpgol.cfg => gpgol-form-encrypted.cfg} | 4 +- forms/{gpgol-cs.cfg => gpgol-form-signed.cfg} | 4 +- src/application-events.cpp | 6 +- src/explorer-events.cpp | 91 +++++++++++++++++++++++++++ src/explorers-events.cpp | 76 ++++++++++++++++++++++ src/gpgoladdin.cpp | 56 ++++++++++++++++- src/gpgoladdin.h | 1 + src/mail.cpp | 58 +++++++++++++++-- src/mail.h | 4 ++ src/mapihelp.cpp | 55 ++++++++++++++++ src/mapihelp.h | 2 + src/mimemaker.cpp | 9 ++- src/olflange.cpp | 4 ++ src/oomhelp.cpp | 15 ++++- src/oomhelp.h | 5 +- 15 files changed, 372 insertions(+), 18 deletions(-) copy forms/{gpgol.cfg => gpgol-form-encrypted.cfg} (81%) copy forms/{gpgol-cs.cfg => gpgol-form-signed.cfg} (81%) create mode 100644 src/explorer-events.cpp create mode 100644 src/explorers-events.cpp hooks/post-receive -- GnuPG extension for MS Outlook http://git.gnupg.org From cvs at cvs.gnupg.org Thu Nov 3 15:08:27 2016 From: cvs at cvs.gnupg.org (by Justus Winter) Date: Thu, 03 Nov 2016 15:08:27 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.1.15-317-gab89164 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via ab89164be02012f1bf159c971853b8610e966301 (commit) via 1ec07cbc209f247fd85704f5701564e31aa56d0b (commit) from d10b67b9bc32e8feff1be86e6646fc23e58fe45d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit ab89164be02012f1bf159c971853b8610e966301 Author: Justus Winter Date: Thu Oct 27 18:48:51 2016 +0200 g10: Improve and unify key selection for -r and --locate-keys. * g10/getkey.c (struct pubkey_cmp_cookie): New type. (key_is_ok, uid_is_ok, subkey_is_ok): New functions. (pubkey_cmp): Likewise. (get_best_pubkey_byname): Likewise. * g10/keydb.h (get_best_pubkey_byname): New prototype. * g10/keylist.c (locate_one): Use the new function. * g10/pkclist.c (find_and_check_key): Likewise. * tests/openpgp/Makefile.am (XTESTS): Add new test. (TEST_FILES): Add new files. * tests/openpgp/key-selection.scm: New file. * tests/openpgp/key-selection/0.asc: Likewise. * tests/openpgp/key-selection/1.asc: Likewise. * tests/openpgp/key-selection/2.asc: Likewise. * tests/openpgp/key-selection/3.asc: Likewise. * tests/openpgp/key-selection/4.asc: Likewise. -- When a name resembling a mail address is given to either --locate-keys or --recipient, rank the search results and use only the most relevant key. This also lets us query which key will be used for encryption using --locate-keys. However, note that --locate-keys may also return keys incapable of encryption, though it will prefer keys that have an encryption subkey. GnuPG-bug-id: 2359 Signed-off-by: Justus Winter diff --git a/g10/getkey.c b/g10/getkey.c index 5ef5fc3..926575d 100644 --- a/g10/getkey.c +++ b/g10/getkey.c @@ -1461,6 +1461,211 @@ get_pubkey_byname (ctrl_t ctrl, GETKEY_CTX * retctx, PKT_public_key * pk, return rc; } + + +/* Comparison machinery for get_best_pubkey_byname. */ + +/* First we have a struct to cache computed information about the key + * in question. */ +struct pubkey_cmp_cookie +{ + int valid; /* Is this cookie valid? */ + PKT_public_key key; /* The key. */ + PKT_user_id *uid; /* The matching UID packet. */ + unsigned int validity; /* Computed validity of (KEY, UID). */ + u32 creation_time; /* Creation time of the newest subkey + capable of encryption. */ +}; + +/* Then we have a series of helper functions. */ +static int +key_is_ok (const PKT_public_key *key) +{ + return ! key->has_expired && ! key->flags.revoked + && key->flags.valid && ! key->flags.disabled; +} + +static int +uid_is_ok (const PKT_public_key *key, const PKT_user_id *uid) +{ + return key_is_ok (key) && ! uid->is_revoked; +} + +static int +subkey_is_ok (const PKT_public_key *sub) +{ + return ! sub->flags.revoked && sub->flags.valid && ! sub->flags.disabled; +} + +/* Finally this function compares a NEW key to the former candidate + * OLD. Returns < 0 if the old key is worse, > 0 if the old key is + * better, == 0 if it is a tie. */ +static int +pubkey_cmp (ctrl_t ctrl, const char *name, struct pubkey_cmp_cookie *old, + struct pubkey_cmp_cookie *new, KBNODE new_keyblock) +{ + KBNODE n; + + new->creation_time = 0; + for (n = find_next_kbnode (new_keyblock, PKT_PUBLIC_SUBKEY); + n; n = find_next_kbnode (n, PKT_PUBLIC_SUBKEY)) + { + PKT_public_key *sub = n->pkt->pkt.public_key; + + if ((sub->pubkey_usage & PUBKEY_USAGE_ENC) == 0) + continue; + + if (! subkey_is_ok (sub)) + continue; + + if (sub->timestamp > new->creation_time) + new->creation_time = sub->timestamp; + } + + for (n = find_next_kbnode (new_keyblock, PKT_USER_ID); + n; n = find_next_kbnode (n, PKT_USER_ID)) + { + PKT_user_id *uid = n->pkt->pkt.user_id; + char *mbox = mailbox_from_userid (uid->name); + int match = mbox ? strcasecmp (name, mbox) == 0 : 0; + + xfree (mbox); + if (! match) + continue; + + new->uid = uid; + new->validity = + get_validity (ctrl, &new->key, uid, NULL, 0) & TRUST_MASK; + new->valid = 1; + + if (! old->valid) + return -1; /* No OLD key. */ + + if (! uid_is_ok (&old->key, old->uid) && uid_is_ok (&new->key, uid)) + return -1; /* Validity of the NEW key is better. */ + + if (old->validity < new->validity) + return -1; /* Validity of the NEW key is better. */ + + if (old->validity == new->validity && uid_is_ok (&new->key, uid) + && old->creation_time < new->creation_time) + return -1; /* Both keys are of the same validity, but the + NEW key is newer. */ + } + + /* Stick with the OLD key. */ + return 1; +} + + +/* This function works like get_pubkey_byname, but if the name + * resembles a mail address, the results are ranked and only the best + * result is returned. */ +int +get_best_pubkey_byname (ctrl_t ctrl, GETKEY_CTX *retctx, PKT_public_key *pk, + const char *name, KBNODE *ret_keyblock, + int include_unusable, int no_akl) +{ + int rc; + struct getkey_ctx_s *ctx = NULL; + + rc = get_pubkey_byname (ctrl, &ctx, pk, name, ret_keyblock, + NULL, include_unusable, no_akl); + if (rc) + { + if (ctx) + getkey_end (ctx); + if (retctx) + *retctx = NULL; + return rc; + } + + if (is_valid_mailbox (name)) + { + /* Rank results and return only the most relevant key. */ + struct pubkey_cmp_cookie best = { 0 }, new; + while (getkey_next (ctx, &new.key, NULL) == 0) + { + KBNODE new_keyblock = get_pubkeyblock (pk_keyid (&new.key)); + int diff = pubkey_cmp (ctrl, name, &best, &new, new_keyblock); + release_kbnode (new_keyblock); + if (diff < 0) + { + /* New key is better. */ + release_public_key_parts (&best.key); + best = new; + } + else if (diff > 0) + { + /* Old key is better. */ + release_public_key_parts (&new.key); + } + else + { + /* A tie. Keep the old key. */ + release_public_key_parts (&new.key); + } + } + getkey_end (ctx); + ctx = NULL; + + if (best.valid) + { + if (retctx || ret_keyblock) + { + ctx = xtrycalloc (1, sizeof **retctx); + if (! ctx) + rc = gpg_error_from_syserror (); + else + { + ctx->kr_handle = keydb_new (); + if (! ctx->kr_handle) + { + xfree (ctx); + *retctx = NULL; + rc = gpg_error_from_syserror (); + } + else + { + u32 *keyid = pk_keyid (&best.key); + ctx->exact = 1; + ctx->nitems = 1; + ctx->items[0].mode = KEYDB_SEARCH_MODE_LONG_KID; + ctx->items[0].u.kid[0] = keyid[0]; + ctx->items[0].u.kid[1] = keyid[1]; + + if (ret_keyblock) + { + release_kbnode (*ret_keyblock); + *ret_keyblock = NULL; + rc = getkey_next (ctx, NULL, ret_keyblock); + } + } + } + } + + if (pk) + *pk = best.key; + else + release_public_key_parts (&best.key); + } + } + + if (rc && ctx) + { + getkey_end (ctx); + ctx = NULL; + } + + if (retctx && ctx) + *retctx = ctx; + else + getkey_end (ctx); + + return rc; +} + + /* Get a public key from a file. * diff --git a/g10/keydb.h b/g10/keydb.h index 35512bb..6133202 100644 --- a/g10/keydb.h +++ b/g10/keydb.h @@ -324,6 +324,13 @@ int get_pubkey_byname (ctrl_t ctrl, KBNODE *ret_keyblock, KEYDB_HANDLE *ret_kdbhd, int include_unusable, int no_akl ); +/* Likewise, but only return the best match if NAME resembles a mail + * address. */ +int get_best_pubkey_byname (ctrl_t ctrl, + GETKEY_CTX *retctx, PKT_public_key *pk, + const char *name, KBNODE *ret_keyblock, + int include_unusable, int no_akl); + /* Get a public key directly from file FNAME. */ gpg_error_t get_pubkey_fromfile (ctrl_t ctrl, PKT_public_key *pk, const char *fname); diff --git a/g10/keylist.c b/g10/keylist.c index 212d77e..51dc409 100644 --- a/g10/keylist.c +++ b/g10/keylist.c @@ -650,7 +650,7 @@ locate_one (ctrl_t ctrl, strlist_t names) for (sl = names; sl; sl = sl->next) { - rc = get_pubkey_byname (ctrl, &ctx, NULL, sl->d, &keyblock, NULL, 1, 0); + rc = get_best_pubkey_byname (ctrl, &ctx, NULL, sl->d, &keyblock, 1, 0); if (rc) { if (gpg_err_code (rc) != GPG_ERR_NO_PUBKEY) diff --git a/g10/pkclist.c b/g10/pkclist.c index da4cc06..eef3437 100644 --- a/g10/pkclist.c +++ b/g10/pkclist.c @@ -838,7 +838,7 @@ find_and_check_key (ctrl_t ctrl, const char *name, unsigned int use, if (from_file) rc = get_pubkey_fromfile (ctrl, pk, name); else - rc = get_pubkey_byname (ctrl, NULL, pk, name, NULL, NULL, 0, 0); + rc = get_best_pubkey_byname (ctrl, NULL, pk, name, NULL, 0, 0); if (rc) { int code; diff --git a/tests/openpgp/Makefile.am b/tests/openpgp/Makefile.am index 5725e11..75e2fd4 100644 --- a/tests/openpgp/Makefile.am +++ b/tests/openpgp/Makefile.am @@ -83,6 +83,7 @@ XTESTS = \ export.scm \ ssh.scm \ quick-key-manipulation.scm \ + key-selection.scm \ issue2015.scm \ issue2346.scm \ issue2417.scm \ @@ -124,7 +125,12 @@ TEST_FILES = pubring.asc secring.asc plain-1o.asc plain-2o.asc plain-3o.asc \ tofu/cross-sigs/871C2247-3.gpg \ tofu/cross-sigs/871C2247-3.txt \ tofu/cross-sigs/871C2247-4.gpg \ - tofu/cross-sigs/README + tofu/cross-sigs/README \ + key-selection/0.asc \ + key-selection/1.asc \ + key-selection/2.asc \ + key-selection/3.asc \ + key-selection/4.asc data_files = data-500 data-9000 data-32000 data-80000 plain-large diff --git a/tests/openpgp/key-selection.scm b/tests/openpgp/key-selection.scm new file mode 100644 index 0000000..536f607 --- /dev/null +++ b/tests/openpgp/key-selection.scm @@ -0,0 +1,82 @@ +#!/usr/bin/env gpgscm + +;; Copyright (C) 2016 g10 Code GmbH +;; +;; This file is part of GnuPG. +;; +;; GnuPG is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 3 of the License, or +;; (at your option) any later version. +;; +;; GnuPG 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 General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with this program; if not, see . + +(load (with-path "defs.scm")) + +;; This test assumes a fixed time of 2004-01-01. + + ;; Redefine gpg with a fixed time. +(define gpg `(, at gpg --faked-system-time=1072911600)) + +;; We have a number of keys for Mr. Acejlnu Acdipr . +(define mailbox "acdipr at example.org") + +;; The keys are sorted, from the least relevant to the most relevant +;; key. +(define keys + '(("ED087E9D3394340738E20A244892A3CF8F65EBAC" + "no encryption-capable subkey, created: 2003-11-30, expires: 2006-11-29" + 4) + ("D7388651A1B7466D03B538428178E04B0BAA385B" + "encryption-capable subkey, created: 2000-12-31, expired: 2001-12-31" + 0) + ("DDEF1BEC66C8BAC8D69CED2AEABED840EC98B024" + "encryption-capable subkey, created: 2001-12-31, expires: 2006-12-30" + 1) + ("03FCFEDE014027DD897AD2F23D32670A96A9C2BF" + "encryption-capable subkey, created: 2002-12-31, expires: 2005-12-30" + 2) + ("B95BD6175CB6339244355BA160B8117E6119CED6" + "encryption-capable subkeys, last created: 2003-05-31, expires: 2005-05-30" + 3))) + +;; Accessors for the elements of KEYS. +(define :fpr car) +(define :comment cadr) +(define :number caddr) +(define (:filename key) + (in-srcdir "key-selection" + (string-append (number->string (:number key)) ".asc"))) + +(define (delete-keys which) + (call-check `(, at gpg --delete-keys ,@(map :fpr which)))) + +(define (import-keys which) + (call-check `(, at gpg --import ,@(map :filename which)))) + +(for-each-p' + "Checking key selection" + (lambda (set) + (import-keys set) + (let ((fpr (list-ref (assoc "fpr" + (gpg-with-colons `(--locate-key ,mailbox))) + 9)) + (expected (:fpr (last set)))) + (unless (equal? fpr expected) + (display "Given keys ") + (apply echo (map :fpr set)) + (echo "This is what --locate-key says:") + (display (call-popen `(, at gpg --locate-key ,mailbox) "")) + (echo "This is the key we expected:") + (display (call-popen `(, at gpg --list-keys ,expected) "")) + (error "Expected" expected "but got" fpr))) + (delete-keys set)) + (lambda (set) + (length set)) + (filter (lambda (x) (not (null? x))) (powerset keys))) diff --git a/tests/openpgp/key-selection/0.asc b/tests/openpgp/key-selection/0.asc new file mode 100644 index 0000000..d40a98b --- /dev/null +++ b/tests/openpgp/key-selection/0.asc @@ -0,0 +1,30 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- + +mQENBDpPvC8BCACqDbU+2znCURAocNMmcwCSYVl5l4Zbx6jcy9ON7y12Ai7CRSbX +8Nb8kggit02pNFtb1l2NKad7DqR1f/WPqkQjZ6rvFHKEOsupqrUhpQ6dU3H94wuO +g4M2PGsaxKAcw24qIoKkTotecLgUFMhduIq7u8kTnalTOW1o/18moVuoVNkDdO4Y +I7n/dloVNv5Xkm5bS4VBdvUzJ9gvbqkynud/L6pSFeng0vVJQMN3tVbApcNzhLBs +G5Fvf9Rve4V8xTeBYQ+VRO7H9nvaS8YFf07kTwUDS69Vs8qIaLKOQJL3F75CileN +K7fb9OC3J4PNF0CDz+e2KkRRF6Q/xS8KXF9rABEBAAG0I0FjZWpsbnUgQWNkaXBy +IDxhY2RpcHJAZXhhbXBsZS5vcmc+iQFUBBMBCAA+FiEE1ziGUaG3Rm0DtThCgXjg +SwuqOFsFAjpPvC8CGwMFCQHhM4AFCwkIBwIGFQgJCgsCBBYCAwECHgECF4AACgkQ +gXjgSwuqOFt7Lgf8DFDVQ4JykT8njX0+JkemSL2UUDH2iVRWkU6tKZPGneEnQGMm +iRfSX0im0pFHWxJ0vZsmUNq33Vr2sbvppT8Ti1rBx4TrdZ7PSEIEi1KTVSx6GKjr +2ObCax2u1p+u+tC35GfhV1Y1pUcSZXc45C1o259ivekRJY/fw9DrvR7154S3ygjp +lkEM4PC33216XMTqUG1sAWw40aDtKaiyp5J8zqLKXXjCnZsTWdj4uxB7E5WPjaEF +ylON/h+Hfw2RMzlYRGTbUu2G/Ma0TiycGJvT78myCpnc5akcKVZu1Wu4VDBqBC1N +dVcTzhJ5T4gwFCWHif3/MYqTVBnZSAVURtI3V7kBDQQ6T7wvAQgAuF5JaVAE9/Vv +K1U+VSAAhWMGSp6fwezgWdj0rn1GBx3DtqQkYXoLRjTrlBf1qOO6NPbBUi1gz8R+ +IQTHsesIXiUSlMige3/HxdSOsbzKipm1SGJedqUz3H03+yfr82NT+QvQmlEGX9k6 +goPY9t3r+O3F6ab4mc5NxFKhj2XvbRyf8I9J+3w6zXBWwsgLHacTCa13zGz6B0NH +dCk/2B6HTJeIJWpHdALQXp0/JcKWksw0Hsihpdu0QploUSPihZostRUKszOkugeu +W0t3fmt6on4fIFWveh9NSVDYIHKVMRU8cl5vRXNNRTsYQOarIvjmoUHv5u+UpZcc +iE/7wILNhQARAQABiQE8BBgBCAAmFiEE1ziGUaG3Rm0DtThCgXjgSwuqOFsFAjpP +vC8CGwwFCQHhM4AACgkQgXjgSwuqOFv9GAgAkACyK3Km4jFBqw7ah2xMxWCkdpgu +DdTi64ra6GyMQk/Lem8DzBO/ER/cavV9lg61qCOy7ecCNs7MhPiWZIod2bcV3JDZ +AglnGgTQ+lSpPXFCk3eoRktRsXesgQ1dE30uR9pypEqZ0BYNZZ2G2hRqAnRgUOOI +7THmf/X5w5KPKLlm3zOlGQomFy6lfOR9Zd5/QoKRNmuD9gNfSE+3vBvr+ISQPIev +Ch2qeC/N0BP5EoVE4SXp8l2oaaVJLi/Yx2J6vfximeeaBPxsKjuA+GJu6IIhegnY +X4kCxWStla+KuN0p0iNUh002pKybISuqyI9vgImH9Nh22Nf7mcRQWflR6A== +=nyjX +-----END PGP PUBLIC KEY BLOCK----- diff --git a/tests/openpgp/key-selection/1.asc b/tests/openpgp/key-selection/1.asc new file mode 100644 index 0000000..fea379c --- /dev/null +++ b/tests/openpgp/key-selection/1.asc @@ -0,0 +1,30 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- + +mQENBDww7w4BCADCvhkDDCAAtDpLCUa2ryPqWxlSSVKdyY9ecqjgEswijsZ+2T6O +Xr/50POpLbW9IWvHdvcifXUk1YZg8wLcnVIMwiZsdNSDM3MycoPoNc7pL5MaPGL6 +e9u+8HWX6aowOo5st6Y57HUeaKReH1Peb0avoEUIE9l4xqVx41AYrKViS7Zp5p9A +67thNKMisZ8aYutlhmVQB/uDO7XiKal07vjftf6aZazNBC5ZBOj4G+/TLcKMox8h +AaUJTkqsJcSCZTc7cMVjikmWItgKm6wIceGTpUGSvvZ3TnWUtgq3ivaMQrpyN3RT +tVM5uO2Mh8Uzkq9YWh2V7IT+jGKztrpdPKu3ABEBAAG0I0FjZWpsbnUgQWNkaXBy +IDxhY2RpcHJAZXhhbXBsZS5vcmc+iQFUBBMBCAA+FiEE3e8b7GbIusjWnO0q6r7Y +QOyYsCQFAjww7w4CGwMFCQlmAYAFCwkIBwIGFQgJCgsCBBYCAwECHgECF4AACgkQ +6r7YQOyYsCT0awf+NENO1grzmRfsyl8ODREmUlnnUAaRiZGQ0h+JkooXiwcm/p5O +DupjRc5OLluDtnjTLMBwNk5ysX6yqSNTni9qCCpm62PaIopG+r8RyFPp4aRjR1Q3 +mbwHkKifLRBxDxeCDKdrqFs7hkVCYOxjyiaEZ2BYogqFDwHFoiE6UwQvwZfpNWex +4Zx8nhoGpcegMMEiGREWCTi0H+zJrYOiVzV2jPQF5lkFkwYMQKNaNQv3L5v2/5AC +Nu6Kej+oYcw/EA+o3OXYLxwa+tijfKqUxtndFsQS/lYSUNszxrcm7dOAx52DCMpC +8MNHmwe3qmofO6G9svqG02bIZTdyJBob5nNBD7kBDQQ8MO8OAQgAttn9ru3Ou6+A +lAqbV7fAbpdeIF5bHy/QZtLxa2dpG8BTOXDcoMp9MUyKjafHbNr+z5unqqTfduXy +oRdJ1D/iXbSpcRkMKRJz4fa+uPNN5SiGzrjxHTcALPG8ctTUvdNrV+Z5VkssU+FW +LQD+s5SQWn848kYTacrDL22JshIpekmz3ztDoNGOZxVj2DwF/QXDeaRhXT9ngB3c +PY8x7e8yIvmAcg8olt9rKTpkGXZHWAyBpyGzBJkxM+wfiNreGMNUkv41G/R4d1Lv +xMlGF05xrBJX9YrV1pRM+EdS4WOs2gvFT3qnBzFAQBZ9nqaLAFVxw0Sl7C+wSQPk +7ZPIKYANFwARAQABiQE8BBgBCAAmFiEE3e8b7GbIusjWnO0q6r7YQOyYsCQFAjww +7w4CGwwFCQlmAYAACgkQ6r7YQOyYsCSDdwf/an06WTTAIwHj8PfXIkywnq3SWfSZ +yuRaFaDan9en8xAfyw2smNnrHnTk86CZWL6yPTij6JZYynv4OxtSafIoT9LxT7uX +VpEtSBpTnnojlHFivfRYMGJ9k/EXGgb941W2DTbvQqzafc2u4K3u8KnFOgzfEj5B +qjYzbt/L2uR2PLOAfYIUYzqTKjdzvSIX2DRvkepHhTwRbCjJrkF/zx0IXFoJeU/k +6tYK6cNNCFTWT0uLJCflAZMtGpf4KDvjlccNts3mZQbEov+Dymj/nZ9JRgjc2heH +Pxi5muPMQ8jAc2i4V8vTybozlZ5O/+JkOOOH0ciLpD3buhgYBY309DIVmA== +=zVE+ +-----END PGP PUBLIC KEY BLOCK----- diff --git a/tests/openpgp/key-selection/2.asc b/tests/openpgp/key-selection/2.asc new file mode 100644 index 0000000..4b697f7 --- /dev/null +++ b/tests/openpgp/key-selection/2.asc @@ -0,0 +1,30 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- + +mQENBD4SIdsBCACqRRWUd9mwgRzVzaDbVLRdNOdyswPYuBKWlHI6Yx0lpfiQK6/X +rnRoR18lYJ0wBqImd/BJbjNE4bYaMUd+p7HzYIKzv8/DuvZQgovt9VIBn+a3YyCa +hdAaWEz994fjl8U5IGbrrGuV4XXlFATA6S7KX7CgxgiK/jVnRl1NVcTjOSnasU2J +LIbh0lawUe0b3HlwT8uFGg/MK3vHGGIalOJRlgeTBAF7zcaTfqoDiAXbbsfaxT4a +zB1OTRut1VOGBLWCsr09VCAMyz8awQqF81uG6cuv9swo76SuTiMcMMBfdNw3etVa +kLgL4JnsnMGM7c1fx/mfMUIUHYndDVT5LzQjABEBAAG0I0FjZWpsbnUgQWNkaXBy +IDxhY2RpcHJAZXhhbXBsZS5vcmc+iQFUBBMBCAA+FiEEA/z+3gFAJ92JetLyPTJn +Cpapwr8FAj4SIdsCGwMFCQWjmoAFCwkIBwIGFQgJCgsCBBYCAwECHgECF4AACgkQ +PTJnCpapwr/bGAgAjGWQ3F9RUpeI3ogLLhGMsXmsOxZX1ptNtjL9HiDsrUY5XCS1 +7vZUpRz0/2nscbu7or6Xy8yZtG0vLXwfzeOvHQz/F8tnzruIWBFSAU8WBidxKxmC +AUlQWg6bAp0aTxyyVi/r719J6k/G/ZOhjgXM243Ck9HNnY2a0h0ArKzPo56N8Cks +caXshdWxIh3M9uJKSxBCxfDTtqPcU7LjNApaUOFphpAPT9ypE/Zw9BZNTVN6vILr +I7upnG5PNXybMCDh2XhpXS2E5/rY9Y3/aFKthBws16JMAzBRKMQqWTTC9a8X+4pa +KcNtQih3X9eRzj4JBAh6cl5qXIbz+32EzXA8drkBDQQ+EiHbAQgAz017pYsm9Sf0 +z5HqOQLx1dwCclzVE5RhvI+qplPT5e9sLG+trbOVpGM6fjWAK/yuxaUJibm/44UX +cxsTuR7gpAwc+gvwrF3cG6kmT+g4kZ7/I4EyBMZjM9lhlIk77MCTLXcT9ONr7Pm4 +flQO+vM6ZYRFm7DtSHzP2z2Uu9USqgLJumn+V61xQXYj3E2ORczOV3blPVUoI7gl +aRnVdveEqrucw+miRWq3clykTdbuP39H2nRgY0KXGbOefWh5dRe2okxL5nlhINGL +lOyj9n4jM6fNp9K8jWeg8YJ7tKRsffrrNnIovslNlkXucYAzM2OveP+JxDdtosSK +fzWtUSzrmQARAQABiQE8BBgBCAAmFiEEA/z+3gFAJ92JetLyPTJnCpapwr8FAj4S +IdsCGwwFCQWjmoAACgkQPTJnCpapwr+p6wf/cO8apRVlpRrI2q92j5DJ0IQsBdUv +Srvp3w8UHZad0VkhgT+edbYHN8VS245ckyWoUBB78XEvxayMF1/Mx0N+u1MOM1dY +MrAiwbaQnE99yjifwVzZz6wJuJ94MMzWw38j22ZTbIBHPh/4nzSl84sN+KuEcP4f +C2h7mat4NDO/VRTf7xWuLInS5yGdDOACwROd85ua4YNxo54s5mcd6BVr4upHd1Hj +0TULgmWvqz49N40VY4GF+38OAC7+DSsdamHVNdTb0fT+KaxTQ0K5BCl+7Oe66CqH +RWxaXRUD4YMRh1jdgc+j4D3Sj4xhevu0Kd6+7BWxmxWZKdOCiu9TEDBjrg== +=YqE5 +-----END PGP PUBLIC KEY BLOCK----- diff --git a/tests/openpgp/key-selection/3.asc b/tests/openpgp/key-selection/3.asc new file mode 100644 index 0000000..ab2ff73 --- /dev/null +++ b/tests/openpgp/key-selection/3.asc @@ -0,0 +1,43 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- + +mQENBD4SIZsBCADMR5w2TF16C1WaP+EIq+pg3InbyKr3VlGgxl2t/+PcRUmxhOh4 +zAs+k/FaKqH+h8JLGT6VlUMqKDqBrHhwVNz5nEYO/HeqaSsHjyNoIr4tS3oJMQWI +0QsRV8cPhlPHXQBS8K2KC7MfTyHIbfagjqakegY9ysZ2N6Qt3I3QSqO0khRHoNtZ +x8l/NHA9u8lRJD1OhfOg8gcY9800LPJbdzmyeOK5ezwyvjp6dXKNgXnwkrHQw7pD +hGITTRtNsRb0xF9e+1X6KRifk/ppJZjk3Lu8AJEyj6AfHZru6lYfv4LP77IW9Lw2 +x7pRwrMNtvffAOGGa4KYiVstgIaPmEm9v2UjABEBAAG0I0FjZWpsbnUgQWNkaXBy +IDxhY2RpcHJAZXhhbXBsZS5vcmc+iQFUBBMBCAA+FiEEuVvWF1y2M5JENVuhYLgR +fmEZztYFAj4SIZsCGwMFCQWjmoAFCwkIBwIGFQgJCgsCBBYCAwECHgECF4AACgkQ +YLgRfmEZztapKAf/US2OkiyDX4D7cRrifnbkMj5YdHjiirqgd5Q9nhWIC/Pk494u +WDMt0XBeHk8aPp6NjQCMpWu8d9TxLCn43dI2eFRLKSk/9nUb3nPzIrtT8/dPEsvG +HEAJKxGMpZLu2UIDIpn2XY+9pS8CB03xVfuAfYrGOmVJS5rr6a592WfCB6XosHO1 +S2iKnMWgmo5C2WJaOq0AL5fzI6w1TAYN10KHFdNdimWJZ85WKk3iRXDUF4PJusWt +PLPHOgbvAMBHtJHu+09DlcoBRyWRvEzXHoBsgm76kvkLpkP23FhuWexfK6qJ+pZG +Ygaw2fGACGi9W7aASaiR5+PcD5WSPaOT2PuyRLkBDQQ+EiGbAQgA0Zt9F5Xhv1wf +zdvuXZeEaX/0uq3T/5IXcP0cjMzylWS3caRd8AB6S6+0NZDrAuO8jbzKuBdVb3so +zhq2g4uPkzCq9QkLwSJDURAstA/w6yV/h83DhEvmhE5MceY57Ev1g+cF3ec9Sshv +MQBPicXw6Umv8fyjmW6LIEXpNeXjz52hyjVk39EzEYFf8+ozC1Ifn5H1NWOnCiBc +5Q4Ud4W26xItyW1bBXWaMR520fotj6wSAX1Al2ynzvZ31RQUgBmm9aiwRKKXC4CW +6E6uDCBKL/Gpebc2Ty8fpJmCFtTByh0M7eeBfCDPTODPS39WjxwxbgIIHMDyXogW +D+Por5jYiQARAQABiQE8BBgBCAAmFiEEuVvWF1y2M5JENVuhYLgRfmEZztYFAj4S +IZsCGwwFCQWjmoAACgkQYLgRfmEZztbhGAf9GHVPYO7qsZkM5RnPRYAZLQGY9ygP +Wac2hX10UVOVFMgd8XVdoRMqj8LHyaf6UrdI6/3lNza2cnleskjxzaNbk9ENhyYs +/KSAyL6JbuZhEZ9Cx77RKRfbG+Z5EIrymgG0+HZuS8XZbJTze0kvQc90Avn78rNa +ta4VB7U6ID0BwbBq4ikeJFJ2si87ZUiVUbFihVCk39HyJMXdDeUJPELi6Z2Rkmov +0fwB1/QaSCvr41zQ1gCLpWC9x6tbas/4DsI0O2XG5W7XGIBt1NnaHMwgHr1Rw2JU +Df6q+bEEiXP4ZsnoeUYi7Q7LU55fn5zsLj8DF2eACSiN+f5emZkZT4wV2bkBDQQ+ +2SXpAQgArTgU5baUzto+s/aEp/z87F7jxeFXTUTgIglHUHvc5oAj59TgZf+6C4t2 +uY6DGST3u2XCRs7FK3iZjvzfEVyDYQd8V/Iew8oeHy2aGmWFbDuZa+8RWWGJ8wfv +V3pCm+86HIzfbqgJ3B3WnIhMqrBvGSlT0oYDVYIDZDbYYnIYNhF5xo/hH1WB9Ul6 +7Mx/KPUTqa2O1Pio7mFy0xFb12+5y5g3PruEG+mM3RLqZug3Z5M3E7gEG2HCnNjQ +CzjICJe9wwOzkoKJLogCEZ2iYhl2DcThxWtOu/EaU3b+iothX0HdO3azMc3v3tcX +t4q/fLUqmJ+P/HVlJtuPKSwnCHHVzwARAQABiQE8BBgBCAAmFiEEuVvWF1y2M5JE +NVuhYLgRfmEZztYFAj7ZJekCGwwFCQPCZwAACgkQYLgRfmEZztZv9wf/Q8HacUDx +AUJXfx/BfK/4zgogDfotz9yaFMmJYob2Mx/ny1Gteh551U5byuyoJW3gENg8Ql6v +s7uSfLAbk2qXYAdApbo1pcYmb5Rd2oDU3+1JONNHs096ZjJLD2WHxTnzWVLMDsPV +cUka+trg8Z1hqw6uGJmu6InggNjZ++1B6aa63Zdu7BudJB/3oWpjXyV7FqU4RtYa +sYN/lmGcir0704yfqRbVcP9fU5kYB17qiNJRtblDjImiiFHJ0PSxpmYU3lDIf1Rf +AC/HXoUetx9PKV1J8EKMQhV/GFa5FbmBCwXcIEj/Z9YEjSK2t9Pw0k0EuKhl7eHp +vlWlPNIJSTq1Bg== +=rf5l +-----END PGP PUBLIC KEY BLOCK----- diff --git a/tests/openpgp/key-selection/4.asc b/tests/openpgp/key-selection/4.asc new file mode 100644 index 0000000..6a0ab9b --- /dev/null +++ b/tests/openpgp/key-selection/4.asc @@ -0,0 +1,18 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- + +mQENBD/KdpABCAD2wlP1kYHldknjyGTnMOUq9r+3/fJR8n4qVt5TRRlDdyfK3ZxM +KWStsmkZuK9dMxo4VSOjVeiXdZlHeQU7RlzVPsCNiJ1Qc2HDgHFdmT7eUgOILA12 +36bueRUwVPGmrBEecs0TpNRQ5CVFbO7mC6cTLhT9nRMd+W+BSuuZ8Zm98ebaVh3I +ml3nPEVhs1UFmIop48RGCt45MZ2mYp77kuAmk8NBJjHy9J4H5UK19r0hla2WY4a3 +Z59hh7kFnNFCM/MhPxd6GwkeXzUF7WSnhzRVIkdv81u2AnIHbo1zD0BUp8Rf64Ns +3iFAeB1VuR6ZJpEypHiHUJtYPmr9okEmg8EDABEBAAG0I0FjZWpsbnUgQWNkaXBy +IDxhY2RpcHJAZXhhbXBsZS5vcmc+iQFUBBMBCAA+FiEE7Qh+nTOUNAc44gokSJKj +z49l66wFAj/KdpACGwMFCQWjmoAFCwkIBwIGFQgJCgsCBBYCAwECHgECF4AACgkQ +SJKjz49l66xZ7QgA7dBJsQP09LhkYDIu8cJzRU6tqa2Y8dx0iFaCU8nqD/0q6xJf +fs2euwMEPsHWmA1WwGwxZpE/NGEksMSQ8TZSQUwCsURxBIiGww5MBtIGeO3ZzreR +Dn0Qhivbiup8ZPtPfFFomoK7ZtWjtGjZ8I5zyYbjT0eEB7P348dkpOtReWDiqGVd +taMnVau4OTDqTRo6fvAiVb37zoaWETsPWtq/TymgkqO/LEhzClzG8xJgpSl98cQW +BoHz5GDVYeVxPEKAN4DdS7gt0KTUC9ZQUcZP+1wTzFohDd/CeUAl4kTeP0QSJVJ3 +QC/WnHk4Y56q8/nngIY6w/wID/R/Cp+plw6F5w== +=BA1F +-----END PGP PUBLIC KEY BLOCK----- commit 1ec07cbc209f247fd85704f5701564e31aa56d0b Author: Justus Winter Date: Thu Nov 3 14:37:15 2016 +0100 gpgscm,tests: Add new functions to the test environment. * tests/gpgscm/lib.scm (first, last, powerset): New functions. * tests/gpgscm/tests.scm (interactive-shell): New function. * tests/openpgp/Makefile.am (EXTRA_DIST): Add new file. * tests/openpgp/README: Document 'interactive-shell'. * tests/openpgp/shell.scm: New file. Signed-off-by: Justus Winter diff --git a/tests/gpgscm/lib.scm b/tests/gpgscm/lib.scm index e4ab483..316eacf 100644 --- a/tests/gpgscm/lib.scm +++ b/tests/gpgscm/lib.scm @@ -42,6 +42,24 @@ ((not (p (car l))) #f) (else (all p (cdr l))))) +;; Return the first element of a list. +(define first car) + +;; Return the last element of a list. +(define (last lst) + (if (null? (cdr lst)) + (car lst) + (last (cdr lst)))) + +;; Compute the powerset of a list. +(define (powerset set) + (if (null? set) + '(()) + (let ((rst (powerset (cdr set)))) + (append (map (lambda (x) (cons (car set) x)) + rst) + rst)))) + ;; Is PREFIX a prefix of S? (define (string-prefix? s prefix) (and (>= (string-length s) (string-length prefix)) diff --git a/tests/gpgscm/tests.scm b/tests/gpgscm/tests.scm index 8986a70..d89a96f 100644 --- a/tests/gpgscm/tests.scm +++ b/tests/gpgscm/tests.scm @@ -481,3 +481,11 @@ (catch (list tmpfiles source *error*) (apply function `(,(call-with-input-file source read-all) , at args))) (list tmpfiles source #f))) + +;; +;; Developing and debugging tests. +;; + +;; Spawn an os shell. +(define (interactive-shell) + (call-with-fds `(,(getenv "SHELL")) 0 1 2)) diff --git a/tests/openpgp/Makefile.am b/tests/openpgp/Makefile.am index bb9b2f4..5725e11 100644 --- a/tests/openpgp/Makefile.am +++ b/tests/openpgp/Makefile.am @@ -188,7 +188,7 @@ sample_msgs = samplemsgs/issue2419.asc EXTRA_DIST = defs.scm $(XTESTS) $(TEST_FILES) \ mkdemodirs signdemokey $(priv_keys) $(sample_keys) \ $(sample_msgs) ChangeLog-2011 run-tests.scm \ - setup.scm finish.scm + setup.scm finish.scm shell.scm CLEANFILES = prepared.stamp x y yy z out err $(data_files) \ plain-1 plain-2 plain-3 trustdb.gpg *.lock .\#lk* \ diff --git a/tests/openpgp/README b/tests/openpgp/README index 8845afd..75d818e 100644 --- a/tests/openpgp/README +++ b/tests/openpgp/README @@ -110,7 +110,10 @@ You can also get an interactive repl by dropping (interactive-repl (current-environment)) -anywhere you like. +anywhere you like. Or, if you want to examine the environment from an +operating system shell, use + + (interactive-shell) ** Interfacing with gpg diff --git a/tests/openpgp/shell.scm b/tests/openpgp/shell.scm new file mode 100644 index 0000000..dadafff --- /dev/null +++ b/tests/openpgp/shell.scm @@ -0,0 +1,32 @@ +#!/usr/bin/env gpgscm + +;; Copyright (C) 2016 g10 Code GmbH +;; +;; This file is part of GnuPG. +;; +;; GnuPG is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 3 of the License, or +;; (at your option) any later version. +;; +;; GnuPG 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 General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with this program; if not, see . + +(load (with-path "defs.scm")) + +;; This is not a test, but can be used to inspect the test +;; environment. Simply execute +;; +;; make -Ctests/openpgp check XTESTS=shell.scm +;; +;; to run it. + +(echo "Note that gpg.conf includes 'batch'. If you want to use gpg") +(echo "interactively you should drop that.") +(echo) +(interactive-shell) ----------------------------------------------------------------------- Summary of changes: g10/getkey.c | 205 ++++++++++++++++++++++++++++ g10/keydb.h | 7 + g10/keylist.c | 2 +- g10/pkclist.c | 2 +- tests/gpgscm/lib.scm | 18 +++ tests/gpgscm/tests.scm | 8 ++ tests/openpgp/Makefile.am | 10 +- tests/openpgp/README | 5 +- tests/openpgp/key-selection.scm | 82 +++++++++++ tests/openpgp/key-selection/0.asc | 30 ++++ tests/openpgp/key-selection/1.asc | 30 ++++ tests/openpgp/key-selection/2.asc | 30 ++++ tests/openpgp/key-selection/3.asc | 43 ++++++ tests/openpgp/key-selection/4.asc | 18 +++ tests/openpgp/{4gb-packet.scm => shell.scm} | 17 ++- 15 files changed, 496 insertions(+), 11 deletions(-) create mode 100644 tests/openpgp/key-selection.scm create mode 100644 tests/openpgp/key-selection/0.asc create mode 100644 tests/openpgp/key-selection/1.asc create mode 100644 tests/openpgp/key-selection/2.asc create mode 100644 tests/openpgp/key-selection/3.asc create mode 100644 tests/openpgp/key-selection/4.asc copy tests/openpgp/{4gb-packet.scm => shell.scm} (71%) mode change 100755 => 100644 hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Thu Nov 3 17:35:12 2016 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Thu, 03 Nov 2016 17:35:12 +0100 Subject: [git] GPGME - branch, master, updated. gpgme-1.7.1-17-gaad94cb Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via aad94cb7c313d4501bed748f48830cbb93c67e20 (commit) from 34a4e8017be452e8ead6b9c2da84be1ec7929cae (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit aad94cb7c313d4501bed748f48830cbb93c67e20 Author: Werner Koch Date: Thu Nov 3 16:29:45 2016 +0100 core: Add gpgme_op_query_swdb and helper. * src/gpgme.h.in (gpgme_query_swdb_result_t): New. (gpgme_op_query_swdb): New. (gpgme_op_query_swdb_result): New. * src/libgpgme.vers, src/gpgme.def: Add the two new functions. * src/queryswdb.c: New. * src/Makefile.am (main_sources): Add new file. * src/context.h (OPDATA_QUERY_SWDB): New. * src/engine-backend.h (struct engine_ops): Add field 'query_swdb'. Adjust all initializer. * src/engine.c (_gpgme_engine_op_query_swdb): New. * src/engine-gpgconf.c (parse_swdb_line): New. (gpgconf_query_swdb): New. (_gpgme_engine_ops_gpgconf): Register that function. * src/util.h (GPG_ERR_TOO_OLD): Define for older libgpg-error. (GPG_ERR_ENGINE_TOO_OLD): Ditto. * tests/run-swdb.c: New. * tests/Makefile.am (noinst_PROGRAMS): Add new debug tool. Signed-off-by: Werner Koch diff --git a/NEWS b/NEWS index 0274f9c..e43aa30 100644 --- a/NEWS +++ b/NEWS @@ -9,6 +9,9 @@ Noteworthy changes in version 1.7.2 (unreleased) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ gpgme_set_sender NEW. gpgme_get_sender NEW. + gpgme_op_query_swdb NEW. + gpgme_op_query_swdb_result NEW. + gpgme_query_swdb_result_t NEW. qt: DN NEW. qt: DN::Attribute NEW. diff --git a/doc/gpgme.texi b/doc/gpgme.texi index 9fae9aa..a70418d 100644 --- a/doc/gpgme.texi +++ b/doc/gpgme.texi @@ -237,7 +237,9 @@ Encrypt Miscellaneous -* Running other Programs:: Running other Programs +* Running other Programs:: Running other Programs. +* Using the Assuan protocol:: Using the Assuan protocol. +* Checking for updates:: How to check for software updates. Run Control @@ -5561,6 +5563,7 @@ Here are some support functions which are sometimes useful. @menu * Running other Programs:: Running other Programs * Using the Assuan protocol:: Using the Assuan protocol +* Checking for updates:: How to check for software updates @end menu @@ -5692,6 +5695,142 @@ Synchronous variant. @end deftypefun + at node Checking for updates + at subsection How to check for software updates + +The GnuPG Project operates a server to query the current versions of +software packages related to GnuPG. GPGME can be used to +access this online database and check whether a new version of a +software package is available. + + at deftp {Data type} {gpgme_query_swdb_result_t} +This is a pointer to a structure used to store the result of a + at code{gpgme_op_query_swdb} operation. After success full call to that +function, you can retrieve the pointer to the result with + at code{gpgme_op_query_swdb_result}. The structure contains the +following member: + + at table @code + at item name +This is the name of the package. + + at item iversion +The currently installed version or an empty string. This value is +either a copy of the argument given to @code{gpgme_op_query_swdb} or +the version of the installed software as figured out by GPGME or GnuPG. + + at item created +This gives the date the file with the list of version numbers has +originally be created by the GnuPG project. + + at item retrieved +This gives the date the file was downloaded. + + at item warning +If this flag is set either an error has occurred or some of the +information in this structure are not properly set. For example if +the version number of the installed software could not be figured out, +the @code{update} flag may not reflect a required update status. + + at item update +If this flag is set an update of the software is available. + + at item urgent +If this flag is set an available update is important. + + at item noinfo +If this flag is set, no valid information could be retrieved. + + at item unknown +If this flag is set the given @code{name} is not known. + + at item tooold +If this flag is set the available information is not fresh enough. + + at item error +If this flag is set some other error has occured. + + at item version +The version string of the latest released version. + + at item reldate +The release date of the latest released version. + + at end table + at end deftp + + at deftypefun gpgme_error_t gpgme_op_query_swdb @ + (@w{gpgme_ctx_t @var{ctx}}, @ + @w{const char *@var{name}}, @ + @w{const char *@var{iversion}}, @ + @w{gpgme_data_t @var{reserved}}) + +Query the software version database for software package @var{name} +and check against the installed version given by @var{iversion}. If + at var{iversion} is given as @code{NULL} a check is only done if GPGME +can figure out the version by itself (for example when using +"gpgme" or "gnupg"). If @code{NULL} is used for @var{name} the +current gpgme version is checked. @var{reserved} must be set to 0. + + at end deftypefun + + at deftypefun gpgme_query_swdb_result_t gpgme_op_query_swdb_result @ + (@w{gpgme_ctx_t @var{ctx}}) + +The function @code{gpgme_op_query_swdb_result} returns a + at code{gpgme_query_swdb_result_t} pointer to a structure holding the +result of a @code{gpgme_op_query_swdb} operation. The pointer is only +valid if the last operation on the context was a sucessful call to + at code{gpgme_op_query_swdb}. If that call failed, the result might +be a @code{NULL} pointer. The returned pointer is only valid until +the next operation is started on the context @var{ctx}. + at end deftypefun + + at noindent +Here is an example on how to check whether GnuPG is current: + + at example +#include + +int +main (void) +@{ + gpg_error_t err; + gpgme_ctx_t ctx; + gpgme_query_swdb_result_t result; + + gpgme_check_version (NULL); + err = gpgme_new (&ctx); + if (err) + fprintf (stderr, "error creating context: %s\n", gpg_strerror (err)); + else + @{ + gpgme_set_protocol (ctx, GPGME_PROTOCOL_GPGCONF); + + err = gpgme_op_query_swdb (ctx, "gnupg", NULL, 0); + if (err) + fprintf (stderr, "error querying swdb: %s\n", gpg_strerror (err)); + else + @{ + result = gpgme_op_query_swdb_result (ctx); + if (!result) + fprintf (stderr, "error querying swdb\n"); + if (!result->warning && !result->update) + printf ("GnuPG version %s is current\n", + result->iversion); + else if (!result->warning && result->update) + printf ("GnuPG version %s can be updated to %s\n", + result->iversion, result->version); + else + fprintf (stderr, "error finding the update status\n"); + @} + gpgme_release (ctx); + @} + return 0; +@} + at end example + + @node Run Control @section Run Control @cindex run control diff --git a/src/Makefile.am b/src/Makefile.am index f166f3b..eddd192 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -91,7 +91,7 @@ main_sources = \ $(uiserver_components) \ engine-g13.c vfs-mount.c vfs-create.c \ engine-spawn.c \ - gpgconf.c \ + gpgconf.c queryswdb.c \ sema.h priv-io.h $(system_components) sys-util.h dirinfo.c \ debug.c debug.h gpgme.c version.c error.c diff --git a/src/context.h b/src/context.h index f6c1ad1..00e2e77 100644 --- a/src/context.h +++ b/src/context.h @@ -38,7 +38,8 @@ typedef enum OPDATA_DECRYPT, OPDATA_SIGN, OPDATA_ENCRYPT, OPDATA_PASSPHRASE, OPDATA_IMPORT, OPDATA_GENKEY, OPDATA_KEYLIST, OPDATA_EDIT, OPDATA_VERIFY, OPDATA_TRUSTLIST, OPDATA_ASSUAN, OPDATA_VFS_MOUNT, - OPDATA_PASSWD, OPDATA_EXPORT, OPDATA_KEYSIGN, OPDATA_TOFU_POLICY + OPDATA_PASSWD, OPDATA_EXPORT, OPDATA_KEYSIGN, OPDATA_TOFU_POLICY, + OPDATA_QUERY_SWDB } ctx_op_data_id_t; diff --git a/src/engine-assuan.c b/src/engine-assuan.c index 65924eb..4c7fe28 100644 --- a/src/engine-assuan.c +++ b/src/engine-assuan.c @@ -796,6 +796,7 @@ struct engine_ops _gpgme_engine_ops_assuan = llass_transact, /* opassuan_transact */ NULL, /* conf_load */ NULL, /* conf_save */ + NULL, /* query_swdb */ llass_set_io_cbs, llass_io_event, llass_cancel, diff --git a/src/engine-backend.h b/src/engine-backend.h index e02c715..a8b1ac6 100644 --- a/src/engine-backend.h +++ b/src/engine-backend.h @@ -127,6 +127,10 @@ struct engine_ops gpgme_error_t (*conf_load) (void *engine, gpgme_conf_comp_t *conf_p); gpgme_error_t (*conf_save) (void *engine, gpgme_conf_comp_t conf); + gpgme_error_t (*query_swdb) (void *engine, + const char *name, const char *iversion, + gpgme_query_swdb_result_t result); + void (*set_io_cbs) (void *engine, gpgme_io_cbs_t io_cbs); void (*io_event) (void *engine, gpgme_event_io_t type, void *type_data); diff --git a/src/engine-g13.c b/src/engine-g13.c index d34db82..972c3a8 100644 --- a/src/engine-g13.c +++ b/src/engine-g13.c @@ -811,6 +811,7 @@ struct engine_ops _gpgme_engine_ops_g13 = g13_transact, NULL, /* conf_load */ NULL, /* conf_save */ + NULL, /* query_swdb */ g13_set_io_cbs, g13_io_event, g13_cancel, diff --git a/src/engine-gpg.c b/src/engine-gpg.c index cb52dea..7725a00 100644 --- a/src/engine-gpg.c +++ b/src/engine-gpg.c @@ -2969,6 +2969,7 @@ struct engine_ops _gpgme_engine_ops_gpg = NULL, /* opassuan_transact */ NULL, /* conf_load */ NULL, /* conf_save */ + NULL, /* query_swdb */ gpg_set_io_cbs, gpg_io_event, gpg_cancel, diff --git a/src/engine-gpgconf.c b/src/engine-gpgconf.c index 271a4dd..25c798e 100644 --- a/src/engine-gpgconf.c +++ b/src/engine-gpgconf.c @@ -47,6 +47,7 @@ #include "engine-backend.h" + struct engine_gpgconf { @@ -941,6 +942,217 @@ gpgconf_conf_save (void *engine, gpgme_conf_comp_t comp) } +/* Parse a line received from gpgconf --query-swdb. This function may + * modify LINE. The result is stored at RESUL. */ +static gpg_error_t +parse_swdb_line (char *line, gpgme_query_swdb_result_t result) +{ + char *field[9]; + int fields = 0; + gpg_err_code_t ec; + + while (line && fields < DIM (field)) + { + field[fields++] = line; + line = strchr (line, ':'); + if (line) + *line++ = 0; + } + /* We require that all fields exists - gpgme emits all these fields + * even on error. They might be empty, though. */ + if (fields < 9) + return gpg_error (GPG_ERR_INV_ENGINE); + + free (result->name); + result->name = strdup (field[0]); + if (!result->name) + return gpg_error_from_syserror (); + + free (result->iversion); + result->iversion = strdup (field[1]); + if (!result->iversion) + return gpg_error_from_syserror (); + + result->urgent = (strtol (field[3], NULL, 10) > 0); + + ec = gpg_err_code (strtoul (field[4], NULL, 10)); + + result->created = _gpgme_parse_timestamp (field[5], NULL); + result->retrieved= _gpgme_parse_timestamp (field[6], NULL); + + free (result->version); + result->version = strdup (field[7]); + if (!result->version) + return gpg_error_from_syserror (); + + result->reldate = _gpgme_parse_timestamp (field[8], NULL); + + /* Set other flags. */ + result->warning = !!ec; + result->update = 0; + result->noinfo = 0; + result->unknown = 0; + result->tooold = 0; + result->error = 0; + + switch (*field[2]) + { + case '-': result->warning = 1; break; + case '?': result->unknown = result->warning = 1; break; + case 'u': result->update = 1; break; + case 'c': break; + case 'n': break; + default: + result->warning = 1; + if (!ec) + ec = GPG_ERR_INV_ENGINE; + break; + } + + if (ec == GPG_ERR_TOO_OLD) + result->tooold = 1; + else if (ec == GPG_ERR_ENOENT) + result->noinfo = 1; + else if (ec) + result->error = 1; + + + return 0; +} + + +static gpgme_error_t +gpgconf_query_swdb (void *engine, + const char *name, const char *iversion, + gpgme_query_swdb_result_t result) +{ + struct engine_gpgconf *gpgconf = engine; + gpgme_error_t err = 0; + char *linebuf; + size_t linebufsize; + int linelen; + char *argv[7]; + int argc = 0; + int rp[2]; + struct spawn_fd_item_s cfd[] = { {-1, 1 /* STDOUT_FILENO */, -1, 0}, + {-1, -1} }; + int status; + int nread; + char *mark = NULL; + + if (!have_gpgconf_version (gpgconf, "2.1.16")) + return gpg_error (GPG_ERR_ENGINE_TOO_OLD); + + /* _gpgme_engine_new guarantees that this is not NULL. */ + argv[argc++] = gpgconf->file_name; + + if (gpgconf->home_dir) + { + argv[argc++] = (char*)"--homedir"; + argv[argc++] = gpgconf->home_dir; + } + + argv[argc++] = (char*)"--query-swdb"; + argv[argc++] = (char*)name; + argv[argc++] = (char*)iversion; + argv[argc] = NULL; + assert (argc < DIM (argv)); + + if (_gpgme_io_pipe (rp, 1) < 0) + return gpg_error_from_syserror (); + + cfd[0].fd = rp[1]; + + status = _gpgme_io_spawn (gpgconf->file_name, argv, + IOSPAWN_FLAG_DETACHED, cfd, NULL, NULL, NULL); + if (status < 0) + { + _gpgme_io_close (rp[0]); + _gpgme_io_close (rp[1]); + return gpg_error_from_syserror (); + } + + linebufsize = 2048; /* Same as used by gpgconf. */ + linebuf = malloc (linebufsize); + if (!linebuf) + { + err = gpg_error_from_syserror (); + goto leave; + } + linelen = 0; + + while ((nread = _gpgme_io_read (rp[0], linebuf + linelen, + linebufsize - linelen - 1))) + { + char *line; + const char *lastmark = NULL; + size_t nused; + + if (nread < 0) + { + err = gpg_error_from_syserror (); + goto leave; + } + + linelen += nread; + linebuf[linelen] = '\0'; + + for (line=linebuf; (mark = strchr (line, '\n')); line = mark+1 ) + { + lastmark = mark; + if (mark > line && mark[-1] == '\r') + mark[-1] = '\0'; + else + mark[0] = '\0'; + + /* Got a full line. Due to the CR removal code (which + occurs only on Windows) we might be one-off and thus + would see empty lines. */ + if (*line) + { + err = parse_swdb_line (line, result); + goto leave; /* Ready. */ + } + else /* empty line. */ + err = 0; + } + + nused = lastmark? (lastmark + 1 - linebuf) : 0; + memmove (linebuf, linebuf + nused, linelen - nused); + linelen -= nused; + + if (!(linelen < linebufsize - 1)) + { + char *newlinebuf; + + if (linelen < 8 * 1024 - 1) + linebufsize = 8 * 1024; + else if (linelen < 64 * 1024 - 1) + linebufsize = 64 * 1024; + else + { + /* We reached our limit - give up. */ + err = gpg_error (GPG_ERR_LINE_TOO_LONG); + goto leave; + } + + newlinebuf = realloc (linebuf, linebufsize); + if (!newlinebuf) + { + err = gpg_error_from_syserror (); + goto leave; + } + linebuf = newlinebuf; + } + } + + leave: + free (linebuf); + _gpgme_io_close (rp[0]); + return err; +} + + static void gpgconf_set_io_cbs (void *engine, gpgme_io_cbs_t io_cbs) { @@ -998,6 +1210,7 @@ struct engine_ops _gpgme_engine_ops_gpgconf = NULL, /* opassuan_transact */ gpgconf_conf_load, gpgconf_conf_save, + gpgconf_query_swdb, gpgconf_set_io_cbs, NULL, /* io_event */ NULL, /* cancel */ diff --git a/src/engine-gpgsm.c b/src/engine-gpgsm.c index 0ce4a6d..a815cf0 100644 --- a/src/engine-gpgsm.c +++ b/src/engine-gpgsm.c @@ -2101,6 +2101,7 @@ struct engine_ops _gpgme_engine_ops_gpgsm = NULL, /* opassuan_transact */ NULL, /* conf_load */ NULL, /* conf_save */ + NULL, /* query_swdb */ gpgsm_set_io_cbs, gpgsm_io_event, gpgsm_cancel, diff --git a/src/engine-spawn.c b/src/engine-spawn.c index df90cb2..d2c7dd6 100644 --- a/src/engine-spawn.c +++ b/src/engine-spawn.c @@ -469,6 +469,7 @@ struct engine_ops _gpgme_engine_ops_spawn = NULL, /* opassuan_transact */ NULL, /* conf_load */ NULL, /* conf_save */ + NULL, /* query_swdb */ engspawn_set_io_cbs, engspawn_io_event, /* io_event */ engspawn_cancel, /* cancel */ diff --git a/src/engine-uiserver.c b/src/engine-uiserver.c index 76fa4d7..47b7dc3 100644 --- a/src/engine-uiserver.c +++ b/src/engine-uiserver.c @@ -1393,6 +1393,7 @@ struct engine_ops _gpgme_engine_ops_uiserver = NULL, /* opassuan_transact */ NULL, /* conf_load */ NULL, /* conf_save */ + NULL, /* query_swdb */ uiserver_set_io_cbs, uiserver_io_event, uiserver_cancel, diff --git a/src/engine.c b/src/engine.c index f5dfe51..4e513b6 100644 --- a/src/engine.c +++ b/src/engine.c @@ -980,6 +980,21 @@ _gpgme_engine_op_conf_save (engine_t engine, gpgme_conf_comp_t conf) } +gpgme_error_t +_gpgme_engine_op_query_swdb (engine_t engine, + const char *name, const char *iversion, + gpgme_query_swdb_result_t result) +{ + if (!engine) + return gpg_error (GPG_ERR_INV_VALUE); + + if (!engine->ops->query_swdb) + return gpg_error (GPG_ERR_NOT_IMPLEMENTED); + + return (*engine->ops->query_swdb) (engine->engine, name, iversion, result); +} + + void _gpgme_engine_set_io_cbs (engine_t engine, gpgme_io_cbs_t io_cbs) { diff --git a/src/engine.h b/src/engine.h index 2999ab6..15b0b5d 100644 --- a/src/engine.h +++ b/src/engine.h @@ -173,6 +173,12 @@ gpgme_error_t _gpgme_engine_op_conf_load (engine_t engine, gpgme_error_t _gpgme_engine_op_conf_save (engine_t engine, gpgme_conf_comp_t conf); +gpgme_error_t _gpgme_engine_op_query_swdb (engine_t engine, + const char *name, + const char *iversion, + gpgme_query_swdb_result_t result); + + void _gpgme_engine_set_io_cbs (engine_t engine, gpgme_io_cbs_t io_cbs); void _gpgme_engine_io_event (engine_t engine, diff --git a/src/gpgconf.c b/src/gpgconf.c index 6591452..b1b84a6 100644 --- a/src/gpgconf.c +++ b/src/gpgconf.c @@ -65,7 +65,7 @@ gpgme_conf_release (gpgme_conf_comp_t conf) } -/* Public function to release load a configuration list. No +/* Public function to load a configuration list. No asynchronous interface for now. */ gpgme_error_t gpgme_op_conf_load (gpgme_ctx_t ctx, gpgme_conf_comp_t *conf_p) @@ -108,5 +108,3 @@ gpgme_op_conf_save (gpgme_ctx_t ctx, gpgme_conf_comp_t comp) ctx->protocol = proto; return err; } - - diff --git a/src/gpgme.def b/src/gpgme.def index d633df5..2f6837d 100644 --- a/src/gpgme.def +++ b/src/gpgme.def @@ -249,5 +249,8 @@ EXPORTS gpgme_set_sender @187 gpgme_get_sender @188 + gpgme_op_query_swdb @189 + gpgme_op_query_swdb_result @190 + ; END diff --git a/src/gpgme.h.in b/src/gpgme.h.in index 94ef51d..4f470a0 100644 --- a/src/gpgme.h.in +++ b/src/gpgme.h.in @@ -2418,6 +2418,67 @@ gpgme_error_t gpgme_op_conf_load (gpgme_ctx_t ctx, gpgme_conf_comp_t *conf_p); gpgme_error_t gpgme_op_conf_save (gpgme_ctx_t ctx, gpgme_conf_comp_t comp); +/* Information about software versions. */ +typedef struct _gpgme_op_query_swdb_result +{ + /* RFU */ + struct _gpgme_op_query_swdb_result *next; + + /* The name of the package (e.g. "gpgme", "gnupg") */ + char *name; + + /* The version number of the installed version. */ + char *iversion; + + /* The time the online info was created. */ + unsigned long created; + + /* The time the online info was retrieved. */ + unsigned long retrieved; + + /* This bit is set if an error occured or some of the information + * in this structure may not be set. */ + unsigned int warning : 1; + + /* An update is available. */ + unsigned int update : 1; + + /* The update is important. */ + unsigned int urgent : 1; + + /* No information at all available. */ + unsigned int noinfo : 1; + + /* The package name is not known. */ + unsigned int unknown : 1; + + /* The information here is too old. */ + unsigned int tooold : 1; + + /* Other error. */ + unsigned int error : 1; + + unsigned int _reserved : 25; + + /* The version number of the latest released version. */ + char *version; + + /* The release date of that version. */ + unsigned long reldate; + +} *gpgme_query_swdb_result_t; + + +/* Run the gpgconf --query-swdb command. */ +gpgme_error_t gpgme_op_query_swdb (gpgme_ctx_t ctx, + const char *name, const char *iversion, + unsigned int reserved); + +/* Return the result from the last query_swdb operation. */ +gpgme_query_swdb_result_t gpgme_op_query_swdb_result (gpgme_ctx_t ctx); + + + /* * Various functions. diff --git a/src/libgpgme.vers b/src/libgpgme.vers index 42f00d5..5457daa 100644 --- a/src/libgpgme.vers +++ b/src/libgpgme.vers @@ -122,6 +122,9 @@ GPGME_1.1 { gpgme_set_sender; gpgme_get_sender; + + gpgme_op_query_swdb; + gpgme_op_query_swdb_result; }; diff --git a/src/queryswdb.c b/src/queryswdb.c new file mode 100644 index 0000000..ce50b1e --- /dev/null +++ b/src/queryswdb.c @@ -0,0 +1,121 @@ +/* queryswdb.c - Access to the SWDB file + * Copyright (C) 2016 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 . + */ + +#if HAVE_CONFIG_H +#include +#endif +#include +#include + +#include "gpgme.h" +#include "debug.h" +#include "context.h" +#include "ops.h" + + +typedef struct +{ + struct _gpgme_op_query_swdb_result result; + +} *op_data_t; + + + +static void +release_op_data (void *hook) +{ + op_data_t opd = (op_data_t) hook; + gpgme_query_swdb_result_t result = &opd->result; + + assert (!result->next); + free (result->name); + free (result->iversion); + free (result->version); +} + + +gpgme_query_swdb_result_t +gpgme_op_query_swdb_result (gpgme_ctx_t ctx) +{ + void *hook; + op_data_t opd; + gpgme_error_t err; + + TRACE_BEG (DEBUG_CTX, "gpgme_op_query_swdb_result", ctx); + + err = _gpgme_op_data_lookup (ctx, OPDATA_QUERY_SWDB, &hook, -1, NULL); + opd = hook; + + if (err || !opd) + { + TRACE_SUC0 ("result=(null)"); + return NULL; + } + + TRACE_SUC1 ("result=%p", &opd->result); + return &opd->result; +} + + + +/* Query the swdb for software package NAME and check against the + * installed version given by IVERSION. If IVERSION is NULL a check + * is only done if GPGME can figure out the version by itself + * (e.g. for "gpgme" or "gnupg"). RESERVED should be 0. + * + * Note that we only implemented the synchronous variant of this + * function but the API is prepared for an asynchronous variant. + */ +gpgme_error_t +gpgme_op_query_swdb (gpgme_ctx_t ctx, const char *name, const char *iversion, + unsigned int reserved) +{ + gpgme_error_t err; + void *hook; + op_data_t opd; + + TRACE_BEG2 (DEBUG_CTX, "gpgme_op_query_swdb", ctx, + "name=%s, iversion=%a", name, iversion); + + if (!ctx || reserved) + return TRACE_ERR (gpg_error (GPG_ERR_INV_VALUE)); + + if (ctx->protocol != GPGME_PROTOCOL_GPGCONF) + return TRACE_ERR (gpg_error (GPG_ERR_UNSUPPORTED_PROTOCOL)); + + if (!name) + name = "gpgme"; + + if (!iversion && !strcmp (name, "gpgme")) + iversion = VERSION; + + err = _gpgme_op_reset (ctx, 1); + if (err) + return err; + + err = _gpgme_op_data_lookup (ctx, OPDATA_QUERY_SWDB, &hook, + sizeof (*opd), release_op_data); + opd = hook; + if (err) + return TRACE_ERR (err); + + err = _gpgme_engine_op_query_swdb (ctx->engine, name, iversion, + &opd->result); + return TRACE_ERR (err); +} diff --git a/src/util.h b/src/util.h index 1474b41..a1be6e7 100644 --- a/src/util.h +++ b/src/util.h @@ -49,6 +49,11 @@ # define GPG_ERR_FALSE 256 #endif +#if GPG_ERROR_VERSION_NUMBER < 0x011900 /* 1.25 */ +# define GPG_ERR_ENGINE_TOO_OLD 300 +# define GPG_ERR_TOO_OLD 308 +#endif + #ifndef GPGRT_ATTR_SENTINEL # define GPGRT_ATTR_SENTINEL(a) /* */ #endif diff --git a/tests/Makefile.am b/tests/Makefile.am index c71914f..e8c7c56 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -33,7 +33,7 @@ noinst_HEADERS = run-support.h noinst_PROGRAMS = $(TESTS) run-keylist run-export run-import run-sign \ run-verify run-encrypt run-identify run-decrypt run-genkey \ - run-keysign run-tofu + run-keysign run-tofu run-swdb if RUN_GPG_TESTS diff --git a/tests/run-swdb.c b/tests/run-swdb.c new file mode 100644 index 0000000..91ed22f --- /dev/null +++ b/tests/run-swdb.c @@ -0,0 +1,151 @@ +/* run-swdb.c - Test tool for SWDB function + * Copyright (C) 2016 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 . + */ + +/* 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 +#endif + +#include +#include +#include +#include + +#include + +#define PGM "run-swdb" + +#include "run-support.h" + + +static int verbose; + + +static const char * +isotimestr (unsigned long value) +{ + time_t t; + static char buffer[25+5]; + struct tm *tp; + + if (!value) + return "none"; + t = value; + + tp = gmtime (&t); + snprintf (buffer, sizeof buffer, "%04d-%02d-%02d %02d:%02d:%02d", + 1900+tp->tm_year, tp->tm_mon+1, tp->tm_mday, + tp->tm_hour, tp->tm_min, tp->tm_sec); + return buffer; +} + + +static int +show_usage (int ex) +{ + fputs ("usage: " PGM " [options] NAME [VERSION]\n\n" + "Options:\n" + " --verbose run in verbose mode\n" + " --status print status lines from the backend\n" + , stderr); + exit (ex); +} + + +int +main (int argc, char **argv) +{ + int last_argc = -1; + gpgme_error_t err; + gpgme_ctx_t ctx; + gpgme_protocol_t protocol = GPGME_PROTOCOL_GPGCONF; + const char *name; + const char *iversion; + gpgme_query_swdb_result_t result; + + if (argc) + { argc--; argv++; } + + while (argc && last_argc != argc ) + { + last_argc = argc; + if (!strcmp (*argv, "--")) + { + argc--; argv++; + break; + } + else if (!strcmp (*argv, "--help")) + show_usage (0); + else if (!strcmp (*argv, "--verbose")) + { + verbose = 1; + argc--; argv++; + } + else if (!strncmp (*argv, "--", 2)) + show_usage (1); + } + + if (argc < 1 || argc > 2) + show_usage (1); + name = argv[0]; + iversion = argc > 1? argv[1] : NULL; + + init_gpgme (protocol); + + err = gpgme_new (&ctx); + fail_if_err (err); + gpgme_set_protocol (ctx, protocol); + + err = gpgme_op_query_swdb (ctx, name, iversion, 0); + if (err) + { + fprintf (stderr, PGM ": error querying swdb: %s\n", gpg_strerror (err)); + exit (1); + } + + result = gpgme_op_query_swdb_result (ctx); + if (!result) + { + fprintf (stderr, PGM ": error querying swdb: %s\n", "no result"); + exit (1); + } + + printf ("package ...: %s\n" + "iversion ..: %s\n" + "version ...: %s\n", + nonnull (result->name), + nonnull (result->iversion), + nonnull (result->version)); + printf ("reldate ...: %s\n", isotimestr (result->reldate)); + printf ("created ...: %s\n", isotimestr (result->created)); + printf ("retrieved .: %s\n", isotimestr (result->retrieved)); + printf ("flags .....:%s%s%s%s%s%s%s\n", + result->warning? " warning" : "", + result->update? " update" : "", + result->urgent? " urgent" : "", + result->unknown? " unknown" : "", + result->tooold? " tooold" : "", + result->noinfo? " noinfo" : "", + result->error? " error" : "" ); + + + gpgme_release (ctx); + return 0; +} ----------------------------------------------------------------------- Summary of changes: NEWS | 3 + doc/gpgme.texi | 141 ++++++++++++++++++++++++++++++++- src/Makefile.am | 2 +- src/context.h | 3 +- src/engine-assuan.c | 1 + src/engine-backend.h | 4 + src/engine-g13.c | 1 + src/engine-gpg.c | 1 + src/engine-gpgconf.c | 213 ++++++++++++++++++++++++++++++++++++++++++++++++++ src/engine-gpgsm.c | 1 + src/engine-spawn.c | 1 + src/engine-uiserver.c | 1 + src/engine.c | 15 ++++ src/engine.h | 6 ++ src/gpgconf.c | 4 +- src/gpgme.def | 3 + src/gpgme.h.in | 61 +++++++++++++++ src/libgpgme.vers | 3 + src/queryswdb.c | 121 ++++++++++++++++++++++++++++ src/util.h | 5 ++ tests/Makefile.am | 2 +- tests/run-swdb.c | 151 +++++++++++++++++++++++++++++++++++ 22 files changed, 736 insertions(+), 7 deletions(-) create mode 100644 src/queryswdb.c create mode 100644 tests/run-swdb.c hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Thu Nov 3 19:01:54 2016 From: cvs at cvs.gnupg.org (by Daniel Kahn Gillmor) Date: Thu, 03 Nov 2016 19:01:54 +0100 Subject: [git] Pinentry - branch, master, updated. pinentry-0.9.7-35-g7b0a822 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The standard pinentry collection". The branch, master has been updated via 7b0a822460eb6f4bf28f85f38c64a86bb8f80d3d (commit) via b0f17edadeefaafd2707a384b77e45a0bf573c3a (commit) from a383ddeb76463ddcf5aca2fb38847ea3158c42a7 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 7b0a822460eb6f4bf28f85f38c64a86bb8f80d3d Author: Daniel Kahn Gillmor Date: Thu Nov 3 12:59:18 2016 -0400 Convert to UTF-8. Signed-off-by: Daniel Kahn Gillmor diff --git a/AUTHORS b/AUTHORS index 695d0ba..d74004a 100644 --- a/AUTHORS +++ b/AUTHORS @@ -5,7 +5,7 @@ License: GPLv2+ Robert Bihlmeyer Werner Koch, g10 Code GmbH -Steffen Hansen, Klar?lvdalens Datakonsult AB +Steffen Hansen, Klar??lvdalens Datakonsult AB Marcus Brinkmann, g10 Code GmbH Timo Schulz, g10 Code GmbH Neal Walfied, g10 Code GmbH diff --git a/doc/pinentry.texi b/doc/pinentry.texi index e9da4ee..feef4f0 100644 --- a/doc/pinentry.texi +++ b/doc/pinentry.texi @@ -64,7 +64,7 @@ This is edition @value{EDITION}, last updated @value{UPDATED}, of @cite{The `PINEntry' Manual}, for version @value{VERSION}. @sp 1 Published by g10 Code GmbH@* -H?ttenstr. 61@* +H??ttenstr. 61@* 40699 Erkrath, Germany @sp 1 @copyrightnotice{} diff --git a/qt/Makefile.am b/qt/Makefile.am index 96d0880..6659007 100644 --- a/qt/Makefile.am +++ b/qt/Makefile.am @@ -1,5 +1,5 @@ # Makefile.am -# Copyright (C) 2002 g10 Code GmbH, Klar?lvdalens Datakonsult AB +# Copyright (C) 2002 g10 Code GmbH, Klar??lvdalens Datakonsult AB # Copyright (C) 2008, 2015 g10 Code GmbH # # This file is part of PINENTRY. commit b0f17edadeefaafd2707a384b77e45a0bf573c3a Author: Daniel Kahn Gillmor Date: Thu Nov 3 12:59:17 2016 -0400 Fix spelling errors. -- Signed-off-by: Daniel Kahn Gillmor Note that this also updates \texinfoversion to 2016-11-03.12 Signed-off-by: Werner Koch diff --git a/ChangeLog-old b/ChangeLog-old index cad8c1a..02a8010 100644 --- a/ChangeLog-old +++ b/ChangeLog-old @@ -999,7 +999,7 @@ * configure.ac: Version 0.6.9 * qt/Makefile.am: Added moc files to DISTCLEANFILES - * qt/pinentrycontroller.cpp: Dont spew assuan debug stuff out on stderr. + * qt/pinentrycontroller.cpp: Don't spew assuan debug stuff out on stderr. 2003-03-26 Steffen Hansen @@ -1619,7 +1619,7 @@ 2000-04-23 Robert Bihlmeyer * secret-query.c (constrain_size): Lower window max_width to - accomodate bugs in GTK and Scwm. + accommodate bugs in GTK and Scwm. * agent.c (main): Set x_enabled if X appears to be available. Use it to selectively make FLAGS_INSURE supported. @@ -1861,7 +1861,7 @@ * agent.c (main): Moved secmem_init() after the fork, since that seemingly munlock's all pages. - Drop priviledges just in case somebody wants to install this + Drop privileges just in case somebody wants to install this suid-root. Flush stdout. @@ -1953,7 +1953,7 @@ * Thoughts: Removed discussion of other names. Added indication of which things already work. - * agent.c (make_tmpdir): Removed occurance of "gpg-agent." + * agent.c (make_tmpdir): Removed occurrence of "gpg-agent." * README: First proper version. diff --git a/NEWS b/NEWS index 4278865..7a7ca76 100644 --- a/NEWS +++ b/NEWS @@ -217,7 +217,7 @@ Noteworthy changes in version 0.7.3 (2007-07-06) * New option --colors=FG,BG,SO to set the colors for the curses pinentry. - * Pinentry-w32 does now basicaly work. It needs some finishing + * Pinentry-w32 does now basically work. It needs some finishing though. For example the buttons should resize themself according to the size of the text. diff --git a/build-aux/texinfo.tex b/build-aux/texinfo.tex index a181898..5552e50 100644 --- a/build-aux/texinfo.tex +++ b/build-aux/texinfo.tex @@ -3,7 +3,7 @@ % Load plain if necessary, i.e., if running under initex. \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi % -\def\texinfoversion{2007-05-03.09} +\def\texinfoversion{2016-11-03.12} % % Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, @@ -415,7 +415,7 @@ \def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm} \def\argremovec#1\c#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm} -% Each occurence of `\^^M' or `\^^M' is replaced by a single space. +% Each occurrence of `\^^M' or `\^^M' is replaced by a single space. % % \argremovec might leave us with trailing space, e.g., % @end itemize @c foo @@ -440,7 +440,7 @@ % to get _exactly_ the rest of the line, we had to prevent such situation. % We prepended an \empty token at the very beginning and we expand it now, % just before passing the control to \argtorun. -% (Similarily, we have to think about #3 of \argcheckspacesY above: it is +% (Similarly, we have to think about #3 of \argcheckspacesY above: it is % either the null string, or it ends with \^^M---thus there is no danger % that a pair of braces would be stripped. % @@ -497,7 +497,7 @@ % used to check whether the current environment is the one expected. % % Non-false conditionals (@iftex, @ifset) don't fit into this, so they -% are not treated as enviroments; they don't open a group. (The +% are not treated as environments; they don't open a group. (The % implementation of @end takes care not to call \endgroup in this % special case.) @@ -4598,7 +4598,7 @@ end \chardef\maxseclevel = 3 % % A numbered section within an unnumbered changes to unnumbered too. -% To achive this, remember the "biggest" unnum. sec. we are currently in: +% To achieve this, remember the "biggest" unnum. sec. we are currently in: \chardef\unmlevel = \maxseclevel % % Trace whether the current chapter is an appendix or not: @@ -7034,7 +7034,7 @@ end % In case a @footnote appears in a vbox, save the footnote text and create % the real \insert just after the vbox finished. Otherwise, the insertion % would be lost. -% Similarily, if a @footnote appears inside an alignment, save the footnote +% Similarly, if a @footnote appears inside an alignment, save the footnote % text to a box and make the \insert when a row of the table is finished. % And the same can be done for other insert classes. --kasal, 16nov03. diff --git a/doc/pinentry.texi b/doc/pinentry.texi index dcff886..e9da4ee 100644 --- a/doc/pinentry.texi +++ b/doc/pinentry.texi @@ -711,14 +711,14 @@ The actual return code is dependent on whether the dialog is in message mode or in passphrase mode. If the dialog is in message mode and the user pressed ok, return 1. -Otherwise, return 0. If an error occured, indicate this by setting it +Otherwise, return 0. If an error occurred, indicate this by setting it in @code{specific_err} or setting @code{locale_err} to @code{1} (for locale specific errors). If the dialog was canceled, then the handler should set the @code{canceled} variable to @code{1}. If the not ok button was pressed, don't do anything else. If the dialog is in passphrase mode return @code{1} if the user -entered a password and pressed ok. If an error occured, return +entered a password and pressed ok. If an error occurred, return @code{-1} and set @code{specific_err} or @code{locale_err}, as above. If the user canceled the dialog box, return @code{-1}. diff --git a/doc/texinfo.tex b/doc/texinfo.tex index 5063065..919d85d 100644 --- a/doc/texinfo.tex +++ b/doc/texinfo.tex @@ -3,7 +3,7 @@ % Load plain if necessary, i.e., if running under initex. \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi % -\def\texinfoversion{2007-05-03.09} +\def\texinfoversion{2016-11-03.12} % % Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, @@ -415,7 +415,7 @@ \def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm} \def\argremovec#1\c#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm} -% Each occurence of `\^^M' or `\^^M' is replaced by a single space. +% Each occurrence of `\^^M' or `\^^M' is replaced by a single space. % % \argremovec might leave us with trailing space, e.g., % @end itemize @c foo @@ -440,7 +440,7 @@ % to get _exactly_ the rest of the line, we had to prevent such situation. % We prepended an \empty token at the very beginning and we expand it now, % just before passing the control to \argtorun. -% (Similarily, we have to think about #3 of \argcheckspacesY above: it is +% (Similarly, we have to think about #3 of \argcheckspacesY above: it is % either the null string, or it ends with \^^M---thus there is no danger % that a pair of braces would be stripped. % @@ -497,7 +497,7 @@ % used to check whether the current environment is the one expected. % % Non-false conditionals (@iftex, @ifset) don't fit into this, so they -% are not treated as enviroments; they don't open a group. (The +% are not treated as environments; they don't open a group. (The % implementation of @end takes care not to call \endgroup in this % special case.) @@ -4598,7 +4598,7 @@ end \chardef\maxseclevel = 3 % % A numbered section within an unnumbered changes to unnumbered too. -% To achive this, remember the "biggest" unnum. sec. we are currently in: +% To achieve this, remember the "biggest" unnum. sec. we are currently in: \chardef\unmlevel = \maxseclevel % % Trace whether the current chapter is an appendix or not: @@ -7034,7 +7034,7 @@ end % In case a @footnote appears in a vbox, save the footnote text and create % the real \insert just after the vbox finished. Otherwise, the insertion % would be lost. -% Similarily, if a @footnote appears inside an alignment, save the footnote +% Similarly, if a @footnote appears inside an alignment, save the footnote % text to a box and make the \insert when a row of the table is finished. % And the same can be done for other insert classes. --kasal, 16nov03. diff --git a/gnome3/pinentry-gnome3.c b/gnome3/pinentry-gnome3.c index d6d7d16..90ff60f 100644 --- a/gnome3/pinentry-gnome3.c +++ b/gnome3/pinentry-gnome3.c @@ -104,7 +104,7 @@ create_prompt (pinentry_t pe, int confirm) g_free (msg); } - /* An error occured during the last prompt. */ + /* An error occurred during the last prompt. */ if (pe->error) { msg = pinentry_utf8_validate (pe->error); diff --git a/m4/glib.m4 b/m4/glib.m4 index b3c632b..7338acb 100644 --- a/m4/glib.m4 +++ b/m4/glib.m4 @@ -95,7 +95,7 @@ main () glib_major_version, glib_minor_version, glib_micro_version); printf ("*** was found! If glib-config was correct, then it is best\n"); printf ("*** to remove the old version of GLIB. You may also be able to fix the error\n"); - printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); + printf("*** by modifying your LD_LIBRARY_PATH environment variable, or by editing\n"); printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); printf("*** required on your system.\n"); printf("*** If glib-config was wrong, set the environment variable GLIB_CONFIG\n"); @@ -132,7 +132,7 @@ main () printf("*** being found. The easiest way to fix this is to remove the old version\n"); printf("*** of GLIB, but you can also set the GLIB_CONFIG environment to point to the\n"); printf("*** correct copy of glib-config. (In this case, you will have to\n"); - printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); + printf("*** modify your LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf\n"); printf("*** so that the correct libraries are found at run-time))\n"); } } @@ -179,7 +179,7 @@ main () echo "***" echo "*** rpm --erase --nodeps gtk gtk-devel" ], [ echo "*** The test program failed to compile or link. See the file config.log for the" - echo "*** exact error that occured. This usually means GLIB was incorrectly installed" + echo "*** exact error that occurred. This usually means GLIB was incorrectly installed" echo "*** or that you have moved GLIB since it was installed. In the latter case, you" echo "*** may want to edit the glib-config script: $GLIB_CONFIG" ]) CFLAGS="$ac_save_CFLAGS" diff --git a/m4/gtk.m4 b/m4/gtk.m4 index f2dd472..6f6a422 100644 --- a/m4/gtk.m4 +++ b/m4/gtk.m4 @@ -91,7 +91,7 @@ main () gtk_major_version, gtk_minor_version, gtk_micro_version); printf ("*** was found! If gtk-config was correct, then it is best\n"); printf ("*** to remove the old version of GTK+. You may also be able to fix the error\n"); - printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n"); + printf("*** by modifying your LD_LIBRARY_PATH environment variable, or by editing\n"); printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n"); printf("*** required on your system.\n"); printf("*** If gtk-config was wrong, set the environment variable GTK_CONFIG\n"); @@ -130,7 +130,7 @@ main () printf("*** being found. The easiest way to fix this is to remove the old version\n"); printf("*** of GTK+, but you can also set the GTK_CONFIG environment to point to the\n"); printf("*** correct copy of gtk-config. (In this case, you will have to\n"); - printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n"); + printf("*** modify your LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf\n"); printf("*** so that the correct libraries are found at run-time))\n"); } } @@ -177,7 +177,7 @@ main () echo "***" echo "*** rpm --erase --nodeps gtk gtk-devel" ], [ echo "*** The test program failed to compile or link. See the file config.log for the" - echo "*** exact error that occured. This usually means GTK was incorrectly installed" + echo "*** exact error that occurred. This usually means GTK was incorrectly installed" echo "*** or that you have moved GTK since it was installed. In the latter case, you" echo "*** may want to edit the gtk-config script: $GTK_CONFIG" ]) CFLAGS="$ac_save_CFLAGS" diff --git a/pinentry/argparse.c b/pinentry/argparse.c index e31b67e..4f586d4 100644 --- a/pinentry/argparse.c +++ b/pinentry/argparse.c @@ -845,7 +845,7 @@ find_long_option( ARGPARSE_ARGS *arg, /* Would be better if we can do a binary search, but it is not possible to reorder our option table because we would mess up our help strings - What we can do is: Build a nice option - lookup table wehn this function is first invoked */ + lookup table when this function is first invoked */ if( !*keyword ) return -1; for(i=0; opts[i].short_opt; i++ ) diff --git a/pinentry/pinentry.c b/pinentry/pinentry.c index 3131b1e..4a0f859 100644 --- a/pinentry/pinentry.c +++ b/pinentry/pinentry.c @@ -96,7 +96,7 @@ pinentry_reset (int use_defaults) pinentry_color_t color_so = pinentry.color_so; int color_so_bright = pinentry.color_so_bright; - int timout = pinentry.timeout; + int timeout = pinentry.timeout; char *invisible_char = pinentry.invisible_char; @@ -184,7 +184,7 @@ pinentry_reset (int use_defaults) pinentry.color_so = color_so; pinentry.color_so_bright = color_so_bright; - pinentry.timeout = timout; + pinentry.timeout = timeout; } } diff --git a/pinentry/pinentry.h b/pinentry/pinentry.h index 50d5f98..c6e12e4 100644 --- a/pinentry/pinentry.h +++ b/pinentry/pinentry.h @@ -109,7 +109,7 @@ struct pinentry int canceled; /* The frontend should set this to true if an error with the local - conversion occured. */ + conversion occurred. */ int locale_err; /* The frontend should set this to a gpg-error so that commands are @@ -222,7 +222,7 @@ typedef struct pinentry *pinentry_t; PIN. If PIN->pin is zero, request a confirmation, otherwise a PIN entry. On confirmation, the function should return TRUE if confirmed, and FALSE otherwise. On PIN entry, the function should - return -1 if an error occured or the user cancelled the operation + return -1 if an error occurred or the user cancelled the operation and 1 otherwise. */ typedef int (*pinentry_cmd_handler_t) (pinentry_t pin); diff --git a/qt/pinentrydialog.cpp b/qt/pinentrydialog.cpp index 12f7718..f9dd700 100644 --- a/qt/pinentrydialog.cpp +++ b/qt/pinentrydialog.cpp @@ -75,7 +75,7 @@ WINBOOL SetForegroundWindowEx(HWND hWnd) void raiseWindow(QWidget *w) { - /* Maybe Qt will become agressive enough one day that + /* Maybe Qt will become aggressive enough one day that * this is enough on windows too*/ w->raise(); #ifdef Q_OS_WIN ----------------------------------------------------------------------- Summary of changes: AUTHORS | 2 +- ChangeLog-old | 8 ++++---- NEWS | 2 +- build-aux/texinfo.tex | 12 ++++++------ doc/pinentry.texi | 6 +++--- doc/texinfo.tex | 12 ++++++------ gnome3/pinentry-gnome3.c | 2 +- m4/glib.m4 | 6 +++--- m4/gtk.m4 | 6 +++--- pinentry/argparse.c | 2 +- pinentry/pinentry.c | 4 ++-- pinentry/pinentry.h | 4 ++-- qt/Makefile.am | 2 +- qt/pinentrydialog.cpp | 2 +- 14 files changed, 35 insertions(+), 35 deletions(-) hooks/post-receive -- The standard pinentry collection http://git.gnupg.org From cvs at cvs.gnupg.org Thu Nov 3 20:14:36 2016 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Thu, 03 Nov 2016 20:14:36 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.1.15-318-gc1ea0b5 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via c1ea0b577a468030d2b006317ba27fc1746c4b14 (commit) from ab89164be02012f1bf159c971853b8610e966301 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit c1ea0b577a468030d2b006317ba27fc1746c4b14 Author: Werner Koch Date: Thu Nov 3 20:07:56 2016 +0100 agent: Extend the PINENTRY_LAUNCHED inquiry and status. * agent/call-pinentry.c (start_pinentry): Get flavor and version and pass it to agent_inq_pinentry_launched. * agent/command.c (agent_inq_pinentry_launched): Add arg EXTRA. * g10/server.c (gpg_proxy_pinentry_notify): Print a new diagnostic. Signed-off-by: Werner Koch diff --git a/agent/agent.h b/agent/agent.h index 1d40386..2775c84 100644 --- a/agent/agent.h +++ b/agent/agent.h @@ -349,7 +349,8 @@ void agent_sighup_action (void); int map_pk_openpgp_to_gcry (int openpgp_algo); /*-- command.c --*/ -gpg_error_t agent_inq_pinentry_launched (ctrl_t ctrl, unsigned long pid); +gpg_error_t agent_inq_pinentry_launched (ctrl_t ctrl, unsigned long pid, + const char *extra); gpg_error_t agent_write_status (ctrl_t ctrl, const char *keyword, ...) GPGRT_ATTR_SENTINEL(0); gpg_error_t agent_print_status (ctrl_t ctrl, const char *keyword, diff --git a/agent/call-pinentry.c b/agent/call-pinentry.c index 813df9a..f83778e 100644 --- a/agent/call-pinentry.c +++ b/agent/call-pinentry.c @@ -225,6 +225,7 @@ getinfo_pid_cb (void *opaque, const void *buffer, size_t length) return 0; } + /* Fork off the pin entry if this has not already been done. Note, that this function must always be used to acquire the lock for the pinentry - we will serialize _all_ pinentry calls. @@ -243,6 +244,7 @@ start_pinentry (ctrl_t ctrl) unsigned long pinentry_pid; const char *value; struct timespec abstime; + char *flavor_version; int err; npth_clock_gettime (&abstime); @@ -539,6 +541,25 @@ start_pinentry (ctrl_t ctrl) } + /* Ask the pinentry for its version and flavor and streo that as a + * string in MB. This information is useful for helping users to + * figure out Pinentry problems. */ + { + membuf_t mb; + + init_membuf (&mb, 256); + if (assuan_transact (entry_ctx, "GETINFO flavor", + put_membuf_cb, &mb, NULL, NULL, NULL, NULL)) + put_membuf_str (&mb, "unknown"); + put_membuf_str (&mb, " "); + if (assuan_transact (entry_ctx, "GETINFO version", + put_membuf_cb, &mb, NULL, NULL, NULL, NULL)) + put_membuf_str (&mb, "unknown"); + put_membuf (&mb, "", 1); + flavor_version = get_membuf (&mb, NULL); + } + + /* Now ask the Pinentry for its PID. If the Pinentry is new enough it will send the pid back and we will use an inquire to notify our client. The client may answer the inquiry either with END or @@ -555,7 +576,7 @@ start_pinentry (ctrl_t ctrl) log_error ("pinentry did not return a PID\n"); else { - rc = agent_inq_pinentry_launched (ctrl, pinentry_pid); + rc = agent_inq_pinentry_launched (ctrl, pinentry_pid, flavor_version); if (gpg_err_code (rc) == GPG_ERR_CANCELED || gpg_err_code (rc) == GPG_ERR_FULLY_CANCELED) return unlock_pinentry (gpg_err_make (GPG_ERR_SOURCE_DEFAULT, @@ -563,6 +584,8 @@ start_pinentry (ctrl_t ctrl) rc = 0; } + xfree (flavor_version); + return 0; } diff --git a/agent/command.c b/agent/command.c index 999f608..4db2834 100644 --- a/agent/command.c +++ b/agent/command.c @@ -362,14 +362,15 @@ agent_print_status (ctrl_t ctrl, const char *keyword, const char *format, ...) that might disturb some older clients, this is only done if enabled via an option. Returns an gpg error code. */ gpg_error_t -agent_inq_pinentry_launched (ctrl_t ctrl, unsigned long pid) +agent_inq_pinentry_launched (ctrl_t ctrl, unsigned long pid, const char *extra) { - char line[100]; + char line[256]; if (!ctrl || !ctrl->server_local || !ctrl->server_local->allow_pinentry_notify) return 0; - snprintf (line, DIM(line), "PINENTRY_LAUNCHED %lu", pid); + snprintf (line, DIM(line), "PINENTRY_LAUNCHED %lu%s%s", + pid, extra?" ":"", extra? extra:""); return assuan_inquire (ctrl->server_local->assuan_ctx, line, NULL, NULL, 0); } diff --git a/g10/server.c b/g10/server.c index 258f08a..0e15176 100644 --- a/g10/server.c +++ b/g10/server.c @@ -770,6 +770,20 @@ gpg_server (ctrl_t ctrl) gpg_error_t gpg_proxy_pinentry_notify (ctrl_t ctrl, const unsigned char *line) { + if (opt.verbose) + { + char *linecopy = xtrystrdup (line); + char *fields[4]; + + if (linecopy + && split_fields (linecopy, fields, DIM (fields)) >= 4 + && !strcmp (fields[0], "PINENTRY_LAUNCHED")) + log_info (_("pinentry launched (pid %s, flavor %s, version %s)\n"), + fields[1], fields[2], fields[3]); + + xfree (linecopy); + } + if (!ctrl || !ctrl->server_local || !ctrl->server_local->allow_pinentry_notify) { ----------------------------------------------------------------------- Summary of changes: agent/agent.h | 3 ++- agent/call-pinentry.c | 25 ++++++++++++++++++++++++- agent/command.c | 7 ++++--- g10/server.c | 14 ++++++++++++++ 4 files changed, 44 insertions(+), 5 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Fri Nov 4 05:52:41 2016 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Fri, 04 Nov 2016 05:52:41 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.1.15-319-gf9da935 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via f9da935c3eb302e75a80def51128fb6f669661d7 (commit) from c1ea0b577a468030d2b006317ba27fc1746c4b14 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit f9da935c3eb302e75a80def51128fb6f669661d7 Author: NIIBE Yutaka Date: Fri Nov 4 13:45:57 2016 +0900 scd: Add --advanced option for READKEY. * scd/command.c (cmd_readkey) : Support ADVANCED arg. * scd/app.c (app_readcert): Add ADVANCED arg. * scd/app-openpgp.c (do_readkey): Implement ADVANCED arg. * scd/app-nks.c (do_readkey): Error return with GPG_ERR_NOT_SUPPORTED. -- "SCD READKEY --advanced OPENPGP.3" returns key in advanced format. With this suport, poldi-ctrl will be no longer needed. Signed-off-by: NIIBE Yutaka diff --git a/scd/app-common.h b/scd/app-common.h index b4bb55b..cda657f 100644 --- a/scd/app-common.h +++ b/scd/app-common.h @@ -72,7 +72,7 @@ struct app_ctx_s { gpg_error_t (*learn_status) (app_t app, ctrl_t ctrl, unsigned int flags); gpg_error_t (*readcert) (app_t app, const char *certid, unsigned char **cert, size_t *certlen); - gpg_error_t (*readkey) (app_t app, const char *certid, + gpg_error_t (*readkey) (app_t app, int advanced, const char *certid, unsigned char **pk, size_t *pklen); gpg_error_t (*getattr) (app_t app, ctrl_t ctrl, const char *name); gpg_error_t (*setattr) (app_t app, const char *name, @@ -154,7 +154,7 @@ gpg_error_t app_write_learn_status (app_t app, ctrl_t ctrl, unsigned int flags); gpg_error_t app_readcert (app_t app, const char *certid, unsigned char **cert, size_t *certlen); -gpg_error_t app_readkey (app_t app, const char *keyid, +gpg_error_t app_readkey (app_t app, int advanced, const char *keyid, unsigned char **pk, size_t *pklen); gpg_error_t app_getattr (app_t app, ctrl_t ctrl, const char *name); gpg_error_t app_setattr (app_t app, const char *name, diff --git a/scd/app-nks.c b/scd/app-nks.c index 458516b..598dee1 100644 --- a/scd/app-nks.c +++ b/scd/app-nks.c @@ -618,13 +618,17 @@ do_readcert (app_t app, const char *certid, certificate parsing code in commands.c:cmd_readkey. For internal use PK and PKLEN may be NULL to just check for an existing key. */ static gpg_error_t -do_readkey (app_t app, const char *keyid, unsigned char **pk, size_t *pklen) +do_readkey (app_t app, int advanced, const char *keyid, + unsigned char **pk, size_t *pklen) { gpg_error_t err; unsigned char *buffer[2]; size_t buflen[2]; unsigned short path[1] = { 0x4500 }; + if (advanced) + return GPG_ERR_NOT_SUPPORTED; + /* We use a generic name to retrieve PK.AUT.IFD-SPK. */ if (!strcmp (keyid, "$IFDAUTHKEY") && app->app_local->nks_version >= 3) ; @@ -698,7 +702,7 @@ do_writekey (app_t app, ctrl_t ctrl, else return gpg_error (GPG_ERR_INV_ID); - if (!force && !do_readkey (app, keyid, NULL, NULL)) + if (!force && !do_readkey (app, 0, keyid, NULL, NULL)) return gpg_error (GPG_ERR_EEXIST); /* Parse the S-expression. */ diff --git a/scd/app-openpgp.c b/scd/app-openpgp.c index d75721f..4bf99ad 100644 --- a/scd/app-openpgp.c +++ b/scd/app-openpgp.c @@ -1115,8 +1115,8 @@ retrieve_fpr_from_card (app_t app, int keyno, char *fpr) #if GNUPG_MAJOR_VERSION > 1 static gpg_error_t retrieve_key_material (FILE *fp, const char *hexkeyid, - const unsigned char **m, size_t *mlen, - const unsigned char **e, size_t *elen) + const unsigned char **m, size_t *mlen, + const unsigned char **e, size_t *elen) { gcry_error_t err = 0; char *line = NULL; /* read_line() buffer. */ @@ -1146,10 +1146,10 @@ retrieve_key_material (FILE *fp, const char *hexkeyid, if (!i) break; /* EOF. */ if (i < 0) - { - err = gpg_error_from_syserror (); - goto leave; /* Error. */ - } + { + err = gpg_error_from_syserror (); + goto leave; /* Error. */ + } if (!max_length) { err = gpg_error (GPG_ERR_TRUNCATED); @@ -1173,7 +1173,7 @@ retrieve_key_material (FILE *fp, const char *hexkeyid, && nfields > 4 && !strcmp (fields[4], hexkeyid)) found_key = 1; continue; - } + } if ( !strcmp (fields[0], "sub") || !strcmp (fields[0], "pub") ) break; /* Next key - stop. */ @@ -1561,8 +1561,8 @@ get_public_key (app_t app, int keyno) Clearly that is not an option and thus we try to locate the key using an external helper. - The helper we use here is gpg itself, which should know about - the key in any case. */ + The helper we use here is gpg itself, which should know about + the key in any case. */ char fpr[41]; char *hexkeyid; @@ -1574,38 +1574,38 @@ get_public_key (app_t app, int keyno) err = retrieve_fpr_from_card (app, keyno, fpr); if (err) - { - log_error ("error while retrieving fpr from card: %s\n", - gpg_strerror (err)); - goto leave; - } + { + log_error ("error while retrieving fpr from card: %s\n", + gpg_strerror (err)); + goto leave; + } hexkeyid = fpr + 24; ret = gpgrt_asprintf (&command, "gpg --list-keys --with-colons --with-key-data '%s'", fpr); if (ret < 0) - { - err = gpg_error_from_syserror (); - goto leave; - } + { + err = gpg_error_from_syserror (); + goto leave; + } fp = popen (command, "r"); xfree (command); if (!fp) - { - err = gpg_error_from_syserror (); - log_error ("running gpg failed: %s\n", gpg_strerror (err)); - goto leave; - } + { + err = gpg_error_from_syserror (); + log_error ("running gpg failed: %s\n", gpg_strerror (err)); + goto leave; + } err = retrieve_key_material (fp, hexkeyid, &m, &mlen, &e, &elen); pclose (fp); if (err) - { - log_error ("error while retrieving key material through pipe: %s\n", + { + log_error ("error while retrieving key material through pipe: %s\n", gpg_strerror (err)); - goto leave; - } + goto leave; + } err = gcry_sexp_build (&s_pkey, NULL, "(public-key(rsa(n%b)(e%b)))", (int)mlen, m, (int)elen, e); @@ -1726,7 +1726,8 @@ do_learn_status (app_t app, ctrl_t ctrl, unsigned int flags) buffer. On error PK and PKLEN are not changed and an error code is returned. */ static gpg_error_t -do_readkey (app_t app, const char *keyid, unsigned char **pk, size_t *pklen) +do_readkey (app_t app, int advanced, const char *keyid, + unsigned char **pk, size_t *pklen) { #if GNUPG_MAJOR_VERSION > 1 gpg_error_t err; @@ -1749,15 +1750,40 @@ do_readkey (app_t app, const char *keyid, unsigned char **pk, size_t *pklen) buf = app->app_local->pk[keyno].key; if (!buf) return gpg_error (GPG_ERR_NO_PUBKEY); - *pklen = app->app_local->pk[keyno].keylen;; - *pk = xtrymalloc (*pklen); - if (!*pk) + + if (advanced) { - err = gpg_error_from_syserror (); - *pklen = 0; - return err; + gcry_sexp_t s_key; + + err = gcry_sexp_new (&s_key, buf, app->app_local->pk[keyno].keylen, 0); + if (err) + return err; + + *pklen = gcry_sexp_sprint (s_key, GCRYSEXP_FMT_ADVANCED, NULL, 0); + *pk = xtrymalloc (*pklen); + if (!*pk) + { + err = gpg_error_from_syserror (); + *pklen = 0; + return err; + } + + gcry_sexp_sprint (s_key, GCRYSEXP_FMT_ADVANCED, *pk, *pklen); + gcry_sexp_release (s_key); + } + else + { + *pklen = app->app_local->pk[keyno].keylen; + *pk = xtrymalloc (*pklen); + if (!*pk) + { + err = gpg_error_from_syserror (); + *pklen = 0; + return err; + } + memcpy (*pk, buf, *pklen); } - memcpy (*pk, buf, *pklen); + return 0; #else return gpg_error (GPG_ERR_NOT_IMPLEMENTED); @@ -2366,7 +2392,7 @@ do_change_pin (app_t app, ctrl_t ctrl, const char *chvnostr, } else if (chvno == 1 || chvno == 3) { - if (!use_pinpad) + if (!use_pinpad) { char *promptbuf = NULL; const char *prompt; @@ -3990,23 +4016,23 @@ do_sign (app_t app, const char *keyidstr, int hashalgo, else { for (s=keyidstr, n=0; hexdigitp (s); s++, n++) - ; + ; if (n != 32) - return gpg_error (GPG_ERR_INV_ID); + return gpg_error (GPG_ERR_INV_ID); else if (!*s) - ; /* no fingerprint given: we allow this for now. */ + ; /* no fingerprint given: we allow this for now. */ else if (*s == '/') - fpr = s + 1; + fpr = s + 1; else - return gpg_error (GPG_ERR_INV_ID); + return gpg_error (GPG_ERR_INV_ID); for (s=keyidstr, n=0; n < 16; s += 2, n++) - tmp_sn[n] = xtoi_2 (s); + tmp_sn[n] = xtoi_2 (s); if (app->serialnolen != 16) - return gpg_error (GPG_ERR_INV_CARD); + return gpg_error (GPG_ERR_INV_CARD); if (memcmp (app->serialno, tmp_sn, 16)) - return gpg_error (GPG_ERR_WRONG_CARD); + return gpg_error (GPG_ERR_WRONG_CARD); } /* If a fingerprint has been specified check it against the one on @@ -4244,23 +4270,23 @@ do_decipher (app_t app, const char *keyidstr, else { for (s=keyidstr, n=0; hexdigitp (s); s++, n++) - ; + ; if (n != 32) - return gpg_error (GPG_ERR_INV_ID); + return gpg_error (GPG_ERR_INV_ID); else if (!*s) - ; /* no fingerprint given: we allow this for now. */ + ; /* no fingerprint given: we allow this for now. */ else if (*s == '/') - fpr = s + 1; + fpr = s + 1; else - return gpg_error (GPG_ERR_INV_ID); + return gpg_error (GPG_ERR_INV_ID); for (s=keyidstr, n=0; n < 16; s += 2, n++) - tmp_sn[n] = xtoi_2 (s); + tmp_sn[n] = xtoi_2 (s); if (app->serialnolen != 16) - return gpg_error (GPG_ERR_INV_CARD); + return gpg_error (GPG_ERR_INV_CARD); if (memcmp (app->serialno, tmp_sn, 16)) - return gpg_error (GPG_ERR_WRONG_CARD); + return gpg_error (GPG_ERR_WRONG_CARD); } /* If a fingerprint has been specified check it against the one on diff --git a/scd/app.c b/scd/app.c index 55b8edd..1f21dc1 100644 --- a/scd/app.c +++ b/scd/app.c @@ -612,7 +612,8 @@ app_readcert (app_t app, const char *certid, This function might not be supported by all applications. */ gpg_error_t -app_readkey (app_t app, const char *keyid, unsigned char **pk, size_t *pklen) +app_readkey (app_t app, int advanced, const char *keyid, + unsigned char **pk, size_t *pklen) { gpg_error_t err; @@ -630,7 +631,7 @@ app_readkey (app_t app, const char *keyid, unsigned char **pk, size_t *pklen) err = lock_reader (app->slot, NULL /*FIXME*/); if (err) return err; - err= app->fnc.readkey (app, keyid, pk, pklen); + err= app->fnc.readkey (app, advanced, keyid, pk, pklen); unlock_reader (app->slot); return err; } diff --git a/scd/command.c b/scd/command.c index 9d978ab..edea01c 100644 --- a/scd/command.c +++ b/scd/command.c @@ -729,17 +729,19 @@ cmd_readcert (assuan_context_t ctx, char *line) static const char hlp_readkey[] = - "READKEY \n" + "READKEY [--advanced] \n" "\n" "Return the public key for the given cert or key ID as a standard\n" "S-expression.\n" + "In --advanced mode it returns the S-expression in advanced format.\n" "\n" - "Note, that this function may even be used on a locked card."; + "Note that this function may even be used on a locked card."; static gpg_error_t cmd_readkey (assuan_context_t ctx, char *line) { ctrl_t ctrl = assuan_get_pointer (ctx); int rc; + int advanced = 0; unsigned char *cert = NULL; size_t ncert, n; ksba_cert_t kc = NULL; @@ -750,11 +752,16 @@ cmd_readkey (assuan_context_t ctx, char *line) if ((rc = open_card (ctrl, NULL))) return rc; + if (has_option (line, "--advanced")) + advanced = 1; + + line = skip_options (line); + line = xstrdup (line); /* Need a copy of the line. */ /* If the application supports the READKEY function we use that. Otherwise we use the old way by extracting it from the certificate. */ - rc = app_readkey (ctrl->app_ctx, line, &pk, &pklen); + rc = app_readkey (ctrl->app_ctx, advanced, line, &pk, &pklen); if (!rc) { /* Yeah, got that key - send it back. */ rc = assuan_send_data (ctx, pk, pklen); ----------------------------------------------------------------------- Summary of changes: scd/app-common.h | 4 +- scd/app-nks.c | 8 +++- scd/app-openpgp.c | 130 ++++++++++++++++++++++++++++++++---------------------- scd/app.c | 5 ++- scd/command.c | 13 ++++-- 5 files changed, 99 insertions(+), 61 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Fri Nov 4 07:35:41 2016 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Fri, 04 Nov 2016 07:35:41 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.1.15-320-gcd00b07 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via cd00b07ec26c3408e6aee66957b08c6fd319b700 (commit) from f9da935c3eb302e75a80def51128fb6f669661d7 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit cd00b07ec26c3408e6aee66957b08c6fd319b700 Author: NIIBE Yutaka Date: Fri Nov 4 15:34:35 2016 +0900 scd: Fix length error for READKEY. * scd/app-openpgp.c (do_readkey): Decrement the length. -- Signed-off-by: NIIBE Yutaka diff --git a/scd/app-openpgp.c b/scd/app-openpgp.c index 4bf99ad..f8d9954 100644 --- a/scd/app-openpgp.c +++ b/scd/app-openpgp.c @@ -1770,6 +1770,8 @@ do_readkey (app_t app, int advanced, const char *keyid, gcry_sexp_sprint (s_key, GCRYSEXP_FMT_ADVANCED, *pk, *pklen); gcry_sexp_release (s_key); + /* Decrement for trailing '\0' */ + *pklen = *pklen - 1; } else { ----------------------------------------------------------------------- Summary of changes: scd/app-openpgp.c | 2 ++ 1 file changed, 2 insertions(+) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Fri Nov 4 08:15:54 2016 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Fri, 04 Nov 2016 08:15:54 +0100 Subject: [git] GPGME - branch, master, updated. gpgme-1.7.1-18-gdf08a0c Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via df08a0ca3f029b06b7e3a6bd63330df5cb96585a (commit) from aad94cb7c313d4501bed748f48830cbb93c67e20 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit df08a0ca3f029b06b7e3a6bd63330df5cb96585a Author: Werner Koch Date: Fri Nov 4 08:10:34 2016 +0100 w32: Fix locating gpgconf on 64 bit systems. * src/w32-util.c (find_program_at_standard_place): Use access to check whether the binary is at CSIDL_PROGRAM_FILES before testing CSIDL_PROGRAM_FILESX86. -- Suggested-by: ticho Fixes-commit: a82e9b182f62966207cad0972be6fa284329a5a1 GnuPG-bug-id: 2814 Signed-off-by: Werner Koch diff --git a/src/w32-util.c b/src/w32-util.c index 21de6dc..0dc1288 100644 --- a/src/w32-util.c +++ b/src/w32-util.c @@ -415,8 +415,17 @@ find_program_at_standard_place (const char *name) We First try the generic place and then fallback to the x86 (i.e. 32 bit) place. This will prefer a 64 bit of the program over a 32 bit version on 64 bit Windows if installed. */ - if (SHGetSpecialFolderPathA (NULL, path, CSIDL_PROGRAM_FILES, 0) - || SHGetSpecialFolderPathA (NULL, path, CSIDL_PROGRAM_FILESX86, 0)) + if (SHGetSpecialFolderPathA (NULL, path, CSIDL_PROGRAM_FILES, 0)) + { + result = _gpgme_strconcat (path, "\\", name, NULL); + if (result && access (result, F_OK)) + { + free (result); + result = NULL; + } + } + if (!result + && SHGetSpecialFolderPathA (NULL, path, CSIDL_PROGRAM_FILESX86, 0)) { result = _gpgme_strconcat (path, "\\", name, NULL); if (result && access (result, F_OK)) ----------------------------------------------------------------------- Summary of changes: src/w32-util.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Fri Nov 4 08:50:05 2016 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Fri, 04 Nov 2016 08:50:05 +0100 Subject: [git] Poldi - branch, master, updated. release-0.4.1-35-gb428097 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "PAM for the OpenPGP card". The branch, master has been updated via b4280978f83971103bf54470d7084e98d125aca2 (commit) via 88e2fe393b465d6ac3def5c786608f98bd53fae7 (commit) via a9763b5f203ab5ebd09a87d8d251bc00eb25ed4c (commit) from ee253ccb14aa1edb15fc19306d13c226900d2800 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit b4280978f83971103bf54470d7084e98d125aca2 Author: NIIBE Yutaka Date: Fri Nov 4 16:46:11 2016 +0900 Only support forking off scdaemon. * src/scd/scd.c (scd_serialno_internal): Cleanup API with no AGENT. (agent_connect_from_infostr): Remove. (agent_scd_getinfo_socket_name): Remove. (get_scd_socket_from_agent): Remove. (scd_connect): Change API to only support forking off scdaemon. * src/pam/pam_poldi.c (pam_sm_authenticate): Follow the change of API. -- Signed-off-by: NIIBE Yutaka diff --git a/src/pam/pam_poldi.c b/src/pam/pam_poldi.c index 0448819..6ed3cc4 100644 --- a/src/pam/pam_poldi.c +++ b/src/pam/pam_poldi.c @@ -549,10 +549,8 @@ pam_sm_authenticate (pam_handle_t *pam_handle, /*** Connect to Scdaemon. ***/ - err = scd_connect (&scd_ctx, - NULL, getenv ("GPG_AGENT_INFO"), - ctx->scdaemon_program, ctx->scdaemon_options, - 0, ctx->loghandle); + err = scd_connect (&scd_ctx, ctx->scdaemon_program, ctx->scdaemon_options, + ctx->loghandle); if (err) goto out; diff --git a/src/scd/scd.c b/src/scd/scd.c index 52a64f4..9f60026 100644 --- a/src/scd/scd.c +++ b/src/scd/scd.c @@ -91,155 +91,9 @@ static assuan_error_t membuf_data_cb (void *opaque, static gpg_error_t scd_serialno_internal (assuan_context_t ctx, - int agent, char **r_serialno); + char **r_serialno); - -/* Helper function for get_scd_socket_from_agent(), which is used by - scd_connect(). - - Try to connect to gpg-agent, which is to be found through the - info-string contained in AGENT_INFOSTR. On success, *AGENT_CTX is - filled with an assuan context. Return proper error code or zero on - success. */ -static int -agent_connect_from_infostr (const char *agent_infostr, - assuan_context_t *agent_ctx, - log_handle_t loghandle) -{ - char *infostr; - int prot; - int pid; - int rc; - char *p; - - *agent_ctx = NULL; - rc = 0; - - infostr = xtrystrdup (agent_infostr); - if (!infostr) - { - rc = gpg_error_from_syserror (); - log_msg_error (loghandle, - _("failed to duplicate %s: %s"), - "agent infostring", gpg_strerror (rc)); - goto out; - } - - p = strchr (infostr, ':'); - if (!p || p == infostr) - { - log_msg_info (loghandle, - _("malformed GPG_AGENT_INFO environment variable")); - /* FIXME: what error code is more appropriate here? -mo */ - rc = gpg_error (GPG_ERR_ASS_CONNECT_FAILED); - goto out; - } - *p++ = 0; - pid = atoi (p); - while (*p && *p != ':') - p++; - prot = *p? atoi (p+1) : 0; - if (prot != 1) - { - log_msg_error (loghandle, - _("agent protocol version %d is not supported"), - prot); - /* FIXME: what error code is more appropriate here? -mo */ - rc = gpg_error (GPG_ERR_ASS_CONNECT_FAILED); - goto out; - - } - - /* Connect! */ - rc = assuan_socket_connect (agent_ctx, infostr, pid); - - out: - - xfree (infostr); - - return rc; -} - -/* Helper function for get_scd_socket_from_agent(), which is used by - scd_connect(). - - Try to retrieve the SCDaemons socket naem from the gpg-agent - context CTX. On success, *SOCKET_NAME is filled with a copy ot the - socket name. Return proper error code or zero on success. */ -static int -agent_scd_getinfo_socket_name (assuan_context_t ctx, char **socket_name, - log_handle_t loghandle) -{ - unsigned char *databuf; - size_t datalen; - membuf_t data; - char *res; - int rc; - - init_membuf (&data, 256); - *socket_name = NULL; - res = NULL; - rc = 0; - - rc = assuan_transact (ctx, "SCD GETINFO socket_name", membuf_data_cb, &data, - NULL, NULL, NULL, NULL); - if (rc) - goto out; - - databuf = get_membuf (&data, &datalen); - if (databuf && datalen) - { - res = xtrymalloc (datalen + 1); - if (!res) - { - log_msg_error (loghandle, - _("warning: can't store getinfo data: %s"), - strerror (errno)); - } - else - { - memcpy (res, databuf, datalen); - res[datalen] = 0; - *socket_name = res; - } - } - - out: - - xfree (get_membuf (&data, &datalen)); - - return rc; -} - -/* Retrieve SCDaemons socket name through a running gpg-agent, which - is to be found through the info-string AGENT_INFOSTR. On Success, - *SOCKET_NAME contains a copy of the socket name. Returns proper - error code or zero on success. */ -static int -get_scd_socket_from_agent (const char *agent_infostr, char **socket_name, - log_handle_t loghandle) -{ - assuan_context_t ctx; - int rc; - - *socket_name = NULL; - ctx = NULL; - rc = 0; - - rc = agent_connect_from_infostr (agent_infostr, &ctx, loghandle); - if (rc) - goto out; - - rc = agent_scd_getinfo_socket_name (ctx, socket_name, loghandle); - - out: - - assuan_disconnect (ctx); - - return rc; -} - /* Send a RESTART to SCDaemon. */ static void restart_scd (scd_context_t ctx) @@ -250,19 +104,11 @@ restart_scd (scd_context_t ctx) -/* Try to connect to scdaemon. We support three methods to access - scdaemon. First: connect to a specified socket, second: connect to - a running gpg-agent, retrieve scdaemon socket name through the - agent and connect to that socket, third: fork of a new scdaemon. - Returns proper error code or zero on success. */ +/* Fork off scdaemon and work by pipes. Returns proper error code or + zero on success. */ gpg_error_t -scd_connect (scd_context_t *scd_ctx, - const char *scdaemon_socket, - const char *agent_infostr, - const char *scd_path, - const char *scd_options, - unsigned int flags, - log_handle_t loghandle) +scd_connect (scd_context_t *scd_ctx, const char *scd_path, + const char *scd_options, log_handle_t loghandle) { assuan_context_t assuan_ctx; scd_context_t ctx; @@ -280,60 +126,17 @@ scd_connect (scd_context_t *scd_ctx, ctx->assuan_ctx = NULL; ctx->flags = 0; -#if 0 - /* Scdaemon is not yet able to run as a system daemon, thus this - code is disabled. */ - - if (scdaemon_socket) - { - /* This has the highest priority; connect to system scdaemon. */ - - rc = assuan_socket_connect (&assuan_ctx, scdaemon_socket, 0); - if (!rc) - { - log_msg_debug (loghandle, - _("connected to system scdaemon through socket '%s'"), - scdaemon_socket); - goto out; - } - } -#endif - - if (agent_infostr && *agent_infostr) - { - /* Somehow connecting to a system scdaemon didn't work. Try to - retrieve a scdaemon socket name from gpg-agent. */ - - char *scd_socket; - - rc = get_scd_socket_from_agent (agent_infostr, &scd_socket, loghandle); - if (!rc) - rc = assuan_socket_connect (&assuan_ctx, scd_socket, 0); - - if (!rc) - log_msg_debug (loghandle, - _("got scdaemon socket name from gpg-agent, " - "connected to socket '%s'"), scd_socket); - - xfree (scd_socket); - - if (!rc) - goto out; - } - if (1) { - /* Neither of the above scdaemon connect methods worked, - fallback: spawn a new scdaemon. */ - const char *pgmname; const char *argv[5]; int no_close_list[3]; int i; - if (flags & SCD_FLAG_VERBOSE) +#if 0 log_msg_debug (loghandle, _("no running scdaemon - starting one")); +#endif if (fflush (NULL)) { @@ -376,7 +179,7 @@ scd_connect (scd_context_t *scd_ctx, no_close_list[i++] = fileno (stderr); no_close_list[i] = -1; - /* connect to the agent and perform initial handshaking */ + /* connect to the scdaemon and perform initial handshaking */ rc = assuan_pipe_connect (&assuan_ctx, scd_path, argv, no_close_list); if (!rc) @@ -404,15 +207,16 @@ scd_connect (scd_context_t *scd_ctx, { /* FIXME: is this the best way? -mo */ //reset_scd (assuan_ctx); - scd_serialno_internal (assuan_ctx, 0, NULL); + scd_serialno_internal (assuan_ctx, NULL); ctx->assuan_ctx = assuan_ctx; - ctx->flags = flags; + ctx->flags = 0; ctx->loghandle = loghandle; *scd_ctx = ctx; - if (flags & SCD_FLAG_VERBOSE) +#if 0 log_msg_debug (loghandle, _("connection to scdaemon established")); +#endif } return rc; @@ -642,7 +446,7 @@ get_serialno_cb (void *opaque, const char *line) } static gpg_error_t -scd_serialno_internal (assuan_context_t ctx, int agent, char **r_serialno) +scd_serialno_internal (assuan_context_t ctx, char **r_serialno) { char *serialno; int rc; @@ -672,7 +476,7 @@ scd_serialno (scd_context_t ctx, char **r_serialno) { gpg_error_t err; - err = scd_serialno_internal (ctx->assuan_ctx, 0, r_serialno); + err = scd_serialno_internal (ctx->assuan_ctx, r_serialno); return err; } diff --git a/src/scd/scd.h b/src/scd/scd.h index 2df7ae7..25680f8 100644 --- a/src/scd/scd.h +++ b/src/scd/scd.h @@ -47,15 +47,10 @@ typedef struct scd_cardinfo scd_cardinfo_t; #define SCD_FLAG_VERBOSE (1 << 0) -/* Try to connect to the agent via socket or fork it off and work by - pipes. Returns proper error code or zero on success. */ -gpg_error_t scd_connect (scd_context_t *scd_ctx, - const char *scdaemon_socket, - const char *agent_infostr, - const char *scd_path, - const char *scd_options, - unsigned int flags, - log_handle_t loghandle); +/* Fork it off and work by pipes. Returns proper error code or zero + on success. */ +gpg_error_t scd_connect (scd_context_t *scd_ctx, const char *scd_path, + const char *scd_options, log_handle_t loghandle); /* Disconnect from SCDaemon; destroy the context SCD_CTX. */ void scd_disconnect (scd_context_t scd_ctx); commit 88e2fe393b465d6ac3def5c786608f98bd53fae7 Author: NIIBE Yutaka Date: Fri Nov 4 15:55:59 2016 +0900 Modify document for removal of poldi-ctrl. -- Signed-off-by: NIIBE Yutaka diff --git a/conf/users.skel b/conf/users.skel index 7ca3913..c2ba6f0 100644 --- a/conf/users.skel +++ b/conf/users.skel @@ -5,9 +5,9 @@ # Entries are of the form: "\n" # (without quotation marks and without angle brackets. Allowed # whitespaces are spaces and tabs. is the serial number -# of an OpenPGP smartcard as reported by poldi-ctrl -# --print-serialno. is a valid username on the system. -# Comments are opened with "#" and terminated by a newline. +# of an OpenPGP smartcard. It can be obtained by "gpg --card-status" +# command as ``Application ID''. is a valid username on +# the system. Comments are opened with "#" and terminated by a newline. # # So, a valid entry would look like: # "D2760001240101010001000006550000 moritz" diff --git a/doc/poldi.texi b/doc/poldi.texi index d098186..191a44a 100644 --- a/doc/poldi.texi +++ b/doc/poldi.texi @@ -142,9 +142,9 @@ associated with many users and one user can be associated with many smartcards. The public keys are stored in files in a subdirectory named -``keys''. The files are named after the card serial numbers and must +``keys''. The files are named after the card serial numbers and must contain the public key as a single S-Expression as it is printed out -by poldi-ctrl. +by gpg-connect-agent (See below). The mapping between keys and Unix accounts is to be established by adding appropriate entries to the user database file named ``users''. @@ -288,9 +288,10 @@ local usernames. Syntax: this file consists of entries - one entry per line. Entries are of the form: "\n" (without quotation marks and without angle brackets. Allowed whitespaces are spaces and tabs. - is the serial number of an OpenPGP smartcard as reported by -poldi-ctrl --print-serialno. is a valid username on the -system. Comments are opened with "#" and terminated by a newline. + is the serial number of an OpenPGP smartcard. It can be +obtained by "gpg --card-status" command as ``Application ID''. + is a valid username on the system. Comments are opened +with "#" and terminated by a newline. @item Directory: keys @@ -354,7 +355,7 @@ card-specific key file. Therefore he inserts Moritz' smartcard and executes: @example -$ poldi-ctrl --print-key > /etc/poldi/localdb/keys/D2760001240101010001000006550000 +$ gpg-connect-agent "/datafile /etc/poldi/localdb/keys/D2760001240101010001000006550000" "SCD READKEY --advanced OPENPGP.3" /bye @end example The administrator wants to allow Moritz to update his card's key diff --git a/po/POTFILES.in b/po/POTFILES.in index abda8f7..b631da8 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -1,6 +1,5 @@ # List of source files which contain translatable strings. -./src/ctrl/poldi-ctrl.c ./src/pam/auth-method-localdb/usersdb.c ./src/pam/auth-method-localdb/auth-localdb.c ./src/pam/auth-method-localdb/key-lookup.h diff --git a/po/de.po b/po/de.po index b24a46b..932bd1e 100644 --- a/po/de.po +++ b/po/de.po @@ -16,55 +16,6 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: src/ctrl/poldi-ctrl.c:85 -msgid "Dump certain card information" -msgstr "Informationen der Smartcard ausgeben" - -#: src/ctrl/poldi-ctrl.c:87 -msgid "Print authentication key from card" -msgstr "Zeige Authentifikationsschl?ssel der Karte an" - -#: src/ctrl/poldi-ctrl.c:89 -msgid "Print serial number from card" -msgstr "Zeige Seriennummer der Karte an" - -#: src/ctrl/poldi-ctrl.c:93 -msgid "Enable debugging mode" -msgstr "Aktiviere Debugging-Modus" - -#: src/ctrl/poldi-ctrl.c:269 -#, c-format -msgid "failed to initialize logging: %s\n" -msgstr "konnte Protokollierung nicht initialisieren: %s\n" - -#: src/ctrl/poldi-ctrl.c:277 -#, c-format -msgid "failed to set logging backend: %s\n" -msgstr "konnte Protokollierungs-Backend nicht aktivieren: %s\n" - -#: src/ctrl/poldi-ctrl.c:316 -#, c-format -msgid "parsing argument vector failed: %s" -msgstr "Auswerten des Argumentvektors fehlgeschlagen: %s" - -#: src/ctrl/poldi-ctrl.c:328 -msgid "more than one command specified (try --help)" -msgstr "mehr als ein Kommando angegeben (versuche --help)" - -#: src/ctrl/poldi-ctrl.c:333 -msgid "no command specified (try --help)" -msgstr "kein Kommando angegeben (versuche --help)" - -#: src/ctrl/poldi-ctrl.c:343 -#, c-format -msgid "failed to connect to scdaemon: %s" -msgstr "Verbinden zum Scdaemon fehlgeschlagen: %s" - -#: src/ctrl/poldi-ctrl.c:352 -#, c-format -msgid "failed to retrieve smartcard data: %s" -msgstr "konnte Daten der Smartcard nicht empfangen: %s" - #: src/pam/auth-method-localdb/auth-localdb.c:109 msgid "Please enter username: " msgstr "Bitte Benutzername eingeben: " diff --git a/po/poldi.pot b/po/poldi.pot index b822d06..241e5bc 100644 --- a/po/poldi.pot +++ b/po/poldi.pot @@ -17,55 +17,6 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: src/ctrl/poldi-ctrl.c:85 -msgid "Dump certain card information" -msgstr "" - -#: src/ctrl/poldi-ctrl.c:87 -msgid "Print authentication key from card" -msgstr "" - -#: src/ctrl/poldi-ctrl.c:89 -msgid "Print serial number from card" -msgstr "" - -#: src/ctrl/poldi-ctrl.c:93 -msgid "Enable debugging mode" -msgstr "" - -#: src/ctrl/poldi-ctrl.c:269 -#, c-format -msgid "failed to initialize logging: %s\n" -msgstr "" - -#: src/ctrl/poldi-ctrl.c:277 -#, c-format -msgid "failed to set logging backend: %s\n" -msgstr "" - -#: src/ctrl/poldi-ctrl.c:316 -#, c-format -msgid "parsing argument vector failed: %s" -msgstr "" - -#: src/ctrl/poldi-ctrl.c:328 -msgid "more than one command specified (try --help)" -msgstr "" - -#: src/ctrl/poldi-ctrl.c:333 -msgid "no command specified (try --help)" -msgstr "" - -#: src/ctrl/poldi-ctrl.c:343 -#, c-format -msgid "failed to connect to scdaemon: %s" -msgstr "" - -#: src/ctrl/poldi-ctrl.c:352 -#, c-format -msgid "failed to retrieve smartcard data: %s" -msgstr "" - #: src/pam/auth-method-localdb/auth-localdb.c:109 msgid "Please enter username: " msgstr "" commit a9763b5f203ab5ebd09a87d8d251bc00eb25ed4c Author: NIIBE Yutaka Date: Fri Nov 4 14:10:10 2016 +0900 Remove poldi-ctrl. * src/Makefile.am (SUBDIRS): Remove ctrl. * src/ctrl: Remove. -- Signed-off-by: NIIBE Yutaka diff --git a/src/Makefile.am b/src/Makefile.am index 8715d19..70cce5b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -17,6 +17,6 @@ # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA -SUBDIRS = assuan util scd pam ctrl +SUBDIRS = assuan util scd pam EXTRA_DIST = README poldi.h diff --git a/src/ctrl/ChangeLog b/src/ctrl/ChangeLog deleted file mode 100644 index 6a23053..0000000 --- a/src/ctrl/ChangeLog +++ /dev/null @@ -1,310 +0,0 @@ -2009-08-08 Moritz - - * poldi-ctrl.c (main): Pass NULL as scd_connect's new scd_options - parameter. - -2008-08-07 Moritz - - * poldi-ctrl.c (cmd_dump): Removed (disabled) workaround for older - cards for now. - -2008-08-04 Moritz - - * poldi-ctrl.c: Mark strings for i18n. - -2008-08-03 Moritz - - * poldi-ctrl.c (i18n_cb): New function. - (main): call simpleparse_set_i18n_cb. - -2008-07-20 Moritz - - * Makefile.am: removed jnlib. - - * poldi-ctrl.c: New static variables: loghandle, scd_ctx, - scd_cardinfo. Setup loghandle and scdaemon context in main(), thus - the cmd implementation functions don't need to it anymore. - Now uses simplelog API. - -2008-07-14 Moritz - - * poldi-ctrl.c: Don't include pwd.h and util/optparse.h. Include: - util/simpleparse.h. - (struct poldi_ctrl_opt): Remove member cmd_print_config. Replace - enum_arg_opt_ids list with enum opt_ids. Replace ARGPARSE_OPTS - definitions with simpleparse_opt_spec_t opt_specs[]. - (my_strusage): Dropped functions. - (poldi_ctrl_options_cb): Adjust to new simpleparse interface. - Throughout: adjust calls to scd_connect() to new API (providing - logging callback). - (cmd_print_config): Dropped function. I don't think this - functionality is required. Instead do: cat poldi.conf. - (main): use new simpleparse subsystem, not jnlibs ARGPARSE, do not - use jnlib logging interface. - -2008-04-05 Moritz - - * poldi-ctrl.c (cmd_dump): Use bin2hex instead of convert_to_hex. - Removed usersdb manipulating functions. - -2007-11-10 Moritz - - * poldi-ctrl.c (conversation): Removed unused function. - -2007-11-04 Moritz - - * poldi-ctrl.c (main): Adjust to new options_parse_argv API. - -2007-10-28 Moritz - - * poldi-ctrl.c: Do not include scd-support.h; include - common/support.h. - * Makefile.am (poldi_ctrl_LDADD): Removed reference to - libscd-support.a - -2007-10-27 Moritz - - * poldi-ctrl.c: Removed "test" command completely. It's rationale - was to test authentication through Poldi. But since poldi-ctrl - didn't use the PAM module (instead it duplicated some - authentication code), it's not suitable for testing Poldi through - *PAM*. Removing this command simplifies the Poldi package. There - are more reliable ways of testing authentication through Poldi: - e.g. the "pamtester" program (not included in PAM Poldi), which - uses the PAM API. - -2007-08-25 Moritz - - * poldi-ctrl.c (my_strusage): Handle copyright line. - Implemented new CLI argument: --serialno-inserted. - (struct poldi_ctrl_opt): New member: serialno_inserted. - (enum arg_opt_ids): New: arg_serialno_inserted. - (ARGPARSE_OPTS arg_opts): Specify arg_serialno_inserted. - (poldi_ctrl_options_cb): Handle arg_serialno_inserted. - (serialno_from_inserted_card): New function. - (cmd_register_card): New variable: use_inserted; use - serialno_from_inserted_card. - (cmd_unregister_card): New variables: serialno, use_inserted; use - serialno_from_inserted_card. - (cmd_associate): New variables: serialno, account, use_inserted; - use serialno_from_inserted_card(). - (cmd_disassociate): Likewise. Allow disassociate if serialno AND - account is given (removed wildcard mechanism with one of these two - being NULL). - -2007-08-17 Moritz - - * poldi-ctrl.c (cmd_test): Call wait_for_card(). - (cmd_dump): Unused variable key_nbits; do not pretend to dump key - sizes; cleanup. - -2007-08-16 Moritz - - * poldi-ctrl.c (cmd_test): Lookup GPG_AGENT_INFO, not - SCDAEMON_INFO. - (cmd_dump): Likewise. - (cmd_set_key): Likewise. - -2007-08-10 Moritz - - * poldi-ctrl.c (cmd_test): Call scd_reset. - (cmd_dump): Likewise. - (cmd_set_key): Likewise. - -2007-06-29 Moritz - - * poldi-ctrl.c: Removed includes: , , - ; new includes: , - , . - (struct poldi_ctrl_opt): Removed members: debug_sc, ctapi_driver, - pcsc_driver, reader_port, disable_opensc, disable_ccid, - debug_ccid_driver. - (enum arg_opt_ids): Removed: arg_ctapi_driver, arg_pcsc_driver, - arg_reader_port, arg_disable_ccid, arg_disable_opensc, - arg_debug_ccid_driver, arg_require_card_switch. - (arg_opts[]): Adjusted to arg_opt_ids changes. - (poldi_ctrl_options_cb): Likewise. - (cardinfo_NULL): New variable. - (cmd_test, cmd_dump, cmd_set_key): Slightly rewritte, use new scd - interface. - (main): Initialize libgcrypt secure memory, removed call to - scd_init. - - * Makefile.am: Adjusted CFLAGS/LDADD, include cmacros.am. - (poldi_ctrl_LDADD): Removed $(GPG_ERR_LDFLAGS),$(LIBUSB_LIBS); - added: $(LIBASSUAN_LIBS). - -2005-12-11 Moritz Schulte - - * poldi-ctrl.c: Removed some FIXMEs. - -2005-12-10 Moritz Schulte - - * poldi-ctrl.c (ask_user): Return ERR_NO_DATA in case of EOF while - reading username, return ERR_INV_NAME in case an empty line was - read. - (key_file_create): Print warning instead of error message in case - the key file does already exist; only change file owner in case - PWENT is non-NULL. - (main): Include new commands, removed old commands. - - (key_file_create): Open key file with O_EXCL flag set, better - error handling. - - (struct poldi_ctrl_opt): New members: cmd_register_card, - cmd_unregister_card, cmd_list_cards, cmd_associate, - cmd_disassociate; removed members: cmd_add_user, cmd_remove_user. - Implemented new commands. - - (cmd_register_card, cmd_unregister_card, cmd_list_cards, - cmd_associate, cmd_disassociate, directory_process_cb): New - functions. - (cmd_add_user, cmd_remove_user): Removed functions. - (enum arg_opt_ids): Add new symbols for new command arguments. - -2005-12-03 Moritz Schulte - - * poldi-ctrl.c: Include , . - (ask_user): New function. - (cmd_test): Mostly rewritten. - (cmd_list): Removed function body; add call to usersdb_list. - (cmd_add, cmd_remove): Stripped. - Adjusted to new usersdb API. - - * poldi-ctrl.c (cmd_add_user): Removed exit calls. - (cmd_remove_user): Likewise. - -2005-11-19 Moritz Schulte - - * poldi-ctrl.c (cmd_dump): Retrive key size information through - card_read_key, print key size. - (cmd_set_key): Adjust to card_read_key API. - -2005-11-12 Moritz Schulte - - * poldi-ctrl.c (cmd_test): Adjust to new wait_for_card() API. - (cmd_set_key, cmd_dump): Adjust to new card_info() API. - - * Makefile.am (poldi_ctrl_CFLAGS): Added include path: - $(top_srcdir)/src/common. - -2005-10-31 Moritz Schulte - - * poldi-ctrl.c (cmd_test): Adjusted to new wait_for_card() API. - (conversation): New function. - Use authenticate() instead of duplicating the authentication - mechanism. - (cmd_dump): Retrieve and print signing key fingerprint. - -2005-10-29 Moritz Schulte - - * poldi-ctrl.c (cmd_remove_user): Print a warning instead of an - error in case the serial number could not be looked up; set ERR to - 0 in this case and only try to remove key file in case SERIALNO is - non-zero. - (cmd_remove_user): Make sure to lookup the serial number before - removing the user from the user database. - -2005-10-26 Moritz Schulte - - * poldi-ctrl.c (poldi_ctrl_options_cb): Use gpg_error_t instead of - gpg_err_code_t. - (cmd_test): Do not call card_close() before "out" label, only - after "out" label. - (cmd_add_user): Recognize situations of adding duplicates much - better; new local variable: skip_userdb. Added plenty of log - messages and comments. - (cmd_set_key): Do not call card_close() before "out" label, only - after "out" label. - (cmd_show_key): New local variable: KEY_SEXP; convert key from - string into s-expression representation and back, so that the user - sees the key in a standard format. - (cmd_remove_user): New local variable; NENTRIES_REMOVED; adjust to - new usersdb_remove_entry() interface. - (main): New local variable: NCOMMANDS; differentiate case of no - command being given from that of too many commands being given; be - more verbose. - (arg_opts): Include special codes in order to seperate commands - from options. - -2005-10-23 Moritz Schulte - - * poldi-ctrl.c (cmd_remove_user): Be more verbose (through jnlib - logging). - Removed dump-shadowed-key command. - (key_file_create): Replaced parameter ACCOUNT with PWENT. - (cmd_add_user): Pass PWENT to key_file_create instead of ACCOUNT. - (cmd_list_users): New local variable LINE_NUMBERS, use it for - error reporting, do not bail out on corrupt lines. - -2005-10-16 Moritz Schulte - - * poldi-ctrl.c (key_file_create, key_file_remove): Re-ordered functions. - (key_file_create, key_file_remove, cmd_test, cmd_set_key) - (cmd_show_key): Use key_filename_construct() instead of - make_filename() directly. - -2005-10-08 Moritz Schulte - - * poldi-ctrl.c: Remove `fake-wait-for-card'-feature. - -2005-10-01 Moritz Schulte - - * poldi-ctrl.c (struct poldi_ctrl_opt): New member: WAIT_TIMEOUT. - (poldi_ctrl_opt): Exten struct initialization. - (arg_opt_ids): New entry: ARG_WAIT_TIMEOUT. - (arg_opts): New entry for ARG_WAIT_TIMEOUT. - (poldi_ctrl_options_cb): Handle ARG_WAIT_TIMEOUT. - (cmd_test): Pass WAIT_TIMEOUT to card_init. - -2005-09-30 Moritz Schulte - - * poldi-ctrl.c (struct poldi_ctrl_opt): Remove unnecessary, rather - annoying const attributes. - (cmd_add_user): Likewise. - -2005-09-27 Moritz Schulte - - * poldi-ctrl.c: Adjust to new card_init API; pass zero timeout. - -2005-07-26 Moritz Schulte - - * poldi-ctrl.c (cmd_test): Remove unnecessary const attributes and - cast. - (cmd_dump): Likewise. - (cmd_remove_user): Likewise. - (cmd_set_key): Likewise. - Updated to use new support.h API. - (cmd_add_user): Fail, if specified serial number does already - exist in database. - (cmd_add_user): Fail, if specified user does not exist on system. - (poldi_ctrl_options_cb): Better interaction with jnlib in respect - to error propagation. - (key_file_remove): Do not return error in case of ENOENT. - -2005-07-13 Moritz Schulte - - * poldi-ctrl.c: Adjust to new card_info() API, use version - information in order to figure out if CHV3 is necessary for public - key retrival. - -2005-07-12 Moritz Schulte - - * poldi-ctrl.c (cmd_show_key): Only print KEY_STRING, if non-NULL. - -2005-01-30 Moritz Schulte - - * poldi-ctrl.c (sexp_to_string): New function. - -2004-11-29 Moritz Schulte - - * poldi-ctrl.c: Fix contact address. - -2004-11-27 Moritz Schulte - - * poldi-ctrl.c (cmd_test): Adjust card_init caller. - (cmd_dump): Likewise. - (cmd_set_key): Likewise. - Implement require-card-switch option. - (cmd_test): Do not require that the uid of the current process is - equal to the one of the user to test authentication for. diff --git a/src/ctrl/Makefile.am b/src/ctrl/Makefile.am deleted file mode 100644 index 776c781..0000000 --- a/src/ctrl/Makefile.am +++ /dev/null @@ -1,40 +0,0 @@ -# Copyright (C) 2005, 2007, 2008 g10 Code GmbH -# -# This file is part of Poldi. -# -# Poldi is free software; you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# Poldi 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 General Public -# License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA -# 02111-1307, USA - -AM_CPPFLAGS = -include $(top_srcdir)/am/cmacros.am - -bin_PROGRAMS = poldi-ctrl - -poldi_ctrl_SOURCES = poldi-ctrl.c -poldi_ctrl_CFLAGS = \ - -Wall \ - -I$(top_builddir) \ - -I$(top_srcdir)/src \ - -I$(top_builddir)/src \ - -I$(top_srcdir)/util \ - -I$(top_srcdir)/src/assuan \ - $(GPG_ERROR_CFLAGS) \ - $(LIBGCRYPT_CFLAGS) - -poldi_ctrl_LDADD = \ - ../scd/libscd.a ../util/libpoldi-util.a ../assuan/libassuan.a \ - $(LIBGCRYPT_LDFLAGS) \ - $(LIBGCRYPT_LIBS) \ - $(GPG_ERROR_LIBS) diff --git a/src/ctrl/poldi-ctrl.c b/src/ctrl/poldi-ctrl.c deleted file mode 100644 index 3dc22f5..0000000 --- a/src/ctrl/poldi-ctrl.c +++ /dev/null @@ -1,375 +0,0 @@ -/* poldi-ctrl.c - Poldi maintaince tool - Copyright (C) 2004, 2005, 2007, 2008 g10 Code GmbH. - - This file is part of Poldi. - - Poldi is free software; you can redistribute it and/or modify it - under the terms of the GNU general Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - Poldi 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, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ - -#include - -#include -#include -#include -#include -#include - -#include - -#include "util/simpleparse.h" -#include "util/simplelog.h" -#include "util/support.h" -#include "util/defs.h" -#include "util/util.h" -#include "scd/scd.h" - -/* We use the Libgcrypt memory allocator. */ -#define xtrymalloc(n) gcry_malloc(n) -#define xtrymalloc_secure(n) gcry_malloc_secure(n) -#define xtrystrdup(p) gcry_strdup(p) -#define xtryrealloc(p,n) gcry_realloc(p,n) -#define xfree(p) gcry_free(p) - - - -/* Global flags. */ -struct poldi_ctrl_opt -{ - int cmd_dump; - int cmd_print_key; - int cmd_print_serialno; -} poldi_ctrl_opt; - -/* Handle for simplelog subsystem. */ -static log_handle_t loghandle; - -/* Handle for scd access subsystem. */ -static scd_context_t scd_ctx; - -/* Struct holding card info. */ -static struct scd_cardinfo scd_cardinfo; - -/* Set defaults. */ -struct poldi_ctrl_opt poldi_ctrl_opt = - { - 0, - 0, - 0 - }; - -enum opt_ids - { - opt_none, - opt_dump, - opt_print_key, - opt_print_serialno, - opt_debug - }; - -static simpleparse_opt_spec_t opt_specs[] = - { - /* Commands: */ - { opt_dump, "dump", - 'd', SIMPLEPARSE_ARG_NONE, 0, N_("Dump certain card information") }, - { opt_print_key, "print-key", - 'k', SIMPLEPARSE_ARG_NONE, 0, N_("Print authentication key from card") }, - { opt_print_serialno, "print-serialno", - 's', SIMPLEPARSE_ARG_NONE, 0, N_("Print serial number from card") }, - - /* Options: */ - { opt_debug, "debug", - 0, SIMPLEPARSE_ARG_NONE, 0, N_("Enable debugging mode") }, - { 0 } - }; - - - -/* Callback for parsing of command-line arguments. */ -static gpg_error_t -poldi_ctrl_options_cb (void *cookie, - simpleparse_opt_spec_t spec, const char *arg) -{ - if (spec.id == opt_dump) - poldi_ctrl_opt.cmd_dump = 1; - else if (spec.id == opt_print_key) - poldi_ctrl_opt.cmd_print_key = 1; - else if (spec.id == opt_print_serialno) - poldi_ctrl_opt.cmd_print_serialno = 1; - else if (spec.id == opt_debug) - log_set_min_level (loghandle, LOG_LEVEL_DEBUG); - - return 0; -} - - - -/* - * Command functions. - */ - - - - -/* Retrieve authentication key from card through the SCDaemon context - CTX and store it as a S-Expression c-string in *KEY_STRING. - Returns proper error code. */ -static gpg_error_t -retrieve_key (scd_context_t ctx, char **key_string) -{ - gcry_sexp_t key; - char *key_s; - gpg_error_t err; - - *key_string = NULL; - key = NULL; - key_s = NULL; - - /* Retrieve key from card. */ - err = scd_readkey (ctx, "OPENPGP.3", &key); - if (err) - { - log_msg_error (loghandle, - "failed to retrieve key from card: %s", - gpg_strerror (err)); - goto out; - } - - /* Convert key into a string. */ - err = sexp_to_string (key, &key_s); - if (err) - { - log_msg_error (loghandle, - "failed to convert key S-Expression " - "into C-String: %s", - gpg_strerror (err)); - goto out; - } - - *key_string = key_s; - - out: - - gcry_sexp_release (key); - - return err; -} - -/* Implementation of `dump' command; dumps information from card. */ -static gpg_error_t -cmd_dump (void) -{ - char *key_s; - gpg_error_t err; - char fpr[41]; - - key_s = NULL; - - /* Retrieve key from card. */ - - err = retrieve_key (scd_ctx, &key_s); - if (err) - { - log_msg_error (loghandle, "failed to retrieve key from card: %s", - gpg_strerror (err)); - goto out; - } - - bin2hex (scd_cardinfo.fpr3, 20, fpr); - - printf ("Serial number: %s\n" - "Signing key fingerprint: %s\n" - "Key:\n%s\n", - scd_cardinfo.serialno, fpr, key_s); - - out: - - gcry_free (key_s); - - return err; -} - -/* Implementation of `print-key' command; dumps information from card. */ -static gpg_error_t -cmd_print_key (void) -{ - char *key_s; - gpg_error_t err; - - key_s = NULL; - - /* Retrieve key from card. */ - - err = retrieve_key (scd_ctx, &key_s); - if (err) - { - log_msg_error (loghandle, "failed to retrieve key from card: %s", - gpg_strerror (err)); - goto out; - } - - printf ("%s", key_s); - - out: - - gcry_free (key_s); - - return err; -} - -/* Implementation of `print-serialno' command. */ -static gpg_error_t -cmd_print_serialno (void) -{ - printf ("%s\n", scd_cardinfo.serialno); - return 0; -} - -static const char * -i18n_cb (void *cookie, const char *msg) -{ - return _(msg); -} - -/* Main. */ -int -main (int argc, const char **argv) -{ - simpleparse_handle_t parsehandle; - unsigned int ncommands; - gpg_error_t err; - - /** Initialize. **/ - - assert (argc > 0); - - /* I18n. */ - setlocale (LC_ALL, ""); - bindtextdomain (PACKAGE, LOCALEDIR); - textdomain (PACKAGE); - - gcry_control (GCRYCTL_INIT_SECMEM, 16384, 0); - - /* Initialize logging. */ - - err = log_create (&loghandle); - if (err) - { - fprintf (stderr, _("failed to initialize logging: %s\n"), - gpg_strerror (err)); - exit (1); - } - - err = log_set_backend_stream (loghandle, stderr); - if (err) - { - fprintf (stderr, _("failed to set logging backend: %s\n"), - gpg_strerror (err)); - exit (1); - } - - log_set_prefix (loghandle, "poldi-ctrl:"); - log_set_flags (loghandle, LOG_FLAG_WITH_PREFIX); - - /* Parse arguments. */ - - err = simpleparse_create (&parsehandle); - if (err) - goto out; - - simpleparse_set_loghandle (parsehandle, loghandle); - simpleparse_set_streams (parsehandle, stdout, stderr); - simpleparse_set_parse_cb (parsehandle, poldi_ctrl_options_cb, NULL); - simpleparse_set_i18n_cb (parsehandle, i18n_cb, NULL); - err = simpleparse_set_specs (parsehandle, opt_specs); - if (err) - goto out; - - simpleparse_set_name (parsehandle, "poldi-ctrl"); - simpleparse_set_package (parsehandle, "Poldi"); - simpleparse_set_version (parsehandle, PACKAGE_VERSION); - simpleparse_set_bugaddress (parsehandle, PACKAGE_BUGREPORT); - simpleparse_set_description (parsehandle, "Command line utility for Poldi"); - simpleparse_set_copyright (parsehandle, - "Copyright (C) 2008 g10 Code GmbH\n" - "License GPLv3+: GNU GPL version 3 or later \n" - "This is free software: you are free to change and redistribute it.\n" - "There is NO WARRANTY, to the extent permitted by law."); - - /* Parse command-line arguments. */ - err = simpleparse_parse (parsehandle, 0, argc - 1, argv + 1, NULL); - /* This causes compiler warning, who is correct? */ - if (err) - { - log_msg_error (loghandle, - _("parsing argument vector failed: %s"), - gpg_strerror (err)); - goto out; - } - - ncommands = (0 - + poldi_ctrl_opt.cmd_print_key - + poldi_ctrl_opt.cmd_print_serialno - + poldi_ctrl_opt.cmd_dump); - if (ncommands > 1) - { - log_msg_error (loghandle, - _("more than one command specified (try --help)")); - goto out; - } - else if (! ncommands) - { - log_msg_error (loghandle, _("no command specified (try --help)")); - goto out; - } - - /* Connect to scdaemon. */ - - err = scd_connect (&scd_ctx, NULL, getenv ("GPG_AGENT_INFO"), - NULL, NULL, 0, loghandle); - if (err) - { - log_msg_error (loghandle, _("failed to connect to scdaemon: %s"), - gpg_strerror (err)); - goto out; - } - - err = scd_learn (scd_ctx, &scd_cardinfo); - if (err) - { - log_msg_error (loghandle, - _("failed to retrieve smartcard data: %s"), - gpg_strerror (err)); - goto out; - } - - if (poldi_ctrl_opt.cmd_dump) - err = cmd_dump (); - else if (poldi_ctrl_opt.cmd_print_key) - err = cmd_print_key (); - else if (poldi_ctrl_opt.cmd_print_serialno) - err = cmd_print_serialno (); - - out: - - if (parsehandle) - simpleparse_destroy (parsehandle); - if (scd_ctx) - scd_disconnect (scd_ctx); - scd_release_cardinfo (scd_cardinfo); - - return err ? EXIT_FAILURE : EXIT_SUCCESS; -} - -/* END */ ----------------------------------------------------------------------- Summary of changes: conf/users.skel | 6 +- doc/poldi.texi | 13 +- po/POTFILES.in | 1 - po/de.po | 49 ------- po/poldi.pot | 49 ------- src/Makefile.am | 2 +- src/ctrl/ChangeLog | 310 ----------------------------------------- src/ctrl/Makefile.am | 40 ------ src/ctrl/poldi-ctrl.c | 375 -------------------------------------------------- src/pam/pam_poldi.c | 6 +- src/scd/scd.c | 224 ++---------------------------- src/scd/scd.h | 13 +- 12 files changed, 31 insertions(+), 1057 deletions(-) delete mode 100644 src/ctrl/ChangeLog delete mode 100644 src/ctrl/Makefile.am delete mode 100644 src/ctrl/poldi-ctrl.c hooks/post-receive -- PAM for the OpenPGP card http://git.gnupg.org From cvs at cvs.gnupg.org Fri Nov 4 12:42:16 2016 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Fri, 04 Nov 2016 12:42:16 +0100 Subject: [git] GPGME - branch, master, updated. gpgme-1.7.1-22-g3509cf2 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 3509cf2f9846360848b6c08d36cbca18373c935e (commit) via 512de91f9a8da8f491e09653eb4b5bdd0a027198 (commit) via 4d3f33d0e9d960df2c34fb4d215987ab4d36111c (commit) via 23979b9be5a6028e3e9cafc3aff632bc720b81f2 (commit) from df08a0ca3f029b06b7e3a6bd63330df5cb96585a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 3509cf2f9846360848b6c08d36cbca18373c935e Author: Andre Heinecke Date: Fri Nov 4 12:33:57 2016 +0100 cpp: Add API for swdb queries * lang/cpp/src/swdbresult.cpp, lang/cpp/src/swdbresult.h (SwdbResult): New. * lang/cpp/src/Makefile.am: Update accordingly. diff --git a/NEWS b/NEWS index 4d2a110..1cf401e 100644 --- a/NEWS +++ b/NEWS @@ -16,6 +16,7 @@ Noteworthy changes in version 1.7.2 (unreleased) qt: DN::Attribute NEW. cpp: EngineInfo::Version::Version(const char*) NEW. cpp: EngineInfo::Version::Version() NEW. + cpp: SwdbResult NEW. Noteworthy changes in version 1.7.1 (2016-10-18) diff --git a/lang/cpp/src/Makefile.am b/lang/cpp/src/Makefile.am index 8ea99f5..608d2d9 100644 --- a/lang/cpp/src/Makefile.am +++ b/lang/cpp/src/Makefile.am @@ -33,7 +33,7 @@ main_sources = \ gpgsetownertrusteditinteractor.cpp gpgsignkeyeditinteractor.cpp \ gpgadduserideditinteractor.cpp defaultassuantransaction.cpp \ scdgetinfoassuantransaction.cpp gpgagentgetinfoassuantransaction.cpp \ - vfsmountresult.cpp configuration.cpp tofuinfo.cpp + vfsmountresult.cpp configuration.cpp tofuinfo.cpp swdbresult.cpp gpgmepp_headers = \ configuration.h context.h data.h decryptionresult.h \ @@ -45,7 +45,7 @@ gpgmepp_headers = \ importresult.h keygenerationresult.h key.h keylistresult.h \ notation.h result.h scdgetinfoassuantransaction.h signingresult.h \ trustitem.h verificationresult.h vfsmountresult.h gpgmepp_export.h \ - tofuinfo.h + tofuinfo.h swdbresult.h private_gpgmepp_headers = \ result_p.h context_p.h util.h callbacks.h data_p.h diff --git a/lang/cpp/src/swdbresult.cpp b/lang/cpp/src/swdbresult.cpp new file mode 100644 index 0000000..3afa8b5 --- /dev/null +++ b/lang/cpp/src/swdbresult.cpp @@ -0,0 +1,231 @@ +/* swdbresult.cpp - wraps gpgme swdb result / query + Copyright (C) 2016 Intevation 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 Library General Public + License as published by the Free Software Foundation; either + version 2 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 Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with GPGME++; see the file COPYING.LIB. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ + +#ifdef HAVE_CONFIG_H + #include "config.h" +#endif + +#include "swdbresult.h" + +#include + +#include "error.h" + +#include "gpgme.h" + +class GpgME::SwdbResult::Private +{ +public: + Private() {} + Private(gpgme_query_swdb_result_t result) + : mResult(result ? new _gpgme_op_query_swdb_result (*result) : nullptr) + { + if (!result) { + mResult->name = nullptr; + return; + } + if (result->name) { + mResult->name = strdup(result->name); + } + if (result->version) { + mVersion = result->version; + } + if (result->iversion) { + mIVersion = result->iversion; + } + } + + Private(const Private &other) + : mResult(other.mResult) + { + if (mResult && mResult->name) { + mResult->name = strdup(mResult->name); + } + mVersion = other.mVersion; + mIVersion = other.mIVersion; + } + + ~Private() + { + if (mResult) { + std::free(mResult->name); + delete mResult; + } + } + + GpgME::EngineInfo::Version mVersion; + GpgME::EngineInfo::Version mIVersion; + gpgme_query_swdb_result_t mResult; +}; + +GpgME::SwdbResult::SwdbResult(gpgme_query_swdb_result_t result) + : d(new Private(result)) +{ +} + +GpgME::SwdbResult::SwdbResult() : d() +{ +} + +bool GpgME::SwdbResult::isNull() const +{ + return !d || !d->mResult; +} + +std::string GpgME::SwdbResult::name() const +{ + if (isNull() || !d->mResult->name) { + return std::string(); + } + return d->mResult->name; +} + +GpgME::EngineInfo::Version GpgME::SwdbResult::version() const +{ + if (isNull()) { + return GpgME::EngineInfo::Version(); + } + return d->mVersion; +} + +GpgME::EngineInfo::Version GpgME::SwdbResult::installedVersion() const +{ + if (isNull()) { + return GpgME::EngineInfo::Version(); + } + return d->mIVersion; +} + +unsigned long GpgME::SwdbResult::created() const +{ + return isNull() ? 0 : d->mResult->created; +} + +unsigned long GpgME::SwdbResult::retrieved() const +{ + return isNull() ? 0 : d->mResult->retrieved; +} + +unsigned long GpgME::SwdbResult::releaseDate() const +{ + return isNull() ? 0 : d->mResult->reldate; +} + +bool GpgME::SwdbResult::warning() const +{ + return isNull() ? 0 : d->mResult->warning; +} + +bool GpgME::SwdbResult::update() const +{ + return isNull() ? 0 : d->mResult->update; +} + +bool GpgME::SwdbResult::noinfo() const +{ + return isNull() ? 0 : d->mResult->noinfo; +} + +bool GpgME::SwdbResult::unknown() const +{ + return isNull() ? 0 : d->mResult->unknown; +} + +bool GpgME::SwdbResult::error() const +{ + return isNull() ? 0 : d->mResult->error; +} + +bool GpgME::SwdbResult::tooOld() const +{ + return isNull() ? 0 : d->mResult->tooold; +} + +bool GpgME::SwdbResult::urgent() const +{ + return isNull() ? 0 : d->mResult->urgent; +} + +std::vector GpgME::SwdbResult::query(const char *name, + const char *iversion, + Error *err) +{ + std::vector ret; + gpgme_ctx_t ctx; + gpgme_error_t gpgerr = gpgme_new(&ctx); + + if (gpgerr) { + if (err) { + *err = Error (gpgerr); + } + return ret; + } + + gpgerr = gpgme_set_protocol(ctx, GPGME_PROTOCOL_GPGCONF); + + if (gpgerr) { + if (err) { + *err = Error(gpgerr); + } + gpgme_release(ctx); + return ret; + } + + gpgerr = gpgme_op_query_swdb(ctx, name, iversion, 0); + + if (gpgerr) { + if (err) { + *err = Error(gpgerr); + } + gpgme_release(ctx); + return ret; + } + gpgme_query_swdb_result_t result = gpgme_op_query_swdb_result(ctx); + while (result) { + ret.push_back(SwdbResult(result)); + result = result->next; + } + + gpgme_release(ctx); + return ret; +} + +std::ostream &GpgME::operator<<(std::ostream &os, const GpgME::SwdbResult &result) +{ + os << "GpgME::SwdbResult("; + if (!result.isNull()) { + os << "\n name: " << result.name() + << "\n version: " << result.version() + << "\n installed: "<< result.installedVersion() + << "\n created: " << result.created() + << "\n retrieved: "<< result.retrieved() + << "\n warning: " << result.warning() + << "\n update: " << result.update() + << "\n urgent: " << result.urgent() + << "\n noinfo: " << result.noinfo() + << "\n unknown: " << result.unknown() + << "\n tooOld: " << result.tooOld() + << "\n error: " << result.error() + << "\n reldate: " << result.releaseDate() + << '\n'; + } + return os << ")\n"; +} diff --git a/lang/cpp/src/swdbresult.h b/lang/cpp/src/swdbresult.h new file mode 100644 index 0000000..e15954d --- /dev/null +++ b/lang/cpp/src/swdbresult.h @@ -0,0 +1,128 @@ +/* + swdbresult.h - wraps a gpgme swdb query / rsult + Copyright (C) 2016 Intevation 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 Library General Public + License as published by the Free Software Foundation; either + version 2 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 Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with GPGME++; see the file COPYING.LIB. If not, write to the + Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + Boston, MA 02110-1301, USA. +*/ +#ifndef __GPGMEPP_SWDB_H__ +#define __GPGMEPP_SWDB_H__ + +#include "gpgmepp_export.h" + +#include "global.h" +#include "engineinfo.h" + +#include +#include +#include +#include + +namespace GpgME +{ + +class GPGMEPP_EXPORT SwdbResult +{ +public: + /* Obtain swdb results through query() */ + SwdbResult(); + explicit SwdbResult(gpgme_query_swdb_result_t result); + + /** Query the swdb to get information about updates. + * + * Runs gpgconf --query-swdb through gpgme and + * returns a list of results. + * If iversion is given as NULL a check is only done if GPGME + * can figure out the version by itself (for example when using + * "gpgme" or "gnupg"). + * + * If NULL is used for name the current gpgme version is + * checked. + * + * @param name: Name of the component to query. + * @param iversion: Optionally the installed version. + * @param err: Optional error. + */ + static std::vector query(const char *name, + const char *iversion = NULL, + Error *err = NULL); + + const SwdbResult &operator=(SwdbResult other) + { + swap(other); + return *this; + } + + void swap(SwdbResult &other) + { + using std::swap; + swap(this->d, other.d); + } + bool isNull() const; + + /* The name of the package (e.g. "gpgme", "gnupg") */ + std::string name() const; + + /* The version of the installed version. */ + EngineInfo::Version installedVersion() const; + + /* The time the online info was created. */ + unsigned long created() const; + + /* The time the online info was retrieved. */ + unsigned long retrieved() const; + + /* This bit is set if an error occured or some of the information + * in this structure may not be set. */ + bool warning() const; + + /* An update is available. */ + bool update() const; + + /* The update is important. */ + bool urgent() const; + + /* No information at all available. */ + bool noinfo() const; + + /* The package name is not known. */ + bool unknown() const; + + /* The information here is too old. */ + bool tooOld() const; + + /* Other error. */ + bool error() const; + + /* The version of the latest released version. */ + EngineInfo::Version version() const; + + /* The release date of that version. */ + unsigned long releaseDate() const; + +private: + class Private; + std::shared_ptr d; +}; + +GPGMEPP_EXPORT std::ostream &operator<<(std::ostream &os, const SwdbResult &info); + +} // namespace GpgME + +GPGMEPP_MAKE_STD_SWAP_SPECIALIZATION(SwdbResult) + +#endif commit 512de91f9a8da8f491e09653eb4b5bdd0a027198 Author: Andre Heinecke Date: Fri Nov 4 12:29:32 2016 +0100 cpp: Add more EngineInfo::Version ctors * lang/cpp/src/engineinfo.h (EngineInfo::Version::Version(const char*)), (EngineInfo::Version::Version()): New. diff --git a/NEWS b/NEWS index e43aa30..4d2a110 100644 --- a/NEWS +++ b/NEWS @@ -14,6 +14,8 @@ Noteworthy changes in version 1.7.2 (unreleased) gpgme_query_swdb_result_t NEW. qt: DN NEW. qt: DN::Attribute NEW. + cpp: EngineInfo::Version::Version(const char*) NEW. + cpp: EngineInfo::Version::Version() NEW. Noteworthy changes in version 1.7.1 (2016-10-18) diff --git a/lang/cpp/src/engineinfo.h b/lang/cpp/src/engineinfo.h index 72e125c..aa6fcca 100644 --- a/lang/cpp/src/engineinfo.h +++ b/lang/cpp/src/engineinfo.h @@ -40,6 +40,12 @@ public: struct Version { int major, minor, patch; + Version() + { + major = 0; + minor = 0; + patch = 0; + } Version(const std::string& version) { @@ -51,6 +57,16 @@ public: } } + Version(const char *version) + { + if (!version || + std::sscanf(version, "%d.%d.%d", &major, &minor, &patch) != 3) { + major = 0; + minor = 0; + patch = 0; + } + } + bool operator < (const Version& other) { if (major < other.major) commit 4d3f33d0e9d960df2c34fb4d215987ab4d36111c Author: Andre Heinecke Date: Fri Nov 4 12:26:46 2016 +0100 cpp: Don't include gpgme.h in tofuinfo header * lang/cpp/src/tofuinfo.h: Don't include gpgme.h -- No public header should include gpgme.h diff --git a/lang/cpp/src/tofuinfo.h b/lang/cpp/src/tofuinfo.h index c09c82a..7165d05 100644 --- a/lang/cpp/src/tofuinfo.h +++ b/lang/cpp/src/tofuinfo.h @@ -25,8 +25,6 @@ #include "gpgmepp_export.h" -#include "gpgme.h" - #include "global.h" #include commit 23979b9be5a6028e3e9cafc3aff632bc720b81f2 Author: Andre Heinecke Date: Fri Nov 4 12:24:34 2016 +0100 cpp: Extend gpgmefw for tofuinfo and swdb query * lang/cpp/src/gpgmefw.h (gpgme_tofu_info_t) (gpgme_query_swdb_result_t): New forwards. diff --git a/lang/cpp/src/gpgmefw.h b/lang/cpp/src/gpgmefw.h index cbdd444..e3c9b18 100644 --- a/lang/cpp/src/gpgmefw.h +++ b/lang/cpp/src/gpgmefw.h @@ -67,4 +67,10 @@ typedef struct gpgme_conf_comp *gpgme_conf_comp_t; struct gpgme_conf_arg; typedef struct gpgme_conf_arg *gpgme_conf_arg_t; +struct _gpgme_tofu_info; +typedef struct _gpgme_tofu_info *gpgme_tofu_info_t; + +struct _gpgme_op_query_swdb_result; +typedef struct _gpgme_op_query_swdb_result *gpgme_query_swdb_result_t; + #endif // __GPGMEPP_GPGMEFW_H__ ----------------------------------------------------------------------- Summary of changes: NEWS | 3 + lang/cpp/src/Makefile.am | 4 +- lang/cpp/src/engineinfo.h | 16 +++ lang/cpp/src/gpgmefw.h | 6 ++ lang/cpp/src/swdbresult.cpp | 231 ++++++++++++++++++++++++++++++++++++++++++++ lang/cpp/src/swdbresult.h | 128 ++++++++++++++++++++++++ lang/cpp/src/tofuinfo.h | 2 - 7 files changed, 386 insertions(+), 4 deletions(-) create mode 100644 lang/cpp/src/swdbresult.cpp create mode 100644 lang/cpp/src/swdbresult.h hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Fri Nov 4 13:51:36 2016 From: cvs at cvs.gnupg.org (by Justus Winter) Date: Fri, 04 Nov 2016 13:51:36 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.1.15-322-g1f45878 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via 1f45878a72f23d4bae08d73b614096b485f35274 (commit) via 43f8006f5c75e3d15fe200e2fa41587a73bfb07b (commit) from cd00b07ec26c3408e6aee66957b08c6fd319b700 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 1f45878a72f23d4bae08d73b614096b485f35274 Author: Justus Winter Date: Fri Nov 4 13:45:30 2016 +0100 gpgscm: Fix printing strings containing zero bytes. * tests/gpgscm/scheme.c (atom2str): Fix computing the length of Scheme strings. Scheme strings can contain zero bytes. Signed-off-by: Justus Winter diff --git a/tests/gpgscm/scheme.c b/tests/gpgscm/scheme.c index 0e31dc5..44dd165 100644 --- a/tests/gpgscm/scheme.c +++ b/tests/gpgscm/scheme.c @@ -2041,7 +2041,9 @@ static void atom2str(scheme *sc, pointer l, int f, char **pp, int *plen) { } } else if (is_string(l)) { if (!f) { - p = strvalue(l); + *pp = strvalue(l); + *plen = strlength(l); + return; } else { /* Hack, uses the fact that printing is needed */ *pp=sc->strbuff; *plen=0; commit 43f8006f5c75e3d15fe200e2fa41587a73bfb07b Author: Justus Winter Date: Fri Nov 4 12:08:20 2016 +0100 gpgscm: Implement 'atexit'. * tests/gpgscm/ffi.scm (throw): Run *run-atexit-handlers* when terminating the interpreter. (*atexit-handlers*): New variable. (*run-atexit-handlers*): New function. (atexit): Likewise. * tests/gpgscm/main.c (main): Run *run-atexit-handlers* at normal interpreter shutdown. Signed-off-by: Justus Winter diff --git a/tests/gpgscm/ffi.scm b/tests/gpgscm/ffi.scm index 72a2a8f..fb18538 100644 --- a/tests/gpgscm/ffi.scm +++ b/tests/gpgscm/ffi.scm @@ -57,6 +57,7 @@ ((more-handlers?) (apply (pop-handler) x)) ((and (= 2 (length x)) (equal? *interpreter-exit* (car x))) + (*run-atexit-handlers*) (_exit (cadr x))) (else (apply error x)))) @@ -64,3 +65,20 @@ ;; Terminate the process returning STATUS to the parent. (define (exit status) (throw *interpreter-exit* status)) + +;; A list of functions run at interpreter shutdown. +(define *atexit-handlers* (list)) + +;; Execute all these functions. +(define (*run-atexit-handlers*) + (unless (null? *atexit-handlers*) + (let ((proc (car *atexit-handlers*))) + ;; Drop proc from the list so that it will not get + ;; executed again even if it raises an exception. + (set! *atexit-handlers* (cdr *atexit-handlers*)) + (proc) + (*run-atexit-handlers*)))) + +;; Register a function to be run at interpreter shutdown. +(define (atexit proc) + (set! *atexit-handlers* (cons proc *atexit-handlers*))) diff --git a/tests/gpgscm/main.c b/tests/gpgscm/main.c index f7c6b0d..70ce855 100644 --- a/tests/gpgscm/main.c +++ b/tests/gpgscm/main.c @@ -291,6 +291,7 @@ main (int argc, char **argv) log_fatal ("%s: %s", script, gpg_strerror (err)); } + scheme_load_string (sc, "(*run-atexit-handlers*)"); scheme_deinit (sc); xfree (sc); return EXIT_SUCCESS; ----------------------------------------------------------------------- Summary of changes: tests/gpgscm/ffi.scm | 18 ++++++++++++++++++ tests/gpgscm/main.c | 1 + tests/gpgscm/scheme.c | 4 +++- 3 files changed, 22 insertions(+), 1 deletion(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Fri Nov 4 14:54:49 2016 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Fri, 04 Nov 2016 14:54:49 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.1.15-323-g2312a7f Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via 2312a7f836b89b812298f25cf50ba56c6ce1806c (commit) from 1f45878a72f23d4bae08d73b614096b485f35274 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 2312a7f836b89b812298f25cf50ba56c6ce1806c Author: Werner Koch Date: Fri Nov 4 14:51:19 2016 +0100 indent: Move comments inside the block. -- This fixes a few if (foo) /* A comment with several lines. */ { } Which has the problem that the block is visually not related to the "if" and might thus falsely be considered a standalone block. Also adds a asterisk on the left side of longer comments. Signed-off-by: Werner Koch diff --git a/g10/getkey.c b/g10/getkey.c index 926575d..b844c16 100644 --- a/g10/getkey.c +++ b/g10/getkey.c @@ -1213,25 +1213,26 @@ get_pubkey_byname (ctrl_t ctrl, GETKEY_CTX * retctx, PKT_public_key * pk, is_mbox = is_valid_mailbox (name); /* The auto-key-locate feature works as follows: there are a number - of methods to look up keys. By default, the local keyring is - tried first. Then, each method listed in the --auto-key-locate is - tried in the order it appears. - - This can be changed as follows: - - - if nodefault appears anywhere in the list of options, then - the local keyring is not tried first, or, - - - if local appears anywhere in the list of options, then the - local keyring is not tried first, but in the order in which - it was listed in the --auto-key-locate option. - - Note: we only save the search context in RETCTX if the local - method is the first method tried (either explicitly or - implicitly). */ + * of methods to look up keys. By default, the local keyring is + * tried first. Then, each method listed in the --auto-key-locate is + * tried in the order it appears. + * + * This can be changed as follows: + * + * - if nodefault appears anywhere in the list of options, then + * the local keyring is not tried first, or, + * + * - if local appears anywhere in the list of options, then the + * local keyring is not tried first, but in the order in which + * it was listed in the --auto-key-locate option. + * + * Note: we only save the search context in RETCTX if the local + * method is the first method tried (either explicitly or + * implicitly). */ if (!no_akl) - /* auto-key-locate is enabled. */ { + /* auto-key-locate is enabled. */ + /* nodefault is true if "nodefault" or "local" appear. */ for (akl = opt.auto_key_locate; akl; akl = akl->next) if (akl->type == AKL_NODEFAULT || akl->type == AKL_LOCAL) @@ -1251,24 +1252,26 @@ get_pubkey_byname (ctrl_t ctrl, GETKEY_CTX * retctx, PKT_public_key * pk, } if (!nodefault) - /* "nodefault" didn't occur. Thus, "local" is implicitly the - first method to try. */ - anylocalfirst = 1; + { + /* "nodefault" didn't occur. Thus, "local" is implicitly the + * first method to try. */ + anylocalfirst = 1; + } if (nodefault && is_mbox) - /* Either "nodefault" or "local" (explicitly) appeared in the auto - key locate list and NAME appears to be an email address. Don't - try the local keyring. */ { + /* Either "nodefault" or "local" (explicitly) appeared in the + * auto key locate list and NAME appears to be an email address. + * Don't try the local keyring. */ rc = GPG_ERR_NO_PUBKEY; } else - /* Either "nodefault" and "local" don't appear in the auto key - locate list (in which case we try the local keyring first) or - NAME does not appear to be an email address (in which case we - only try the local keyring). In this case, lookup NAME in the - local keyring. */ { + /* Either "nodefault" and "local" don't appear in the auto key + * locate list (in which case we try the local keyring first) or + * NAME does not appear to be an email address (in which case we + * only try the local keyring). In this case, lookup NAME in + * the local keyring. */ add_to_strlist (&namelist, name); rc = key_byname (retctx, namelist, pk, 0, include_unusable, ret_keyblock, ret_kdbhd); @@ -1277,11 +1280,11 @@ get_pubkey_byname (ctrl_t ctrl, GETKEY_CTX * retctx, PKT_public_key * pk, /* If the requested name resembles a valid mailbox and automatic retrieval has been enabled, we try to import the key. */ if (gpg_err_code (rc) == GPG_ERR_NO_PUBKEY && !no_akl && is_mbox) - /* NAME wasn't present in the local keyring (or we didn't try the - local keyring). Since the auto key locate feature is enabled - and NAME appears to be an email address, try the auto locate - feature. */ { + /* NAME wasn't present in the local keyring (or we didn't try + * the local keyring). Since the auto key locate feature is + * enabled and NAME appears to be an email address, try the auto + * locate feature. */ for (akl = opt.auto_key_locate; akl; akl = akl->next) { unsigned char *fpr = NULL; @@ -1349,9 +1352,9 @@ get_pubkey_byname (ctrl_t ctrl, GETKEY_CTX * retctx, PKT_public_key * pk, case AKL_KEYSERVER: /* Strictly speaking, we don't need to only use a valid - mailbox for the getname search, but it helps cut down - on the problem of searching for something like "john" - and getting a whole lot of keys back. */ + * mailbox for the getname search, but it helps cut down + * on the problem of searching for something like "john" + * and getting a whole lot of keys back. */ if (keyserver_any_configured (ctrl)) { mechanism = "keyserver"; @@ -1382,12 +1385,12 @@ get_pubkey_byname (ctrl_t ctrl, GETKEY_CTX * retctx, PKT_public_key * pk, } /* Use the fingerprint of the key that we actually fetched. - This helps prevent problems where the key that we fetched - doesn't have the same name that we used to fetch it. In - the case of CERT and PKA, this is an actual security - requirement as the URL might point to a key put in by an - attacker. By forcing the use of the fingerprint, we - won't use the attacker's key here. */ + * This helps prevent problems where the key that we fetched + * doesn't have the same name that we used to fetch it. In + * the case of CERT and PKA, this is an actual security + * requirement as the URL might point to a key put in by an + * attacker. By forcing the use of the fingerprint, we + * won't use the attacker's key here. */ if (!rc && fpr) { char fpr_string[MAX_FINGERPRINT_LEN * 2 + 1]; @@ -1407,7 +1410,7 @@ get_pubkey_byname (ctrl_t ctrl, GETKEY_CTX * retctx, PKT_public_key * pk, } else if (!rc && !fpr && !did_akl_local) { /* The acquisition method said no failure occurred, but - it didn't return a fingerprint. That's a failure. */ + * it didn't return a fingerprint. That's a failure. */ no_fingerprint = 1; rc = GPG_ERR_NO_PUBKEY; } @@ -1416,9 +1419,9 @@ get_pubkey_byname (ctrl_t ctrl, GETKEY_CTX * retctx, PKT_public_key * pk, if (!rc && !did_akl_local) { /* There was no error and we didn't do a local lookup. - This means that we imported a key into the local - keyring. Try to read the imported key from the - keyring. */ + * This means that we imported a key into the local + * keyring. Try to read the imported key from the + * keyring. */ if (retctx) { getkey_end (*retctx); @@ -1461,6 +1464,7 @@ get_pubkey_byname (ctrl_t ctrl, GETKEY_CTX * retctx, PKT_public_key * pk, return rc; } + /* Comparison machinery for get_best_pubkey_byname. */ @@ -1477,26 +1481,30 @@ struct pubkey_cmp_cookie capable of encryption. */ }; + /* Then we have a series of helper functions. */ static int key_is_ok (const PKT_public_key *key) { - return ! key->has_expired && ! key->flags.revoked - && key->flags.valid && ! key->flags.disabled; + return (! key->has_expired && ! key->flags.revoked + && key->flags.valid && ! key->flags.disabled); } + static int uid_is_ok (const PKT_public_key *key, const PKT_user_id *uid) { return key_is_ok (key) && ! uid->is_revoked; } + static int subkey_is_ok (const PKT_public_key *sub) { return ! sub->flags.revoked && sub->flags.valid && ! sub->flags.disabled; } + /* Finally this function compares a NEW key to the former candidate * OLD. Returns < 0 if the old key is worse, > 0 if the old key is * better, == 0 if it is a tie. */ @@ -1504,7 +1512,7 @@ static int pubkey_cmp (ctrl_t ctrl, const char *name, struct pubkey_cmp_cookie *old, struct pubkey_cmp_cookie *new, KBNODE new_keyblock) { - KBNODE n; + kbnode_t n; new->creation_time = 0; for (n = find_next_kbnode (new_keyblock, PKT_PUBLIC_SUBKEY); ----------------------------------------------------------------------- Summary of changes: g10/getkey.c | 104 ++++++++++++++++++++++++++++++++--------------------------- 1 file changed, 56 insertions(+), 48 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Sat Nov 5 03:14:44 2016 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Sat, 05 Nov 2016 03:14:44 +0100 Subject: [git] Poldi - branch, master, updated. release-0.4.1-36-g448ca0e Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "PAM for the OpenPGP card". The branch, master has been updated via 448ca0ee59007691e223f7054fb6eec2336d41df (commit) from b4280978f83971103bf54470d7084e98d125aca2 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 448ca0ee59007691e223f7054fb6eec2336d41df Author: NIIBE Yutaka Date: Sat Nov 5 11:13:32 2016 +0900 Remove src/ctrl from configure. * configure.ac: Remove src/ctrl. -- Signed-off-by: NIIBE Yutaka diff --git a/configure.ac b/configure.ac index 4e0b53a..5e87907 100644 --- a/configure.ac +++ b/configure.ac @@ -231,7 +231,6 @@ AC_CONFIG_FILES([Makefile src/util/Makefile src/util/configure-stamp src/scd/Makefile - src/ctrl/Makefile src/pam/Makefile src/pam/auth-support/Makefile src/pam/auth-method-localdb/Makefile ----------------------------------------------------------------------- Summary of changes: configure.ac | 1 - 1 file changed, 1 deletion(-) hooks/post-receive -- PAM for the OpenPGP card http://git.gnupg.org From cvs at cvs.gnupg.org Sat Nov 5 10:58:13 2016 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Sat, 05 Nov 2016 10:58:13 +0100 Subject: [git] Pinentry - branch, master, updated. pinentry-0.9.7-36-g553af04 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The standard pinentry collection". The branch, master has been updated via 553af04cf9c103c2e2cd5085b0d5fb647a608d51 (commit) from 7b0a822460eb6f4bf28f85f38c64a86bb8f80d3d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 553af04cf9c103c2e2cd5085b0d5fb647a608d51 Author: Werner Koch Date: Sat Nov 5 10:55:46 2016 +0100 core: Add command getinfo/flavor. * pinentry/pinentry.c: Inlcude pinentry-curses.h. (cmd_getinfo): Add sub-command "flavor" Signed-off-by: Werner Koch diff --git a/pinentry/pinentry.c b/pinentry/pinentry.c index 4a0f859..d2f4229 100644 --- a/pinentry/pinentry.c +++ b/pinentry/pinentry.c @@ -52,7 +52,10 @@ #include "password-cache.h" #ifdef INSIDE_EMACS -#include "pinentry-emacs.h" +# include "pinentry-emacs.h" +#endif +#ifdef FALLBACK_CURSES +# include "pinentry-curses.h" #endif #ifdef HAVE_W32CE_SYSTEM @@ -1414,23 +1417,50 @@ cmd_message (assuan_context_t ctx, char *line) version - Return the version of the program. pid - Return the process id of the server. + flavor - Return information about the used pinentry flavor */ static gpg_error_t cmd_getinfo (assuan_context_t ctx, char *line) { int rc; + const char *s; + char buffer[100]; if (!strcmp (line, "version")) { - const char *s = VERSION; + s = VERSION; rc = assuan_send_data (ctx, s, strlen (s)); } else if (!strcmp (line, "pid")) { - char numbuf[50]; - snprintf (numbuf, sizeof numbuf, "%lu", (unsigned long)getpid ()); - rc = assuan_send_data (ctx, numbuf, strlen (numbuf)); + snprintf (buffer, sizeof buffer, "%lu", (unsigned long)getpid ()); + rc = assuan_send_data (ctx, buffer, strlen (buffer)); + } + else if (!strcmp (line, "flavor")) + { + const char *flags; + + if (!strncmp (this_pgmname, "pinentry-", 9) && this_pgmname[9]) + s = this_pgmname + 9; + else + s = this_pgmname; + + if (0) + ; +#ifdef INSIDE_EMACS + else if (pinentry_cmd_handler == emacs_cmd_handler) + flags = ":emacs"; +#endif +#ifdef FALLBACK_CURSES + else if (pinentry_cmd_handler == curses_cmd_handler) + flags = ":curses"; +#endif + else + flags = ""; + + snprintf (buffer, sizeof buffer, "%s%s", s, flags); + rc = assuan_send_data (ctx, buffer, strlen (buffer)); } else rc = gpg_error (GPG_ERR_ASS_PARAMETER); ----------------------------------------------------------------------- Summary of changes: pinentry/pinentry.c | 40 +++++++++++++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 5 deletions(-) hooks/post-receive -- The standard pinentry collection http://git.gnupg.org From cvs at cvs.gnupg.org Sat Nov 5 11:49:34 2016 From: cvs at cvs.gnupg.org (by Daniel Kahn Gillmor) Date: Sat, 05 Nov 2016 11:49:34 +0100 Subject: [git] Pinentry - branch, master, updated. pinentry-0.9.7-47-gb945576 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The standard pinentry collection". The branch, master has been updated via b945576fe906ffcd5bcc50b4322ef2f34d8fb89f (commit) via aa5b7bb42d5324e6f5494faaf85b24c2e161f810 (commit) via 799116010a57aec9a86c5529388111d54aff3c55 (commit) via f7b99ff5f7f78db45350308bf409ea4a9e94f161 (commit) via d0fe54d592a8d2be6fc82b26290a644bb3629214 (commit) via 102832a2c1f3ffa432e2a169791611bb3ca13a04 (commit) via 784c4e0a3acace39a4a632bf443c794752297d54 (commit) via 93b4454f4fe4d97dd89efccd64dbdd02bd002f77 (commit) via 3be5b4fabaabf86f085b0b5303a1312abb7d0617 (commit) via 19c2110557d0504c1b406bde24e86cb5eb552fc7 (commit) via 96e3c5fcf210e971fe1ba66b9127ad51144fcc49 (commit) from 553af04cf9c103c2e2cd5085b0d5fb647a608d51 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit b945576fe906ffcd5bcc50b4322ef2f34d8fb89f Author: Daniel Kahn Gillmor Date: Sat Nov 5 00:44:53 2016 -0400 build: Avoid unnecessary dependency on gtk+-2 for GNOME3 development. * configure.ac: There is no reason to reject building the GNOME3 pinentry if GTK+-2 development libraries are not present. GNOME3 does not require GTK+-2. Signed-off-by: Daniel Kahn Gillmor diff --git a/configure.ac b/configure.ac index 1dfdf17..2a96ccd 100644 --- a/configure.ac +++ b/configure.ac @@ -438,14 +438,13 @@ if test "$pinentry_gtk_2" != "no" -o "$pinentry_gnome_3" != "no"; then fi dnl check if the module gtk+-2.0 exists -if test "$pinentry_gtk_2" != "no" -o "$pinentry_gnome_3" != "no"; then +if test "$pinentry_gtk_2" != "no"; then AC_MSG_CHECKING([for gtk+-2]) "${PKG_CONFIG}" --exists gtk+-2.0 if test $? -ne 0 ; then AC_MSG_RESULT([no]) AC_MSG_WARN([pkg-config could not find the module gtk+-2.0]) pinentry_gtk_2=no - pinentry_gnome_3=no else AC_MSG_RESULT([yes]) AC_MSG_CHECKING([gtk+-2 version >= 2.4.0]) @@ -455,7 +454,6 @@ if test "$pinentry_gtk_2" != "no" -o "$pinentry_gnome_3" != "no"; then if test $? -ne 0 ; then AC_MSG_WARN([building GTK+-2 pinentry disabled]) pinentry_gtk_2=no - pinentry_gnome_3=no else GTK2CFLAGS=`"${PKG_CONFIG}" --cflags gtk+-2.0` GTK2LIBS=`"${PKG_CONFIG}" --libs gtk+-2.0` @@ -465,10 +463,6 @@ if test "$pinentry_gtk_2" != "no" -o "$pinentry_gnome_3" != "no"; then then pinentry_gtk_2=yes fi - if test "$pinentry_gnome_3" != "no" - then - pinentry_gnome_3=yes - fi fi fi fi commit aa5b7bb42d5324e6f5494faaf85b24c2e161f810 Author: Daniel Kahn Gillmor Date: Sat Nov 5 00:25:12 2016 -0400 all: Prefer https:// over http:// in source where possible. -- This change cleans up as many internal web references as possible, to make them use https. In some cases, the canonical references had slightly different URLs in addition to the change in schema. Sadly, git.savannah.gnu.org is still http-only. Signed-off-by: Daniel Kahn Gillmor diff --git a/README b/README index b80d466..33f0ab4 100644 --- a/README +++ b/README @@ -3,7 +3,7 @@ PIN Entry This is a collection of simple PIN or passphrase entry dialogs which utilize the Assuan protocol as described by the aegypten project; see -http://www.gnupg.org/aegypten/ for details. +https://www.gnupg.org/aegypten/ for details. There are programs for different toolkits available. For all GUIs it is automatically detected which modules can be built, but it can also diff --git a/autogen.sh b/autogen.sh index 7effd56..37edfc6 100755 --- a/autogen.sh +++ b/autogen.sh @@ -422,7 +422,7 @@ if [ -d .git ]; then [ -z "${SILENT}" ] && cat <. +# along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a diff --git a/build-aux/config.guess b/build-aux/config.guess index dbfb978..7adf147 100755 --- a/build-aux/config.guess +++ b/build-aux/config.guess @@ -15,7 +15,7 @@ timestamp='2015-01-01' # General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, see . +# along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a diff --git a/build-aux/config.sub b/build-aux/config.sub index 6d2e94c..0b2d816 100755 --- a/build-aux/config.sub +++ b/build-aux/config.sub @@ -15,7 +15,7 @@ timestamp='2015-01-01' # General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, see . +# along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a diff --git a/build-aux/depcomp b/build-aux/depcomp index 4ebd5b3..f0a474c 100755 --- a/build-aux/depcomp +++ b/build-aux/depcomp @@ -16,7 +16,7 @@ scriptversion=2013-05-30.07; # UTC # GNU General Public License for more details. # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a diff --git a/build-aux/gitlog-to-changelog b/build-aux/gitlog-to-changelog index 5cf071f..81a0431 100755 --- a/build-aux/gitlog-to-changelog +++ b/build-aux/gitlog-to-changelog @@ -22,7 +22,7 @@ my $VERSION = '2012-01-24 15:58 (wk)'; # UTC # GNU General Public License for more details. # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program. If not, see . # Written by Jim Meyering # Custom bugs bred by Werner Koch diff --git a/build-aux/mdate-sh b/build-aux/mdate-sh index b3719cf..39f48bb 100755 --- a/build-aux/mdate-sh +++ b/build-aux/mdate-sh @@ -17,7 +17,7 @@ scriptversion=2010-08-21.06; # UTC # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a diff --git a/build-aux/missing b/build-aux/missing index db98974..528c6c4 100755 --- a/build-aux/missing +++ b/build-aux/missing @@ -1,7 +1,7 @@ #! /bin/sh # Common wrapper for a few potentially missing GNU programs. -scriptversion=2013-10-28.13; # UTC +scriptversion=2016-11-05.04; # UTC # Copyright (C) 1996-2013 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard , 1996. @@ -17,7 +17,7 @@ scriptversion=2013-10-28.13; # UTC # GNU General Public License for more details. # You should have received a copy of the GNU General Public License -# along with this program. If not, see . +# along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -101,9 +101,9 @@ else exit $st fi -perl_URL=http://www.perl.org/ -flex_URL=http://flex.sourceforge.net/ -gnu_software_URL=http://www.gnu.org/software +perl_URL=https://www.perl.org/ +flex_URL=https://github.com/westes/flex +gnu_software_URL=https://www.gnu.org/software program_details () { diff --git a/build-aux/texinfo.tex b/build-aux/texinfo.tex index 5552e50..1e6de89 100644 --- a/build-aux/texinfo.tex +++ b/build-aux/texinfo.tex @@ -3,7 +3,7 @@ % Load plain if necessary, i.e., if running under initex. \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi % -\def\texinfoversion{2016-11-03.12} +\def\texinfoversion{2016-11-05.00} % % Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, @@ -21,7 +21,7 @@ % % You should have received a copy of the GNU General Public License % along with this texinfo.tex file; see the file COPYING. If not, -% see . +% see . % % As a special exception, when this file is read by TeX when processing % a Texinfo source document, you may use the result without @@ -29,9 +29,9 @@ % % Please try the latest version of texinfo.tex before submitting bug % reports; you can get the latest version from: -% http://www.gnu.org/software/texinfo/ (the Texinfo home page), or +% https://www.gnu.org/software/texinfo/ (the Texinfo home page), or % ftp://tug.org/tex/texinfo.tex -% (and all CTAN mirrors, see http://www.ctan.org). +% (and all CTAN mirrors, see https://www.ctan.org). % The texinfo.tex in any given distribution could well be out % of date, so if that's what you're using, please check. % @@ -55,7 +55,7 @@ % extent. You can get the existing language-specific files from the % full Texinfo distribution. % -% The GNU Texinfo home page is http://www.gnu.org/software/texinfo. +% The GNU Texinfo home page is https://www.gnu.org/software/texinfo. \message{Loading texinfo [version \texinfoversion]:} @@ -1209,7 +1209,7 @@ where each line of input produces a line of output.} % for display in the outlines, and in other places. Thus, we have to % double any backslashes. Otherwise, a name like "\node" will be % interpreted as a newline (\n), followed by o, d, e. Not good. -% http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html +% https://mailman.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html % (and related messages, the final outcome is that it is up to the TeX % user to double the backslashes and otherwise make the string valid, so % that's what we do). @@ -2560,7 +2560,7 @@ end % We use the free feym* fonts from the eurosym package by Henrik % Theiling, which support regular, slanted, bold and bold slanted (and % "outlined" (blackboard board, sort of) versions, which we don't need). -% It is available from http://www.ctan.org/tex-archive/fonts/eurosym. +% It is available from https://www.ctan.org/tex-archive/fonts/eurosym. % % Although only regular is the truly official Euro symbol, we ignore % that. The Euro is designed to be slightly taller than the regular diff --git a/configure.ac b/configure.ac index 1620ebd..1dfdf17 100644 --- a/configure.ac +++ b/configure.ac @@ -42,7 +42,7 @@ m4_define([mym4_betastring], m4_define([mym4_isgit],m4_if(mym4_betastring,[],[no],[yes])) m4_define([mym4_full_version],[mym4_version[]mym4_betastring]) -AC_INIT([pinentry],[mym4_full_version], [http://bugs.gnupg.org]) +AC_INIT([pinentry],[mym4_full_version], [https://bugs.gnupg.org]) AC_CONFIG_AUX_DIR([build-aux]) AM_CONFIG_HEADER(config.h) diff --git a/doc/texinfo.tex b/doc/texinfo.tex index 919d85d..3f81058 100644 --- a/doc/texinfo.tex +++ b/doc/texinfo.tex @@ -3,7 +3,7 @@ % Load plain if necessary, i.e., if running under initex. \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi % -\def\texinfoversion{2016-11-03.12} +\def\texinfoversion{2016-11-05.00} % % Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, @@ -21,7 +21,7 @@ % % You should have received a copy of the GNU General Public License % along with this texinfo.tex file; see the file COPYING. If not, -% see . +% see . % % As a special exception, when this file is read by TeX when processing % a Texinfo source document, you may use the result without @@ -29,9 +29,9 @@ % % Please try the latest version of texinfo.tex before submitting bug % reports; you can get the latest version from: -% http://www.gnu.org/software/texinfo/ (the Texinfo home page), or +% https://www.gnu.org/software/texinfo/ (the Texinfo home page), or % ftp://tug.org/tex/texinfo.tex -% (and all CTAN mirrors, see http://www.ctan.org). +% (and all CTAN mirrors, see https://www.ctan.org). % The texinfo.tex in any given distribution could well be out % of date, so if that's what you're using, please check. % @@ -55,7 +55,7 @@ % extent. You can get the existing language-specific files from the % full Texinfo distribution. % -% The GNU Texinfo home page is http://www.gnu.org/software/texinfo. +% The GNU Texinfo home page is https://www.gnu.org/software/texinfo. \message{Loading texinfo [version \texinfoversion]:} @@ -1209,7 +1209,7 @@ where each line of input produces a line of output.} % for display in the outlines, and in other places. Thus, we have to % double any backslashes. Otherwise, a name like "\node" will be % interpreted as a newline (\n), followed by o, d, e. Not good. -% http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html +% https://mailman.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html % (and related messages, the final outcome is that it is up to the TeX % user to double the backslashes and otherwise make the string valid, so % that's what we do). @@ -2560,7 +2560,7 @@ end % We use the free feym* fonts from the eurosym package by Henrik % Theiling, which support regular, slanted, bold and bold slanted (and % "outlined" (blackboard board, sort of) versions, which we don't need). -% It is available from http://www.ctan.org/tex-archive/fonts/eurosym. +% It is available from https://www.ctan.org/tex-archive/fonts/eurosym. % % Although only regular is the truly official Euro symbol, we ignore % that. The Euro is designed to be slightly taller than the regular diff --git a/emacs/pinentry-emacs.c b/emacs/pinentry-emacs.c index de4ca05..da96985 100644 --- a/emacs/pinentry-emacs.c +++ b/emacs/pinentry-emacs.c @@ -14,7 +14,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see . + along with this program; if not, see . */ #ifdef HAVE_CONFIG_H diff --git a/gtk+-2/pinentry-gtk-2.c b/gtk+-2/pinentry-gtk-2.c index 9d29d90..a7ac91e 100644 --- a/gtk+-2/pinentry-gtk-2.c +++ b/gtk+-2/pinentry-gtk-2.c @@ -116,7 +116,7 @@ constrain_size (GtkWidget *win, GtkRequisition *req, gpointer data) /* Realize the window as transient if we grab the keyboard. This makes the window a modal dialog to the root window, which helps the window manager. See the following quote from: - http://standards.freedesktop.org/wm-spec/wm-spec-1.4.html#id2512420 + https://standards.freedesktop.org/wm-spec/wm-spec-1.4.html#id2512420 Implementing enhanced support for application transient windows diff --git a/m4/pkg.m4 b/m4/pkg.m4 index e602e5b..5acff96 100644 --- a/m4/pkg.m4 +++ b/m4/pkg.m4 @@ -146,7 +146,7 @@ path to pkg-config. _PKG_TEXT -To get pkg-config, see .])], +To get pkg-config, see .])], [$4]) else $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS diff --git a/pinentry/argparse.c b/pinentry/argparse.c index 4f586d4..f6c160c 100644 --- a/pinentry/argparse.c +++ b/pinentry/argparse.c @@ -26,7 +26,7 @@ * * You should have received a copies of the GNU General Public License * and the GNU Lesser General Public License along with this program; - * if not, see . + * if not, see . */ /* This file may be used as part of GnuPG or standalone. A GnuPG @@ -1490,10 +1490,10 @@ strusage( int level ) case 10: #if ARGPARSE_GPL_VERSION == 3 p = ("License GPLv3+: GNU GPL version 3 or later " - ""); + ""); #else p = ("License GPLv2+: GNU GPL version 2 or later " - ""); + ""); #endif break; case 11: p = "foo"; break; @@ -1515,7 +1515,7 @@ ARGPARSE_STR2(ARGPARSE_GPL_VERSION) "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" "GNU General Public License for more details.\n\n" "You should have received a copy of the GNU General Public License\n" -"along with this software. If not, see .\n"; +"along with this software. If not, see .\n"; break; case 40: /* short and long usage */ case 41: p = ""; break; diff --git a/pinentry/argparse.h b/pinentry/argparse.h index b4dc253..54d9c5b 100644 --- a/pinentry/argparse.h +++ b/pinentry/argparse.h @@ -25,7 +25,7 @@ * * You should have received a copies of the GNU General Public License * and the GNU Lesser General Public License along with this program; - * if not, see . + * if not, see . */ #ifndef LIBJNLIB_ARGPARSE_H diff --git a/pinentry/password-cache.c b/pinentry/password-cache.c index c98c4c5..903c013 100644 --- a/pinentry/password-cache.c +++ b/pinentry/password-cache.c @@ -14,7 +14,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see . + along with this program; if not, see . */ #ifdef HAVE_CONFIG_H diff --git a/pinentry/password-cache.h b/pinentry/password-cache.h index 0bc8788..77e82e1 100644 --- a/pinentry/password-cache.h +++ b/pinentry/password-cache.h @@ -14,7 +14,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see . + along with this program; if not, see . */ #ifndef PASSWORD_CACHE_H diff --git a/pinentry/pinentry-emacs.c b/pinentry/pinentry-emacs.c index 9ced8da..df12f1b 100644 --- a/pinentry/pinentry-emacs.c +++ b/pinentry/pinentry-emacs.c @@ -14,7 +14,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see . + along with this program; if not, see . */ #ifdef HAVE_CONFIG_H diff --git a/pinentry/pinentry-emacs.h b/pinentry/pinentry-emacs.h index 61d04cc..24dabb9 100644 --- a/pinentry/pinentry-emacs.h +++ b/pinentry/pinentry-emacs.h @@ -14,7 +14,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see . + along with this program; if not, see . */ #ifndef PINENTRY_EMACS_H diff --git a/pinentry/pinentry.c b/pinentry/pinentry.c index d2f4229..0023ebe 100644 --- a/pinentry/pinentry.c +++ b/pinentry/pinentry.c @@ -14,7 +14,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see . + along with this program; if not, see . */ #ifdef HAVE_CONFIG_H diff --git a/pinentry/pinentry.h b/pinentry/pinentry.h index c6e12e4..01fb373 100644 --- a/pinentry/pinentry.h +++ b/pinentry/pinentry.h @@ -14,7 +14,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see . + along with this program; if not, see . */ #ifndef PINENTRY_H diff --git a/tty/Makefile.am b/tty/Makefile.am index e232473..7168342 100644 --- a/tty/Makefile.am +++ b/tty/Makefile.am @@ -14,7 +14,7 @@ # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, see . +# along with this program; if not, see . ## Process this file with automake to produce Makefile.in diff --git a/tty/pinentry-tty.c b/tty/pinentry-tty.c index 183b7a5..bd82fad 100644 --- a/tty/pinentry-tty.c +++ b/tty/pinentry-tty.c @@ -16,7 +16,7 @@ General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, see . + along with this program; if not, see . */ #ifdef HAVE_CONFIG_H commit 799116010a57aec9a86c5529388111d54aff3c55 Author: Werner Koch Date: Sat Nov 5 11:42:24 2016 +0100 gnome3: Avoid using gnome and gcr symbol namespace. * gnome3/pinentry-gnome3.c (struct _gnome3_run): Rename to pe_gnome3_run_s. (_gcr_prompt_password_done): Rename to pe_gcr_prompt_password_done. (_gcr_prompt_confirm_done): Rename to pe_gcr_prompt_confirm_done. (_gcr_timeout_done): Rename to pe_gcr_timeout_done. Signed-off-by: Werner Koch diff --git a/gnome3/pinentry-gnome3.c b/gnome3/pinentry-gnome3.c index c8d8fcf..afa95b7 100644 --- a/gnome3/pinentry-gnome3.c +++ b/gnome3/pinentry-gnome3.c @@ -44,6 +44,25 @@ # define VERSION #endif + +struct pe_gnome3_run_s { + pinentry_t pinentry; + GcrPrompt *prompt; + GMainLoop *main_loop; + int ret; + guint timeout_id; + int timed_out; +}; + +static void pe_gcr_prompt_password_done (GObject *source_object, + GAsyncResult *res, gpointer user_data); + +static void pe_gcr_prompt_confirm_done (GObject *source_object, + GAsyncResult *res, gpointer user_data); +static gboolean pe_gcr_timeout_done (gpointer user_data); + + + static gchar * pinentry_utf8_validate (gchar *text) { @@ -69,23 +88,6 @@ pinentry_utf8_validate (gchar *text) return result; } -struct _gnome3_run { - pinentry_t pinentry; - GcrPrompt *prompt; - GMainLoop *main_loop; - int ret; - guint timeout_id; - int timed_out; -}; - -static void -_gcr_prompt_password_done (GObject *source_object, GAsyncResult *res, gpointer user_data); - -static void -_gcr_prompt_confirm_done (GObject *source_object, GAsyncResult *res, gpointer user_data); - -static gboolean -_gcr_timeout_done (gpointer user_data); static void _propagate_g_error_to_pinentry (pinentry_t pe, GError *error, @@ -217,7 +219,7 @@ create_prompt (pinentry_t pe, int confirm) static int gnome3_cmd_handler (pinentry_t pe) { - struct _gnome3_run state; + struct pe_gnome3_run_s state; state.main_loop = g_main_loop_new (NULL, FALSE); if (!state.main_loop) @@ -239,19 +241,22 @@ gnome3_cmd_handler (pinentry_t pe) return -1; } if (pe->pin) - gcr_prompt_password_async (state.prompt, NULL, _gcr_prompt_password_done, + gcr_prompt_password_async (state.prompt, NULL, pe_gcr_prompt_password_done, &state); else - gcr_prompt_confirm_async (state.prompt, NULL, _gcr_prompt_confirm_done, + gcr_prompt_confirm_async (state.prompt, NULL, pe_gcr_prompt_confirm_done, &state); if (pe->timeout) - state.timeout_id = g_timeout_add_seconds (pe->timeout, _gcr_timeout_done, &state); + state.timeout_id = g_timeout_add_seconds (pe->timeout, + pe_gcr_timeout_done, &state); g_main_loop_run (state.main_loop); /* clean up state: */ if (state.timeout_id && !state.timed_out) - g_source_destroy (g_main_context_find_source_by_id (NULL, state.timeout_id)); + g_source_destroy + (g_main_context_find_source_by_id (NULL, state.timeout_id)); + g_clear_object (&state.prompt); g_main_loop_unref (state.main_loop); return state.ret; @@ -259,9 +264,10 @@ gnome3_cmd_handler (pinentry_t pe) static void -_gcr_prompt_password_done (GObject *source_object, GAsyncResult *res, gpointer user_data) +pe_gcr_prompt_password_done (GObject *source_object, + GAsyncResult *res, gpointer user_data) { - struct _gnome3_run *state = (struct _gnome3_run *) user_data; + struct pe_gnome3_run_s *state = user_data; GcrPrompt *prompt = GCR_PROMPT (source_object); if (state && prompt && state->prompt == prompt) @@ -316,10 +322,10 @@ _gcr_prompt_password_done (GObject *source_object, GAsyncResult *res, gpointer u } static void -_gcr_prompt_confirm_done (GObject *source_object, GAsyncResult *res, - gpointer user_data) +pe_gcr_prompt_confirm_done (GObject *source_object, GAsyncResult *res, + gpointer user_data) { - struct _gnome3_run *state = (struct _gnome3_run *) user_data; + struct pe_gnome3_run_s *state = user_data; GcrPrompt *prompt = GCR_PROMPT (source_object); if (state && prompt && state->prompt == prompt) @@ -369,9 +375,9 @@ _gcr_prompt_confirm_done (GObject *source_object, GAsyncResult *res, } static gboolean -_gcr_timeout_done (gpointer user_data) +pe_gcr_timeout_done (gpointer user_data) { - struct _gnome3_run *state = (struct _gnome3_run *) user_data; + struct pe_gnome3_run_s *state = user_data; if (!state) return FALSE; commit f7b99ff5f7f78db45350308bf409ea4a9e94f161 Author: Daniel Kahn Gillmor Date: Fri Nov 4 18:57:52 2016 -0400 gnome3: Honor timeout. * gnome3/pinentry-gnome3.c (create_prompt): Use timeout to determine how long to wait for Gcr to provide a system prompt before giving up. (_gcr_timeout_done): New. Record that a timeout has elapsed. (gnome3_cmd_handler): Set up a timeout before launching the prompt, and tear it down afterward. (_gcr_prompt_password_done): Report timeout differently from normal cancellation. (_gcr_prompt_confirm_done): Report timeout differently from normal cancellation. -- Without this change, pinentry-gnome3 does not respect the timeout parameter at all, and can hang indefinitely in the event that the system prompter is locked or the user is ignoring the session. Signed-off-by: Daniel Kahn Gillmor diff --git a/gnome3/pinentry-gnome3.c b/gnome3/pinentry-gnome3.c index 85142b9..c8d8fcf 100644 --- a/gnome3/pinentry-gnome3.c +++ b/gnome3/pinentry-gnome3.c @@ -74,6 +74,8 @@ struct _gnome3_run { GcrPrompt *prompt; GMainLoop *main_loop; int ret; + guint timeout_id; + int timed_out; }; static void @@ -82,6 +84,9 @@ _gcr_prompt_password_done (GObject *source_object, GAsyncResult *res, gpointer u static void _gcr_prompt_confirm_done (GObject *source_object, GAsyncResult *res, gpointer user_data); +static gboolean +_gcr_timeout_done (gpointer user_data); + static void _propagate_g_error_to_pinentry (pinentry_t pe, GError *error, gpg_err_code_t code, const char *loc) @@ -105,11 +110,25 @@ create_prompt (pinentry_t pe, int confirm) char window_id[32]; /* Create the prompt. */ - prompt = GCR_PROMPT (gcr_system_prompt_open (-1, NULL, &error)); + prompt = GCR_PROMPT (gcr_system_prompt_open (pe->timeout ? pe->timeout : -1, NULL, &error)); if (! prompt) { - _propagate_g_error_to_pinentry (pe, error, GPG_ERR_CONFIGURATION, - "gcr_system_prompt_open"); + /* this means the timeout elapsed, but no prompt was ever shown. */ + if (error->code == GCR_SYSTEM_PROMPT_IN_PROGRESS) + { + fprintf (stderr, "Timeout: the Gcr system prompter was already in use.\n"); + pe->specific_err_info = strdup ("Timeout: the Gcr system prompter was already in use."); + /* not using GPG_ERR_TIMEOUT here because the user never saw + a prompt: */ + pe->specific_err = gpg_error (GPG_ERR_PIN_ENTRY); + } + else + { + fprintf (stderr, "couldn't create prompt for gnupg passphrase: %s\n", + error->message); + _propagate_g_error_to_pinentry (pe, error, GPG_ERR_CONFIGURATION, + "gcr_system_prompt_open"); + } g_error_free (error); return NULL; } @@ -211,6 +230,8 @@ gnome3_cmd_handler (pinentry_t pe) } state.pinentry = pe; state.ret = 0; + state.timeout_id = 0; + state.timed_out = 0; state.prompt = create_prompt (pe, !!(pe->pin)); if (!state.prompt) { @@ -224,9 +245,13 @@ gnome3_cmd_handler (pinentry_t pe) gcr_prompt_confirm_async (state.prompt, NULL, _gcr_prompt_confirm_done, &state); + if (pe->timeout) + state.timeout_id = g_timeout_add_seconds (pe->timeout, _gcr_timeout_done, &state); g_main_loop_run (state.main_loop); /* clean up state: */ + if (state.timeout_id && !state.timed_out) + g_source_destroy (g_main_context_find_source_by_id (NULL, state.timeout_id)); g_clear_object (&state.prompt); g_main_loop_unref (state.main_loop); return state.ret; @@ -249,7 +274,17 @@ _gcr_prompt_password_done (GObject *source_object, GAsyncResult *res, gpointer u /* "The returned password is valid until the next time a method is called to display another prompt." */ password = gcr_prompt_password_finish (prompt, res, &error); - if (error) + if ((! password && ! error) + || (error && error->code == G_IO_ERROR_CANCELLED)) + { + /* operation was cancelled or timed out. */ + ret = -1; + if (state->timed_out) + state->pinentry->specific_err = gpg_error (GPG_ERR_TIMEOUT); + if (error) + g_error_free (error); + } + else if (error) { _propagate_g_error_to_pinentry (pe, error, GPG_ERR_PIN_ENTRY, @@ -257,8 +292,6 @@ _gcr_prompt_password_done (GObject *source_object, GAsyncResult *res, gpointer u g_error_free (error); ret = -1; } - else if (! password && ! error) /* User cancelled the operation. */ - ret = -1; else { pinentry_setbufferlen (pe, strlen (password) + 1); @@ -301,8 +334,16 @@ _gcr_prompt_confirm_done (GObject *source_object, GAsyncResult *res, reply = gcr_prompt_confirm_finish (prompt, res, &error); if (error) { - _propagate_g_error_to_pinentry (pe, error, GPG_ERR_PIN_ENTRY, - "gcr_system_confirm_finish"); + if (error->code == G_IO_ERROR_CANCELLED) + { + pe->canceled = 1; + if (state->timed_out) + state->pinentry->specific_err = gpg_error (GPG_ERR_TIMEOUT); + } + else + _propagate_g_error_to_pinentry (state->pinentry, error, GPG_ERR_PIN_ENTRY, + "gcr_system_confirm_finish"); + g_error_free (error); ret = 0; } else if (reply == GCR_PROMPT_REPLY_CONTINUE @@ -316,6 +357,8 @@ _gcr_prompt_confirm_done (GObject *source_object, GAsyncResult *res, else /* GCR_PROMPT_REPLY_CANCEL */ { pe->canceled = 1; + if (state->timed_out) + state->pinentry->specific_err = gpg_error (GPG_ERR_TIMEOUT); ret = 0; } state->ret = ret; @@ -325,6 +368,20 @@ _gcr_prompt_confirm_done (GObject *source_object, GAsyncResult *res, g_main_loop_quit (state->main_loop); } +static gboolean +_gcr_timeout_done (gpointer user_data) +{ + struct _gnome3_run *state = (struct _gnome3_run *) user_data; + + if (!state) + return FALSE; + + state->timed_out = 1; + gcr_prompt_close (state->prompt); + + return FALSE; +} + pinentry_cmd_handler_t pinentry_cmd_handler = gnome3_cmd_handler; int commit d0fe54d592a8d2be6fc82b26290a644bb3629214 Author: Daniel Kahn Gillmor Date: Fri Nov 4 18:57:51 2016 -0400 gnome3: Convert password/confirmation to asynchronous model. * gnome3/pinentry-gnome3.c (gnome3_cmd_handler): Convert main part of password or confirmation fetching into asynchronous code by moving completion into... (_gcr_prompt_password_done): ... here and... (_gcr_prompt_confirm_done): ... here. -- The async programming interface to gcr is necessary if we want to be able to enforce a timeout, which will happen in the next patch in this series. Signed-off-by: Daniel Kahn Gillmor Did not apply cleanluy due to me comment reformatting in a former patch. Fixed. -wk diff --git a/gnome3/pinentry-gnome3.c b/gnome3/pinentry-gnome3.c index f24ac4a..85142b9 100644 --- a/gnome3/pinentry-gnome3.c +++ b/gnome3/pinentry-gnome3.c @@ -69,6 +69,19 @@ pinentry_utf8_validate (gchar *text) return result; } +struct _gnome3_run { + pinentry_t pinentry; + GcrPrompt *prompt; + GMainLoop *main_loop; + int ret; +}; + +static void +_gcr_prompt_password_done (GObject *source_object, GAsyncResult *res, gpointer user_data); + +static void +_gcr_prompt_confirm_done (GObject *source_object, GAsyncResult *res, gpointer user_data); + static void _propagate_g_error_to_pinentry (pinentry_t pe, GError *error, gpg_err_code_t code, const char *loc) @@ -185,24 +198,57 @@ create_prompt (pinentry_t pe, int confirm) static int gnome3_cmd_handler (pinentry_t pe) { - GcrPrompt *prompt = NULL; - GError *error = NULL; - int ret = -1; + struct _gnome3_run state; - if (pe->pin) /* Passphrase mode. */ + state.main_loop = g_main_loop_new (NULL, FALSE); + if (!state.main_loop) { - const char *password; + pe->specific_err_info = strdup ("Failed to create GMainLoop"); + pe->specific_err = gpg_error (GPG_ERR_PIN_ENTRY); + pe->specific_err_loc = "g_main_loop_new"; + pe->canceled = 1; + return -1; + } + state.pinentry = pe; + state.ret = 0; + state.prompt = create_prompt (pe, !!(pe->pin)); + if (!state.prompt) + { + pe->canceled = 1; + return -1; + } + if (pe->pin) + gcr_prompt_password_async (state.prompt, NULL, _gcr_prompt_password_done, + &state); + else + gcr_prompt_confirm_async (state.prompt, NULL, _gcr_prompt_confirm_done, + &state); + + g_main_loop_run (state.main_loop); + + /* clean up state: */ + g_clear_object (&state.prompt); + g_main_loop_unref (state.main_loop); + return state.ret; +}; - prompt = create_prompt (pe, 0); - if (! prompt) /* Something went wrong. */ - { - pe->canceled = 1; - return -1; - } + +static void +_gcr_prompt_password_done (GObject *source_object, GAsyncResult *res, gpointer user_data) +{ + struct _gnome3_run *state = (struct _gnome3_run *) user_data; + GcrPrompt *prompt = GCR_PROMPT (source_object); + + if (state && prompt && state->prompt == prompt) + { + const char *password; + GError *error = NULL; + pinentry_t pe = state->pinentry; + int ret = -1; /* "The returned password is valid until the next time a method is called to display another prompt." */ - password = gcr_prompt_password (prompt, NULL, &error); + password = gcr_prompt_password_finish (prompt, res, &error); if (error) { _propagate_g_error_to_pinentry (pe, error, @@ -229,21 +275,30 @@ gnome3_cmd_handler (pinentry_t pe) ret = 1; } + state->ret = ret; } - else /* Message box mode. */ + + if (state) + g_main_loop_quit (state->main_loop); +} + +static void +_gcr_prompt_confirm_done (GObject *source_object, GAsyncResult *res, + gpointer user_data) +{ + struct _gnome3_run *state = (struct _gnome3_run *) user_data; + GcrPrompt *prompt = GCR_PROMPT (source_object); + + if (state && prompt && state->prompt == prompt) { GcrPromptReply reply; - - prompt = create_prompt (pe, 1); - if (! prompt) /* Something went wrong. */ - { - pe->canceled = 1; - return -1; - } + GError *error = NULL; + pinentry_t pe = state->pinentry; + int ret = -1; /* XXX: We don't support a third button! */ - reply = gcr_prompt_confirm_run (prompt, NULL, &error); + reply = gcr_prompt_confirm_finish (prompt, res, &error); if (error) { _propagate_g_error_to_pinentry (pe, error, GPG_ERR_PIN_ENTRY, @@ -263,11 +318,11 @@ gnome3_cmd_handler (pinentry_t pe) pe->canceled = 1; ret = 0; } + state->ret = ret; } - if (prompt) - g_clear_object (&prompt); - return ret; + if (state) + g_main_loop_quit (state->main_loop); } pinentry_cmd_handler_t pinentry_cmd_handler = gnome3_cmd_handler; commit 102832a2c1f3ffa432e2a169791611bb3ca13a04 Author: Daniel Kahn Gillmor Date: Fri Nov 4 18:57:50 2016 -0400 qt: Report timeout. * qt/pinentryconfirm.h (PinentryConfirm): Add _timed_out, timedOut(). * qt/pinentrydialog.h (PinentryDialog): Add _timed_out, timedOut(). * qt/pinentryconfirm.cpp (slotTimeout): Record elapsed timeout. (PinentryConfirm): Initialize _timed_out to false. (timedOut): New. Returns value of _timed_out. * qt/pinentryDialog.cpp (slotTimeout): Record elapsed timeout. (PinentryDialog): Initialize _timed_out to false. (timedOut): New. Returns value of _timed_out. * qt/main.cpp (qt_cmd_handler): Report if canceled due to timeout. Signed-off-by: Daniel Kahn Gillmor diff --git a/qt/main.cpp b/qt/main.cpp index d5da4a8..8284960 100644 --- a/qt/main.cpp +++ b/qt/main.cpp @@ -44,6 +44,7 @@ #include #include +#include #ifdef FALLBACK_CURSES #include @@ -205,6 +206,8 @@ qt_cmd_handler(pinentry_t pe) } bool ret = pinentry.exec(); if (!ret) { + if (pinentry.timedOut()) + pe->specific_err = gpg_error (GPG_ERR_TIMEOUT); return -1; } @@ -270,6 +273,9 @@ qt_cmd_handler(pinentry_t pe) if (rc == QMessageBox::Cancel) { pe->canceled = true; } + if (box.timedOut()) { + pe->specific_err = gpg_error (GPG_ERR_TIMEOUT); + } return rc == QMessageBox::Ok || rc == QMessageBox::Yes ; diff --git a/qt/pinentryconfirm.cpp b/qt/pinentryconfirm.cpp index e81b188..8b59d9d 100644 --- a/qt/pinentryconfirm.cpp +++ b/qt/pinentryconfirm.cpp @@ -24,6 +24,7 @@ PinentryConfirm::PinentryConfirm(Icon icon, int timeout, const QString &title, const QString &desc, StandardButtons buttons, QWidget *parent) : QMessageBox(icon, title, desc, buttons, parent) { + _timed_out = false; if (timeout > 0) { _timer = new QTimer(this); connect(_timer, SIGNAL(timeout()), this, SLOT(slotTimeout())); @@ -36,6 +37,11 @@ PinentryConfirm::PinentryConfirm(Icon icon, int timeout, const QString &title, raiseWindow(this); } +bool PinentryConfirm::timedOut() const +{ + return _timed_out; +} + void PinentryConfirm::showEvent(QShowEvent *event) { QDialog::showEvent(event); @@ -45,6 +51,7 @@ void PinentryConfirm::showEvent(QShowEvent *event) void PinentryConfirm::slotTimeout() { QAbstractButton *b = button(QMessageBox::Cancel); + _timed_out = true; if (b) { b->animateClick(0); diff --git a/qt/pinentryconfirm.h b/qt/pinentryconfirm.h index 23e05dc..21b91c5 100644 --- a/qt/pinentryconfirm.h +++ b/qt/pinentryconfirm.h @@ -29,12 +29,14 @@ public: PinentryConfirm(Icon, int timeout, const QString &title, const QString &desc, StandardButtons buttons, QWidget *parent); + bool timedOut() const; private slots: void slotTimeout(); private: QTimer *_timer; + bool _timed_out; protected: /* reimp */ void showEvent(QShowEvent *event); diff --git a/qt/pinentrydialog.cpp b/qt/pinentrydialog.cpp index f9dd700..92cf19e 100644 --- a/qt/pinentrydialog.cpp +++ b/qt/pinentrydialog.cpp @@ -121,6 +121,7 @@ QPixmap icon(QStyle::StandardPixmap which) void PinEntryDialog::slotTimeout() { + _timed_out = true; reject(); } @@ -137,6 +138,7 @@ PinEntryDialog::PinEntryDialog(QWidget *parent, const char *name, mVisiActionEdit(NULL), mVisiCB(NULL) { + _timed_out = false; setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); if (modal) { @@ -463,6 +465,11 @@ QString PinEntryDialog::repeatedPin() const return QString(); } +bool PinEntryDialog::timedOut() const +{ + return _timed_out; +} + void PinEntryDialog::setRepeatErrorText(const QString &err) { mRepeatError = err; diff --git a/qt/pinentrydialog.h b/qt/pinentrydialog.h index c302f95..905be0f 100644 --- a/qt/pinentrydialog.h +++ b/qt/pinentrydialog.h @@ -82,6 +82,8 @@ public: void setPinentryInfo(pinentry_t); + bool timedOut() const; + protected slots: void updateQuality(const QString &); void slotTimeout(); @@ -105,6 +107,7 @@ private: QPushButton *_cancel; bool _grabbed; bool _have_quality_bar; + bool _timed_out; pinentry_t _pinentry_info; QTimer *_timer; QString mRepeatError, commit 784c4e0a3acace39a4a632bf443c794752297d54 Author: Daniel Kahn Gillmor Date: Fri Nov 4 18:57:49 2016 -0400 curses: Report timeout. * pinentry/pinentry-curses.c (dialog_run): Report if canceled due to timeout. Signed-off-by: Daniel Kahn Gillmor diff --git a/pinentry/pinentry-curses.c b/pinentry/pinentry-curses.c index 9882cbf..a6dbb69 100644 --- a/pinentry/pinentry-curses.c +++ b/pinentry/pinentry-curses.c @@ -941,6 +941,7 @@ dialog_run (pinentry_t pinentry, const char *tty_name, const char *tty_type) if (timed_out && no_input) { done = -2; + pinentry->specific_err = gpg_error (GPG_ERR_TIMEOUT); break; } #endif commit 93b4454f4fe4d97dd89efccd64dbdd02bd002f77 Author: Daniel Kahn Gillmor Date: Fri Nov 4 18:57:48 2016 -0400 gtk2: Report timeout. * gtk+-2/pinentry-gtk-2.c (create_window): Send pointer to pinentry into timeout_cb. (timeout_cb): Report if canceled due to timeout. -- Signed-off-by: Daniel Kahn Gillmor Fixed a shadowed variable in timeout_cb. Signed-off-by: Werner Koch diff --git a/gtk+-2/pinentry-gtk-2.c b/gtk+-2/pinentry-gtk-2.c index cd6270f..9d29d90 100644 --- a/gtk+-2/pinentry-gtk-2.c +++ b/gtk+-2/pinentry-gtk-2.c @@ -38,6 +38,7 @@ #include #include #include +#include #ifdef HAVE_GETOPT_H #include @@ -515,9 +516,13 @@ show_hide_button_toggled (GtkWidget *widget, gpointer data) static gboolean timeout_cb (gpointer data) { - (void)data; + pinentry_t pe = (pinentry_t)data; if (!got_input) - gtk_main_quit (); + { + gtk_main_quit (); + if (pe) + pe->specific_err = gpg_error (GPG_ERR_TIMEOUT); + } /* Don't run again. */ timeout_source = 0; @@ -873,7 +878,7 @@ create_window (pinentry_t ctx) gtk_window_present (GTK_WINDOW (win)); /* Make sure it has the focus. */ if (pinentry->timeout > 0) - timeout_source = g_timeout_add (pinentry->timeout*1000, timeout_cb, NULL); + timeout_source = g_timeout_add (pinentry->timeout*1000, timeout_cb, pinentry); return win; } commit 3be5b4fabaabf86f085b0b5303a1312abb7d0617 Author: Daniel Kahn Gillmor Date: Fri Nov 4 18:57:47 2016 -0400 tty: Report timeout. * tty/pinentry-tty.c (confirm): Report if canceled due to timeout. (password): Report if canceled due to timeout. Signed-off-by: Daniel Kahn Gillmor diff --git a/tty/pinentry-tty.c b/tty/pinentry-tty.c index cef6947..183b7a5 100644 --- a/tty/pinentry-tty.c +++ b/tty/pinentry-tty.c @@ -37,6 +37,7 @@ #include #include #include +#include #include "pinentry.h" #include "memory.h" @@ -283,6 +284,11 @@ confirm (pinentry_t pinentry, FILE *ttyfi, FILE *ttyfo) } } +#ifndef HAVE_DOSISH_SYSTEM + if (timed_out) + pinentry->specific_err = gpg_error (GPG_ERR_TIMEOUT); +#endif + tcsetattr (fileno(ttyfi), TCSANOW, &o_term); return ret; @@ -447,6 +453,11 @@ password (pinentry_t pinentry, FILE *ttyfi, FILE *ttyfo) secmem_free (passphrase); } +#ifndef HAVE_DOSISH_SYSTEM + if (timed_out) + pinentry->specific_err = gpg_error (GPG_ERR_TIMEOUT); +#endif + return done; } commit 19c2110557d0504c1b406bde24e86cb5eb552fc7 Author: Daniel Kahn Gillmor Date: Fri Nov 4 18:57:46 2016 -0400 gnome3: Propagate GError messages to pinentry. * gnome3/pinentry-gnome3.c (_propagate_g_error_to_pinentry): New. Send GError messages back out to pinentry error reporting. (create_prompt): Use _propagate_g_error_to_pinentry on error. (gnome3_cmd_handler): Use _propagate_g_error_to_pinentry on error. -- Signed-off-by: Daniel Kahn Gillmor Modified to take care of malloc failure. Also fixed alignment of some old comments. Signed-off-by: Werner Koch diff --git a/gnome3/pinentry-gnome3.c b/gnome3/pinentry-gnome3.c index 1205300..f24ac4a 100644 --- a/gnome3/pinentry-gnome3.c +++ b/gnome3/pinentry-gnome3.c @@ -69,6 +69,20 @@ pinentry_utf8_validate (gchar *text) return result; } +static void +_propagate_g_error_to_pinentry (pinentry_t pe, GError *error, + gpg_err_code_t code, const char *loc) +{ + size_t infolen = strlen(error->message) + 20; + + pe->specific_err = gpg_error (code); + pe->specific_err_info = malloc (infolen); + if (pe->specific_err_info) + snprintf (pe->specific_err_info, infolen, + "%d: %s", error->code, error->message); + pe->specific_err_loc = loc; +} + static GcrPrompt * create_prompt (pinentry_t pe, int confirm) { @@ -81,11 +95,8 @@ create_prompt (pinentry_t pe, int confirm) prompt = GCR_PROMPT (gcr_system_prompt_open (-1, NULL, &error)); if (! prompt) { - fprintf (stderr, "couldn't create prompt for gnupg passphrase: %s\n", - error->message); - pe->specific_err_loc = "gcr_prompt"; - pe->specific_err_info = strdup (error->message); - pe->specific_err = gpg_error (GPG_ERR_CONFIGURATION); + _propagate_g_error_to_pinentry (pe, error, GPG_ERR_CONFIGURATION, + "gcr_system_prompt_open"); g_error_free (error); return NULL; } @@ -148,7 +159,8 @@ create_prompt (pinentry_t pe, int confirm) /* gcr expects a string; we have a int. see gcr's ui/frob-system-prompt.c for example conversion using %lu */ - snprintf(window_id, sizeof (window_id), "%lu", (long unsigned int)pe->parent_wid); + snprintf (window_id, sizeof (window_id), "%lu", + (long unsigned int)pe->parent_wid); window_id[sizeof (window_id) - 1] = '\0'; gcr_prompt_set_caller_window (prompt, window_id); @@ -177,14 +189,12 @@ gnome3_cmd_handler (pinentry_t pe) GError *error = NULL; int ret = -1; - if (pe->pin) - /* Passphrase mode. */ + if (pe->pin) /* Passphrase mode. */ { const char *password; prompt = create_prompt (pe, 0); - if (! prompt) - /* Something went wrong. */ + if (! prompt) /* Something went wrong. */ { pe->canceled = 1; return -1; @@ -194,14 +204,14 @@ gnome3_cmd_handler (pinentry_t pe) is called to display another prompt." */ password = gcr_prompt_password (prompt, NULL, &error); if (error) - /* Error. */ { - pe->specific_err = gpg_error (GPG_ERR_ASS_GENERAL); + _propagate_g_error_to_pinentry (pe, error, + GPG_ERR_PIN_ENTRY, + "gcr_system_password_finish"); g_error_free (error); ret = -1; } - else if (! password && ! error) - /* User cancelled the operation. */ + else if (! password && ! error) /* User cancelled the operation. */ ret = -1; else { @@ -220,14 +230,12 @@ gnome3_cmd_handler (pinentry_t pe) ret = 1; } } - else - /* Message box mode. */ + else /* Message box mode. */ { GcrPromptReply reply; prompt = create_prompt (pe, 1); - if (! prompt) - /* Something went wrong. */ + if (! prompt) /* Something went wrong. */ { pe->canceled = 1; return -1; @@ -238,17 +246,19 @@ gnome3_cmd_handler (pinentry_t pe) reply = gcr_prompt_confirm_run (prompt, NULL, &error); if (error) { - pe->specific_err = gpg_error (GPG_ERR_ASS_GENERAL); + _propagate_g_error_to_pinentry (pe, error, GPG_ERR_PIN_ENTRY, + "gcr_system_confirm_finish"); ret = 0; } else if (reply == GCR_PROMPT_REPLY_CONTINUE /* XXX: Hack since gcr doesn't yet support one button message boxes treat cancel the same as okay. */ || pe->one_button) - /* Confirmation. */ - ret = 1; - else - /* GCR_PROMPT_REPLY_CANCEL */ + { + /* Confirmation. */ + ret = 1; + } + else /* GCR_PROMPT_REPLY_CANCEL */ { pe->canceled = 1; ret = 0; commit 96e3c5fcf210e971fe1ba66b9127ad51144fcc49 Author: Daniel Kahn Gillmor Date: Fri Nov 4 18:57:45 2016 -0400 gnome3: Set parent window. * gnome3/pinentry-gnome3.c (create_prompt): Tell Gcr about the caller window, if we know it. Signed-off-by: Daniel Kahn Gillmor diff --git a/gnome3/pinentry-gnome3.c b/gnome3/pinentry-gnome3.c index 90ff60f..1205300 100644 --- a/gnome3/pinentry-gnome3.c +++ b/gnome3/pinentry-gnome3.c @@ -75,6 +75,7 @@ create_prompt (pinentry_t pe, int confirm) GcrPrompt *prompt; GError *error = NULL; char *msg; + char window_id[32]; /* Create the prompt. */ prompt = GCR_PROMPT (gcr_system_prompt_open (-1, NULL, &error)); @@ -145,8 +146,11 @@ create_prompt (pinentry_t pe, int confirm) /* XXX: Add support for the third option. */ } - /* XXX: gcr expects a string; we have a int. */ - // gcr_prompt_set_caller_window (prompt, pe->parent_wid); + /* gcr expects a string; we have a int. see gcr's + ui/frob-system-prompt.c for example conversion using %lu */ + snprintf(window_id, sizeof (window_id), "%lu", (long unsigned int)pe->parent_wid); + window_id[sizeof (window_id) - 1] = '\0'; + gcr_prompt_set_caller_window (prompt, window_id); #ifdef HAVE_LIBSECRET if (! confirm && pe->allow_external_password_cache && pe->keyinfo) ----------------------------------------------------------------------- Summary of changes: README | 2 +- autogen.sh | 2 +- build-aux/compile | 2 +- build-aux/config.guess | 2 +- build-aux/config.sub | 2 +- build-aux/depcomp | 2 +- build-aux/gitlog-to-changelog | 2 +- build-aux/mdate-sh | 2 +- build-aux/missing | 10 +- build-aux/texinfo.tex | 14 +-- configure.ac | 10 +- doc/texinfo.tex | 14 +-- emacs/pinentry-emacs.c | 2 +- gnome3/pinentry-gnome3.c | 224 +++++++++++++++++++++++++++++++++--------- gtk+-2/pinentry-gtk-2.c | 13 ++- m4/pkg.m4 | 2 +- pinentry/argparse.c | 8 +- pinentry/argparse.h | 2 +- pinentry/password-cache.c | 2 +- pinentry/password-cache.h | 2 +- pinentry/pinentry-curses.c | 1 + pinentry/pinentry-emacs.c | 2 +- pinentry/pinentry-emacs.h | 2 +- pinentry/pinentry.c | 2 +- pinentry/pinentry.h | 2 +- qt/main.cpp | 6 ++ qt/pinentryconfirm.cpp | 7 ++ qt/pinentryconfirm.h | 2 + qt/pinentrydialog.cpp | 7 ++ qt/pinentrydialog.h | 3 + tty/Makefile.am | 2 +- tty/pinentry-tty.c | 13 ++- 32 files changed, 268 insertions(+), 100 deletions(-) hooks/post-receive -- The standard pinentry collection http://git.gnupg.org From cvs at cvs.gnupg.org Sat Nov 5 21:39:55 2016 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Sat, 05 Nov 2016 21:39:55 +0100 Subject: [git] GPA - branch, master, updated. gpa-0.9.9-8-g059956d Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Assistant". The branch, master has been updated via 059956d3efce81a3bb22967335dadc72c027d883 (commit) from d8fd5f4a75668ce25d42af87959cee4b70d80603 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 059956d3efce81a3bb22967335dadc72c027d883 Author: Werner Koch Date: Sat Nov 5 21:28:59 2016 +0100 Add new tab to the key details with TOFU information. * src/gpa-tofu-list.c: New. * src/gpa-tofu-list.h: New. * src/Makefile.am (gpa_SOURCES): Add new files. * src/gpa.h (ENABLE_TOFU_INFO): Define depending on GPGME version. * src/keymanager.c (key_manager_selection_changed): List with tofu info. * src/convert.c (gpa_expiry_date_string): Factor code out to ... (gpa_date_string): new. * src/gpa-key-details.c: Include gpa-tofu-list.h. (struct _GpaKeyDetails): Add fields tofu_list and tofu_page. (gpa_key_details_finalize): Release tofu objects. (build_tofu_page): New. (ui_mode_changed): Call that. (gpa_key_details_update): Add TOFU notebook page. * src/gpa-key-details.c (details_page_fill_key): Move KeyID after the fingerprint. Signed-off-by: Werner Koch diff --git a/src/Makefile.am b/src/Makefile.am index 6a2ab71..67c8190 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -119,6 +119,7 @@ gpa_SOURCES = \ selectkeydlg.c selectkeydlg.h \ keymanager.c keymanager.h \ gpa-key-details.c gpa-key-details.h \ + gpa-tofu-list.c glag-tofu-list.h \ ownertrustdlg.c ownertrustdlg.h \ keysigndlg.c keysigndlg.h \ keygendlg.c keygendlg.h \ diff --git a/src/convert.c b/src/convert.c index 9a37ffa..280c5b8 100644 --- a/src/convert.c +++ b/src/convert.c @@ -72,32 +72,45 @@ gpa_time_unit_from_string (const char *string) char * -gpa_expiry_date_string (unsigned long expiry_time) +gpa_date_string (unsigned long t) { gchar *result; - GDate expiry_date; + GDate date; - if (sizeof (time_t) <= 4 && expiry_time == (time_t)2145914603) + if (sizeof (time_t) <= 4 && t == (time_t)2145914603) { /* 2145914603 (2037-12-31 23:23:23) is used by GPGME to indicate a time we can't represent. */ result = g_strdup (">= 2038"); } - else if ( expiry_time > 0 ) + else if ( t > 0 ) { - g_date_set_time_t (&expiry_date, (time_t) expiry_time); + g_date_set_time_t (&date, (time_t)t ); result = g_strdup_printf ("%04d-%02d-%02d", - g_date_get_year (&expiry_date), - g_date_get_month (&expiry_date), - g_date_get_day (&expiry_date)); + g_date_get_year (&date), + g_date_get_month (&date), + g_date_get_day (&date)); } else - result = g_strdup (_("never expires")); + result = g_strdup (""); return result; } char * +gpa_expiry_date_string (unsigned long expiry_time) +{ + char *p = gpa_date_string (expiry_time); + if (!*p) + { + g_free (p); + p = g_strdup (_("never expires")); + } + return p; +} + + +char * gpa_creation_date_string (unsigned long creation_time) { gchar *result; diff --git a/src/convert.h b/src/convert.h index da304e0..6373417 100644 --- a/src/convert.h +++ b/src/convert.h @@ -14,7 +14,7 @@ * License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, see . + * along with this program; if not, see . */ #ifndef CONVERT_H @@ -22,6 +22,7 @@ const char *gpa_unit_expiry_time_string (int idx); char gpa_time_unit_from_string (const char *string); +char *gpa_date_string (unsigned long t); char *gpa_expiry_date_string (unsigned long expiry_time); char *gpa_creation_date_string (unsigned long creation_time); const char *gpa_sex_char_to_string (char sex); diff --git a/src/gpa-key-details.c b/src/gpa-key-details.c index abb3b1a..d48e2b0 100644 --- a/src/gpa-key-details.c +++ b/src/gpa-key-details.c @@ -37,6 +37,7 @@ #include "siglist.h" #include "certchain.h" #include "gpasubkeylist.h" +#include "gpa-tofu-list.h" #include "gpa-key-details.h" #include "gtktools.h" @@ -73,10 +74,14 @@ struct _GpaKeyDetails GtkWidget *signatures_uids; GtkWidget *certchain_list; - /* The widgets in the subkeys list. */ + /* The widgets in the subkeys page. */ GtkWidget *subkeys_page; GtkWidget *subkeys_list; + /* The widgets in the TOFU page. */ + GtkWidget *tofu_page; + GtkWidget *tofu_list; + /* The key currently shown or NULL. */ gpgme_key_t current_key; @@ -159,13 +164,13 @@ details_page_fill_key (GpaKeyDetails *kdt, gpgme_key_t key) gtk_label_set_text (GTK_LABEL (kdt->detail_name), text); g_free (text); - text = (gchar*) gpa_gpgme_key_get_short_keyid (key); - gtk_label_set_text (GTK_LABEL (kdt->detail_key_id), text); - text = gpa_gpgme_key_format_fingerprint (key->subkeys->fpr); gtk_label_set_text (GTK_LABEL (kdt->detail_fingerprint), text); g_free (text); + text = (gchar*) gpa_gpgme_key_get_short_keyid (key); + gtk_label_set_text (GTK_LABEL (kdt->detail_key_id), text); + text = gpa_expiry_date_string (key->subkeys->expires); gtk_label_set_text (GTK_LABEL (kdt->detail_expiry), text); g_free (text); @@ -305,10 +310,10 @@ construct_details_page (GpaKeyDetails *kdt) (table, table_row++, "", TRUE); kdt->detail_name = add_details_row (table, table_row++, _("User name:"), TRUE); - kdt->detail_key_id = add_details_row - (table, table_row++, _("Key ID:"), TRUE); kdt->detail_fingerprint = add_details_row (table, table_row++, _("Fingerprint:"), TRUE); + kdt->detail_key_id = add_details_row + (table, table_row++, _("Key ID:"), TRUE); kdt->detail_expiry = add_details_row (table, table_row++, _("Expires at:"), FALSE); kdt->detail_owner_trust = add_details_row @@ -496,6 +501,57 @@ build_subkeys_page (GpaKeyDetails *kdt, gpgme_key_t key) } +/* Create and append new page with TOFU info for KEY. If KEY is NULL + remove an existing TOFU page. */ +static void +build_tofu_page (GpaKeyDetails *kdt, gpgme_key_t key) +{ +#ifdef ENABLE_TOFU_INFO + GtkWidget *vbox; + GtkWidget *scrolled; + GtkWidget *tofulist; + int pnum; + + /* First remove an existing page. */ + if (kdt->tofu_page) + { + pnum = gtk_notebook_page_num (GTK_NOTEBOOK (kdt), kdt->tofu_page); + if (pnum >= 0) + gtk_notebook_remove_page (GTK_NOTEBOOK (kdt), pnum); + kdt->tofu_page = NULL; + if (kdt->tofu_list) + { + g_object_unref (kdt->tofu_list); + kdt->tofu_list = NULL; + } + } + if (!key) + return; + + /* Create a new page. */ + vbox = gtk_vbox_new (FALSE, 5); + gtk_container_set_border_width (GTK_CONTAINER (vbox), 5); + scrolled = gtk_scrolled_window_new (NULL, NULL); + gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled), + GTK_SHADOW_IN); + gtk_box_pack_start (GTK_BOX (vbox), scrolled, TRUE, TRUE, 0); + tofulist = gpa_tofu_list_new (); + gtk_container_add (GTK_CONTAINER (scrolled), tofulist); + gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled), + GTK_POLICY_AUTOMATIC, + GTK_POLICY_AUTOMATIC); + kdt->tofu_list = tofulist; + g_object_ref (kdt->tofu_list); + kdt->tofu_page = vbox; + gtk_notebook_append_page (GTK_NOTEBOOK (kdt), kdt->tofu_page, + gtk_label_new (_("Tofu"))); + + /* Fill this page. */ + gpa_tofu_list_set_key (kdt->tofu_list, key); +#endif /*ENABLE_TOFU_INFO*/ +} + + /* Signal handler for the "changed_ui_mode" signal. */ static void ui_mode_changed (GpaOptions *options, gpointer param) @@ -512,6 +568,7 @@ ui_mode_changed (GpaOptions *options, gpointer param) build_signatures_page (kdt, kdt->current_key); build_subkeys_page (kdt, kdt->current_key); } + build_tofu_page (kdt, kdt->current_key); gtk_notebook_set_show_tabs (GTK_NOTEBOOK (kdt), gtk_notebook_get_n_pages (GTK_NOTEBOOK (kdt)) > 1); gtk_widget_show_all (GTK_WIDGET (kdt)); @@ -583,6 +640,11 @@ gpa_key_details_finalize (GObject *object) g_object_unref (kdt->subkeys_list); kdt->subkeys_list = NULL; } + if (kdt->tofu_list) + { + g_object_unref (kdt->tofu_list); + kdt->tofu_list = NULL; + } parent_class->finalize (object); } @@ -651,6 +713,10 @@ gpa_key_details_update (GtkWidget *keydetails, gpgme_key_t key, int keycount) pnum = 1; else if (widget == kdt->subkeys_page) pnum = 2; +#ifdef ENABLE_TOFU_INFO + else if (widget == kdt->tofu_page) + pnum = 3; +#endif /*ENABLE_TOFU_INFO*/ else pnum = 0; } @@ -686,8 +752,9 @@ gpa_key_details_update (GtkWidget *keydetails, gpgme_key_t key, int keycount) { details_page_fill_num_keys (kdt, keycount); build_signatures_page (kdt, NULL); - build_subkeys_page (kdt, NULL); } + build_tofu_page (kdt, key); + gtk_notebook_set_show_tabs (GTK_NOTEBOOK (kdt), gtk_notebook_get_n_pages (GTK_NOTEBOOK (kdt)) > 1); @@ -698,6 +765,10 @@ gpa_key_details_update (GtkWidget *keydetails, gpgme_key_t key, int keycount) pnum = gtk_notebook_page_num (GTK_NOTEBOOK (kdt), kdt->signatures_page); else if (pnum == 2 && kdt->subkeys_page) pnum = gtk_notebook_page_num (GTK_NOTEBOOK (kdt), kdt->subkeys_page); +#ifdef ENABLE_TOFU_INFO + else if (pnum == 3 && kdt->tofu_page) + pnum = gtk_notebook_page_num (GTK_NOTEBOOK (kdt), kdt->tofu_page); +#endif /*ENABLE_TOFU_INFO*/ else pnum = 0; gtk_notebook_set_current_page (GTK_NOTEBOOK (kdt), pnum); diff --git a/src/gpa-tofu-list.c b/src/gpa-tofu-list.c new file mode 100644 index 0000000..0ac153d --- /dev/null +++ b/src/gpa-tofu-list.c @@ -0,0 +1,266 @@ +/* gpa-tofu-list.c - A list to show TOFU information. + * Copyright (C) 2016 g10 Code GmbH + * + * This file is part of GPA + * + * GPA is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * GPA 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#include + +#include "gpa.h" +#include "convert.h" +#include "gtktools.h" +#include "keytable.h" +#include "gpa-tofu-list.h" + +#ifdef ENABLE_TOFU_INFO + +static gboolean tofu_list_query_tooltip_cb (GtkWidget *wdiget, int x, int y, + gboolean keyboard_mode, + GtkTooltip *tooltip, + gpointer user_data); + + + +typedef enum +{ + TOFU_ADDRESS, + TOFU_VALIDITY, + TOFU_POLICY, + TOFU_COUNT, + TOFU_FIRSTSIGN, + TOFU_LASTSIGN, + TOFU_FIRSTENCR, + TOFU_LASTENCR, + TOFU_N_COLUMNS +} SubkeyListColumn; + + +/* Create a new subkey list. */ +GtkWidget * +gpa_tofu_list_new (void) +{ + GtkListStore *store; + GtkWidget *list; + GtkTreeViewColumn *column; + GtkCellRenderer *renderer; + + /* Init the model */ + store = gtk_list_store_new (TOFU_N_COLUMNS, + G_TYPE_STRING, /* address */ + G_TYPE_STRING, /* validity */ + G_TYPE_STRING, /* policy */ + G_TYPE_STRING, /* count */ + G_TYPE_STRING, /* firstsign */ + G_TYPE_STRING, /* lastsign */ + G_TYPE_STRING, /* firstencr */ + G_TYPE_STRING /* lastencr */ + ); + + /* The view */ + list = gtk_tree_view_new_with_model (GTK_TREE_MODEL (store)); + gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (list), TRUE); + + /* Add the columns */ + renderer = gtk_cell_renderer_text_new (); + column = gtk_tree_view_column_new_with_attributes (NULL, renderer, + "text", TOFU_ADDRESS, + NULL); + gpa_set_column_title (column, _("Address"), + _("The mail address.")); + gtk_tree_view_append_column (GTK_TREE_VIEW (list), column); + + renderer = gtk_cell_renderer_text_new (); + column = gtk_tree_view_column_new_with_attributes (NULL, renderer, + "text", TOFU_VALIDITY, + NULL); + gpa_set_column_title (column, _("Validity"), + _("The TOFU validity of the mail address:\n" + " Minimal = Only little history available\n")); + gtk_tree_view_append_column (GTK_TREE_VIEW (list), column); + + renderer = gtk_cell_renderer_text_new (); + column = gtk_tree_view_column_new_with_attributes (NULL, renderer, + "text", TOFU_POLICY, + NULL); + gpa_set_column_title (column, _("Policy"), + _("The TOFU policy set for this mail address.")); + gtk_tree_view_append_column (GTK_TREE_VIEW (list), column); + + renderer = gtk_cell_renderer_text_new (); + column = gtk_tree_view_column_new_with_attributes (NULL, renderer, + "text", TOFU_COUNT, + NULL); + gpa_set_column_title (column, _("Count"), + _("The number of signatures seen for this address\n" + "and the number of encryption done to this address.") + ); + gtk_tree_view_append_column (GTK_TREE_VIEW (list), column); + + renderer = gtk_cell_renderer_text_new (); + column = gtk_tree_view_column_new_with_attributes (NULL, renderer, + "text", TOFU_FIRSTSIGN, + NULL); + gpa_set_column_title (column, _("First Sig"), + _("The date the first signature was verified.")); + gtk_tree_view_append_column (GTK_TREE_VIEW (list), column); + + renderer = gtk_cell_renderer_text_new (); + column = gtk_tree_view_column_new_with_attributes (NULL, renderer, + "text", TOFU_LASTSIGN, + NULL); + gpa_set_column_title (column, _("Last Sig"), + _("The most recent date a signature was verified.")); + gtk_tree_view_append_column (GTK_TREE_VIEW (list), column); + + renderer = gtk_cell_renderer_text_new (); + column = gtk_tree_view_column_new_with_attributes (NULL, renderer, + "text", TOFU_FIRSTENCR, + NULL); + gpa_set_column_title (column, _("First Enc"), + _("The date the first encrypted mail was sent.")); + gtk_tree_view_append_column (GTK_TREE_VIEW (list), column); + + renderer = gtk_cell_renderer_text_new (); + column = gtk_tree_view_column_new_with_attributes (NULL, renderer, + "text", TOFU_LASTENCR, + NULL); + gpa_set_column_title (column, _("Last Enc"), + _("The most recent date an encrypted mail was sent.")); + gtk_tree_view_append_column (GTK_TREE_VIEW (list), column); + + g_object_set (list, "has-tooltip", TRUE, NULL); + g_signal_connect (list, "query-tooltip", + G_CALLBACK (tofu_list_query_tooltip_cb), list); + + return list; +} + + +static const gchar * +tofu_validity_str (gpgme_tofu_info_t tofu) +{ + switch (tofu->validity) + { + case 0: return _("Conflict"); + case 1: return _("Unknown"); + case 2: return _("Minimal"); + case 3: return _("Basic"); + case 4: return _("Full"); + default: return "?"; + } +} + + +static const gchar * +tofu_policy_str (gpgme_tofu_info_t tofu) +{ + switch (tofu->policy) + { + case GPGME_TOFU_POLICY_NONE: return _("None"); + case GPGME_TOFU_POLICY_AUTO: return _("Auto"); + case GPGME_TOFU_POLICY_GOOD: return _("Good"); + case GPGME_TOFU_POLICY_UNKNOWN: return _("Unknown"); + case GPGME_TOFU_POLICY_BAD: return _("Bad"); + case GPGME_TOFU_POLICY_ASK: return _("Ask"); + } + return "?"; +} + + +/* Set the key whose subkeys should be displayed. */ +void +gpa_tofu_list_set_key (GtkWidget *list, gpgme_key_t key) +{ + GtkListStore *store = GTK_LIST_STORE (gtk_tree_view_get_model + (GTK_TREE_VIEW (list))); + GtkTreeIter iter; + gpgme_user_id_t uid; + gpgme_tofu_info_t tofu; + char *countstr, *firstsign, *lastsign, *firstencr, *lastencr; + + /* Empty the list */ + gtk_list_store_clear (store); + + if (!key || !key->uids) + return; + + for (uid = key->uids; uid; uid = uid->next) + { + if (!uid->address || !uid->tofu) + continue; /* No address or tofu info. */ + tofu = uid->tofu; + + /* Note that we do not need to filter ADDRESS like we do with + * user ids because GPGME checked that it is a valid mail + * address. */ + countstr = g_strdup_printf ("%hu/%hu", tofu->signcount, tofu->encrcount); + firstsign = gpa_date_string (tofu->signfirst); + lastsign = gpa_date_string (tofu->signlast); + firstencr = gpa_date_string (tofu->encrfirst); + lastencr = gpa_date_string (tofu->encrlast); + + gtk_list_store_append (store, &iter); + gtk_list_store_set + (store, &iter, + TOFU_ADDRESS, uid->address, + TOFU_VALIDITY, tofu_validity_str (tofu), + TOFU_POLICY, tofu_policy_str (tofu), + TOFU_COUNT, countstr, + TOFU_FIRSTSIGN,firstsign, + TOFU_LASTSIGN, lastsign, + TOFU_FIRSTENCR,firstencr, + TOFU_LASTENCR, lastencr, + -1); + + g_free (countstr); + g_free (firstsign); + g_free (lastsign); + g_free (firstencr); + g_free (lastencr); + } + +} + + +/* Tooltip display callback. */ +static gboolean +tofu_list_query_tooltip_cb (GtkWidget *widget, int x, int y, + gboolean keyboard_tip, + GtkTooltip *tooltip, gpointer user_data) +{ + GtkTreeView *tv = GTK_TREE_VIEW (widget); + GtkTreeViewColumn *column; + char *text; + + (void)user_data; + + if (!gtk_tree_view_get_tooltip_context (tv, &x, &y, keyboard_tip, + NULL, NULL, NULL)) + return FALSE; /* Not at a row - do not show a tooltip. */ + if (!gtk_tree_view_get_path_at_pos (tv, x, y, NULL, &column, NULL, NULL)) + return FALSE; + + widget = gtk_tree_view_column_get_widget (column); + text = widget? gtk_widget_get_tooltip_text (widget) : NULL; + if (!text) + return FALSE; /* No tooltip desired. */ + + gtk_tooltip_set_text (tooltip, text); + g_free (text); + + return TRUE; /* Show tooltip. */ +} +#endif /*ENABLE_TOFU_INFO*/ diff --git a/src/gpa-tofu-list.h b/src/gpa-tofu-list.h new file mode 100644 index 0000000..f568eb7 --- /dev/null +++ b/src/gpa-tofu-list.h @@ -0,0 +1,31 @@ +/* gpa-tofu-list.h - A list to show TOFU information + * Copyright (C) 2016 g10 Code GmbH + * + * This file is part of GPA + * + * GPA is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * GPA 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#ifndef GPA_TOFU_LIST_H +#define GPA_TOFU_LIST_H + +#include + +/* Create a new TOFU list. */ +GtkWidget * gpa_tofu_list_new (void); + +/* Set the key for which TOFU information shall be shown. */ +void gpa_tofu_list_set_key (GtkWidget *list, gpgme_key_t key); + +#endif /* GPA_TOFU_LIST_H */ diff --git a/src/gpa.h b/src/gpa.h index deebed1..57bddb8 100644 --- a/src/gpa.h +++ b/src/gpa.h @@ -46,6 +46,10 @@ #include "options.h" /* ditto */ +#if GPGME_VERSION_NUMBER >= 0x010700 +# define ENABLE_TOFU_INFO 1 +#endif + /* Global constants. */ #define GPA_MAX_UID_WIDTH 50 /* # of chars after wich a user id is truncated in dialog boxes. */ diff --git a/src/gpafileencryptop.c b/src/gpafileencryptop.c index 4e22446..a76c4e0 100644 --- a/src/gpafileencryptop.c +++ b/src/gpafileencryptop.c @@ -581,6 +581,7 @@ expired_key (gpgme_key_t key, GtkWidget *parent) gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0); gtk_box_pack_start_defaults (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox); + /* Fixme: We leak the date string. */ message = g_strdup_printf (_("The following key expired on %s:"), gpa_expiry_date_string (key->subkeys->expires)); diff --git a/src/keymanager.c b/src/keymanager.c index 2cef4ab..d90fcc7 100644 --- a/src/keymanager.c +++ b/src/keymanager.c @@ -723,6 +723,9 @@ key_manager_selection_changed (GtkTreeSelection *treeselection, is okay. */ gpgme_set_keylist_mode (self->ctx->ctx, (old_mode +#ifdef GPGME_KEYLIST_MODE_WITH_TOFU + | GPGME_KEYLIST_MODE_WITH_TOFU +#endif | GPGME_KEYLIST_MODE_SIGS | GPGME_KEYLIST_MODE_VALIDATE)); gpgme_set_protocol (self->ctx->ctx, key->protocol); ----------------------------------------------------------------------- Summary of changes: src/Makefile.am | 1 + src/convert.c | 31 ++-- src/convert.h | 3 +- src/gpa-key-details.c | 85 +++++++++- src/gpa-tofu-list.c | 266 +++++++++++++++++++++++++++++++ src/{ownertrustdlg.h => gpa-tofu-list.h} | 23 +-- src/gpa.h | 4 + src/gpafileencryptop.c | 1 + src/keymanager.c | 3 + 9 files changed, 389 insertions(+), 28 deletions(-) create mode 100644 src/gpa-tofu-list.c copy src/{ownertrustdlg.h => gpa-tofu-list.h} (52%) hooks/post-receive -- The GNU Privacy Assistant http://git.gnupg.org From cvs at cvs.gnupg.org Sat Nov 5 21:56:14 2016 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Sat, 05 Nov 2016 21:56:14 +0100 Subject: [git] GPA - branch, master, updated. gpa-0.9.9-9-gc669156 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Assistant". The branch, master has been updated via c669156837d41cb0c051007dd863888bc13ef97f (commit) from 059956d3efce81a3bb22967335dadc72c027d883 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit c669156837d41cb0c051007dd863888bc13ef97f Author: Werner Koch Date: Sat Nov 5 21:53:45 2016 +0100 Fix make distcheck broken by last commit. -- diff --git a/src/Makefile.am b/src/Makefile.am index 67c8190..4957b66 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -119,7 +119,7 @@ gpa_SOURCES = \ selectkeydlg.c selectkeydlg.h \ keymanager.c keymanager.h \ gpa-key-details.c gpa-key-details.h \ - gpa-tofu-list.c glag-tofu-list.h \ + gpa-tofu-list.c gpa-tofu-list.h \ ownertrustdlg.c ownertrustdlg.h \ keysigndlg.c keysigndlg.h \ keygendlg.c keygendlg.h \ ----------------------------------------------------------------------- Summary of changes: src/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- The GNU Privacy Assistant http://git.gnupg.org From cvs at cvs.gnupg.org Sat Nov 5 22:25:50 2016 From: cvs at cvs.gnupg.org (by Daniel Kahn Gillmor) Date: Sat, 05 Nov 2016 22:25:50 +0100 Subject: [git] Pinentry - branch, master, updated. pinentry-0.9.7-48-g2e17565 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The standard pinentry collection". The branch, master has been updated via 2e17565fd9cb94afe840050780d28db75e5c4053 (commit) from b945576fe906ffcd5bcc50b4322ef2f34d8fb89f (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 2e17565fd9cb94afe840050780d28db75e5c4053 Author: Daniel Kahn Gillmor Date: Thu Nov 3 12:31:40 2016 -0400 gnome3: Test if Gcr System Prompter is available at startup. * gnome3/pinentry-gnome3.c (gcr_system_prompt_available): New. Tests whether it is possible to create a GcrSystemPrompt. (main): Use gcr_system_prompt_available() to decide whether to fall back to curses or not. -- Debian-bug-id: 842015 Signed-off-by: Daniel Kahn Gillmor diff --git a/gnome3/pinentry-gnome3.c b/gnome3/pinentry-gnome3.c index afa95b7..ba6ab46 100644 --- a/gnome3/pinentry-gnome3.c +++ b/gnome3/pinentry-gnome3.c @@ -390,6 +390,41 @@ pe_gcr_timeout_done (gpointer user_data) pinentry_cmd_handler_t pinentry_cmd_handler = gnome3_cmd_handler; + +/* Test whether we can create a system prompt or not. This briefly + * does create a system prompt, which blocks other tools from making + * the same request concurrently, so we just create it to test if it is + * available, and quickly close it. */ +static int +pe_gcr_system_prompt_available (void) +{ + GcrSystemPrompt *prompt; + GError *error = NULL; + int ret = 0; + + prompt = GCR_SYSTEM_PROMPT (gcr_system_prompt_open (0, NULL, &error)); + if (prompt) + { + ret = 1; + if (!gcr_system_prompt_close (prompt, NULL, &error)) + fprintf (stderr, "failed to close test Gcr System Prompt (%d): %s\n", + error ? error->code : -1, + error ? error->message : ""); + g_clear_object (&prompt); + } + else if (error && error->code == GCR_SYSTEM_PROMPT_IN_PROGRESS) + { + /* This one particular failure is OK; we're clearly capable of + * making a system prompt, even though someone else has the + * system prompter right now: */ + ret = 1; + } + + if (error) + g_error_free (error); + return ret; +} + int main (int argc, char *argv[]) { @@ -402,6 +437,12 @@ main (int argc, char *argv[]) " falling back to curses\n"); pinentry_cmd_handler = curses_cmd_handler; } + else if (!pe_gcr_system_prompt_available ()) + { + fprintf (stderr, "No Gcr System Prompter available," + " falling back to curses\n"); + pinentry_cmd_handler = curses_cmd_handler; + } #endif pinentry_parse_opts (argc, argv); ----------------------------------------------------------------------- Summary of changes: gnome3/pinentry-gnome3.c | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) hooks/post-receive -- The standard pinentry collection http://git.gnupg.org From cvs at cvs.gnupg.org Mon Nov 7 01:06:32 2016 From: cvs at cvs.gnupg.org (by Daniel Kahn Gillmor) Date: Mon, 07 Nov 2016 01:06:32 +0100 Subject: [git] Pinentry - branch, master, updated. pinentry-0.9.7-49-ge353f4d Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The standard pinentry collection". The branch, master has been updated via e353f4d1ac31e58f46eeba29279adf809dfb96a9 (commit) from 2e17565fd9cb94afe840050780d28db75e5c4053 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit e353f4d1ac31e58f46eeba29279adf809dfb96a9 Author: Daniel Kahn Gillmor Date: Sun Nov 6 02:17:04 2016 -0500 gnome3: Fall back to curses if screensaver is locked. * gnome3/pinentry-gnome3.c (pe_gnome_screen_locked): New Function. Returns true only if we can talk to a GNOME screensaver over D-Bus and it assures us that it is locked. (main): If GNOME screensaver is locked, fall back to curses. -- We assume that if pinentry is triggered while the screensaver is locked, then it is likely being done by some sort of remote connection (e.g. ssh), and isn't being done directly from the graphical console. In that case, prompting at the graphical console won't be able to get the attention of the user, so we should fall back to curses if possible. GnuPG-bug-id: 2818 diff --git a/gnome3/pinentry-gnome3.c b/gnome3/pinentry-gnome3.c index ba6ab46..e06885e 100644 --- a/gnome3/pinentry-gnome3.c +++ b/gnome3/pinentry-gnome3.c @@ -390,6 +390,71 @@ pe_gcr_timeout_done (gpointer user_data) pinentry_cmd_handler_t pinentry_cmd_handler = gnome3_cmd_handler; +/* Test whether there is a GNOME screensaver running that happens to + * be locked. Note that if there is no GNOME screensaver running at + * all the answer is still FALSE. */ +static gboolean +pe_gnome_screen_locked (void) +{ + GDBusConnection *dbus; + GError *error = NULL; + GVariant *reply, *reply_bool; + gboolean ret; + + dbus = g_bus_get_sync (G_BUS_TYPE_SESSION, NULL, &error); + + if (!dbus) + { + fprintf (stderr, "failed to connect to user session D-Bus (%d): %s", + error ? error->code : -1, + error ? error->message : ""); + if (error) + g_error_free (error); + return FALSE; + } + + /* this is intended to be the equivalent of: + * dbus-send --print-reply=literal --session \ + * --dest=org.gnome.ScreenSaver \ + * /org/gnome/ScreenSaver \ + * org.gnome.ScreenSaver.GetActive + */ + reply = g_dbus_connection_call_sync (dbus, + "org.gnome.ScreenSaver", + "/org/gnome/ScreenSaver", + "org.gnome.ScreenSaver", + "GetActive", + NULL, + ((const GVariantType *) "(b)"), + G_DBUS_CALL_FLAGS_NO_AUTO_START, + 0, + NULL, + &error); + g_object_unref(dbus); + if (!reply) + { + fprintf (stderr, "failed to get reply (%d): %s", + error ? error->code : -1, + error ? error->message : ""); + if (error) + g_error_free (error); + return FALSE; + } + reply_bool = g_variant_get_child_value (reply, 0); + if (!reply_bool) + { + fprintf (stderr, "failed to get boolean from reply\n"); + ret = FALSE; + } + else + { + ret = g_variant_get_boolean (reply_bool); + g_variant_unref (reply_bool); + } + + g_variant_unref (reply); + return ret; +} /* Test whether we can create a system prompt or not. This briefly * does create a system prompt, which blocks other tools from making @@ -443,6 +508,12 @@ main (int argc, char *argv[]) " falling back to curses\n"); pinentry_cmd_handler = curses_cmd_handler; } + else if (pe_gnome_screen_locked ()) + { + fprintf (stderr, "GNOME screensaver is locked," + " falling back to curses\n"); + pinentry_cmd_handler = curses_cmd_handler; + } #endif pinentry_parse_opts (argc, argv); ----------------------------------------------------------------------- Summary of changes: gnome3/pinentry-gnome3.c | 71 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) hooks/post-receive -- The standard pinentry collection http://git.gnupg.org From cvs at cvs.gnupg.org Mon Nov 7 01:27:17 2016 From: cvs at cvs.gnupg.org (by Daniel Kahn Gillmor) Date: Mon, 07 Nov 2016 01:27:17 +0100 Subject: [git] Pinentry - branch, master, updated. pinentry-0.9.7-51-g15a6fd9 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The standard pinentry collection". The branch, master has been updated via 15a6fd9f1ee0e3bc62daf143546f5186ce947700 (commit) via e4e3a9cc88704dcffac660d0b92fd1ed8abecc11 (commit) from e353f4d1ac31e58f46eeba29279adf809dfb96a9 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 15a6fd9f1ee0e3bc62daf143546f5186ce947700 Author: Daniel Kahn Gillmor Date: Sat Nov 5 17:53:47 2016 -0400 gnome3: Avoid risk of uinitialized memory access. * gnome3/pinentry-gnome3.c (_propagate_g_error_to_pinentry): Ensure that pinentry->specific_err_info is null-terminated. -- It's possible that "%d: %s" ends up producing more than 20 additional characters. A 64-bit signed int at its minimum is "-9223372036854775808", which is 20 characters. On any platform where gint is 128-bit (i don't know whether they exist), it could be significantly more. snprintf doesn't write the final NUL byte if the string exceeds the buffer, so anyone reading specific_err_info as a NUL-terminated string in such a case would go on to read uninitialized memory after the buffer. So we should force there to always be a NUL char after the written buffer. It would be simpler to use asprintf, but i suspect that's not portable enough for use in pinentry. Signed-off-by: Daniel Kahn Gillmor Signed-off-by: Neal H. Walfield diff --git a/gnome3/pinentry-gnome3.c b/gnome3/pinentry-gnome3.c index e06885e..f9c9262 100644 --- a/gnome3/pinentry-gnome3.c +++ b/gnome3/pinentry-gnome3.c @@ -93,13 +93,26 @@ static void _propagate_g_error_to_pinentry (pinentry_t pe, GError *error, gpg_err_code_t code, const char *loc) { - size_t infolen = strlen(error->message) + 20; + char *t; + + /* We can't return the result of g_strdup_printf directly, because + * this needs to be g_free'd, but the users of PE (e.g., + * pinentry_reset in pinentry/pinentry.c) use free. */ + t = g_strdup_printf ("%d: %s", error->code, error->message); + if (t) + { + /* If strdup fails, then PE->SPECIFIC_ERR_INFO will be NULL, + * which is exactly what we want if strdup fails. So, there is + * no need to check for failure. */ + pe->specific_err_info = strdup (t); + g_free (t); + } + else + { + pe->specific_err_info = NULL; + } pe->specific_err = gpg_error (code); - pe->specific_err_info = malloc (infolen); - if (pe->specific_err_info) - snprintf (pe->specific_err_info, infolen, - "%d: %s", error->code, error->message); pe->specific_err_loc = loc; } commit e4e3a9cc88704dcffac660d0b92fd1ed8abecc11 Author: Daniel Kahn Gillmor Date: Sat Nov 5 23:26:35 2016 -0400 tty: Declare dummy curses_cmd_handler. * tty/pinentry-tty.c: Declare a dummy handler for the curses_cmd_handler for fallback. -- This is needed for building pinentry-tty, which links to a copy of the pinentry object which doesn't have curses (it makes no sense to fallback from tty to curses). But the new cmd_info in pinentry/pinentry.c needs some sort of value to test against when reporting the flavor. You can replicate this linker error from git with: ./autogen.sh ./configure --enable-maintainer-mode \ --enable-{fallback-curses,pinentry-tty} \ --disable-{inside-emacs,libsecret} && make Which produces: gcc -g -O2 -Wall -Wcast-align -Wshadow -Wstrict-prototypes -Wformat -Wno-format-y2k -Wformat-security -W -Wno-sign-compare -Wno-missing-field-initializers -Wdeclaration-after-statement -Wno-pointer-sign -Wpointer-arith -o pinentry-tty pinentry-tty.o ../pinentry/libpinentry.a ../secmem/libsecmem.a -lassuan -L/usr/lib/x86_64-linux-gnu -lgpg-error -L/usr/lib/x86_64-linux-gnu -lgpg-error -lcap ../pinentry/libpinentry.a(pinentry.o): In function `cmd_getinfo': ?BUILDDIR?/pinentry/pinentry.c:1457: undefined reference to `curses_cmd_handler' collect2: error: ld returned 1 exit status Makefile:410: recipe for target 'pinentry-tty' failed make[2]: *** [pinentry-tty] Error 1 make[2]: Leaving directory '?BUILDDIR?/tty' One could argue that developers who --enable-tty then must also --disable-fallback-curses, but that would just mean that it's impossible to't build one of the graphical pinentries at the same time (with curses fallback) as you are actually building pinentry-tty. Arguably, though, the ./configure script should figure out the right thing to do in this case and the build each variant sensibly. This patch is a hack to ensure that pinentry-tty continues to link properly even when other pinentries are being built concurrently with a curses fallback. Signed-off-by: Daniel Kahn Gillmor diff --git a/tty/pinentry-tty.c b/tty/pinentry-tty.c index bd82fad..3d6cd5a 100644 --- a/tty/pinentry-tty.c +++ b/tty/pinentry-tty.c @@ -556,6 +556,10 @@ tty_cmd_handler(pinentry_t pinentry) pinentry_cmd_handler_t pinentry_cmd_handler = tty_cmd_handler; +/* needed to link cleanly; should never be used except for comparison + * in pinentry/pinentry.c's cmd_getinfo(): */ +pinentry_cmd_handler_t curses_cmd_handler = NULL; + int main (int argc, char *argv[]) ----------------------------------------------------------------------- Summary of changes: gnome3/pinentry-gnome3.c | 23 ++++++++++++++++++----- tty/pinentry-tty.c | 4 ++++ 2 files changed, 22 insertions(+), 5 deletions(-) hooks/post-receive -- The standard pinentry collection http://git.gnupg.org From cvs at cvs.gnupg.org Mon Nov 7 02:17:24 2016 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Mon, 07 Nov 2016 02:17:24 +0100 Subject: [git] Poldi - branch, master, updated. release-0.4.1-37-g201e9a6 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "PAM for the OpenPGP card". The branch, master has been updated via 201e9a653ef887c060d68ed3e868312e47a20817 (commit) from 448ca0ee59007691e223f7054fb6eec2336d41df (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 201e9a653ef887c060d68ed3e868312e47a20817 Author: NIIBE Yutaka Date: Mon Nov 7 10:16:56 2016 +0900 spelling fixes of doc/poldi.texi. -- Signed-off-by: NIIBE Yutaka diff --git a/doc/poldi.texi b/doc/poldi.texi index 191a44a..17fe3b9 100644 --- a/doc/poldi.texi +++ b/doc/poldi.texi @@ -15,7 +15,7 @@ @dircategory GNU Utilities @direntry -* poldi: (poldi) PAM authenciation via OpenPGP smartcards. +* poldi: (poldi) PAM authentication via OpenPGP smartcards. @end direntry @include version.texi @@ -104,7 +104,7 @@ and currently supports two authentication methods: @table @asis @item ``local-database'' authentication method -This method establishs the mapping between user accounts and +This method establishes the mapping between user accounts and smartcards through a locally administered database. @item ``X509'' authentication @@ -158,10 +158,10 @@ Such an entry is of the following form: @section X509 authentication With X509 authentication smartcards need to be associated with X509 -certicates. This mapping is to be established through the ``url'' +certificates. This mapping is to be established through the ``url'' field on the OpenPGP smartcard. The url field is expected to hold either a valid LDAP url (``ldap://...'') or a file url -(``file:///...''). After a certificate has been successfuly looked +(``file:///...''). After a certificate has been successfully looked up, it is validated through Dirmngr and a challenge-response authentication is triggered against the smartcard. The mapping between smartcards and local accounts is established through the list @@ -172,12 +172,12 @@ addresses for the local username on the system. Note: semantics might change. To illustrate this with an example: lets assume a user is trying to -authenticate himself trough Poldi's X509 method. Poldi looks up the +authenticate himself through Poldi's X509 method. Poldi looks up the url field of the user's smartcard and retrieves his X509 certificate. The certificate contains two e-mail addresses: ``'' and ``''. Since the administrator set the ``X509 domain'' to ``gnupg.org'' in Poldi's configuration file, Poldi will -pick out the address ``fry@@gnupg.org'' and (after succesful +pick out the address ``fry@@gnupg.org'' and (after successful challenge-response authentication) will let the user login as ``fry''. @node Installation from Source @@ -190,7 +190,7 @@ dependencies may vary with the enabled authentication methods. Independent from enabled authentication methods, Poldi depends on Libgpg-error, Libgcrypt, Libassuan, Scdaemon and of course Libpam. -The ``X509'' authentication method additionaly has a build-time +The ``X509'' authentication method additionally has a build-time dependency on libksba and requires Dirmngr to be properly setup at runtime. The ``local database'' authentication method has no additional requirements. @@ -224,7 +224,7 @@ Poldi's main configuration file is ``@code{sysconfdir}/poldi/poldi.conf''. The syntax of Poldi's configuration file is identical to the one used by several other GnuPG components; options and their values are written next to each other, -seperated by a whitespace - one such configuration item per line. +separated by a white space - one such configuration item per line. Poldi supports the following authentication method independent options, which can be specified in the main configuration file and in @@ -405,7 +405,7 @@ settings: @item Organizational Unit: Testing @end table -The other options required are rather self-explanitory. After CA +The other options required are rather self-explanatory. After CA creation, we need to generate a signing request. For this, gpgsm --gen-key can be used (after inserting the users smartcard). Here is an example session (* at the beginning means user's input): @@ -540,7 +540,7 @@ Again, it's a very good idea to also add: @example debug -log-file /some/where/poldi.og +log-file /some/where/poldi.log @end example Add the following to ``poldi-x509.conf'': ----------------------------------------------------------------------- Summary of changes: doc/poldi.texi | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) hooks/post-receive -- PAM for the OpenPGP card http://git.gnupg.org From cvs at cvs.gnupg.org Mon Nov 7 04:51:44 2016 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Mon, 07 Nov 2016 04:51:44 +0100 Subject: [git] Poldi - branch, master, updated. release-0.4.1-39-g67d9216 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "PAM for the OpenPGP card". The branch, master has been updated via 67d92164f5512d4b0ba5d7461085b7941d091bf8 (commit) via 9604dba2dadb77fe4dce2c536c44ceba56c3a05c (commit) from 201e9a653ef887c060d68ed3e868312e47a20817 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 67d92164f5512d4b0ba5d7461085b7941d091bf8 Author: NIIBE Yutaka Date: Mon Nov 7 12:51:16 2016 +0900 Add NEWS entries. -- Signed-off-by: NIIBE Yutaka diff --git a/NEWS b/NEWS index decdc2d..a52f269 100644 --- a/NEWS +++ b/NEWS @@ -2,6 +2,19 @@ Changes since version 0.4.1: +* poldi-ctrl is removed + Please use gpg-connect-agent instead. + +* Poldi always invokes scdaemon to connect it through pipe + Older Poldi has a feature of connecting to scdaemon with help of + gpg-agent using the GPG_AGENT_INFO enviornment variable. In GnuPG + 2.1, the GPG_AGENT_INFO is gone and scdaemon no longer keeps locking + the reader after card removal, it is good to always invoke scdaemon + for the authentication. If there is an existing scdaemon with card + inserted, a failure is expected and this is safer fallback. That's + because Poldi should not connect to a smartcard which is in use for + other purpose and possibly already authenticated. + * New option "scdaemon-options" Added a new option "scdaemon-options", which can be used to specify the scdaemon configuration file to use for newly spawned scdaemon commit 9604dba2dadb77fe4dce2c536c44ceba56c3a05c Author: NIIBE Yutaka Date: Mon Nov 7 11:49:08 2016 +0900 Fix path of scdaemon. * am/cmacros.am (AM_CPPFLAGS): Add GNUPG_LIBEXECDIR. * configure.ac (GNUPG_DEFAULT_SCD): Use GNUPG_LIBEXECDIR. -- Signed-off-by: NIIBE Yutaka diff --git a/am/cmacros.am b/am/cmacros.am index ca24616..7cfab3f 100644 --- a/am/cmacros.am +++ b/am/cmacros.am @@ -1,4 +1,5 @@ -AM_CPPFLAGS += -DGNUPG_BINDIR="\"$(bindir)\"" +AM_CPPFLAGS += -DGNUPG_BINDIR="\"$(bindir)\"" \ + -DGNUPG_LIBEXECDIR="\"$(libexecdir)\"" datadir = @datadir@ localedir = $(datadir)/locale DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@ diff --git a/configure.ac b/configure.ac index 5e87907..1886e2c 100644 --- a/configure.ac +++ b/configure.ac @@ -69,7 +69,7 @@ AC_DEFINE_UNQUOTED(NEED_KSBA_VERSION, "$NEED_KSBA_VERSION", AH_BOTTOM([ /* Setup the hardwired names of modules. */ #ifndef GNUPG_DEFAULT_SCD -#define GNUPG_DEFAULT_SCD ( GNUPG_BINDIR "/scdaemon" ) +#define GNUPG_DEFAULT_SCD ( GNUPG_LIBEXECDIR "/scdaemon" ) #endif #ifndef GNUPG_DEFAULT_DIRMNGR #define GNUPG_DEFAULT_DIRMNGR ( GNUPG_BINDIR "/dirmngr" ) diff --git a/src/scd/scd.c b/src/scd/scd.c index 9f60026..abd63f9 100644 --- a/src/scd/scd.c +++ b/src/scd/scd.c @@ -180,8 +180,7 @@ scd_connect (scd_context_t *scd_ctx, const char *scd_path, no_close_list[i] = -1; /* connect to the scdaemon and perform initial handshaking */ - rc = assuan_pipe_connect (&assuan_ctx, scd_path, argv, - no_close_list); + rc = assuan_pipe_connect (&assuan_ctx, scd_path, argv, no_close_list); if (!rc) { log_msg_debug (loghandle, ----------------------------------------------------------------------- Summary of changes: NEWS | 13 +++++++++++++ am/cmacros.am | 3 ++- configure.ac | 2 +- src/scd/scd.c | 3 +-- 4 files changed, 17 insertions(+), 4 deletions(-) hooks/post-receive -- PAM for the OpenPGP card http://git.gnupg.org From cvs at cvs.gnupg.org Mon Nov 7 06:02:43 2016 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Mon, 07 Nov 2016 06:02:43 +0100 Subject: [git] Poldi - branch, master, updated. release-0.4.1-40-g16912be Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "PAM for the OpenPGP card". The branch, master has been updated via 16912be8d2685e82a3fe40e94912e90cbb73e47b (commit) from 67d92164f5512d4b0ba5d7461085b7941d091bf8 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 16912be8d2685e82a3fe40e94912e90cbb73e47b Author: NIIBE Yutaka Date: Mon Nov 7 13:56:16 2016 +0900 Fix SERIALNO command. * src/scd/scd.c (scd_serialno_internal): No agent any more. -- Signed-off-by: NIIBE Yutaka diff --git a/src/scd/scd.c b/src/scd/scd.c index abd63f9..a565f78 100644 --- a/src/scd/scd.c +++ b/src/scd/scd.c @@ -452,8 +452,7 @@ scd_serialno_internal (assuan_context_t ctx, char **r_serialno) serialno = NULL; - rc = assuan_transact (ctx, agent ? "SCD SERIALNO" : "SERIALNO", - NULL, NULL, NULL, NULL, + rc = assuan_transact (ctx, "SERIALNO", NULL, NULL, NULL, NULL, get_serialno_cb, &serialno); if (rc) goto out; ----------------------------------------------------------------------- Summary of changes: src/scd/scd.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) hooks/post-receive -- PAM for the OpenPGP card http://git.gnupg.org From cvs at cvs.gnupg.org Mon Nov 7 10:56:48 2016 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Mon, 07 Nov 2016 10:56:48 +0100 Subject: [git] Pinentry - branch, master, updated. pinentry-0.9.7-52-g8f51108 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The standard pinentry collection". The branch, master has been updated via 8f51108a17d0080c33fae182f1e4b9259f10a9e5 (commit) from 15a6fd9f1ee0e3bc62daf143546f5186ce947700 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 8f51108a17d0080c33fae182f1e4b9259f10a9e5 Author: Werner Koch Date: Mon Nov 7 08:37:11 2016 +0100 Add fail-safe string termination for snprintf. * gtk+-2/pinentry-gtk-2.c (changed_text_handler): Make sure an snprintf buffer is always ternminated. * pinentry/pinentry.c (my_strusage): Ditto. (write_status_error): Ditto. (cmd_getinfo): Ditto. * w32/main.c (w32_strerror): Ditto. -- This is to fix the surprising implementation of snprintf on Windows. Note that we don't need this in GnuPG because there we use our own snprintf. Signed-off-by: Werner Koch diff --git a/gtk+-2/pinentry-gtk-2.c b/gtk+-2/pinentry-gtk-2.c index a7ac91e..6037533 100644 --- a/gtk+-2/pinentry-gtk-2.c +++ b/gtk+-2/pinentry-gtk-2.c @@ -398,12 +398,14 @@ changed_text_handler (GtkWidget *widget) else if (percent < 0) { snprintf (textbuf, sizeof textbuf, "(%d%%)", -percent); + textbuf[sizeof textbuf -1] = 0; color.red = 0xffff; percent = -percent; } else { snprintf (textbuf, sizeof textbuf, "%d%%", percent); + textbuf[sizeof textbuf -1] = 0; color.green = 0xffff; } gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (qualitybar), diff --git a/pinentry/pinentry.c b/pinentry/pinentry.c index 0023ebe..46e6894 100644 --- a/pinentry/pinentry.c +++ b/pinentry/pinentry.c @@ -604,8 +604,11 @@ my_strusage( int level ) size_t n = 50 + strlen (this_pgmname); str = malloc (n); if (str) - snprintf (str, n, "Usage: %s [options] (-h for help)", - this_pgmname); + { + snprintf (str, n, "Usage: %s [options] (-h for help)", + this_pgmname); + str[n-1] = 0; + } } p = str; } @@ -966,6 +969,7 @@ write_status_error (assuan_context_t ctx, pinentry_t pe) pe->specific_err_loc? pe->specific_err_loc : "?", pe->specific_err, pe->specific_err_info? pe->specific_err_info : ""); + buf[sizeof buf -1] = 0; assuan_write_status (ctx, "ERROR", buf); } @@ -1435,6 +1439,7 @@ cmd_getinfo (assuan_context_t ctx, char *line) { snprintf (buffer, sizeof buffer, "%lu", (unsigned long)getpid ()); + buffer[sizeof buffer -1] = 0; rc = assuan_send_data (ctx, buffer, strlen (buffer)); } else if (!strcmp (line, "flavor")) @@ -1460,6 +1465,7 @@ cmd_getinfo (assuan_context_t ctx, char *line) flags = ""; snprintf (buffer, sizeof buffer, "%s%s", s, flags); + buffer[sizeof buffer -1] = 0; rc = assuan_send_data (ctx, buffer, strlen (buffer)); } else diff --git a/w32/main.c b/w32/main.c index 8c19cb2..b35879d 100644 --- a/w32/main.c +++ b/w32/main.c @@ -83,6 +83,7 @@ w32_strerror (int ec) /* There is only a wchar_t FormatMessage. It does not make much sense to play the conversion game; we print only the code. */ snprintf (strerr, sizeof strerr, "ec=%d", ec); + strerr[sizeof strerr -1] = 0; #else FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM, NULL, ec, MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT), ----------------------------------------------------------------------- Summary of changes: gtk+-2/pinentry-gtk-2.c | 2 ++ pinentry/pinentry.c | 10 ++++++++-- w32/main.c | 1 + 3 files changed, 11 insertions(+), 2 deletions(-) hooks/post-receive -- The standard pinentry collection http://git.gnupg.org From cvs at cvs.gnupg.org Mon Nov 7 13:31:59 2016 From: cvs at cvs.gnupg.org (by Justus Winter) Date: Mon, 07 Nov 2016 13:31:59 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.1.15-328-g70215ff Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via 70215ff470c82d144e872057dfa5a478cc9195f2 (commit) via 413cc50345557e0a516f33b98e8aab19bbc8b4fe (commit) via 6e677f9b55fdb610e93134042ee41ee5c641cbdf (commit) via 5840353d8bbcd9e75374f3bdb2547ffa7bbea897 (commit) from 4d7dc432b598d7d28d6caba78a94d12034134b96 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 70215ff470c82d144e872057dfa5a478cc9195f2 Author: Justus Winter Date: Mon Nov 7 12:28:07 2016 +0100 tests,tools: Reimplement 'mk-tdata' in Scheme. * tests/openpgp/defs.scm (tools): Drop 'mk-tdata'. * tests/openpgp/setup.scm (make-test-data): New function. * tests/openpgp/verify.scm: Avoid 'mk-tdata'. * tools/Makefile.am (noinst_PROGRAMS): Drop 'mk-tdata'. * tools/mk-tdata.c: Drop file. Signed-off-by: Justus Winter diff --git a/tests/openpgp/defs.scm b/tests/openpgp/defs.scm index c911ea3..62bd1e2 100644 --- a/tests/openpgp/defs.scm +++ b/tests/openpgp/defs.scm @@ -59,7 +59,6 @@ (gpgconf "GPGCONF" "tools/gpgconf") (gpg-preset-passphrase "GPG_PRESET_PASSPHRASE" "agent/gpg-preset-passphrase") - (mktdata "MKTDATA" "tools/mk-tdata") (gpgtar "GPGTAR" "tools/gpgtar") (gpg-zip "GPGZIP" "tools/gpg-zip") (pinentry "PINENTRY" "tests/openpgp/fake-pinentry"))) diff --git a/tests/openpgp/setup.scm b/tests/openpgp/setup.scm index 99fbdea..d3ce0d6 100755 --- a/tests/openpgp/setup.scm +++ b/tests/openpgp/setup.scm @@ -19,11 +19,17 @@ (load (with-path "defs.scm")) +(define (make-test-data filename size) + (call-with-binary-output-file + filename + (lambda (port) + (display (make-random-string size) port)))) + (define (create-gpghome) (echo "Creating test environment...") - (letfd ((fd (open "random_seed" (logior O_WRONLY O_CREAT O_BINARY) #o600))) - (call-with-fds (list (tool 'mktdata) "600") CLOSED_FD fd STDERR_FILENO)) + (srandom (getpid)) + (make-test-data "random_seed" 600) (for-each-p "Creating configuration files" @@ -44,10 +50,8 @@ (for-each-p "Creating sample data files" (lambda (size) - (letfd ((fd (open (string-append "data-" (number->string size)) - (logior O_WRONLY O_CREAT O_BINARY) #o600))) - (call-with-fds (list (tool 'mktdata) (number->string size)) - CLOSED_FD fd STDERR_FILENO))) + (make-test-data (string-append "data-" (number->string size)) + size)) '(500 9000 32000 80000)) (for-each-p "Unpacking samples" diff --git a/tests/openpgp/verify.scm b/tests/openpgp/verify.scm index e8aa7df..eb984b1 100755 --- a/tests/openpgp/verify.scm +++ b/tests/openpgp/verify.scm @@ -26,12 +26,14 @@ "Checking bogus signature" (lambda (char) (lettmp (x) - (pipe:do - (pipe:spawn `(,(tool 'mktdata) --char ,char "64")) - (pipe:write-to x (logior O_WRONLY O_CREAT O_BINARY) #o600)) + (call-with-binary-output-file + x + (lambda (port) + (display (make-string 64 (integer->char (string->number char))) + port))) (if (= 0 (call `(, at GPG --verify ,x data-500))) (error "no error code from verify")))) - '("0x2d" "0xca")) + '("#x2d" "#xca")) ;; A plain signed message created using ;; echo abc | gpg --homedir . --passphrase-fd 0 -u Alpha -z0 -sa msg diff --git a/tools/Makefile.am b/tools/Makefile.am index c07a8b1..75750f7 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -66,7 +66,7 @@ libexec_PROGRAMS += gpg-check-pattern endif if !HAVE_W32CE_SYSTEM -noinst_PROGRAMS = clean-sat mk-tdata make-dns-cert gpgsplit +noinst_PROGRAMS = clean-sat make-dns-cert gpgsplit endif if !HAVE_W32CE_SYSTEM diff --git a/tools/mk-tdata.c b/tools/mk-tdata.c deleted file mode 100644 index 0aca035..0000000 --- a/tools/mk-tdata.c +++ /dev/null @@ -1,75 +0,0 @@ -/* mk-tdata.c - Create some simple random testdata - * Copyright (C) 1998, 1999, 2000, 2001, 2006 Free Software Foundation, Inc. - * - * This file is free software; as a special exception the author gives - * unlimited permission to copy and/or distribute it, with or without - * modifications, as long as this notice is preserved. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY, to the extent permitted by law; without even the - * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include - - -#ifndef RAND_MAX /* for SunOS */ -#define RAND_MAX 32767 -#endif - -int -main(int argc, char **argv) -{ - int i, c = 0; - int limit =0; - int char_mode = 0; - -#if HAVE_W32_SYSTEM - if (setmode (fileno (stdout), O_BINARY) == -1) - perror ("setmode"); -#endif - - if (argc) - { - argc--; - argv++; - } - - /* Check for option --char N */ - if (argc > 1 && !strcmp (argv[0], "--char")) - { - char_mode = 1; - c = strtol (argv[1], NULL, 0); - argc -= 2; - argv += 2; - } - - limit = argc ? atoi(argv[0]) : 0; - - srand(getpid()); - - for (i=0; !limit || i < limit; i++ ) - { - if (char_mode) - { - putchar (c); - } - else - { -#ifdef HAVE_RAND - c = ((unsigned)(1 + (int) (256.0*rand()/(RAND_MAX+1.0)))-1); -#else - c = ((unsigned)(1 + (int) (256.0*random()/(RAND_MAX+1.0)))-1); -#endif - putchar (c); - } - } - return 0; -} commit 413cc50345557e0a516f33b98e8aab19bbc8b4fe Author: Justus Winter Date: Mon Nov 7 13:12:01 2016 +0100 gpgscm,w32: Provide schemish file handling for binary files. * tests/gpgscm/lib.scm (call-with-binary-input-file): New function. (call-with-binary-output-file): Likewise. Signed-off-by: Justus Winter diff --git a/tests/gpgscm/lib.scm b/tests/gpgscm/lib.scm index 270189d..a8ae2f8 100644 --- a/tests/gpgscm/lib.scm +++ b/tests/gpgscm/lib.scm @@ -187,6 +187,20 @@ (loop acc)))))) ;; +;; Windows support. +;; + +;; Like call-with-input-file but opens the file in 'binary' mode. +(define (call-with-binary-input-file filename proc) + (letfd ((fd (open filename (logior O_RDONLY O_BINARY)))) + (proc (fdopen fd "rb")))) + +;; Like call-with-output-file but opens the file in 'binary' mode. +(define (call-with-binary-output-file filename proc) + (letfd ((fd (open filename (logior O_WRONLY O_CREAT O_BINARY) #o600))) + (proc (fdopen fd "wb")))) + +;; ;; Libc functions. ;; commit 6e677f9b55fdb610e93134042ee41ee5c641cbdf Author: Justus Winter Date: Mon Nov 7 12:21:26 2016 +0100 gpgscm: Add support for pseudo-random numbers. * tests/gpgscm/ffi.c (do_getpid): New function. (do_srandom): Likewise. (random_scaled): Likewise. (do_random): Likewise. (do_make_random_string): Likewise. (ffi_init): Expose the new functions. * tests/gpgscm/lib.scm: Document the new functions. Signed-off-by: Justus Winter diff --git a/tests/gpgscm/ffi.c b/tests/gpgscm/ffi.c index 49aeb97..8bb2652 100644 --- a/tests/gpgscm/ffi.c +++ b/tests/gpgscm/ffi.c @@ -472,6 +472,73 @@ do_get_isotime (scheme *sc, pointer args) FFI_RETURN_STRING (sc, timebuf); } +static pointer +do_getpid (scheme *sc, pointer args) +{ + FFI_PROLOG (); + FFI_ARGS_DONE_OR_RETURN (sc, args); + FFI_RETURN_INT (sc, getpid ()); +} + +static pointer +do_srandom (scheme *sc, pointer args) +{ + FFI_PROLOG (); + int seed; + FFI_ARG_OR_RETURN (sc, int, seed, number, args); + FFI_ARGS_DONE_OR_RETURN (sc, args); + srand (seed); + FFI_RETURN (sc); +} + +static int +random_scaled (int scale) +{ + int v; +#ifdef HAVE_RAND + v = rand (); +#else + v = random (); +#endif + +#ifndef RAND_MAX /* for SunOS */ +#define RAND_MAX 32767 +#endif + + return ((int) (1 + (int) ((float) scale * v / (RAND_MAX + 1.0))) - 1); +} + +static pointer +do_random (scheme *sc, pointer args) +{ + FFI_PROLOG (); + int scale; + FFI_ARG_OR_RETURN (sc, int, scale, number, args); + FFI_ARGS_DONE_OR_RETURN (sc, args); + FFI_RETURN_INT (sc, random_scaled (scale)); +} + +static pointer +do_make_random_string (scheme *sc, pointer args) +{ + FFI_PROLOG (); + int size; + pointer chunk; + char *p; + FFI_ARG_OR_RETURN (sc, int, size, number, args); + FFI_ARGS_DONE_OR_RETURN (sc, args); + if (size < 0) + return ffi_sprintf (sc, "size must be positive"); + + chunk = sc->vptr->mk_counted_string (sc, NULL, size); + if (sc->no_memory) + FFI_RETURN_ERR (sc, ENOMEM); + + for (p = sc->vptr->string_value (chunk); size; p++, size--) + *p = (char) random_scaled (256); + FFI_RETURN_POINTER (sc, chunk); +} + /* estream functions. */ @@ -1233,6 +1300,12 @@ ffi_init (scheme *sc, const char *argv0, const char *scriptname, ffi_define_function (sc, mkdir); ffi_define_function (sc, rmdir); ffi_define_function (sc, get_isotime); + ffi_define_function (sc, getpid); + + /* Random numbers. */ + ffi_define_function (sc, srandom); + ffi_define_function (sc, random); + ffi_define_function (sc, make_random_string); /* Process management. */ ffi_define_function (sc, spawn_process); diff --git a/tests/gpgscm/lib.scm b/tests/gpgscm/lib.scm index 316eacf..270189d 100644 --- a/tests/gpgscm/lib.scm +++ b/tests/gpgscm/lib.scm @@ -185,3 +185,24 @@ (else (write-char (apply read-char p) acc) (loop acc)))))) + +;; +;; Libc functions. +;; + +;; Get our process id. +(ffi-define (getpid)) + +;; +;; Random numbers. +;; + +;; Seed the random number generator. +(ffi-define (srandom seed)) + +;; Get a pseudo-random number between 0 (inclusive) and SCALE +;; (exclusive). +(ffi-define (random scale)) + +;; Create a string of the given SIZE containing pseudo-random data. +(ffi-define (make-random-string size)) commit 5840353d8bbcd9e75374f3bdb2547ffa7bbea897 Author: Justus Winter Date: Mon Nov 7 12:53:17 2016 +0100 g10: Fix crash. * g10/getkey.c (get_best_pubkey_byname): If 'get_pubkey_byname' does not return a getkey context, then it can return at most one key, therefore there is nothing to rank. Also, always initialize '*retctx' to be on the safe side. GnuPG-bug-id: 2828 Fixes: ab89164be02012f1bf159c971853b8610e966301 Signed-off-by: Justus Winter diff --git a/g10/getkey.c b/g10/getkey.c index 648c230..59625e7 100644 --- a/g10/getkey.c +++ b/g10/getkey.c @@ -1577,18 +1577,19 @@ get_best_pubkey_byname (ctrl_t ctrl, GETKEY_CTX *retctx, PKT_public_key *pk, int rc; struct getkey_ctx_s *ctx = NULL; + if (retctx) + *retctx = NULL; + rc = get_pubkey_byname (ctrl, &ctx, pk, name, ret_keyblock, NULL, include_unusable, no_akl); if (rc) { if (ctx) getkey_end (ctx); - if (retctx) - *retctx = NULL; return rc; } - if (is_valid_mailbox (name)) + if (is_valid_mailbox (name) && ctx) { /* Rank results and return only the most relevant key. */ struct pubkey_cmp_cookie best = { 0 }, new; ----------------------------------------------------------------------- Summary of changes: g10/getkey.c | 7 +++-- tests/gpgscm/ffi.c | 73 ++++++++++++++++++++++++++++++++++++++++++++++ tests/gpgscm/lib.scm | 35 ++++++++++++++++++++++ tests/openpgp/defs.scm | 1 - tests/openpgp/setup.scm | 16 +++++++---- tests/openpgp/verify.scm | 10 ++++--- tools/Makefile.am | 2 +- tools/mk-tdata.c | 75 ------------------------------------------------ 8 files changed, 129 insertions(+), 90 deletions(-) delete mode 100644 tools/mk-tdata.c hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Mon Nov 7 14:07:36 2016 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Mon, 07 Nov 2016 14:07:36 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.1.15-329-g56e1864 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via 56e1864aa337f36317534db521fd4434d70e0784 (commit) from 70215ff470c82d144e872057dfa5a478cc9195f2 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 56e1864aa337f36317534db521fd4434d70e0784 Author: Werner Koch Date: Mon Nov 7 14:04:47 2016 +0100 wks: Encrypt all client mails also the target key, * tools/gpg-wks-client.c (encrypt_response): Add arg FINGERPRINT. (send_confirmation_response): Ditto. (process_confirmation_request): Parse out fingerprint and pass send_confirmation_response. -- This is useful for debugging the protocol and to avoid surprises when the sender tries to open a message from the Sent folder. Signed-off-by: Werner Koch diff --git a/tools/gpg-wks-client.c b/tools/gpg-wks-client.c index cc0c0a5..9bf5403 100644 --- a/tools/gpg-wks-client.c +++ b/tools/gpg-wks-client.c @@ -113,7 +113,8 @@ static void wrong_args (const char *text) GPGRT_ATTR_NORETURN; static gpg_error_t command_supported (char *userid); static gpg_error_t command_send (const char *fingerprint, char *userid); static gpg_error_t encrypt_response (estream_t *r_output, estream_t input, - const char *addrspec); + const char *addrspec, + const char *fingerprint); static gpg_error_t read_confirmation_request (estream_t msg); static gpg_error_t command_receive_cb (void *opaque, const char *mediatype, estream_t fp, @@ -604,7 +605,7 @@ command_send (const char *fingerprint, char *userid) /* Encrypt the key part. */ es_rewind (key); - err = encrypt_response (&keyenc, key, submission_to); + err = encrypt_response (&keyenc, key, submission_to, fingerprint); if (err) goto leave; es_fclose (key); @@ -688,14 +689,16 @@ encrypt_response_status_cb (void *opaque, const char *keyword, char *args) /* Encrypt the INPUT stream to a new stream which is stored at success - * at R_OUTPUT. Encryption is done for ADDRSPEC. We currently - * retrieve that key from the WKD, DANE, or from "local". "local" is - * last to prefer the latest key version but use a local copy in case - * we are working offline. It might be useful for the server to send - * the fingerprint of its encryption key - or even the entire key - * back. */ + * at R_OUTPUT. Encryption is done for ADDRSPEC and for FINGERPRINT + * (so that the sent message may later be inspected by the user). We + * currently retrieve that key from the WKD, DANE, or from "local". + * "local" is last to prefer the latest key version but use a local + * copy in case we are working offline. It might be useful for the + * server to send the fingerprint of its encryption key - or even the + * entire key back. */ static gpg_error_t -encrypt_response (estream_t *r_output, estream_t input, const char *addrspec) +encrypt_response (estream_t *r_output, estream_t input, const char *addrspec, + const char *fingerprint) { gpg_error_t err; ccparray_t ccp; @@ -730,6 +733,8 @@ encrypt_response (estream_t *r_output, estream_t input, const char *addrspec) ccparray_put (&ccp, "--auto-key-locate=clear,wkd,dane,local"); ccparray_put (&ccp, "--recipient"); ccparray_put (&ccp, addrspec); + ccparray_put (&ccp, "--recipient"); + ccparray_put (&ccp, fingerprint); ccparray_put (&ccp, "--encrypt"); ccparray_put (&ccp, "--"); @@ -764,7 +769,8 @@ encrypt_response (estream_t *r_output, estream_t input, const char *addrspec) static gpg_error_t send_confirmation_response (const char *sender, const char *address, - const char *nonce, int encrypt) + const char *nonce, int encrypt, + const char *fingerprint) { gpg_error_t err; estream_t body = NULL; @@ -800,7 +806,7 @@ send_confirmation_response (const char *sender, const char *address, es_rewind (body); if (encrypt) { - err = encrypt_response (&bodyenc, body, sender); + err = encrypt_response (&bodyenc, body, sender, fingerprint); if (err) goto leave; es_fclose (body); @@ -876,7 +882,7 @@ process_confirmation_request (estream_t msg) gpg_error_t err; nvc_t nvc; nve_t item; - const char *value, *sender, *address, *nonce; + const char *value, *sender, *address, *fingerprint, *nonce; err = nvc_parse (&nvc, NULL, msg); if (err) @@ -903,6 +909,18 @@ process_confirmation_request (estream_t msg) goto leave; } + /* Get the fingerprint. */ + if (!((item = nvc_lookup (nvc, "fingerprint:")) + && (value = nve_value (item)) + && strlen (value) >= 40)) + { + log_error ("received invalid wks message: %s\n", + "'fingerprint' missing or invalid"); + err = gpg_error (GPG_ERR_INV_DATA); + goto leave; + } + fingerprint = value; + /* FIXME: Check that the fingerprint matches the key used to decrypt the * message. */ @@ -947,11 +965,11 @@ process_confirmation_request (estream_t msg) /* Send the confirmation. If no key was found, try again without * encryption. */ - err = send_confirmation_response (sender, address, nonce, 1); + err = send_confirmation_response (sender, address, nonce, 1, fingerprint); if (gpg_err_code (err) == GPG_ERR_NO_PUBKEY) { log_info ("no encryption key found - sending response in the clear\n"); - err = send_confirmation_response (sender, address, nonce, 0); + err = send_confirmation_response (sender, address, nonce, 0, NULL); } leave: ----------------------------------------------------------------------- Summary of changes: tools/gpg-wks-client.c | 46 ++++++++++++++++++++++++++++++++-------------- 1 file changed, 32 insertions(+), 14 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Mon Nov 7 14:11:23 2016 From: cvs at cvs.gnupg.org (by Justus Winter) Date: Mon, 07 Nov 2016 14:11:23 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.1.15-330-g37751d2 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via 37751d2b194bc33539f5b9ea0e02e9f209d2bcf6 (commit) from 56e1864aa337f36317534db521fd4434d70e0784 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 37751d2b194bc33539f5b9ea0e02e9f209d2bcf6 Author: Justus Winter Date: Mon Nov 7 14:09:07 2016 +0100 tests: Fix build. * tests/openpgp/Makefile.am: Drop dependency on 'mk-tdata'. Fixes: 70215ff470c82d144e872057dfa5a478cc9195f2 Signed-off-by: Justus Winter diff --git a/tests/openpgp/Makefile.am b/tests/openpgp/Makefile.am index 8df968c..acd2329 100644 --- a/tests/openpgp/Makefile.am +++ b/tests/openpgp/Makefile.am @@ -22,7 +22,6 @@ # Programs required before we can run these tests. required_pgms = ../../g10/gpg$(EXEEXT) ../../agent/gpg-agent$(EXEEXT) \ ../../tools/gpg-connect-agent$(EXEEXT) \ - ../../tools/mk-tdata$(EXEEXT) \ ../gpgscm/gpgscm$(EXEEXT) AM_CPPFLAGS = -I$(top_srcdir)/common ----------------------------------------------------------------------- Summary of changes: tests/openpgp/Makefile.am | 1 - 1 file changed, 1 deletion(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Mon Nov 7 15:46:00 2016 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Mon, 07 Nov 2016 15:46:00 +0100 Subject: [git] GpgOL - branch, nomapi, updated. gpgol-1.4.0-144-gb6b1b43 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG extension for MS Outlook". The branch, nomapi has been updated via b6b1b43ca1f29bf3afebd53d8afb0b3d7b3e7f4d (commit) via 2d411103d6ce9ff3b69353a095ac862c15312783 (commit) via 68835bfc6096603361038b985e9a93a9b42eb850 (commit) via 7c002f5b713786022964df6eae09f6dd06ddb0e0 (commit) via c21454e49cff01b0200f02c58812a696f7127050 (commit) via aadd8026eca38983fa14e1045400e8e9c0f50508 (commit) via 765e04b5e0fb6ce3ebcf2374a6e09dc8e3005ca9 (commit) via b41e5bcfaeab4964c0609d755177f31ecb5e458c (commit) via 24e1932dc7c974ce18f8171a9e8c16bdc1a359a5 (commit) from ada53e40e5c3907e8ae9539bd3212b57b48aba43 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit b6b1b43ca1f29bf3afebd53d8afb0b3d7b3e7f4d Author: Andre Heinecke Date: Mon Nov 7 15:28:53 2016 +0100 Remove the need to revert mails * src/application-events.cpp (EVENT_SINK_INVOKE): Remove comment. * src/gpgoladdin.cpp (GpgolAddin::OnDisconnection): Close instead revert. (GpgolAddin::OnStartupComplete): Create Window message hook. * src/mail.cpp (Mail::close_all_mails): New. * src/mail.h: Update accordingly. * src/mailitem-events.cpp (request_close): New. src/mailitem-events.cpp (EVENT_SINK_INVOKE): Update event handling to new logic. See comments. * src/windowmessages.cpp (gpgol_hook): New. (create_message_hook): New. Registers gpgol_hook. src/windowmessages.h: Update accordingly. -- This is basically the yewel of the nomapi branch. Without persistent changes in MAPI we can just close the Mails with discard changes set to true to "revert" our mails. This removes the need for a revert and Outlook won't create new mails containing our reverted mails. There should be no more need for revert at all. It's left in as an additional fallback in case something fails. diff --git a/src/application-events.cpp b/src/application-events.cpp index f70c44a..8f089d4 100644 --- a/src/application-events.cpp +++ b/src/application-events.cpp @@ -97,11 +97,7 @@ EVENT_SINK_INVOKE(ApplicationEvents) case Quit: { log_debug ("%s:%s: Quit event", SRCNAME, __func__); - /* Reverting all mails here can cause outlook to go - into an endless sync state after the next start. - So we can't do it. Needs handling. - Mail::revert_all_mails(); - */ + break; } default: log_oom_extra ("%s:%s: Unhandled Event: %lx \n", diff --git a/src/gpgoladdin.cpp b/src/gpgoladdin.cpp index 7c0c4e9..9e80808 100644 --- a/src/gpgoladdin.cpp +++ b/src/gpgoladdin.cpp @@ -176,7 +176,8 @@ GpgolAddin::GpgolAddin (void) : m_lRef(0), m_addin(nullptr), m_applicationEventSink(nullptr), m_explorersEventSink(nullptr), - m_disabled(false) + m_disabled(false), + m_hook(nullptr) { read_options (); use_mime_ui = opt.mime_ui; @@ -200,6 +201,8 @@ GpgolAddin::~GpgolAddin (void) engine_deinit (); write_options (); + UnhookWindowsHookEx (m_hook); + addin_instance = NULL; log_debug ("%s:%s: Object deleted\n", SRCNAME, __func__); @@ -299,7 +302,7 @@ GpgolAddin::OnDisconnection (ext_DisconnectMode RemoveMode, does not allow us any OOM calls then and only returns "Unexpected error" in that case. Weird. */ - if (Mail::revert_all_mails ()) + if (Mail::close_all_mails ()) { MessageBox (NULL, "Failed to remove plaintext from at least one message.\n\n" @@ -429,6 +432,13 @@ GpgolAddin::OnStartupComplete (SAFEARRAY** custom) SRCNAME, __func__); return E_NOINTERFACE; } + + if (!(m_hook = create_message_hook ())) + { + log_error ("%s:%s: Failed to create messagehook. ", + SRCNAME, __func__); + } + /* Set up categories */ const char *decCategory = _("GpgOL: Encrypted Message"); const char *verifyCategory = _("GpgOL: Verified Sender"); diff --git a/src/gpgoladdin.h b/src/gpgoladdin.h index a871348..316bbaf 100644 --- a/src/gpgoladdin.h +++ b/src/gpgoladdin.h @@ -213,7 +213,7 @@ private: LPDISPATCH m_explorersEventSink; LPDISPATCH m_ribbon_control; bool m_disabled; - + HHOOK m_hook; }; class GpgolAddinFactory: public IClassFactory diff --git a/src/mail.cpp b/src/mail.cpp index cb015fd..4f8fb7b 100644 --- a/src/mail.cpp +++ b/src/mail.cpp @@ -825,6 +825,30 @@ Mail::get_sender () } int +Mail::close_all_mails () +{ + int err = 0; + std::map::iterator it; + TRACEPOINT; + for (it = g_mail_map.begin(); it != g_mail_map.end(); ++it) + { + if (it->second->close ()) + { + log_error ("Failed to close mail: %p ", it->first); + /* Should not happen */ + if (it->second->revert()) + { + err++; + } + } + else + { + delete it->second; + } + } + return err; +} +int Mail::revert_all_mails () { int err = 0; @@ -837,10 +861,11 @@ Mail::revert_all_mails () err++; continue; } + it->second->set_needs_save (true); if (!invoke_oom_method (it->first, "Save", NULL)) { - log_error ("Failed to save reverted mail: %p ", it->first); + log_error ("Failed to save reverted mail: %p ", it->second); err++; continue; } @@ -1029,7 +1054,7 @@ Mail::close () /* Reset the uuid after discarding all changes in the oom so that we can still find ourself. */ - set_uuid (); +// set_uuid (); /* Now that we have closed it with discard changes we no longer need to wipe the mail because the plaintext was diff --git a/src/mail.h b/src/mail.h index cef5819..21ca885 100644 --- a/src/mail.h +++ b/src/mail.h @@ -98,6 +98,21 @@ public: */ static int revert_all_mails (); + /** @brief close all known Mail objects. + * + * Close our mail with discard changes set to true. + * This discards the plaintext / attachments. Afterwards + * it calls save if neccessary to sync back the collected + * property changes. + * + * This is the nicest of our three "Clean plaintext" + * functions. Will fallback to revert if closing fails. + * Closed mails are deleted. + * + * @returns the number of errors that occured. + */ + static int close_all_mails (); + /** @brief Reference to the mailitem. Do not Release! */ LPDISPATCH item () { return m_mailitem; } diff --git a/src/mailitem-events.cpp b/src/mailitem-events.cpp index a3e569c..e1e5881 100644 --- a/src/mailitem-events.cpp +++ b/src/mailitem-events.cpp @@ -74,6 +74,8 @@ private: Mail * m_mail; /* The mail object related to this mailitem */ bool m_send_seen; /* The message is about to be submitted */ bool m_decrypt_after_write; + bool m_ignore_unloads; + bool m_ignore_next_unload; }; MailItemEvents::MailItemEvents() : @@ -83,7 +85,9 @@ MailItemEvents::MailItemEvents() : m_ref(1), m_mail(NULL), m_send_seen (false), - m_decrypt_after_write(false) + m_decrypt_after_write(false), + m_ignore_unloads(false), + m_ignore_next_unload(false) { } @@ -108,6 +112,19 @@ request_decrypt (LPVOID arg) return 0; } +static DWORD WINAPI +request_close (LPVOID arg) +{ + log_debug ("%s:%s: requesting close for: %s", + SRCNAME, __func__, (char*) arg); + if (do_in_ui_thread (REQUEST_CLOSE, arg)) + { + log_debug ("%s:%s: close request failed for: %s", + SRCNAME, __func__, (char*) arg); + } + return 0; +} + /* The main Invoke function. The return value of this function does not appear to have any effect on outlook although I have read in an example somewhere that you @@ -133,6 +150,8 @@ EVENT_SINK_INVOKE(MailItemEvents) { case Open: { + log_oom_extra ("%s:%s: Open : %p", + SRCNAME, __func__, m_mail); LPMESSAGE message; int draft_flags = 0; if (!opt.encrypt_default && !opt.sign_default) @@ -156,9 +175,16 @@ EVENT_SINK_INVOKE(MailItemEvents) } set_gpgol_draft_info_flags (message, draft_flags); gpgol_release (message); + + if (m_mail->is_crypto_mail()) + { + m_ignore_unloads = true; + } } case BeforeRead: { + log_oom_extra ("%s:%s: BeforeRead : %p", + SRCNAME, __func__, m_mail); if (m_mail->pre_process_message ()) { log_error ("%s:%s: Pre process message failed.", @@ -168,6 +194,21 @@ EVENT_SINK_INVOKE(MailItemEvents) } case Read: { + log_oom_extra ("%s:%s: Read : %p", + SRCNAME, __func__, m_mail); + m_object->AddRef(); + if (!m_mail->is_crypto_mail()) + { + /* Not for us. */ + break; + } + if (m_mail->set_uuid ()) + { + log_debug ("%s:%s: Failed to set uuid.", + SRCNAME, __func__); + delete m_mail; /* deletes this, too */ + return S_OK; + } if (m_mail->decrypt_verify ()) { log_error ("%s:%s: Decrypt message failed.", @@ -231,6 +272,8 @@ EVENT_SINK_INVOKE(MailItemEvents) If this encryption is successful and we pass the send as then the encrypted data is sent. */ + log_oom_extra ("%s:%s: Send : %p", + SRCNAME, __func__, m_mail); if (parms->cArgs != 1 || parms->rgvarg[0].vt != (VT_BOOL | VT_BYREF)) { log_debug ("%s:%s: Uncancellable send event.", @@ -257,6 +300,8 @@ EVENT_SINK_INVOKE(MailItemEvents) } case Write: { + log_oom_extra ("%s:%s: Write : %p", + SRCNAME, __func__, m_mail); /* This is a bit strange. We sometimes get multiple write events without a read in between. When we access the message in the second event it fails and if we cancel the event outlook @@ -279,25 +324,19 @@ EVENT_SINK_INVOKE(MailItemEvents) to enable reverting this mails. */ *(parms->rgvarg[0].pboolVal) = VARIANT_TRUE; - log_oom ("%s:%s: Canceling write event.", + log_debug ("%s:%s: Canceling write event.", SRCNAME, __func__); return S_OK; } - - if (m_mail->revert ()) - { - /* An error cleaning the mail should not happen normally. - But just in case there is an error we cancel the - write here. */ - log_debug ("%s:%s: Failed to remove plaintext.", - SRCNAME, __func__); - *(parms->rgvarg[0].pboolVal) = VARIANT_TRUE; - } + log_debug ("%s:%s: Passing write event.", + SRCNAME, __func__); m_mail->set_needs_save (false); break; } case AfterWrite: { + log_oom_extra ("%s:%s: AfterWrite : %p", + SRCNAME, __func__, m_mail); if (m_send_seen) { m_send_seen = false; @@ -310,23 +349,28 @@ EVENT_SINK_INVOKE(MailItemEvents) HANDLE thread = CreateThread (NULL, 0, request_decrypt, (LPVOID) uuid, 0, NULL); CloseHandle (thread); + m_decrypt_after_write = false; } break; } case Close: { + log_oom_extra ("%s:%s: Close : %p", + SRCNAME, __func__, m_mail); if (m_mail->is_crypto_mail ()) { /* Close. This happens when an Opened mail is closed. To prevent the question of wether or not to save the changes (Which would save the decrypted data without an event to - prevent it) we save proactively. This happens by set_needs_save - and calling save. Which will revert a mail because we never want - to save unreverted mails. + prevent it) we cancel the close and then either close it + with discard changes or revert / save it. + This happens with a window message as we can't invoke close from + close. But as a side effect the mail, if opened in the explorer still will - be reverted, too. So shown as empty. This is bad. To prevent that - we request a decrypt in the AfterWrite event. + be reverted, too. So shown as empty. To prevent that + we request a decrypt in the AfterWrite event which checks if the + message is opened in the explorer. If not it destroys the mail. Evil Hack: Outlook sends an Unload event after the message is closed This is not true our Internal Object is kept alive if it is opened @@ -334,26 +378,71 @@ EVENT_SINK_INVOKE(MailItemEvents) the window message handler that checks for decrypt again if the mail is currently open in the active explorer. If not we delete our Mail object so that the message is released. - */ - m_mail->set_needs_save (true); + */ + if (parms->cArgs != 1 || parms->rgvarg[0].vt != (VT_BOOL | VT_BYREF)) + { + /* This happens in the weird case */ + log_debug ("%s:%s: Uncancellable close event.", + SRCNAME, __func__); + break; + } + *(parms->rgvarg[0].pboolVal) = VARIANT_TRUE; + log_oom ("%s:%s: Canceling close event.", + SRCNAME, __func__); m_decrypt_after_write = true; - invoke_oom_method (m_object, "Save", NULL); + m_ignore_unloads = false; + m_ignore_next_unload = true; + + char *uuid = strdup (m_mail->get_uuid ().c_str()); + HANDLE thread = CreateThread (NULL, 0, request_close, + (LPVOID) uuid, 0, NULL); + CloseHandle (thread); } } case Unload: { - if (!m_decrypt_after_write) + log_oom_extra ("%s:%s: Unload : %p", + SRCNAME, __func__, m_mail); + /* Unload. Experiments have shown that this does not + mean a mail is actually unloaded in Outlook. E.g. + If it was open in an inspector and then closed we + see an unload event but the mail is still shown in + the explorer. Fun. On the other hand if a message + was opened and the explorer selection changes + we also get an unload but the mail is still open. + + Really we still get events after the unload and + can make changes to the object. + + In case the mail was opened m_ignore_unloads is set + to true so the mail is not removed when the message + selection changes. As close invokes decrypt_again + the mail object is removed there when the explorer + selection changed. + + In case the mail was closed m_ignore_next_unload + is set so only the Unload thad follows the canceled + close is ignored and not the unload that comes from + our then triggered close (save / discard). + + + This is horribly hackish and feels wrong. But it + works. + */ + if (m_ignore_unloads || m_ignore_next_unload) { - log_debug ("%s:%s: Removing Mail for message: %p.", + if (m_ignore_next_unload) + { + m_ignore_next_unload = false; + } + log_debug ("%s:%s: Ignoring unload for message: %p.", SRCNAME, __func__, m_object); - delete m_mail; } else { - /* See explanation in Close why this is not broken. */ - log_debug ("%s:%s: Ignoring unload for message: %p.", + log_debug ("%s:%s: Removing Mail for message: %p.", SRCNAME, __func__, m_object); - m_decrypt_after_write = false; + delete m_mail; } return S_OK; } diff --git a/src/windowmessages.cpp b/src/windowmessages.cpp index fd3ee2e..585d0d0 100644 --- a/src/windowmessages.cpp +++ b/src/windowmessages.cpp @@ -181,3 +181,34 @@ do_in_ui_thread (gpgol_wmsg_type type, void *data) } return ctx.err; } + + +LRESULT CALLBACK +gpgol_hook(int code, WPARAM wParam, LPARAM lParam) +{ +/* Once we are in the close events we don't have enough + control to revert all our changes so we have to do it + with this nice little hack by catching the WM_CLOSE message + before it reaches outlook. */ + LPCWPSTRUCT cwp = (LPCWPSTRUCT) lParam; + + if (cwp->message == WM_CLOSE) + { + log_debug ("%s:%s: WM_CLOSE windowmessage. Closing all mails.", + SRCNAME, __func__); + Mail::revert_all_mails(); + } + return CallNextHookEx (NULL, code, wParam, lParam); +} + +/* Create the message hook for outlook's windowmessages + we are especially interested in WM_QUIT to do cleanups + and prevent the "Item has changed" question. */ +HHOOK +create_message_hook() +{ + return SetWindowsHookEx (WH_CALLWNDPROC, + gpgol_hook, + NULL, + GetCurrentThreadId()); +} diff --git a/src/windowmessages.h b/src/windowmessages.h index 36a621c..c7f275e 100644 --- a/src/windowmessages.h +++ b/src/windowmessages.h @@ -66,4 +66,9 @@ send_msg_to_ui_thread (wm_ctx_t *ctx); in the ui thread. Returns the result. */ int do_in_ui_thread (gpgol_wmsg_type type, void *data); + +/** Create our filter before outlook Window Messages. */ +HHOOK +create_message_hook(); + #endif // WINDOWMESSAGES_H commit 2d411103d6ce9ff3b69353a095ac862c15312783 Author: Andre Heinecke Date: Mon Nov 7 15:27:14 2016 +0100 Disable ui invalidation in explorers for now * src/explorer-events.cpp, src/explorers-events.cpp (EVENT_SINK_INVOKE): Disable ui invalidation. -- This triggers a bug causing duplicated mailitems so disabled for now. diff --git a/src/explorer-events.cpp b/src/explorer-events.cpp index f48f6ac..6336561 100644 --- a/src/explorer-events.cpp +++ b/src/explorer-events.cpp @@ -69,7 +69,7 @@ EVENT_SINK_INVOKE(ExplorerEvents) { log_oom_extra ("%s:%s: Selection change in explorer: %p", SRCNAME, __func__, this); - gpgoladdin_invalidate_ui (); + // gpgoladdin_invalidate_ui (); break; } case Close: diff --git a/src/explorers-events.cpp b/src/explorers-events.cpp index 476e11e..663a5a9 100644 --- a/src/explorers-events.cpp +++ b/src/explorers-events.cpp @@ -66,7 +66,6 @@ EVENT_SINK_INVOKE(ExplorersEvents) break; } - gpgoladdin_invalidate_ui (); } default: break; commit 68835bfc6096603361038b985e9a93a9b42eb850 Author: Andre Heinecke Date: Mon Nov 7 14:50:10 2016 +0100 Always discard changes on close for now * src/mail.cpp, src/mail.h (Mail::close): Remove save changes parameter. -- We need to figure out if we want to save after disarding changes by ourself depending on property changes. diff --git a/src/mail.cpp b/src/mail.cpp index c7747e2..cb015fd 100644 --- a/src/mail.cpp +++ b/src/mail.cpp @@ -1013,14 +1013,14 @@ Mail::close_inspector () } int -Mail::close (bool discard) +Mail::close () { VARIANT aVariant[1]; DISPPARAMS dispparams; dispparams.rgvarg = aVariant; dispparams.rgvarg[0].vt = VT_INT; - dispparams.rgvarg[0].intVal = discard ? 1 : 0; + dispparams.rgvarg[0].intVal = 1; dispparams.cArgs = 1; dispparams.cNamedArgs = 0; diff --git a/src/mail.h b/src/mail.h index 95f07c8..cef5819 100644 --- a/src/mail.h +++ b/src/mail.h @@ -254,9 +254,10 @@ public: by the caller. */ char ** get_recipients () const; - /** Call close with discard changes true or false - returns the value of the oom call. */ - int close (bool discard); + /** Call close with discard changes to discard + plaintext. returns the value of the oom close + call. */ + int close (); private: void update_categories (); commit 7c002f5b713786022964df6eae09f6dd06ddb0e0 Author: Andre Heinecke Date: Mon Nov 7 14:47:38 2016 +0100 Add request_close windowmessage * src/windowmessage.h (REQUEST_CLOSE): Declare. * src/windowmessages.cpp (gpgol_window_proc): Handle REQUEST_CLOSE. * src/ribbon-callbacks.cpp (get_mail_from_control): Update to new get_unique_id signature. diff --git a/src/ribbon-callbacks.cpp b/src/ribbon-callbacks.cpp index 2bb80e5..977145a 100644 --- a/src/ribbon-callbacks.cpp +++ b/src/ribbon-callbacks.cpp @@ -1463,14 +1463,20 @@ get_mail_from_control (LPDISPATCH ctrl) } xfree (ctx_name); + char *uid; /* Get the uid of this item. */ - char *uid = get_unique_id (mailitem, 0); + uid = get_unique_id (mailitem, 0, nullptr); if (!uid) { - log_oom ("%s:%s: Failed to get uid for %p .", - SRCNAME, __func__, mailitem); - gpgol_release (mailitem); - return NULL; + uid = mapi_get_uid (mailitem); + if (!uid) + { + log_oom ("%s:%s: Failed to get uid for %p .", + SRCNAME, __func__, mailitem); + log_debug ("subject: %s", get_oom_string(mailitem, "Subject")); + gpgol_release (mailitem); + return NULL; + } } auto ret = Mail::get_mail_for_uuid (uid); diff --git a/src/windowmessages.cpp b/src/windowmessages.cpp index 2c6e7ea..fd3ee2e 100644 --- a/src/windowmessages.cpp +++ b/src/windowmessages.cpp @@ -77,7 +77,7 @@ gpgol_window_proc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) break; } - char *active_uuid = get_unique_id (mailitem, 0); + char *active_uuid = get_unique_id (mailitem, 0, nullptr); if (!active_uuid || strcmp (active_uuid, uuid)) { log_debug ("%s:%s: UUID mismatch", @@ -86,20 +86,38 @@ gpgol_window_proc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) delete mail; break; } + log_debug ("%s:%s: Decrypting %s again", + SRCNAME, __func__, uuid); xfree (uuid); xfree (active_uuid); mail->decrypt_verify (); break; } - - break; + case (REQUEST_CLOSE): + { + char *uuid = (char *) ctx->data; + auto mail = Mail::get_mail_for_uuid (uuid); + if (!mail) + { + log_debug ("%s:%s: Close request for uuid which is gone.", + SRCNAME, __func__); + break; + } + if (mail->close()) + { + log_debug ("%s:%s: Close request failed.", + SRCNAME, __func__); + } + ctx->wmsg_type = REQUEST_DECRYPT; + gpgol_window_proc (hWnd, message, wParam, (LPARAM) ctx); + break; + } default: log_debug ("Unknown msg"); } return DefWindowProc(hWnd, message, wParam, lParam); } - return DefWindowProc(hWnd, message, wParam, lParam); } diff --git a/src/windowmessages.h b/src/windowmessages.h index d9580e2..36a621c 100644 --- a/src/windowmessages.h +++ b/src/windowmessages.h @@ -40,7 +40,9 @@ typedef enum _gpgol_wmsg_type UNKNOWN = 0, PARSING_DONE = 2, /* A mail was parsed. Data should be a pointer to the mail object. */ - REQUEST_DECRYPT = 3 + REQUEST_DECRYPT = 3, + REQUEST_CLOSE = 4 /* Request the mail to be closed with discard + changes set to true */ } gpgol_wmsg_type; typedef struct commit c21454e49cff01b0200f02c58812a696f7127050 Author: Andre Heinecke Date: Mon Nov 7 12:59:50 2016 +0100 Use msgclass to determine if a mail is crypto * src/mail.cpp (is_crypto_mail): Use messageclass instead of processed. * src/mail.h: Update accordingly. -- This makes the function usable after prerproceessing and not only after decryption. diff --git a/src/mail.cpp b/src/mail.cpp index 0168497..c7747e2 100644 --- a/src/mail.cpp +++ b/src/mail.cpp @@ -479,13 +479,23 @@ do_parsing (LPVOID arg) return 0; } -int -Mail::decrypt_verify() +bool +Mail::is_crypto_mail() const { if (m_type == MSGTYPE_UNKNOWN || m_type == MSGTYPE_GPGOL || m_type == MSGTYPE_SMIME) { /* Not a message for us. */ + return false; + } + return true; +} + +int +Mail::decrypt_verify() +{ + if (!is_crypto_mail()) + { return 0; } if (m_needs_wipe) diff --git a/src/mail.h b/src/mail.h index 81ddf58..95f07c8 100644 --- a/src/mail.h +++ b/src/mail.h @@ -172,7 +172,7 @@ public: * @returns true if the mail was either signed or encrypted and we processed * it. */ - bool is_crypto_mail () { return m_processed; } + bool is_crypto_mail () const; /** @brief This mail needs to be actually written. * commit aadd8026eca38983fa14e1045400e8e9c0f50508 Author: Andre Heinecke Date: Mon Nov 7 12:57:05 2016 +0100 Add IID and install functions for explorer sinks * src/eventsinks.h (install_ExplorerEvents_sink) (install_ExplorersEvents_sink): Declare. * src/oomhelp.h: Add missing uuids. diff --git a/src/eventsinks.h b/src/eventsinks.h index 0bcfc03..82f618d 100644 --- a/src/eventsinks.h +++ b/src/eventsinks.h @@ -25,4 +25,8 @@ LPDISPATCH install_ApplicationEvents_sink (LPDISPATCH obj); void detach_ApplicationEvents_sink (LPDISPATCH obj); LPDISPATCH install_MailItemEvents_sink (LPDISPATCH obj); void detach_MailItemEvents_sink (LPDISPATCH obj); +LPDISPATCH install_ExplorerEvents_sink (LPDISPATCH obj); +void detach_ExplorerEvents_sink (LPDISPATCH obj); +LPDISPATCH install_ExplorersEvents_sink (LPDISPATCH obj); +void detach_ExplorersEvents_sink (LPDISPATCH obj); #endif // EVENTSINKS_H diff --git a/src/oomhelp.h b/src/oomhelp.h index 74e7faf..35991ce 100644 --- a/src/oomhelp.h +++ b/src/oomhelp.h @@ -64,6 +64,10 @@ DEFINE_GUID(IID_IPictureDisp, 0x8b, 0xbb, 0x00, 0xaa, 0x00, 0x30, 0x0c, 0xab); DEFINE_GUID(IID_ApplicationEvents, 0x0006304E, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46); +DEFINE_GUID(IID_ExplorerEvents, 0x0006300F, 0x0000, 0x0000, + 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46); +DEFINE_GUID(IID_ExplorersEvents, 0x00063078, 0x0000, 0x0000, + 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46); DEFINE_GUID(IID_MailItemEvents, 0x0006302B, 0x0000, 0x0000, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46); DEFINE_GUID(IID_MailItem, 0x00063034, 0x0000, 0x0000, commit 765e04b5e0fb6ce3ebcf2374a6e09dc8e3005ca9 Author: Andre Heinecke Date: Mon Nov 7 12:53:07 2016 +0100 Use shared_ptr for parser object * src/mail.cpp (m_parser): Change to shared_ptr (Mail::parsing_done): Check if parser already deleted. * src/mail.h: Update accordingly. -- The state in which this happens should no longer be reached due to the previous commit that prevents duplication in the uuid map. Still better handle it. diff --git a/src/mail.cpp b/src/mail.cpp index d63b7cd..0168497 100644 --- a/src/mail.cpp +++ b/src/mail.cpp @@ -537,7 +537,7 @@ Mail::decrypt_verify() return 1; } - m_parser = new ParseController (cipherstream, m_type); + m_parser = std::shared_ptr (new ParseController (cipherstream, m_type)); gpgol_release (cipherstream); HANDLE parser_thread = CreateThread (NULL, 0, do_parsing, (LPVOID) this, 0, @@ -610,6 +610,31 @@ void Mail::parsing_done() { TRACEPOINT; + log_oom_extra ("Mail %p Parsing done for parser: %p", + this, m_parser.get()); + if (!m_parser) + { + /* This should not happen but it happens when outlook + sends multiple ItemLoad events for the same Mail + Object. In that case it could happen that one + parser was already done while a second is now + returning for the wrong mail (as it's looked up + by uuid.) + + We have a check in get_uuid that the uuid was + not in the map before (and the parser is replaced). + So this really really should not happen. We + handle it anyway as we crash otherwise. + + It should not happen because the parser is only + created in decrypt_verify which is called in the + read event. And even in there we check if the parser + was set. + */ + log_error ("%s:%s: No parser obj. For mail: %p", + SRCNAME, __func__, this); + return; + } /* Store the results. */ m_decrypt_result = m_parser->decrypt_result (); m_verify_result = m_parser->verify_result (); @@ -635,7 +660,6 @@ Mail::parsing_done() } /* Invalidate UI to set the correct sig status. */ - delete m_parser; m_parser = nullptr; gpgoladdin_invalidate_ui (); TRACEPOINT; diff --git a/src/mail.h b/src/mail.h index 0385fbd..81ddf58 100644 --- a/src/mail.h +++ b/src/mail.h @@ -198,7 +198,7 @@ public: /** @brief get the associated parser. only valid while the actual parsing happens. */ - ParseController *parser () { return m_parser; } + std::shared_ptr parser () { return m_parser; } /** To be called from outside once the paser was done. In Qt this would be a slot that is called once it is finished @@ -276,7 +276,7 @@ private: int m_moss_position; /* The number of the original message attachment. */ char *m_sender; msgtype_t m_type; /* Our messagetype as set in mapi */ - ParseController *m_parser; + std::shared_ptr m_parser; GpgME::VerificationResult m_verify_result; GpgME::DecryptionResult m_decrypt_result; GpgME::Signature m_sig; commit b41e5bcfaeab4964c0609d755177f31ecb5e458c Author: Andre Heinecke Date: Mon Nov 7 12:50:13 2016 +0100 Check for duplicates in mail map * src/mail.cpp (Mail::set_uuid): Check for duplicates in mail map and handle them. -- Sometimes we have the troubling state that multiple item load events occur for the same mail, as identified by uuid. This is bad but now at least we have some handling and report it as an error otherwise it could lead to cases where a parser returned for a wrong mail According to documentation this should not happen as this means that multiple ItemLoad events occured for the same mailobject without unload / destruction of the mail. But it happens. If you invalidate the UI in the selection change event Outlook loads a new mailobject for the mail. Might happen in other surprising cases. We replace in that case as experiments have shown that the last mailobject is the one that is visible. diff --git a/src/mail.cpp b/src/mail.cpp index 3e2aa88..d63b7cd 100644 --- a/src/mail.cpp +++ b/src/mail.cpp @@ -1212,6 +1212,28 @@ Mail::set_uuid() if (m_uuid.empty()) { m_uuid = uuid; + Mail *other = get_mail_for_uuid (uuid); + if (other) + { + /* According to documentation this should not + happen as this means that multiple ItemLoad + events occured for the same mailobject without + unload / destruction of the mail. + + But it happens. If you invalidate the UI + in the selection change event Outlook loads a + new mailobject for the mail. Might happen in + other surprising cases. We replace in that + case as experiments have shown that the last + mailobject is the one that is visible. + + Still troubling state so we log this as an error. + */ + log_error ("%s:%s: There is another mail for %p " + "with uuid: %s replacing it.", + SRCNAME, __func__, m_mailitem, uuid); + delete other; + } g_uid_map.insert (std::pair (m_uuid, this)); log_debug ("%s:%s: uuid for %p is now %s", SRCNAME, __func__, this, commit 24e1932dc7c974ce18f8171a9e8c16bdc1a359a5 Author: Andre Heinecke Date: Mon Nov 7 12:40:43 2016 +0100 Fix build by adding new event handlers to Makefile * src/Makefile.am (gpgol_SOURCES): Add new files. -- Forgotten in previous commit. diff --git a/src/Makefile.am b/src/Makefile.am index ae4ad97..55a9a7e 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -82,7 +82,8 @@ gpgol_SOURCES = \ exechelp.c exechelp.h \ addin-options.cpp addin-options.h \ parsecontroller.cpp parsecontroller.h \ - mimedataprovider.cpp mimedataprovider.h + mimedataprovider.cpp mimedataprovider.h \ + explorer-events.cpp explorers-events.cpp #treeview_SOURCES = treeview.c ----------------------------------------------------------------------- Summary of changes: src/Makefile.am | 3 +- src/application-events.cpp | 6 +- src/eventsinks.h | 4 ++ src/explorer-events.cpp | 2 +- src/explorers-events.cpp | 1 - src/gpgoladdin.cpp | 14 ++++- src/gpgoladdin.h | 2 +- src/mail.cpp | 97 ++++++++++++++++++++++++++++--- src/mail.h | 28 +++++++-- src/mailitem-events.cpp | 141 ++++++++++++++++++++++++++++++++++++--------- src/oomhelp.h | 4 ++ src/ribbon-callbacks.cpp | 16 +++-- src/windowmessages.cpp | 57 ++++++++++++++++-- src/windowmessages.h | 9 ++- 14 files changed, 323 insertions(+), 61 deletions(-) hooks/post-receive -- GnuPG extension for MS Outlook http://git.gnupg.org From cvs at cvs.gnupg.org Mon Nov 7 17:47:17 2016 From: cvs at cvs.gnupg.org (by Justus Winter) Date: Mon, 07 Nov 2016 17:47:17 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.1.15-335-g26df829 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via 26df829fa22f027ca4a5eaf155cdaa2123afbdd5 (commit) via abe0cc7a21d2b0b5c77cc525b999d1ede2d29185 (commit) via 4d98a72b88cf167295e1ecd6125b9c7a11b6239f (commit) via a55393cb5f4b331cb3a715c7d9a8b91f7606f337 (commit) via ac078469cbafe85cf771fca84f376740850d10b0 (commit) from 37751d2b194bc33539f5b9ea0e02e9f209d2bcf6 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 26df829fa22f027ca4a5eaf155cdaa2123afbdd5 Author: Justus Winter Date: Mon Nov 7 17:44:34 2016 +0100 tests: Write a log file for each test. * tests/openpgp/Makefile.am (CLEANFILES): Delete logs. * tests/openpgp/run-tests.scm (test::run-sync): Write logs. Signed-off-by: Justus Winter diff --git a/tests/openpgp/Makefile.am b/tests/openpgp/Makefile.am index cfdd58d..8f565b3 100644 --- a/tests/openpgp/Makefile.am +++ b/tests/openpgp/Makefile.am @@ -197,7 +197,7 @@ EXTRA_DIST = defs.scm $(XTESTS) $(TEST_FILES) \ CLEANFILES = prepared.stamp x y yy z out err $(data_files) \ plain-1 plain-2 plain-3 trustdb.gpg *.lock .\#lk* \ - *.test.log gpg_dearmor gpg.conf gpg-agent.conf S.gpg-agent \ + *.log gpg_dearmor gpg.conf gpg-agent.conf S.gpg-agent \ pubring.gpg pubring.gpg~ pubring.kbx pubring.kbx~ \ secring.gpg pubring.pkr secring.skr \ gnupg-test.stop random_seed gpg-agent.log tofu.db \ diff --git a/tests/openpgp/run-tests.scm b/tests/openpgp/run-tests.scm index ce0217b..9e9bc3d 100644 --- a/tests/openpgp/run-tests.scm +++ b/tests/openpgp/run-tests.scm @@ -83,16 +83,18 @@ (define (set-pid x) (new name directory command x retcode)) (define (run-sync . args) - (with-working-directory directory - (let* ((p (inbound-pipe)) - (pid (spawn-process-fd (append command args) 0 - (:write-end p) (:write-end p)))) - (close (:write-end p)) - (splice (:read-end p) STDERR_FILENO) - (close (:read-end p)) - (let ((t' (set-retcode (wait-process name pid #t)))) - (t'::report) - t')))) + (letfd ((log (open (string-append name ".log") + (logior O_WRONLY O_BINARY O_CREAT) #o600))) + (with-working-directory directory + (let* ((p (inbound-pipe)) + (pid (spawn-process-fd (append command args) 0 + (:write-end p) (:write-end p)))) + (close (:write-end p)) + (splice (:read-end p) STDERR_FILENO log) + (close (:read-end p)) + (let ((t' (set-retcode (wait-process name pid #t)))) + (t'::report) + t'))))) (define (run-sync-quiet . args) (with-working-directory directory (set-retcode commit abe0cc7a21d2b0b5c77cc525b999d1ede2d29185 Author: Justus Winter Date: Mon Nov 7 17:40:43 2016 +0100 gpgscm: Generalize splice to write to multiple sinks. * tests/gpgscm/ffi.c (ordinal_suffix): New function. (do_splice): Generalize splice to write to multiple sinks. * tests/gpgscm/lib.scm (splice): Document this fact. Signed-off-by: Justus Winter diff --git a/tests/gpgscm/ffi.c b/tests/gpgscm/ffi.c index 18aff98..d4bf3ef 100644 --- a/tests/gpgscm/ffi.c +++ b/tests/gpgscm/ffi.c @@ -995,17 +995,36 @@ do_file_equal (scheme *sc, pointer args) goto out; } +static const char * +ordinal_suffix (int n) +{ + switch (n) + { + case 1: return "st"; + case 2: return "nd"; + case 3: return "rd"; + default: return "th"; + } + assert (! "reached"); +} + static pointer do_splice (scheme *sc, pointer args) { FFI_PROLOG (); int source; - int sink; char buffer[1024]; ssize_t bytes_read; + pointer sinks, sink; FFI_ARG_OR_RETURN (sc, int, source, number, args); - FFI_ARG_OR_RETURN (sc, int, sink, number, args); - FFI_ARGS_DONE_OR_RETURN (sc, args); + sinks = args; + if (sinks == sc->NIL) + return ffi_sprintf (sc, "need at least one sink"); + for (sink = sinks; sink != sc->NIL; sink = pair_cdr (sink), ffi_arg_index++) + if (! sc->vptr->is_number (pair_car (sink))) + return ffi_sprintf (sc, "%d%s argument is not a number", + ffi_arg_index, ordinal_suffix (ffi_arg_index)); + while (1) { bytes_read = read (source, buffer, sizeof buffer); @@ -1013,8 +1032,23 @@ do_splice (scheme *sc, pointer args) break; if (bytes_read < 0) FFI_RETURN_ERR (sc, gpg_error_from_syserror ()); - if (write (sink, buffer, bytes_read) != bytes_read) - FFI_RETURN_ERR (sc, gpg_error_from_syserror ()); + + for (sink = sinks; sink != sc->NIL; sink = pair_cdr (sink)) + { + int fd = sc->vptr->ivalue (pair_car (sink)); + char *p = buffer; + ssize_t left = bytes_read; + + while (left) + { + ssize_t written = write (fd, p, left); + if (written < 0) + FFI_RETURN_ERR (sc, gpg_error_from_syserror ()); + assert (written <= left); + left -= written; + p += written; + } + } } FFI_RETURN (sc); } diff --git a/tests/gpgscm/lib.scm b/tests/gpgscm/lib.scm index 7d2d1eb..27779e2 100644 --- a/tests/gpgscm/lib.scm +++ b/tests/gpgscm/lib.scm @@ -207,8 +207,9 @@ ;; Get our process id. (ffi-define (getpid)) -;; Copy data from file descriptor SOURCE to SINK. -(ffi-define (splice source sink)) +;; Copy data from file descriptor SOURCE to every file descriptor in +;; SINKS. +(ffi-define (splice source . sinks)) ;; ;; Random numbers. commit 4d98a72b88cf167295e1ecd6125b9c7a11b6239f Author: Justus Winter Date: Mon Nov 7 16:59:15 2016 +0100 gpgscm: Drop 'len' argument from splice. * tests/gpgscm/ffi.c (do_splice): Drop 'len' argument, no-one uses it. * tests/gpgscm/lib.scm (splice): Document foreign function. Signed-off-by: Justus Winter diff --git a/tests/gpgscm/ffi.c b/tests/gpgscm/ffi.c index 8bb2652..18aff98 100644 --- a/tests/gpgscm/ffi.c +++ b/tests/gpgscm/ffi.c @@ -1001,29 +1001,20 @@ do_splice (scheme *sc, pointer args) FFI_PROLOG (); int source; int sink; - ssize_t len = -1; char buffer[1024]; ssize_t bytes_read; FFI_ARG_OR_RETURN (sc, int, source, number, args); FFI_ARG_OR_RETURN (sc, int, sink, number, args); - if (args != sc->NIL) - FFI_ARG_OR_RETURN (sc, ssize_t, len, number, args); FFI_ARGS_DONE_OR_RETURN (sc, args); - while (len == -1 || len > 0) + while (1) { - size_t want = sizeof buffer; - if (len > 0 && (ssize_t) want > len) - want = (size_t) len; - - bytes_read = read (source, buffer, want); + bytes_read = read (source, buffer, sizeof buffer); if (bytes_read == 0) break; if (bytes_read < 0) FFI_RETURN_ERR (sc, gpg_error_from_syserror ()); if (write (sink, buffer, bytes_read) != bytes_read) FFI_RETURN_ERR (sc, gpg_error_from_syserror ()); - if (len != -1) - len -= bytes_read; } FFI_RETURN (sc); } diff --git a/tests/gpgscm/lib.scm b/tests/gpgscm/lib.scm index a8ae2f8..7d2d1eb 100644 --- a/tests/gpgscm/lib.scm +++ b/tests/gpgscm/lib.scm @@ -207,6 +207,9 @@ ;; Get our process id. (ffi-define (getpid)) +;; Copy data from file descriptor SOURCE to SINK. +(ffi-define (splice source sink)) + ;; ;; Random numbers. ;; commit a55393cb5f4b331cb3a715c7d9a8b91f7606f337 Author: Justus Winter Date: Mon Nov 7 16:21:21 2016 +0100 tests: Move environment creation and teardown into each test. * tests/gpgscm/tests.scm (log): New function. * tests/openpgp/run-tests.scm (run-tests-parallel): Do not run the startup and teardown scripts. (run-tests-sequential): Likewise. * tests/openpgp/setup.scm: Move all functions... * tests/openpgp/defs.scm: ... here and make them less verbose. (setup-environment): New function. (setup-legacy-environment): Likewise. (start-agent): Make less verbose, run 'stop-agent' at interpreter exit. (stop-agent): Make less verbose. * tests/openpgp/finish.scm: Drop file. * tests/openpgp/Makefile.am (EXTRA_DIST): Drop removed file. * tests/openpgp/4gb-packet.scm: Use 'setup-environment' or 'setup-legacy-environment' as appropriate. * tests/openpgp/armdetach.scm: Likewise. * tests/openpgp/armdetachm.scm: Likewise. * tests/openpgp/armencrypt.scm: Likewise. * tests/openpgp/armencryptp.scm: Likewise. * tests/openpgp/armor.scm: Likewise. * tests/openpgp/armsignencrypt.scm: Likewise. * tests/openpgp/armsigs.scm: Likewise. * tests/openpgp/clearsig.scm: Likewise. * tests/openpgp/conventional-mdc.scm: Likewise. * tests/openpgp/conventional.scm: Likewise. * tests/openpgp/decrypt-dsa.scm: Likewise. * tests/openpgp/decrypt.scm: Likewise. * tests/openpgp/default-key.scm: Likewise. * tests/openpgp/detach.scm: Likewise. * tests/openpgp/detachm.scm: Likewise. * tests/openpgp/ecc.scm: Likewise. * tests/openpgp/encrypt-dsa.scm: Likewise. * tests/openpgp/encrypt.scm: Likewise. * tests/openpgp/encryptp.scm: Likewise. * tests/openpgp/export.scm: Likewise. * tests/openpgp/finish.scm: Likewise. * tests/openpgp/genkey1024.scm: Likewise. * tests/openpgp/gpgtar.scm: Likewise. * tests/openpgp/gpgv-forged-keyring.scm: Likewise. * tests/openpgp/import.scm: Likewise. * tests/openpgp/issue2015.scm: Likewise. * tests/openpgp/issue2417.scm: Likewise. * tests/openpgp/issue2419.scm: Likewise. * tests/openpgp/key-selection.scm: Likewise. * tests/openpgp/mds.scm: Likewise. * tests/openpgp/multisig.scm: Likewise. * tests/openpgp/quick-key-manipulation.scm: Likewise. * tests/openpgp/seat.scm: Likewise. * tests/openpgp/shell.scm: Likewise. * tests/openpgp/signencrypt-dsa.scm: Likewise. * tests/openpgp/signencrypt.scm: Likewise. * tests/openpgp/sigs-dsa.scm: Likewise. * tests/openpgp/sigs.scm: Likewise. * tests/openpgp/ssh.scm: Likewise. * tests/openpgp/tofu.scm: Likewise. * tests/openpgp/use-exact-key.scm: Likewise. * tests/openpgp/verify.scm: Likewise. * tests/openpgp/version.scm: Likewise. * tests/openpgp/issue2346.scm: Likewise and simplify. -- The previous Bourne Shell-based test suite created the environment before running all tests, and tore it down after executing them. When we created the Scheme-based test suite, we kept this design at first, but introduced a way to run each test in its own environment to prevent tests from interfering with each other. Nevertheless, every test started out with the same environment. Move the creation of the test environment into each test. This gives us finer control over the environment each test is run in. It also makes it possible to run each test by simply executing it using gpgscm without the use of the runner. Furthermore, it has the neat side-effect of speeding up the test suite if run in parallel. Signed-off-by: Justus Winter diff --git a/tests/gpgscm/tests.scm b/tests/gpgscm/tests.scm index d89a96f..72afa99 100644 --- a/tests/gpgscm/tests.scm +++ b/tests/gpgscm/tests.scm @@ -38,6 +38,10 @@ (apply echo msg) (flush-stdio)) +(define (log . msg) + (if (> (*verbose*) 0) + (apply info msg))) + (define (error . msg) (apply info msg) (exit 1)) diff --git a/tests/openpgp/4gb-packet.scm b/tests/openpgp/4gb-packet.scm index 8b2fcd6..9c387af 100755 --- a/tests/openpgp/4gb-packet.scm +++ b/tests/openpgp/4gb-packet.scm @@ -21,6 +21,7 @@ ;; 2^32-1 as invalid and exit with status code 2. (load (with-path "defs.scm")) +(setup-environment) (if (= 0 (call `(, at GPG --list-packets ,(in-srcdir "4gb-packet.asc")))) (info "Can parse 4GB packets.") diff --git a/tests/openpgp/Makefile.am b/tests/openpgp/Makefile.am index acd2329..cfdd58d 100644 --- a/tests/openpgp/Makefile.am +++ b/tests/openpgp/Makefile.am @@ -193,7 +193,7 @@ sample_msgs = samplemsgs/issue2419.asc EXTRA_DIST = defs.scm $(XTESTS) $(TEST_FILES) \ mkdemodirs signdemokey $(priv_keys) $(sample_keys) \ $(sample_msgs) ChangeLog-2011 run-tests.scm \ - setup.scm finish.scm shell.scm + setup.scm shell.scm CLEANFILES = prepared.stamp x y yy z out err $(data_files) \ plain-1 plain-2 plain-3 trustdb.gpg *.lock .\#lk* \ diff --git a/tests/openpgp/armdetach.scm b/tests/openpgp/armdetach.scm index 69e09d8..f458441 100755 --- a/tests/openpgp/armdetach.scm +++ b/tests/openpgp/armdetach.scm @@ -18,6 +18,7 @@ ;; along with this program; if not, see . (load (with-path "defs.scm")) +(setup-legacy-environment) (for-each-p "Checking armored detached signatures" diff --git a/tests/openpgp/armdetachm.scm b/tests/openpgp/armdetachm.scm index 618f7aa..8d30fd3 100755 --- a/tests/openpgp/armdetachm.scm +++ b/tests/openpgp/armdetachm.scm @@ -18,6 +18,7 @@ ;; along with this program; if not, see . (load (with-path "defs.scm")) +(setup-legacy-environment) (define files (append plain-files data-files)) diff --git a/tests/openpgp/armencrypt.scm b/tests/openpgp/armencrypt.scm index b0cf099..b9dfc1e 100755 --- a/tests/openpgp/armencrypt.scm +++ b/tests/openpgp/armencrypt.scm @@ -18,6 +18,7 @@ ;; along with this program; if not, see . (load (with-path "defs.scm")) +(setup-legacy-environment) (for-each-p "Checking armored encryption" diff --git a/tests/openpgp/armencryptp.scm b/tests/openpgp/armencryptp.scm index 7555ce9..d280902 100755 --- a/tests/openpgp/armencryptp.scm +++ b/tests/openpgp/armencryptp.scm @@ -18,6 +18,7 @@ ;; along with this program; if not, see . (load (with-path "defs.scm")) +(setup-legacy-environment) (for-each-p "Checking armored encryption and decryption using pipes" diff --git a/tests/openpgp/armor.scm b/tests/openpgp/armor.scm index 578e248..7498ba7 100755 --- a/tests/openpgp/armor.scm +++ b/tests/openpgp/armor.scm @@ -18,6 +18,7 @@ ;; along with this program; if not, see . (load (with-path "defs.scm")) +(setup-legacy-environment) (define armored_key_8192 "-----BEGIN PGP PUBLIC KEY BLOCK----- Version: SKS 1.0.9 diff --git a/tests/openpgp/armsignencrypt.scm b/tests/openpgp/armsignencrypt.scm index b84bfe4..18178f1 100755 --- a/tests/openpgp/armsignencrypt.scm +++ b/tests/openpgp/armsignencrypt.scm @@ -18,6 +18,7 @@ ;; along with this program; if not, see . (load (with-path "defs.scm")) +(setup-legacy-environment) (for-each-p "Checking armored signing and encryption" diff --git a/tests/openpgp/armsigs.scm b/tests/openpgp/armsigs.scm index d897581..6e5d056 100755 --- a/tests/openpgp/armsigs.scm +++ b/tests/openpgp/armsigs.scm @@ -18,6 +18,7 @@ ;; along with this program; if not, see . (load (with-path "defs.scm")) +(setup-legacy-environment) (for-each-p "Checking armored signatures" diff --git a/tests/openpgp/clearsig.scm b/tests/openpgp/clearsig.scm index 96b1b4c..7b95561 100755 --- a/tests/openpgp/clearsig.scm +++ b/tests/openpgp/clearsig.scm @@ -18,6 +18,7 @@ ;; along with this program; if not, see . (load (with-path "defs.scm")) +(setup-legacy-environment) (define (check-signing args input) (lambda (source sink) diff --git a/tests/openpgp/conventional-mdc.scm b/tests/openpgp/conventional-mdc.scm index dcdb474..fb92217 100755 --- a/tests/openpgp/conventional-mdc.scm +++ b/tests/openpgp/conventional-mdc.scm @@ -18,6 +18,7 @@ ;; along with this program; if not, see . (load (with-path "defs.scm")) +(setup-legacy-environment) (define s2k '--s2k-count=65536) (define passphrase "Hier spricht HAL") diff --git a/tests/openpgp/conventional.scm b/tests/openpgp/conventional.scm index 67e28e2..af889dc 100755 --- a/tests/openpgp/conventional.scm +++ b/tests/openpgp/conventional.scm @@ -18,6 +18,7 @@ ;; along with this program; if not, see . (load (with-path "defs.scm")) +(setup-legacy-environment) (define s2k '--s2k-count=65536) (define passphrase "Hier spricht HAL") diff --git a/tests/openpgp/decrypt-dsa.scm b/tests/openpgp/decrypt-dsa.scm index b01a0f7..49f9534 100755 --- a/tests/openpgp/decrypt-dsa.scm +++ b/tests/openpgp/decrypt-dsa.scm @@ -18,6 +18,7 @@ ;; along with this program; if not, see . (load (with-path "defs.scm")) +(setup-legacy-environment) (for-each-p "Checking decryption of supplied DSA encrypted file" diff --git a/tests/openpgp/decrypt.scm b/tests/openpgp/decrypt.scm index ec0f8e7..ba8bcee 100755 --- a/tests/openpgp/decrypt.scm +++ b/tests/openpgp/decrypt.scm @@ -18,6 +18,7 @@ ;; along with this program; if not, see . (load (with-path "defs.scm")) +(setup-legacy-environment) (for-each-p "Checking decryption of supplied files" diff --git a/tests/openpgp/default-key.scm b/tests/openpgp/default-key.scm index 07cc8c0..a90cca8 100755 --- a/tests/openpgp/default-key.scm +++ b/tests/openpgp/default-key.scm @@ -18,6 +18,7 @@ ;; along with this program; if not, see . (load (with-path "defs.scm")) +(setup-legacy-environment) ;; Import the sample key ;; diff --git a/tests/openpgp/defs.scm b/tests/openpgp/defs.scm index 62bd1e2..09c313b 100644 --- a/tests/openpgp/defs.scm +++ b/tests/openpgp/defs.scm @@ -146,10 +146,132 @@ (if (number? verbose) (*set-verbose!* verbose))) +;; +;; Support for test environment creation and teardown. +;; + +(define (make-test-data filename size) + (call-with-binary-output-file + filename + (lambda (port) + (display (make-random-string size) port)))) + +(define (create-gpghome) + (log "Creating test environment...") + + (srandom (getpid)) + (make-test-data "random_seed" 600) + + (log "Creating configuration files") + (for-each + (lambda (name) + (file-copy (in-srcdir (string-append name ".tmpl")) name) + (let ((p (open-input-output-file name))) + (cond + ((string=? "gpg.conf" name) + (if have-opt-always-trust + (display "no-auto-check-trustdb\n" p)) + (display (string-append "agent-program " + (tool 'gpg-agent) + "|--debug-quick-random\n") p) + (display "allow-weak-digest-algos\n" p)) + ((string=? "gpg-agent.conf" name) + (display (string-append "pinentry-program " PINENTRY "\n") p))))) + '("gpg.conf" "gpg-agent.conf"))) + +;; Initialize the test environment, install appropriate configuration +;; and start the agent, without any keys. +(define (setup-environment) + (create-gpghome) + (start-agent)) + +(define (create-legacy-gpghome) + (log "Creating sample data files") + (for-each + (lambda (size) + (make-test-data (string-append "data-" (number->string size)) + size)) + '(500 9000 32000 80000)) + + (log "Unpacking samples") + (for-each + (lambda (name) + (dearmor (in-srcdir (string-append name "o.asc")) name)) + '("plain-1" "plain-2" "plain-3" "plain-large")) + + (mkdir "private-keys-v1.d" "-rwx") + + (log "Storing private keys") + (for-each + (lambda (name) + (dearmor (in-srcdir (string-append "/privkeys/" name ".asc")) + (string-append "private-keys-v1.d/" name ".key"))) + '("50B2D4FA4122C212611048BC5FC31BD44393626E" + "7E201E28B6FEB2927B321F443205F4724EBE637E" + "13FDB8809B17C5547779F9D205C45F47CE0217CE" + "343D8AF79796EE107D645A2787A9D9252F924E6F" + "8B5ABF3EF9EB8D96B91A0B8C2C4401C91C834C34" + "0D6F6AD4C4C803B25470F9104E9F4E6A4CA64255" + "FD692BD59D6640A84C8422573D469F84F3B98E53" + "76F7E2B35832976B50A27A282D9B87E44577EB66" + "A0747D5F9425E6664F4FFBEED20FBCA79FDED2BD" + "00FE67F28A52A8AA08FFAED20AF832DA916D1985" + "1DF48228FEFF3EC2481B106E0ACA8C465C662CC5" + "A2832820DC9F40751BDCD375BB0945BA33EC6B4C" + "ADE710D74409777B7729A7653373D820F67892E0" + "CEFC51AF91F68A2904FBFF62C4F075A4785B803F" + "1E28F20E41B54C2D1234D896096495FF57E08D18" + "EB33B687EB8581AB64D04852A54453E85F3DF62D" + "C6A6390E9388CDBAD71EAEA698233FE5E04F001E" + "D69102E0F5AC6B6DB8E4D16DA8E18CF46D88CAE3")) + + (log "Importing public demo and test keys") + (for-each + (lambda (file) + (call-check `(, at GPG --yes --import ,(in-srcdir file)))) + (list "pubdemo.asc" "pubring.asc" key-file1)) + + (pipe:do + (pipe:open (in-srcdir "pubring.pkr.asc") (logior O_RDONLY O_BINARY)) + (pipe:spawn `(, at GPG --dearmor)) + (pipe:spawn `(, at GPG --yes --import)))) + +(define (preset-passphrases) + (log "Presetting passphrases") + ;; one at example.com + (call-check `(,(tool 'gpg-preset-passphrase) + --preset --passphrase def + "50B2D4FA4122C212611048BC5FC31BD44393626E")) + (call-check `(,(tool 'gpg-preset-passphrase) + --preset --passphrase def + "7E201E28B6FEB2927B321F443205F4724EBE637E")) + ;; alpha at example.net + (call-check `(,(tool 'gpg-preset-passphrase) + --preset --passphrase abc + "76F7E2B35832976B50A27A282D9B87E44577EB66")) + (call-check `(,(tool 'gpg-preset-passphrase) + --preset --passphrase abc + "A0747D5F9425E6664F4FFBEED20FBCA79FDED2BD"))) + +;; Initialize the test environment, install appropriate configuration +;; and start the agent, with the keys from the legacy test suite. +(define (setup-legacy-environment) + (setup-environment) + (if (member "--unpack-tarball" *args*) + (begin + (call-check `(,(tool 'gpgtar) --extract --directory=. ,(cadr *args*))) + (start-agent)) + (begin + (create-gpghome) + (start-agent) + (create-legacy-gpghome))) + (preset-passphrases)) + ;; Create the socket dir and start the agent. (define (start-agent) - (echo "Starting gpg-agent...") - (catch (echo "Warning: Creating socket directory failed:" (car *error*)) + (log "Starting gpg-agent...") + (atexit stop-agent) + (catch (log "Warning: Creating socket directory failed:" (car *error*)) (call-popen `(,(tool 'gpgconf) --create-socketdir) "")) (call-check `(,(tool 'gpg-connect-agent) --verbose ,(string-append "--agent-program=" (tool 'gpg-agent) @@ -158,8 +280,8 @@ ;; Stop the agent and remove the socket dir. (define (stop-agent) - (echo "Stopping gpg-agent...") - (catch (echo "Warning: Removing socket directory failed.") + (log "Stopping gpg-agent...") + (catch (log "Warning: Removing socket directory failed.") (call-popen `(,(tool 'gpgconf) --remove-socketdir) "")) (call-check `(,(tool 'gpg-connect-agent) --verbose --no-autostart killagent /bye))) diff --git a/tests/openpgp/detach.scm b/tests/openpgp/detach.scm index 375e922..2180f78 100755 --- a/tests/openpgp/detach.scm +++ b/tests/openpgp/detach.scm @@ -18,6 +18,7 @@ ;; along with this program; if not, see . (load (with-path "defs.scm")) +(setup-legacy-environment) (for-each-p "Checking detached signatures" diff --git a/tests/openpgp/detachm.scm b/tests/openpgp/detachm.scm index a4ebce0..1de8da9 100755 --- a/tests/openpgp/detachm.scm +++ b/tests/openpgp/detachm.scm @@ -18,6 +18,7 @@ ;; along with this program; if not, see . (load (with-path "defs.scm")) +(setup-legacy-environment) (define files (append plain-files data-files)) diff --git a/tests/openpgp/ecc.scm b/tests/openpgp/ecc.scm index 8f38494..2190b9b 100755 --- a/tests/openpgp/ecc.scm +++ b/tests/openpgp/ecc.scm @@ -18,6 +18,7 @@ ;; along with this program; if not, see . (load (with-path "defs.scm")) +(setup-legacy-environment) (define keygrips '("8E06A180EFFE4C65B812150CAF19BF30C0689A4C" "E4403F3FD7A443FAC29FEF288FA0D20AC212851E" diff --git a/tests/openpgp/encrypt-dsa.scm b/tests/openpgp/encrypt-dsa.scm index 5228e43..fccb8c9 100755 --- a/tests/openpgp/encrypt-dsa.scm +++ b/tests/openpgp/encrypt-dsa.scm @@ -18,6 +18,7 @@ ;; along with this program; if not, see . (load (with-path "defs.scm")) +(setup-legacy-environment) (for-each-p "Checking encryption using DSA" diff --git a/tests/openpgp/encrypt.scm b/tests/openpgp/encrypt.scm index 7452fc5..ea97b4d 100755 --- a/tests/openpgp/encrypt.scm +++ b/tests/openpgp/encrypt.scm @@ -18,6 +18,7 @@ ;; along with this program; if not, see . (load (with-path "defs.scm")) +(setup-legacy-environment) (for-each-p "Checking encryption" diff --git a/tests/openpgp/encryptp.scm b/tests/openpgp/encryptp.scm index 2b010ac..d939190 100755 --- a/tests/openpgp/encryptp.scm +++ b/tests/openpgp/encryptp.scm @@ -18,6 +18,7 @@ ;; along with this program; if not, see . (load (with-path "defs.scm")) +(setup-legacy-environment) (for-each-p "Checking encryption and decryption using pipes" diff --git a/tests/openpgp/export.scm b/tests/openpgp/export.scm index f7a23f4..a79411c 100755 --- a/tests/openpgp/export.scm +++ b/tests/openpgp/export.scm @@ -18,6 +18,7 @@ ;; along with this program; if not, see . (load (with-path "defs.scm")) +(setup-legacy-environment) (define (check-for predicate lines message) (unless (any predicate lines) diff --git a/tests/openpgp/finish.scm b/tests/openpgp/finish.scm deleted file mode 100755 index 37845ae..0000000 --- a/tests/openpgp/finish.scm +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env gpgscm - -;; Copyright (C) 2016 g10 Code GmbH -;; -;; This file is part of GnuPG. -;; -;; GnuPG is free software; you can redistribute it and/or modify -;; it under the terms of the GNU General Public License as published by -;; the Free Software Foundation; either version 3 of the License, or -;; (at your option) any later version. -;; -;; GnuPG 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 General Public License for more details. -;; -;; You should have received a copy of the GNU General Public License -;; along with this program; if not, see . - -(load (with-path "defs.scm")) - -(stop-agent) diff --git a/tests/openpgp/genkey1024.scm b/tests/openpgp/genkey1024.scm index 9870f46..e5008c3 100755 --- a/tests/openpgp/genkey1024.scm +++ b/tests/openpgp/genkey1024.scm @@ -18,6 +18,7 @@ ;; along with this program; if not, see . (load (with-path "defs.scm")) +(setup-environment) (define (genkey config) (pipe:do diff --git a/tests/openpgp/gpgtar.scm b/tests/openpgp/gpgtar.scm index 15f528f..69206b4 100755 --- a/tests/openpgp/gpgtar.scm +++ b/tests/openpgp/gpgtar.scm @@ -18,6 +18,7 @@ ;; along with this program; if not, see . (load (with-path "defs.scm")) +(setup-legacy-environment) (catch (skip "gpgtar not built") (call-check `(,(tool 'gpgtar) --help))) diff --git a/tests/openpgp/gpgv-forged-keyring.scm b/tests/openpgp/gpgv-forged-keyring.scm index ebe4e40..65d21c5 100755 --- a/tests/openpgp/gpgv-forged-keyring.scm +++ b/tests/openpgp/gpgv-forged-keyring.scm @@ -18,6 +18,7 @@ ;; along with this program; if not, see . (load (with-path "defs.scm")) +(setup-legacy-environment) (define msg_signed_asc " -----BEGIN PGP SIGNED MESSAGE----- diff --git a/tests/openpgp/import.scm b/tests/openpgp/import.scm index 98f3ad9..c354753 100755 --- a/tests/openpgp/import.scm +++ b/tests/openpgp/import.scm @@ -18,6 +18,7 @@ ;; along with this program; if not, see . (load (with-path "defs.scm")) +(setup-environment) (info "Checking bug 894: segv importing certain keys.") (call-check `(,(tool 'gpg) --import ,(in-srcdir "bug894-test.asc"))) diff --git a/tests/openpgp/issue2015.scm b/tests/openpgp/issue2015.scm index e51ece4..4f151aa 100755 --- a/tests/openpgp/issue2015.scm +++ b/tests/openpgp/issue2015.scm @@ -18,6 +18,7 @@ ;; along with this program; if not, see . (load (with-path "defs.scm")) +(setup-environment) (info "Checking passphrase cache (issue2015)...") (call-check `(,(tool 'gpg-preset-passphrase) diff --git a/tests/openpgp/issue2346.scm b/tests/openpgp/issue2346.scm index b336566..cbe03f9 100755 --- a/tests/openpgp/issue2346.scm +++ b/tests/openpgp/issue2346.scm @@ -18,16 +18,11 @@ ;; along with this program; if not, see . (load (with-path "defs.scm")) +(setup-environment) (define key (in-srcdir "samplekeys/issue2346.gpg")) -(define old-home (getenv "GNUPGHOME")) -(with-temporary-working-directory - (file-copy (path-join old-home "gpg.conf") "gpg.conf") - (file-copy (path-join old-home "gpg-agent.conf") "gpg-agent.conf") - (setenv "GNUPGHOME" "." #t) - - (info "Checking import statistics (issue2346)...") - (let ((status (call-popen `(, at GPG --status-fd=1 --import ,key) ""))) - (unless (string-contains? status "IMPORT_RES 1 0 1 0 0 0 0 0 0 1 1 0 0 0 0") - (error "Unexpected number of keys imported" status)))) +(info "Checking import statistics (issue2346)...") +(let ((status (call-popen `(, at GPG --status-fd=1 --import ,key) ""))) + (unless (string-contains? status "IMPORT_RES 1 0 1 0 0 0 0 0 0 1 1 0 0 0 0") + (error "Unexpected number of keys imported" status))) diff --git a/tests/openpgp/issue2417.scm b/tests/openpgp/issue2417.scm index 9079323..5f70e08 100755 --- a/tests/openpgp/issue2417.scm +++ b/tests/openpgp/issue2417.scm @@ -18,6 +18,7 @@ ;; along with this program; if not, see . (load (with-path "defs.scm")) +(setup-legacy-environment) (define old-home (getenv "GNUPGHOME")) diff --git a/tests/openpgp/issue2419.scm b/tests/openpgp/issue2419.scm index 1f87d1b..9b67851 100755 --- a/tests/openpgp/issue2419.scm +++ b/tests/openpgp/issue2419.scm @@ -18,6 +18,7 @@ ;; along with this program; if not, see . (load (with-path "defs.scm")) +(setup-environment) (info "Checking iobuf_peek corner case (issue2419)...") (lettmp diff --git a/tests/openpgp/key-selection.scm b/tests/openpgp/key-selection.scm index 536f607..93bd001 100644 --- a/tests/openpgp/key-selection.scm +++ b/tests/openpgp/key-selection.scm @@ -18,6 +18,7 @@ ;; along with this program; if not, see . (load (with-path "defs.scm")) +(setup-legacy-environment) ;; This test assumes a fixed time of 2004-01-01. diff --git a/tests/openpgp/mds.scm b/tests/openpgp/mds.scm index 8ca6c7b..bf598eb 100755 --- a/tests/openpgp/mds.scm +++ b/tests/openpgp/mds.scm @@ -18,6 +18,7 @@ ;; along with this program; if not, see . (load (with-path "defs.scm")) +(setup-environment) (define empty-string-hashes `((1 "D41D8CD98F00B204E9800998ECF8427E" "MD5") diff --git a/tests/openpgp/multisig.scm b/tests/openpgp/multisig.scm index 31cdc77..7f1c4c5 100755 --- a/tests/openpgp/multisig.scm +++ b/tests/openpgp/multisig.scm @@ -24,6 +24,7 @@ ;; not really needed because verify could do the same. We keep it anyway. (load (with-path "defs.scm")) +(setup-legacy-environment) (define sig-1ls1ls-valid " -----BEGIN PGP ARMORED FILE----- diff --git a/tests/openpgp/quick-key-manipulation.scm b/tests/openpgp/quick-key-manipulation.scm index b6411d0..4579081 100755 --- a/tests/openpgp/quick-key-manipulation.scm +++ b/tests/openpgp/quick-key-manipulation.scm @@ -18,6 +18,7 @@ ;; along with this program; if not, see . (load (with-path "defs.scm")) +(setup-environment) ;; XXX because of --always-trust, the trustdb is not created. ;; Therefore, we redefine GPG without --always-trust. diff --git a/tests/openpgp/run-tests.scm b/tests/openpgp/run-tests.scm index 0cee559..ce0217b 100644 --- a/tests/openpgp/run-tests.scm +++ b/tests/openpgp/run-tests.scm @@ -109,49 +109,40 @@ (define (report) (echo (string-append (status retcode) ":") name)))))) -(define (run-tests-parallel setup teardown . tests) +(define (run-tests-parallel setup tests) (lettmp (gpghome-tar) (setup::run-sync '--create-tarball gpghome-tar) (let loop ((pool (test-pool::new '())) (tests' tests)) (if (null? tests') (let ((results (pool::wait))) (for-each (lambda (t) - (let ((teardown' (teardown::set-directory - t::directory))) - (teardown'::run-sync-quiet)) (unlink-recursively t::directory) (t::report)) results::procs) (exit (results::report))) (let* ((wd (mkdtemp)) (test (car tests')) - (test' (test::set-directory wd)) - (setup' (setup::set-directory wd))) - (setup'::run-sync-quiet '--unpack-tarball gpghome-tar) - (loop (pool::add (test'::run-async)) (cdr tests'))))))) + (test' (test::set-directory wd))) + (loop (pool::add (test'::run-async '--unpack-tarball gpghome-tar)) + (cdr tests'))))))) -(define (run-tests-sequential setup teardown . tests) +(define (run-tests-sequential setup tests) (lettmp (gpghome-tar) (setup::run-sync '--create-tarball gpghome-tar) (let loop ((pool (test-pool::new '())) (tests' tests)) (if (null? tests') (let ((results (pool::wait))) (for-each (lambda (t) - (let ((teardown' (teardown::set-directory - t::directory))) - (teardown'::run-sync-quiet)) (unlink-recursively t::directory)) results::procs) (exit (results::report))) (let* ((wd (mkdtemp)) (test (car tests')) - (test' (test::set-directory wd)) - (setup' (setup::set-directory wd))) - (setup'::run-sync-quiet '--unpack-tarball gpghome-tar) - (loop (pool::add (test'::run-sync)) (cdr tests'))))))) + (test' (test::set-directory wd))) + (loop (pool::add (test'::run-sync '--unpack-tarball gpghome-tar)) + (cdr tests'))))))) (let* ((runner (if (member "--parallel" *args*) run-tests-parallel run-tests-sequential)) (tests (filter (lambda (arg) (not (string-prefix? arg "--"))) *args*))) - (apply runner (append (list (test::scm "setup.scm") (test::scm "finish.scm")) - (map test::scm tests)))) + (runner (test::scm "setup.scm") (map test::scm tests))) diff --git a/tests/openpgp/seat.scm b/tests/openpgp/seat.scm index aceecca..22a5a67 100755 --- a/tests/openpgp/seat.scm +++ b/tests/openpgp/seat.scm @@ -18,6 +18,7 @@ ;; along with this program; if not, see . (load (with-path "defs.scm")) +(setup-legacy-environment) (for-each-p "Checking encryption, signing, and producing armored output" diff --git a/tests/openpgp/setup.scm b/tests/openpgp/setup.scm index d3ce0d6..d2e125e 100755 --- a/tests/openpgp/setup.scm +++ b/tests/openpgp/setup.scm @@ -19,116 +19,12 @@ (load (with-path "defs.scm")) -(define (make-test-data filename size) - (call-with-binary-output-file - filename - (lambda (port) - (display (make-random-string size) port)))) - -(define (create-gpghome) - (echo "Creating test environment...") - - (srandom (getpid)) - (make-test-data "random_seed" 600) - - (for-each-p - "Creating configuration files" - (lambda (name) - (file-copy (in-srcdir (string-append name ".tmpl")) name) - (let ((p (open-input-output-file name))) - (cond - ((string=? "gpg.conf" name) - (if have-opt-always-trust - (display "no-auto-check-trustdb\n" p)) - (display (string-append "agent-program " - (tool 'gpg-agent) - "|--debug-quick-random\n") p) - (display "allow-weak-digest-algos\n" p)) - ((string=? "gpg-agent.conf" name) - (display (string-append "pinentry-program " PINENTRY "\n") p))))) - '("gpg.conf" "gpg-agent.conf")) - - (for-each-p "Creating sample data files" - (lambda (size) - (make-test-data (string-append "data-" (number->string size)) - size)) - '(500 9000 32000 80000)) - - (for-each-p "Unpacking samples" - (lambda (name) - (dearmor (in-srcdir (string-append name "o.asc")) name)) - '("plain-1" "plain-2" "plain-3" "plain-large")) - - ;; XXX implement cleanup - (catch '() - (mkdir "private-keys-v1.d" "-rwx")) - - (define counter (make-counter)) - (for-each-p' "Storing private keys" - (lambda (name) - (dearmor (in-srcdir (string-append "/privkeys/" name ".asc")) - (string-append "private-keys-v1.d/" name ".key"))) - (lambda (name) (counter)) - '("50B2D4FA4122C212611048BC5FC31BD44393626E" - "7E201E28B6FEB2927B321F443205F4724EBE637E" - "13FDB8809B17C5547779F9D205C45F47CE0217CE" - "343D8AF79796EE107D645A2787A9D9252F924E6F" - "8B5ABF3EF9EB8D96B91A0B8C2C4401C91C834C34" - "0D6F6AD4C4C803B25470F9104E9F4E6A4CA64255" - "FD692BD59D6640A84C8422573D469F84F3B98E53" - "76F7E2B35832976B50A27A282D9B87E44577EB66" - "A0747D5F9425E6664F4FFBEED20FBCA79FDED2BD" - "00FE67F28A52A8AA08FFAED20AF832DA916D1985" - "1DF48228FEFF3EC2481B106E0ACA8C465C662CC5" - "A2832820DC9F40751BDCD375BB0945BA33EC6B4C" - "ADE710D74409777B7729A7653373D820F67892E0" - "CEFC51AF91F68A2904FBFF62C4F075A4785B803F" - "1E28F20E41B54C2D1234D896096495FF57E08D18" - "EB33B687EB8581AB64D04852A54453E85F3DF62D" - "C6A6390E9388CDBAD71EAEA698233FE5E04F001E" - "D69102E0F5AC6B6DB8E4D16DA8E18CF46D88CAE3")) - - (for-each-p - "Importing public demo and test keys" - (lambda (file) - (call-check `(, at GPG --yes --import ,(in-srcdir file)))) - (list "pubdemo.asc" "pubring.asc" key-file1)) - - (pipe:do - (pipe:open (in-srcdir "pubring.pkr.asc") (logior O_RDONLY O_BINARY)) - (pipe:spawn `(, at GPG --dearmor)) - (pipe:spawn `(, at GPG --yes --import)))) - -(define (preset-passphrases) - (info "Preset passphrases") - ;; one at example.com - (call-check `(,(tool 'gpg-preset-passphrase) - --preset --passphrase def - "50B2D4FA4122C212611048BC5FC31BD44393626E")) - (call-check `(,(tool 'gpg-preset-passphrase) - --preset --passphrase def - "7E201E28B6FEB2927B321F443205F4724EBE637E")) - ;; alpha at example.net - (call-check `(,(tool 'gpg-preset-passphrase) - --preset --passphrase abc - "76F7E2B35832976B50A27A282D9B87E44577EB66")) - (call-check `(,(tool 'gpg-preset-passphrase) - --preset --passphrase abc - "A0747D5F9425E6664F4FFBEED20FBCA79FDED2BD")) - (echo "All set up.")) - -(cond - ((member "--create-tarball" *args*) - (with-temporary-working-directory - (setenv "GNUPGHOME" (getcwd) #t) - (create-gpghome) - (stop-agent) - (call-check `(,(tool 'gpgtar) --create --output ,(cadr *args*) ".")))) - ((member "--unpack-tarball" *args*) - (call-check `(,(tool 'gpgtar) --extract --directory=. ,(cadr *args*))) - (start-agent) - (preset-passphrases)) - (else - (create-gpghome) - (start-agent) - (preset-passphrases))) +(unless (member "--create-tarball" *args*) + (error "Usage: setup.scm --create-tarball ")) + +(with-temporary-working-directory + (setenv "GNUPGHOME" (getcwd) #t) + (create-gpghome) + (create-legacy-gpghome) + (stop-agent) + (call-check `(,(tool 'gpgtar) --create --output ,(cadr *args*) "."))) diff --git a/tests/openpgp/shell.scm b/tests/openpgp/shell.scm index dadafff..ea4b540 100644 --- a/tests/openpgp/shell.scm +++ b/tests/openpgp/shell.scm @@ -18,6 +18,7 @@ ;; along with this program; if not, see . (load (with-path "defs.scm")) +(setup-environment) ;; This is not a test, but can be used to inspect the test ;; environment. Simply execute diff --git a/tests/openpgp/signencrypt-dsa.scm b/tests/openpgp/signencrypt-dsa.scm index baf1def..c969d2f 100755 --- a/tests/openpgp/signencrypt-dsa.scm +++ b/tests/openpgp/signencrypt-dsa.scm @@ -18,6 +18,7 @@ ;; along with this program; if not, see . (load (with-path "defs.scm")) +(setup-legacy-environment) (for-each-p "Checking signing and encryption using DSA" diff --git a/tests/openpgp/signencrypt.scm b/tests/openpgp/signencrypt.scm index b138dce..b4c3bd6 100755 --- a/tests/openpgp/signencrypt.scm +++ b/tests/openpgp/signencrypt.scm @@ -18,6 +18,7 @@ ;; along with this program; if not, see . (load (with-path "defs.scm")) +(setup-legacy-environment) (for-each-p "Checking signing and encryption" diff --git a/tests/openpgp/sigs-dsa.scm b/tests/openpgp/sigs-dsa.scm index bf5e415..f909078 100755 --- a/tests/openpgp/sigs-dsa.scm +++ b/tests/openpgp/sigs-dsa.scm @@ -18,6 +18,7 @@ ;; along with this program; if not, see . (load (with-path "defs.scm")) +(setup-legacy-environment) (for-each-p "Checking signing using DSA with the default hash algorithm" diff --git a/tests/openpgp/sigs.scm b/tests/openpgp/sigs.scm index c478231..abdcd8f 100755 --- a/tests/openpgp/sigs.scm +++ b/tests/openpgp/sigs.scm @@ -18,6 +18,7 @@ ;; along with this program; if not, see . (load (with-path "defs.scm")) +(setup-legacy-environment) (for-each-p "Checking signing with the default hash algorithm" diff --git a/tests/openpgp/ssh.scm b/tests/openpgp/ssh.scm index 1fe2e5d..a825409 100755 --- a/tests/openpgp/ssh.scm +++ b/tests/openpgp/ssh.scm @@ -18,6 +18,7 @@ ;; along with this program; if not, see . (load (with-path "defs.scm")) +(setup-environment) (define GNUPGHOME (getenv "GNUPGHOME")) (if (string=? "" GNUPGHOME) diff --git a/tests/openpgp/tofu.scm b/tests/openpgp/tofu.scm index 3cca189..91c9e78 100755 --- a/tests/openpgp/tofu.scm +++ b/tests/openpgp/tofu.scm @@ -18,6 +18,7 @@ ;; along with this program; if not, see . (load (with-path "defs.scm")) +(setup-environment) ;; Redefine GPG without --always-trust and a fixed time. (define GPG `(,(tool 'gpg) --no-permission-warning diff --git a/tests/openpgp/use-exact-key.scm b/tests/openpgp/use-exact-key.scm index bec537b..18851da 100755 --- a/tests/openpgp/use-exact-key.scm +++ b/tests/openpgp/use-exact-key.scm @@ -18,6 +18,7 @@ ;; along with this program; if not, see . (load (with-path "defs.scm")) +(setup-legacy-environment) ;; Import the sample key ;; diff --git a/tests/openpgp/verify.scm b/tests/openpgp/verify.scm index eb984b1..2c2c14a 100755 --- a/tests/openpgp/verify.scm +++ b/tests/openpgp/verify.scm @@ -18,6 +18,7 @@ ;; along with this program; if not, see . (load (with-path "defs.scm")) +(setup-legacy-environment) ;; ;; Two simple tests to check that verify fails for bad input data diff --git a/tests/openpgp/version.scm b/tests/openpgp/version.scm index 57efb93..2b211d8 100755 --- a/tests/openpgp/version.scm +++ b/tests/openpgp/version.scm @@ -18,6 +18,7 @@ ;; along with this program; if not, see . (load (with-path "defs.scm")) +(setup-environment) (info "Printing the GPG version") (assert (string-contains? (call-check `(, at GPG --version)) commit ac078469cbafe85cf771fca84f376740850d10b0 Author: Justus Winter Date: Mon Nov 7 14:57:51 2016 +0100 tests: Do not allow tests to be run in a shared environment. * tests/openpgp/README: Update. * tests/openpgp/run-tests.scm (run-tests-parallel-shared): Drop function. (run-tests-parallel-isolated): Rename to 'run-tests-parallel'. (run-tests-sequential-shared): Drop function. (run-tests-sequential-isolated): Rename to 'run-tests-sequential'. Signed-off-by: Justus Winter diff --git a/tests/openpgp/README b/tests/openpgp/README index 75d818e..eba77b1 100644 --- a/tests/openpgp/README +++ b/tests/openpgp/README @@ -36,18 +36,13 @@ below. From your build directory, do: run-tests.scm [test suite runner args] *** Arguments supported by the test suite runner -The test suite runner supports four modes of operation, -{sequential,parallel}x{isolated,shared}. You can select the mode of -operation using a combination of the flags --parallel, --sequential, ---shared, and --isolated. - -By default the tests are run in sequential order, each one in a clean -environment. +The test suite runner supports two modes of operation, '--sequential' +and '--parallel'. By default the tests are run in sequential order, +each one in a clean environment. You can specify the tests to run as positional arguments relative to -srcdir (e.g. just 'version.scm'). By default all tests listed in -run-tests.scm are executed. Note that you do not have to specify -setup.scm and finish.scm, they are executed implicitly. +srcdir (e.g. just 'version.scm'). Note that you do not have to +specify setup.scm and finish.scm, they are executed implicitly. The test suite runner can be executed in any location that the current user can write to. It will create temporary files and directories, diff --git a/tests/openpgp/run-tests.scm b/tests/openpgp/run-tests.scm index 18f8b80..0cee559 100644 --- a/tests/openpgp/run-tests.scm +++ b/tests/openpgp/run-tests.scm @@ -109,18 +109,7 @@ (define (report) (echo (string-append (status retcode) ":") name)))))) -(define (run-tests-parallel-shared setup teardown . tests) - (setup::run-sync) - (let loop ((pool (test-pool::new '())) (tests' tests)) - (if (null? tests') - (let ((results (pool::wait))) - (for-each (lambda (t) (t::report)) results::procs) - (teardown::run-sync) - (exit (results::report))) - (let ((test (car tests'))) - (loop (pool::add (test::run-async)) (cdr tests')))))) - -(define (run-tests-parallel-isolated setup teardown . tests) +(define (run-tests-parallel setup teardown . tests) (lettmp (gpghome-tar) (setup::run-sync '--create-tarball gpghome-tar) (let loop ((pool (test-pool::new '())) (tests' tests)) @@ -140,16 +129,7 @@ (setup'::run-sync-quiet '--unpack-tarball gpghome-tar) (loop (pool::add (test'::run-async)) (cdr tests'))))))) -(define (run-tests-sequential-shared setup teardown . tests) - (let loop ((pool (test-pool::new '())) - (tests' `(,setup , at tests ,teardown))) - (if (null? tests') - (let ((results (pool::wait))) - (exit (results::report))) - (let ((test (car tests'))) - (loop (pool::add (test::run-sync)) (cdr tests')))))) - -(define (run-tests-sequential-isolated setup teardown . tests) +(define (run-tests-sequential setup teardown . tests) (lettmp (gpghome-tar) (setup::run-sync '--create-tarball gpghome-tar) (let loop ((pool (test-pool::new '())) (tests' tests)) @@ -170,12 +150,8 @@ (loop (pool::add (test'::run-sync)) (cdr tests'))))))) (let* ((runner (if (member "--parallel" *args*) - (if (member "--shared" *args*) - run-tests-parallel-shared - run-tests-parallel-isolated) - (if (member "--shared" *args*) - run-tests-sequential-shared - run-tests-sequential-isolated))) + run-tests-parallel + run-tests-sequential)) (tests (filter (lambda (arg) (not (string-prefix? arg "--"))) *args*))) (apply runner (append (list (test::scm "setup.scm") (test::scm "finish.scm")) (map test::scm tests)))) ----------------------------------------------------------------------- Summary of changes: tests/gpgscm/ffi.c | 57 ++++++++++---- tests/gpgscm/lib.scm | 4 + tests/gpgscm/tests.scm | 4 + tests/openpgp/4gb-packet.scm | 1 + tests/openpgp/Makefile.am | 4 +- tests/openpgp/README | 15 ++-- tests/openpgp/armdetach.scm | 1 + tests/openpgp/armdetachm.scm | 1 + tests/openpgp/armencrypt.scm | 1 + tests/openpgp/armencryptp.scm | 1 + tests/openpgp/armor.scm | 1 + tests/openpgp/armsignencrypt.scm | 1 + tests/openpgp/armsigs.scm | 1 + tests/openpgp/clearsig.scm | 1 + tests/openpgp/conventional-mdc.scm | 1 + tests/openpgp/conventional.scm | 1 + tests/openpgp/decrypt-dsa.scm | 1 + tests/openpgp/decrypt.scm | 1 + tests/openpgp/default-key.scm | 1 + tests/openpgp/defs.scm | 130 ++++++++++++++++++++++++++++++- tests/openpgp/detach.scm | 1 + tests/openpgp/detachm.scm | 1 + tests/openpgp/ecc.scm | 1 + tests/openpgp/encrypt-dsa.scm | 1 + tests/openpgp/encrypt.scm | 1 + tests/openpgp/encryptp.scm | 1 + tests/openpgp/export.scm | 1 + tests/openpgp/finish.scm | 22 ------ tests/openpgp/genkey1024.scm | 1 + tests/openpgp/gpgtar.scm | 1 + tests/openpgp/gpgv-forged-keyring.scm | 1 + tests/openpgp/import.scm | 1 + tests/openpgp/issue2015.scm | 1 + tests/openpgp/issue2346.scm | 15 ++-- tests/openpgp/issue2417.scm | 1 + tests/openpgp/issue2419.scm | 1 + tests/openpgp/key-selection.scm | 1 + tests/openpgp/mds.scm | 1 + tests/openpgp/multisig.scm | 1 + tests/openpgp/quick-key-manipulation.scm | 1 + tests/openpgp/run-tests.scm | 77 ++++++------------ tests/openpgp/seat.scm | 1 + tests/openpgp/setup.scm | 122 +++-------------------------- tests/openpgp/shell.scm | 1 + tests/openpgp/signencrypt-dsa.scm | 1 + tests/openpgp/signencrypt.scm | 1 + tests/openpgp/sigs-dsa.scm | 1 + tests/openpgp/sigs.scm | 1 + tests/openpgp/ssh.scm | 1 + tests/openpgp/tofu.scm | 1 + tests/openpgp/use-exact-key.scm | 1 + tests/openpgp/verify.scm | 1 + tests/openpgp/version.scm | 1 + 53 files changed, 262 insertions(+), 231 deletions(-) delete mode 100755 tests/openpgp/finish.scm hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Mon Nov 7 18:17:28 2016 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Mon, 07 Nov 2016 18:17:28 +0100 Subject: [git] GpgOL - branch, nomapi, updated. gpgol-1.4.0-145-g7ba4f6e Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG extension for MS Outlook". The branch, nomapi has been updated via 7ba4f6e43ffc999945f7c9298b44572d237723e4 (commit) from b6b1b43ca1f29bf3afebd53d8afb0b3d7b3e7f4d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 7ba4f6e43ffc999945f7c9298b44572d237723e4 Author: Andre Heinecke Date: Mon Nov 7 18:14:05 2016 +0100 Only close on WM_CLOSE of explorers * src/explorer-events.cpp (EVENT_SINK_INVOKE): Track explorers. * src/gpgoladdin.cpp (install_explorer_sinks): Install sinks. * src/windowmessages.cpp (add_explorer_window) (remove_explorer_window): New. (gpgol_hook): Only react to explorers. -- This prevents mails from beeing closed when they are opened in a reader. Still todo is to close only the mails from the selection of the explorer that is currently closing and only to close all mails if it is the last explorer. diff --git a/src/explorer-events.cpp b/src/explorer-events.cpp index 6336561..c8130a7 100644 --- a/src/explorer-events.cpp +++ b/src/explorer-events.cpp @@ -32,6 +32,7 @@ #include "oomhelp.h" #include "mail.h" #include "gpgoladdin.h" +#include "windowmessages.h" /* Explorer Events */ BEGIN_EVENT_SINK(ExplorerEvents, IDispatch) @@ -76,6 +77,10 @@ EVENT_SINK_INVOKE(ExplorerEvents) { log_oom_extra ("%s:%s: Deleting event handler: %p", SRCNAME, __func__, this); + + HWND hwnd; + ((LPOLEWINDOW)m_object)->GetWindow(&hwnd); + remove_explorer_window (hwnd); delete this; return S_OK; } diff --git a/src/gpgoladdin.cpp b/src/gpgoladdin.cpp index 9e80808..0f43663 100644 --- a/src/gpgoladdin.cpp +++ b/src/gpgoladdin.cpp @@ -407,6 +407,9 @@ install_explorer_sinks (LPDISPATCH application) log_oom_extra ("%s:%s: created sink %p for explorer %i", SRCNAME, __func__, sink, i); } + HWND hwnd; + ((LPOLEWINDOW)explorer)->GetWindow(&hwnd); + add_explorer_window (hwnd); gpgol_release (explorer); } /* Now install the event sink to handle new explorers */ diff --git a/src/windowmessages.cpp b/src/windowmessages.cpp index 585d0d0..a650810 100644 --- a/src/windowmessages.cpp +++ b/src/windowmessages.cpp @@ -182,6 +182,21 @@ do_in_ui_thread (gpgol_wmsg_type type, void *data) return ctx.err; } +static std::vector explorers; + +void +add_explorer_window (HWND hwnd) +{ + explorers.push_back (hwnd); +} + +void remove_explorer_window (HWND hwnd) +{ + explorers.erase(std::remove(explorers.begin(), + explorers.end(), + hwnd), + explorers.end()); +} LRESULT CALLBACK gpgol_hook(int code, WPARAM wParam, LPARAM lParam) @@ -192,11 +207,30 @@ gpgol_hook(int code, WPARAM wParam, LPARAM lParam) before it reaches outlook. */ LPCWPSTRUCT cwp = (LPCWPSTRUCT) lParam; - if (cwp->message == WM_CLOSE) + switch (cwp->message) { - log_debug ("%s:%s: WM_CLOSE windowmessage. Closing all mails.", - SRCNAME, __func__); - Mail::revert_all_mails(); + case WM_CLOSE: + { + if (std::find(explorers.begin(), explorers.end(), cwp->hwnd) == explorers.end()) + { + /* Not an explorer window */ + break; + } + log_debug ("%s:%s: WM_CLOSE windowmessage for explorer. " + "Closing all mails.", + SRCNAME, __func__); + Mail::close_all_mails(); + } + case WM_SYSCOMMAND: + if (cwp->wParam == SC_CLOSE) + { + log_debug ("%s:%s: SC_CLOSE syscommand. Closing all mails.", + SRCNAME, __func__); + Mail::close_all_mails(); + } + break; + default: + break; } return CallNextHookEx (NULL, code, wParam, lParam); } diff --git a/src/windowmessages.h b/src/windowmessages.h index c7f275e..0af0a3c 100644 --- a/src/windowmessages.h +++ b/src/windowmessages.h @@ -71,4 +71,7 @@ do_in_ui_thread (gpgol_wmsg_type type, void *data); HHOOK create_message_hook(); +void add_explorer_window (HWND hwnd); +void remove_explorer_window (HWND hwnd); + #endif // WINDOWMESSAGES_H ----------------------------------------------------------------------- Summary of changes: src/explorer-events.cpp | 5 +++++ src/gpgoladdin.cpp | 3 +++ src/windowmessages.cpp | 42 ++++++++++++++++++++++++++++++++++++++---- src/windowmessages.h | 3 +++ 4 files changed, 49 insertions(+), 4 deletions(-) hooks/post-receive -- GnuPG extension for MS Outlook http://git.gnupg.org From cvs at cvs.gnupg.org Tue Nov 8 16:18:38 2016 From: cvs at cvs.gnupg.org (by Justus Winter) Date: Tue, 08 Nov 2016 16:18:38 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.1.15-342-g1062953 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via 1062953d5132af674aacfc6372e3e9f066c5d145 (commit) via 2a7615c48ed79e6b28710cc293ce30c812b2e5b0 (commit) via 4dd4801bfa4c3f7ba279b3d171a8ed299dbffaaa (commit) via 591d61d80f4f81176f7e236df794922df9e001a1 (commit) via d4454837cd60981c2863955b11c9e1cc8f9e3833 (commit) via dd13b2a561e31045fd3d3576bab99543cd4eb6cc (commit) via 7cbb0803847b8db618d39ff50ae6015e409ab1ae (commit) from 26df829fa22f027ca4a5eaf155cdaa2123afbdd5 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 1062953d5132af674aacfc6372e3e9f066c5d145 Author: Justus Winter Date: Tue Nov 8 16:15:32 2016 +0100 tests: Fix environment setup. * tests/openpgp/defs.scm (setup-legacy-environment): Do not call 'setup-environment' because that will start the agent, and hence register the atexit function twice. Fixes: a55393cb5f4b331cb3a715c7d9a8b91f7606f337 Signed-off-by: Justus Winter diff --git a/tests/openpgp/defs.scm b/tests/openpgp/defs.scm index 09c313b..e91902c 100644 --- a/tests/openpgp/defs.scm +++ b/tests/openpgp/defs.scm @@ -256,13 +256,12 @@ ;; Initialize the test environment, install appropriate configuration ;; and start the agent, with the keys from the legacy test suite. (define (setup-legacy-environment) - (setup-environment) + (create-gpghome) (if (member "--unpack-tarball" *args*) (begin (call-check `(,(tool 'gpgtar) --extract --directory=. ,(cadr *args*))) (start-agent)) (begin - (create-gpghome) (start-agent) (create-legacy-gpghome))) (preset-passphrases)) commit 2a7615c48ed79e6b28710cc293ce30c812b2e5b0 Author: Justus Winter Date: Tue Nov 8 15:54:56 2016 +0100 tests: Log and display output from tests when run in parallel. * tests/openpgp/run-tests.scm (test): Add field 'logfd'. (test::new, test::set-*): Adapt accordingly. (test::set-logfd): New function. (test::open-log-file): Likewise. (test::run-sync): Use the new function. (test::run-async): Likewise. (test::report): Replay the log. (run-tests-parallel): Reverse the results to restore the original order. Signed-off-by: Justus Winter diff --git a/tests/openpgp/run-tests.scm b/tests/openpgp/run-tests.scm index 23ff8a2..90879a6 100644 --- a/tests/openpgp/run-tests.scm +++ b/tests/openpgp/run-tests.scm @@ -73,18 +73,23 @@ (package (define (scm name . args) (new name #f `(,*argv0* ,@(verbosity (*verbose*)) , at args - ,(in-srcdir name)) #f #f)) - (define (new name directory command pid retcode) + ,(in-srcdir name)) #f #f CLOSED_FD)) + (define (new name directory command pid retcode logfd) (package (define (set-directory x) - (new name x command pid retcode)) + (new name x command pid retcode logfd)) (define (set-retcode x) - (new name directory command pid x)) + (new name directory command pid x logfd)) (define (set-pid x) - (new name directory command x retcode)) + (new name directory command x retcode logfd)) + (define (set-logfd x) + (new name directory command pid retcode x)) + (define (open-log-file) + (let ((filename (string-append name ".log"))) + (catch '() (unlink filename)) + (open filename (logior O_RDWR O_BINARY O_CREAT) #o600))) (define (run-sync . args) - (letfd ((log (open (string-append name ".log") - (logior O_WRONLY O_BINARY O_CREAT) #o600))) + (letfd ((log (open-log-file))) (with-working-directory directory (let* ((p (inbound-pipe)) (pid (spawn-process-fd (append command args) 0 @@ -102,13 +107,19 @@ name (spawn-process-fd (append command args) CLOSED_FD CLOSED_FD CLOSED_FD) #t)))) (define (run-async . args) - (with-working-directory directory - (set-pid (spawn-process-fd (append command args) - CLOSED_FD CLOSED_FD CLOSED_FD)))) + (let ((log (open-log-file))) + (with-working-directory directory + (new name directory command + (spawn-process-fd (append command args) CLOSED_FD log log) + retcode log)))) (define (status) (let ((t (assoc retcode '((0 "PASS") (77 "SKIP") (99 "ERROR"))))) (if (not t) "FAIL" (cadr t)))) (define (report) + (unless (= logfd CLOSED_FD) + (seek logfd 0 SEEK_SET) + (splice logfd STDERR_FILENO) + (close logfd)) (echo (string-append (status retcode) ":") name)))))) (define (run-tests-parallel setup tests) @@ -120,7 +131,7 @@ (for-each (lambda (t) (catch (echo "Removing" t::directory "failed:" *error*) (unlink-recursively t::directory)) - (t::report)) results::procs) + (t::report)) (reverse results::procs)) (exit (results::report))) (let* ((wd (mkdtemp)) (test (car tests')) commit 4dd4801bfa4c3f7ba279b3d171a8ed299dbffaaa Author: Justus Winter Date: Tue Nov 8 15:38:17 2016 +0100 tests: Simplify test. * tests/openpgp/issue2417.scm: Simplify. Signed-off-by: Justus Winter diff --git a/tests/openpgp/issue2417.scm b/tests/openpgp/issue2417.scm index 5f70e08..f584000 100755 --- a/tests/openpgp/issue2417.scm +++ b/tests/openpgp/issue2417.scm @@ -18,27 +18,15 @@ ;; along with this program; if not, see . (load (with-path "defs.scm")) -(setup-legacy-environment) +(setup-environment) -(define old-home (getenv "GNUPGHOME")) +(define keyfile (in-srcdir "samplekeys" "rsa-rsa-sample-1.asc")) (define (touch file-name) (close (open file-name (logior O_WRONLY O_BINARY O_CREAT) #o600))) (info "Checking robustness wrt empty databases in gnupghome (issue2417)...") - -(lettmp - ;; Prepare some random key to import later. - (keyfile) - (pipe:do - (pipe:gpg '(--export alpha)) - (pipe:write-to keyfile (logior O_WRONLY O_BINARY O_CREAT) #o600)) - - (with-temporary-working-directory - (file-copy (path-join old-home "gpg.conf") "gpg.conf") - (file-copy (path-join old-home "gpg-agent.conf") "gpg-agent.conf") - (setenv "GNUPGHOME" "." #t) - (touch "trustdb.gpg") - (touch "pubring.gpg") - (touch "pubring.kbx") - (call-check `(,(tool 'GPG) --import ,keyfile)))) +(touch "trustdb.gpg") +(touch "pubring.gpg") +(touch "pubring.kbx") +(call-check `(,(tool 'GPG) --import ,keyfile)) commit 591d61d80f4f81176f7e236df794922df9e001a1 Author: Justus Winter Date: Tue Nov 8 15:11:12 2016 +0100 gpgscm: Expose seek and associated constants. * tests/gpgscm/ffi.c (do_seek): New function. (ffi_init): Expose 'seek' and 'SEEK_{SET,CUR,END}'. * tests/gpgscm/lib.scm: Document the new function. Signed-off-by: Justus Winter diff --git a/tests/gpgscm/ffi.c b/tests/gpgscm/ffi.c index add82f7..c91d4aa 100644 --- a/tests/gpgscm/ffi.c +++ b/tests/gpgscm/ffi.c @@ -326,6 +326,21 @@ do_close (scheme *sc, pointer args) } static pointer +do_seek (scheme *sc, pointer args) +{ + FFI_PROLOG (); + int fd; + off_t offset; + int whence; + FFI_ARG_OR_RETURN (sc, int, fd, number, args); + FFI_ARG_OR_RETURN (sc, off_t, offset, number, args); + FFI_ARG_OR_RETURN (sc, int, whence, number, args); + FFI_ARGS_DONE_OR_RETURN (sc, args); + FFI_RETURN_ERR (sc, lseek (fd, offset, whence) == (off_t) -1 + ? gpg_error_from_syserror () : 0); +} + +static pointer do_mkdtemp (scheme *sc, pointer args) { FFI_PROLOG (); @@ -1309,6 +1324,9 @@ ffi_init (scheme *sc, const char *argv0, const char *scriptname, ffi_define_constant (sc, STDIN_FILENO); ffi_define_constant (sc, STDOUT_FILENO); ffi_define_constant (sc, STDERR_FILENO); + ffi_define_constant (sc, SEEK_SET); + ffi_define_constant (sc, SEEK_CUR); + ffi_define_constant (sc, SEEK_END); ffi_define_function (sc, sleep); ffi_define_function (sc, usleep); @@ -1320,6 +1338,7 @@ ffi_init (scheme *sc, const char *argv0, const char *scriptname, ffi_define_function (sc, open); ffi_define_function (sc, fdopen); ffi_define_function (sc, close); + ffi_define_function (sc, seek); ffi_define_function_name (sc, "_mkdtemp", mkdtemp); ffi_define_function (sc, unlink); ffi_define_function (sc, unlink_recursively); diff --git a/tests/gpgscm/lib.scm b/tests/gpgscm/lib.scm index 27779e2..4e19eae 100644 --- a/tests/gpgscm/lib.scm +++ b/tests/gpgscm/lib.scm @@ -204,6 +204,14 @@ ;; Libc functions. ;; +;; Change the read/write offset. +(ffi-define (seek fd offset whence)) + +;; Constants for WHENCE. +(ffi-define SEEK_SET) +(ffi-define SEEK_CUR) +(ffi-define SEEK_END) + ;; Get our process id. (ffi-define (getpid)) commit d4454837cd60981c2863955b11c9e1cc8f9e3833 Author: Justus Winter Date: Tue Nov 8 14:47:43 2016 +0100 gpgscm: Fix error message. * tests/gpgscm/ffi.c (do_wait_processes): Fix and improve error messages. Signed-off-by: Justus Winter diff --git a/tests/gpgscm/ffi.c b/tests/gpgscm/ffi.c index d4bf3ef..add82f7 100644 --- a/tests/gpgscm/ffi.c +++ b/tests/gpgscm/ffi.c @@ -48,6 +48,20 @@ #include "ffi.h" #include "ffi-private.h" +/* For use in nice error messages. */ +static const char * +ordinal_suffix (int n) +{ + switch (n) + { + case 1: return "st"; + case 2: return "nd"; + case 3: return "rd"; + default: return "th"; + } + assert (! "reached"); +} + int @@ -827,17 +841,19 @@ do_wait_processes (scheme *sc, pointer args) err = ffi_list2argv (sc, list_names, &names, &count); if (err == gpg_error (GPG_ERR_INV_VALUE)) - return ffi_sprintf (sc, "%luth element of first argument is " + return ffi_sprintf (sc, "%lu%s element of first argument is " "neither string nor symbol", - (unsigned long) count); + (unsigned long) count, + ordinal_suffix ((int) count)); if (err) FFI_RETURN_ERR (sc, err); err = ffi_list2intv (sc, list_pids, (int **) &pids, &count); if (err == gpg_error (GPG_ERR_INV_VALUE)) - return ffi_sprintf (sc, "%luth element of second argument is " - "neither string nor symbol", - (unsigned long) count); + return ffi_sprintf (sc, "%lu%s element of second argument is " + "not a number", + (unsigned long) count, + ordinal_suffix ((int) count)); if (err) FFI_RETURN_ERR (sc, err); @@ -995,19 +1011,6 @@ do_file_equal (scheme *sc, pointer args) goto out; } -static const char * -ordinal_suffix (int n) -{ - switch (n) - { - case 1: return "st"; - case 2: return "nd"; - case 3: return "rd"; - default: return "th"; - } - assert (! "reached"); -} - static pointer do_splice (scheme *sc, pointer args) { commit dd13b2a561e31045fd3d3576bab99543cd4eb6cc Author: Justus Winter Date: Tue Nov 8 14:11:23 2016 +0100 tests,w32: Make cleanup more robust. * tests/openpgp/run-tests.scm (run-tests-parallel): Catch errors when removing the working directory. On Windows this can fail if there is still a process using one of the files there. (run-tests-sequential): Likewise. Signed-off-by: Justus Winter diff --git a/tests/openpgp/run-tests.scm b/tests/openpgp/run-tests.scm index 9e9bc3d..23ff8a2 100644 --- a/tests/openpgp/run-tests.scm +++ b/tests/openpgp/run-tests.scm @@ -118,7 +118,8 @@ (if (null? tests') (let ((results (pool::wait))) (for-each (lambda (t) - (unlink-recursively t::directory) + (catch (echo "Removing" t::directory "failed:" *error*) + (unlink-recursively t::directory)) (t::report)) results::procs) (exit (results::report))) (let* ((wd (mkdtemp)) @@ -134,7 +135,8 @@ (if (null? tests') (let ((results (pool::wait))) (for-each (lambda (t) - (unlink-recursively t::directory)) + (catch (echo "Removing" t::directory "failed:" *error*) + (unlink-recursively t::directory))) results::procs) (exit (results::report))) (let* ((wd (mkdtemp)) commit 7cbb0803847b8db618d39ff50ae6015e409ab1ae Author: Justus Winter Date: Tue Nov 8 14:05:46 2016 +0100 common,w32: Simplify locking. * common/asshelp.c (lock_spawning): Use the same code on Windows that we use on all other platforms. (unlock_spawning): Likewise. Signed-off-by: Justus Winter diff --git a/common/asshelp.c b/common/asshelp.c index f8c3237..2cab310 100644 --- a/common/asshelp.c +++ b/common/asshelp.c @@ -267,48 +267,7 @@ static gpg_error_t lock_spawning (lock_spawn_t *lock, const char *homedir, const char *name, int verbose) { -#ifdef HAVE_W32_SYSTEM - int waitrc; - int timeout = (!strcmp (name, "agent") - ? SECS_TO_WAIT_FOR_AGENT - : SECS_TO_WAIT_FOR_DIRMNGR); - - (void)homedir; /* Not required. */ - - *lock = CreateMutexW - (NULL, FALSE, - !strcmp (name, "agent")? L"spawn_"GNUPG_NAME"_agent_sentinel": - !strcmp (name, "dirmngr")? L"spawn_"GNUPG_NAME"_dirmngr_sentinel": - /* */ L"spawn_"GNUPG_NAME"_unknown_sentinel"); - if (!*lock) - { - log_error ("failed to create the spawn_%s mutex: %s\n", - name, w32_strerror (-1)); - return gpg_error (GPG_ERR_GENERAL); - } - - retry: - waitrc = WaitForSingleObject (*lock, 1000); - if (waitrc == WAIT_OBJECT_0) - return 0; - - if (waitrc == WAIT_TIMEOUT && timeout) - { - timeout--; - if (verbose) - log_info ("another process is trying to start the %s ... (%ds)\n", - name, timeout); - goto retry; - } - if (waitrc == WAIT_TIMEOUT) - log_info ("error waiting for the spawn_%s mutex: timeout\n", name); - else - log_info ("error waiting for the spawn_%s mutex: (code=%d) %s\n", - name, waitrc, w32_strerror (-1)); - return gpg_error (GPG_ERR_GENERAL); -#else /*!HAVE_W32_SYSTEM*/ char *fname; - (void)verbose; *lock = NULL; @@ -333,7 +292,6 @@ lock_spawning (lock_spawn_t *lock, const char *homedir, const char *name, return gpg_error_from_syserror (); return 0; -#endif /*!HAVE_W32_SYSTEM*/ } @@ -343,15 +301,8 @@ unlock_spawning (lock_spawn_t *lock, const char *name) { if (*lock) { -#ifdef HAVE_W32_SYSTEM - if (!ReleaseMutex (*lock)) - log_error ("failed to release the spawn_%s mutex: %s\n", - name, w32_strerror (-1)); - CloseHandle (*lock); -#else /*!HAVE_W32_SYSTEM*/ (void)name; dotlock_destroy (*lock); -#endif /*!HAVE_W32_SYSTEM*/ *lock = NULL; } } ----------------------------------------------------------------------- Summary of changes: common/asshelp.c | 49 -------------------------------------- tests/gpgscm/ffi.c | 58 +++++++++++++++++++++++++++++++-------------- tests/gpgscm/lib.scm | 8 +++++++ tests/openpgp/defs.scm | 3 +-- tests/openpgp/issue2417.scm | 24 +++++-------------- tests/openpgp/run-tests.scm | 39 ++++++++++++++++++++---------- 6 files changed, 81 insertions(+), 100 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Tue Nov 8 18:16:24 2016 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Tue, 08 Nov 2016 18:16:24 +0100 Subject: [git] GpgOL - branch, nomapi, updated. gpgol-1.4.0-146-gfd27fa2 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG extension for MS Outlook". The branch, nomapi has been updated via fd27fa2fc04ba2172e4007b472d000153286b311 (commit) from 7ba4f6e43ffc999945f7c9298b44572d237723e4 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit fd27fa2fc04ba2172e4007b472d000153286b311 Author: Andre Heinecke Date: Tue Nov 8 18:13:35 2016 +0100 Only decrypt / verify one mail at once * src/mail.cpp (do_parsing): Lock parsing -- This fixes some threading problems when there were very quick mail switches but it also makes the code more stable and improves performance as it filters out parser calls for mails that were already unloaded. diff --git a/src/mail.cpp b/src/mail.cpp index 4f8fb7b..a727b23 100644 --- a/src/mail.cpp +++ b/src/mail.cpp @@ -39,6 +39,7 @@ #include #include #include +#include #include #include @@ -460,10 +461,12 @@ add_attachments(LPDISPATCH mail, return 0; } +GPGRT_LOCK_DEFINE(parser_lock); + static DWORD WINAPI do_parsing (LPVOID arg) { - log_debug ("%s:%s: starting the parser for: %p", + log_debug ("%s:%s: preparing the parser for: %p", SRCNAME, __func__, arg); Mail *mail = (Mail *)arg; @@ -474,8 +477,22 @@ do_parsing (LPVOID arg) SRCNAME, __func__, arg); return -1; } - parser->parse(); - do_in_ui_thread (PARSING_DONE, arg); + gpgrt_lock_lock (&parser_lock); + /* Serialize here to avoid too many + decryption attempts if there are + multiple mailobjects which might have already + been deleted (e.g. by quick switches of the mailview. */ + if (Mail::is_valid_ptr (mail)) + { + parser->parse(); + do_in_ui_thread (PARSING_DONE, arg); + } + else + { + log_debug ("%s:%s: canceling parsing for: %p already deleted", + SRCNAME, __func__, arg); + } + gpgrt_lock_unlock (&parser_lock); return 0; } ----------------------------------------------------------------------- Summary of changes: src/mail.cpp | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) hooks/post-receive -- GnuPG extension for MS Outlook http://git.gnupg.org From cvs at cvs.gnupg.org Tue Nov 8 22:04:14 2016 From: cvs at cvs.gnupg.org (by Daniel Kahn Gillmor) Date: Tue, 08 Nov 2016 22:04:14 +0100 Subject: [git] Pinentry - branch, master, updated. pinentry-0.9.7-53-gcf8885f Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The standard pinentry collection". The branch, master has been updated via cf8885fd5a61654a164f470fa3e7095b8e424258 (commit) from 8f51108a17d0080c33fae182f1e4b9259f10a9e5 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit cf8885fd5a61654a164f470fa3e7095b8e424258 Author: Daniel Kahn Gillmor Date: Tue Nov 8 14:37:25 2016 -0600 gnome3: Tighten up error messages when GNOME screensaver is absent. * gnome3/pinentry-gnome3.c (pe_gnome_screen_locked): clean up error messages when GNOME screensaver is absent or misbehaving. -- Signed-off-by: Daniel Kahn Gillmor diff --git a/gnome3/pinentry-gnome3.c b/gnome3/pinentry-gnome3.c index f9c9262..a040f9b 100644 --- a/gnome3/pinentry-gnome3.c +++ b/gnome3/pinentry-gnome3.c @@ -446,9 +446,12 @@ pe_gnome_screen_locked (void) g_object_unref(dbus); if (!reply) { - fprintf (stderr, "failed to get reply (%d): %s", - error ? error->code : -1, - error ? error->message : ""); + /* G_IO_ERROR_TIMED_OUT is the expected response when there is + * no gnome screensaver at all, don't be noisy in that case: */ + if (!(error && error->code == G_IO_ERROR_TIMED_OUT)) + fprintf (stderr, "Failed to get d-bus reply for org.gnome.ScreenSaver.GetActive (%d): %s\n", + error ? error->code : -1, + error ? error->message : ""); if (error) g_error_free (error); return FALSE; @@ -456,7 +459,7 @@ pe_gnome_screen_locked (void) reply_bool = g_variant_get_child_value (reply, 0); if (!reply_bool) { - fprintf (stderr, "failed to get boolean from reply\n"); + fprintf (stderr, "Failed to get d-bus boolean from org.gnome.ScreenSaver.GetActive; assuming screensaver is not locked\n"); ret = FALSE; } else ----------------------------------------------------------------------- Summary of changes: gnome3/pinentry-gnome3.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) hooks/post-receive -- The standard pinentry collection http://git.gnupg.org From cvs at cvs.gnupg.org Wed Nov 9 08:36:55 2016 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Wed, 09 Nov 2016 08:36:55 +0100 Subject: [git] GPGME - branch, master, updated. gpgme-1.7.1-23-g10f2e1c Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 10f2e1c30be651e74a03f4563a9f212d7416adb3 (commit) from 3509cf2f9846360848b6c08d36cbca18373c935e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 10f2e1c30be651e74a03f4563a9f212d7416adb3 Author: Werner Koch Date: Wed Nov 9 08:33:02 2016 +0100 w32: Better protect the IO-system's fd_table * src/w32-io.c (fd_table_lock): New. (new_fd): Lock allocation of a new slot. (release_fd): Lock deallocation of a slot. -- Note that we lock only the allocation but not the sanitiy checks we do further down in the code. Signed-off-by: Werner Koch diff --git a/src/w32-io.c b/src/w32-io.c index 3a69541..0d1c810 100644 --- a/src/w32-io.c +++ b/src/w32-io.c @@ -84,6 +84,7 @@ static struct duplicates works just fine. */ int dup_from; } fd_table[MAX_SLAFD]; +DEFINE_STATIC_LOCK (fd_table_lock); /* Returns the FD or -1 on resource limit. */ @@ -92,6 +93,8 @@ new_fd (void) { int idx; + LOCK (fd_table_lock); + for (idx = 0; idx < MAX_SLAFD; idx++) if (! fd_table[idx].used) break; @@ -99,14 +102,18 @@ new_fd (void) if (idx == MAX_SLAFD) { gpg_err_set_errno (EIO); - return -1; + idx = -1; + } + else + { + fd_table[idx].used = 1; + fd_table[idx].handle = INVALID_HANDLE_VALUE; + fd_table[idx].socket = INVALID_SOCKET; + fd_table[idx].rvid = 0; + fd_table[idx].dup_from = -1; } - fd_table[idx].used = 1; - fd_table[idx].handle = INVALID_HANDLE_VALUE; - fd_table[idx].socket = INVALID_SOCKET; - fd_table[idx].rvid = 0; - fd_table[idx].dup_from = -1; + UNLOCK (fd_table_lock); return idx; } @@ -115,14 +122,21 @@ new_fd (void) void release_fd (int fd) { - if (fd < 0 || fd >= MAX_SLAFD || !fd_table[fd].used) + if (fd < 0 || fd >= MAX_SLAFD) return; - fd_table[fd].used = 0; - fd_table[fd].handle = INVALID_HANDLE_VALUE; - fd_table[fd].socket = INVALID_SOCKET; - fd_table[fd].rvid = 0; - fd_table[fd].dup_from = -1; + LOCK (fd_table_lock); + + if (fd_table[fd].used) + { + fd_table[fd].used = 0; + fd_table[fd].handle = INVALID_HANDLE_VALUE; + fd_table[fd].socket = INVALID_SOCKET; + fd_table[fd].rvid = 0; + fd_table[fd].dup_from = -1; + } + + UNLOCK (fd_table_lock); } ----------------------------------------------------------------------- Summary of changes: src/w32-io.c | 38 ++++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Wed Nov 9 09:09:05 2016 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Wed, 09 Nov 2016 09:09:05 +0100 Subject: [git] ADNS-g10 - branch, master, updated. adns-1.4-g10-6-21-g92b7fed Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "ADNS migrated to autotools/libtool". The branch, master has been updated via 92b7fed7d65ba98c2d8736a692708b2f0597f6c5 (commit) from 9b21d214642b2a6ba43809369118722f2fa86415 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 92b7fed7d65ba98c2d8736a692708b2f0597f6c5 Author: Werner Koch Date: Wed Nov 9 09:06:29 2016 +0100 Catch network failures from sendto earlier. * src/adns.h (adns_s_netunreach): New. (adns_s_netdown): New. * src/general.c (struct sinfo): Add corresponding strings. * src/transmit.c (adns__query_send): Bail out early on ENETUNREACH and ENETDOWN. -- This patch will stop retrying sending UDP packets to an IP address for which the sever can't reach the network or the interface is down. A common case for these errors are lost network connections (WLAN lost or cable unplugged). It does not make sense to keep on trying once sendto returned one of these errors - it is unlikely that this will be solved within the next 30 seconds (15 retries * 2s) Signed-off-by: Werner Koch diff --git a/src/adns.h b/src/adns.h index 9fe9a9a..ac62b9a 100644 --- a/src/adns.h +++ b/src/adns.h @@ -254,6 +254,8 @@ typedef enum { adns_s_norecurse, adns_s_invalidresponse, adns_s_unknownformat, + adns_s_netunreach, + adns_s_netdown, adns_s_max_remotefail= 59, diff --git a/src/general.c b/src/general.c index a65fc8f..a6b7871 100644 --- a/src/general.c +++ b/src/general.c @@ -8,20 +8,20 @@ * Copyright (C) 1999-2000,2003,2006 Tony Finch * Copyright (C) 1991 Massachusetts Institute of Technology * (See the file INSTALL for full details.) - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. - * + * * This program 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 General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include @@ -53,7 +53,7 @@ void adns__vdiag(adns_state ads, const char *pfx, adns_initflags prevent, int serv, adns_query qu, const char *fmt, va_list al) { const char *bef, *aft; vbuf vb; - + if (!ads->logfn || (!(ads->iflags & adns_if_debug) && (!prevent || (ads->iflags & prevent)))) @@ -82,7 +82,7 @@ void adns__vdiag(adns_state ads, const char *pfx, adns_initflags prevent, bef=", "; aft=")\n"; adns__vbuf_free(&vb); } - + if (serv>=0) { adns__lprintf(ads,"%sNS=%s",bef,inet_ntoa(ads->servers[serv].addr)); bef=", "; aft=")\n"; @@ -164,7 +164,7 @@ adns_status adns_rr_info(adns_rrtype type, if (len_r) *len_r= typei->rrsz; if (!datap) return adns_s_ok; - + adns__vbuf_init(&vb); st= typei->convstring(&vb,datap); if (st) goto x_freevb; @@ -188,33 +188,35 @@ static const struct sinfo { const char *string; } sinfos[]= { SINFO( ok, "OK" ), - + SINFO( nomemory, "Out of memory" ), SINFO( unknownrrtype, "Query not implemented in DNS library" ), SINFO( systemfail, "General resolver or system failure" ), - + SINFO( timeout, "DNS query timed out" ), SINFO( allservfail, "All nameservers failed" ), SINFO( norecurse, "Recursion denied by nameserver" ), SINFO( invalidresponse, "Nameserver sent bad response" ), SINFO( unknownformat, "Nameserver used unknown format" ), - + SINFO( netunreach, "Network is unreachable" ), + SINFO( netdown, "Network is down" ), + SINFO( rcodeservfail, "Nameserver reports failure" ), SINFO( rcodeformaterror, "Query not understood by nameserver" ), SINFO( rcodenotimplemented, "Query not implemented by nameserver" ), SINFO( rcoderefused, "Query refused by nameserver" ), SINFO( rcodeunknown, "Nameserver sent unknown response code" ), - + SINFO( inconsistent, "Inconsistent resource records in DNS" ), SINFO( prohibitedcname, "DNS alias found where canonical name wanted" ), SINFO( answerdomaininvalid, "Found syntactically invalid domain name" ), SINFO( answerdomaintoolong, "Found overly-long domain name" ), SINFO( invaliddata, "Found invalid DNS data" ), - + SINFO( querydomainwrong, "Domain invalid for particular DNS query type" ), SINFO( querydomaininvalid, "Domain name is syntactically invalid" ), SINFO( querydomaintoolong, "Domain name or component is too long" ), - + SINFO( nxdomain, "No such domain" ), SINFO( nodata, "No such data" ) }; @@ -275,7 +277,7 @@ static int sti_compar(const void *key, const void *elem) { here= *st; min= (sti==stinfos) ? 0 : sti[-1].stmax+1; max= sti->stmax; - + return here < min ? -1 : here > max ? 1 : 0; } @@ -311,7 +313,7 @@ void adns__isort(void *array, int nobjs, int sz, void *tempbuf, void adns__sigpipe_protect(adns_state ads) { #ifdef HAVE_W32_SYSTEM /* No SIGPIPE under Windows. */ - (void)ads; + (void)ads; #else sigset_t toblock; struct sigaction sa; @@ -325,7 +327,7 @@ void adns__sigpipe_protect(adns_state ads) { sa.sa_handler= SIG_IGN; sigfillset(&sa.sa_mask); sa.sa_flags= 0; - + r= sigprocmask(SIG_SETMASK,&toblock,&ads->stdsigmask); assert(!r); r= sigaction(SIGPIPE,&sa,&ads->stdsigpipe); assert(!r); #endif @@ -334,7 +336,7 @@ void adns__sigpipe_protect(adns_state ads) { void adns__sigpipe_unprotect(adns_state ads) { #ifdef HAVE_W32_SYSTEM /* No SIGPIPE under Windows. */ - (void)ads; + (void)ads; #else int r; diff --git a/src/transmit.c b/src/transmit.c index d070ecc..61ecb08 100644 --- a/src/transmit.c +++ b/src/transmit.c @@ -9,20 +9,20 @@ * Copyright (C) 1999-2000,2003,2006 Tony Finch * Copyright (C) 1991 Massachusetts Institute of Technology * (See the file INSTALL for full details.) - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. - * + * * This program 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 General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include @@ -44,12 +44,12 @@ static adns_status mkquery_header(adns_state ads, vbuf *vb, int *id_r, int qdlen) { int id; byte *rqp; - + if (!adns__vbuf_ensure(vb,DNS_HDRSIZE+qdlen+4)) return adns_s_nomemory; vb->used= 0; MKQUERY_START(vb); - + *id_r= id= (ads->nextid++) & 0x0ffff; MKQUERY_ADDW(id); MKQUERY_ADDB(0x01); /* QR=Q(0), OPCODE=QUERY(0000), !AA, !TC, RD */ @@ -60,7 +60,7 @@ static adns_status mkquery_header(adns_state ads, vbuf *vb, MKQUERY_ADDW(0); /* ARCOUNT=0 */ MKQUERY_STOP(vb); - + return adns_s_ok; } @@ -72,7 +72,7 @@ static adns_status mkquery_footer(vbuf *vb, adns_rrtype type) { MKQUERY_ADDW(DNS_CLASS_IN); /* QCLASS=IN */ MKQUERY_STOP(vb); assert(vb->used <= vb->avail); - + return adns_s_ok; } @@ -86,7 +86,7 @@ adns_status adns__qdpl_normal(adns_state ads, ll= 0; p= *p_io; - + while (p!=pe && (c= *p++)!='.') { if (c=='\\') { if (!(flags & adns_qf_quoteok_query)) return adns_s_querydomaininvalid; @@ -114,7 +114,7 @@ adns_status adns__qdpl_normal(adns_state ads, if (ll == *ll_io) return adns_s_querydomaininvalid; label_r[ll++]= c; } - + *p_io= p; *ll_io= ll; return adns_s_ok; @@ -131,7 +131,7 @@ adns_status adns__mkquery(adns_state ads, vbuf *vb, int *id_r, adns_status st; st= mkquery_header(ads,vb,id_r,ol+2); if (st) return st; - + MKQUERY_START(vb); p= owner; pe= owner+ol; @@ -151,9 +151,9 @@ adns_status adns__mkquery(adns_state ads, vbuf *vb, int *id_r, MKQUERY_ADDB(0); MKQUERY_STOP(vb); - + st= mkquery_footer(vb,type); - + return adns_s_ok; } @@ -182,9 +182,9 @@ adns_status adns__mkquery_frdgram(adns_state ads, vbuf *vb, int *id_r, MKQUERY_ADDB(0); MKQUERY_STOP(vb); - + st= mkquery_footer(vb,type); - + return adns_s_ok; } @@ -274,17 +274,24 @@ void adns__query_send(adns_query qu, struct timeval now) { servaddr.sin_family= AF_INET; servaddr.sin_addr= ads->servers[serv].addr; servaddr.sin_port= htons(DNS_PORT); - + r= adns__sock_sendto(ads->udpsocket,qu->query_dgram,qu->query_dglen,0, (const struct sockaddr*)&servaddr,sizeof(servaddr)); - if (r<0 && errno == EMSGSIZE) { - qu->retries= 0; - query_usetcp(qu,now); - return; + if (r<0) { + if (errno == EMSGSIZE) { + qu->retries= 0; + query_usetcp(qu,now); + return; + } else if (errno == ENETUNREACH) { + adns__query_fail(qu,adns_s_netunreach); + return; + } else if (errno == ENETDOWN) { + adns__query_fail(qu,adns_s_netdown); + return; + } else if (errno != EAGAIN) + adns__warn(ads,serv,0,"sendto failed: %s",strerror(errno)); } - if (r<0 && errno != EAGAIN) - adns__warn(ads,serv,0,"sendto failed: %s",strerror(errno)); - + qu->timeout= now; timevaladd(&qu->timeout,UDPRETRYMS); qu->udpsent |= (1< This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via f1f341062e24724e26928d893dd5769d3ccf5fa2 (commit) from 10f2e1c30be651e74a03f4563a9f212d7416adb3 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit f1f341062e24724e26928d893dd5769d3ccf5fa2 Author: Justus Winter Date: Wed Nov 9 13:56:00 2016 +0100 python: Require at least GPGME 1.7 for out-of-tree builds. * lang/python/setup.py.in: Bump required version to 1.7. Signed-off-by: Justus Winter diff --git a/lang/python/setup.py.in b/lang/python/setup.py.in index 3d0b730..9669c28 100755 --- a/lang/python/setup.py.in +++ b/lang/python/setup.py.in @@ -75,8 +75,8 @@ if '-' in version: version = version.split('-')[0] major, minor, patch = map(int, version.split('.')) -if not (major > 1 or (major == 1 and minor >= 6)): - sys.exit('Need at least GPGME version 1.6, found {}.'.format(version_raw)) +if not (major > 1 or (major == 1 and minor >= 7)): + sys.exit('Need at least GPGME version 1.7, found {}.'.format(version_raw)) if not gpgme_h: gpgme_h = os.path.join(getconfig("prefix")[0], "include", "gpgme.h") ----------------------------------------------------------------------- Summary of changes: lang/python/setup.py.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Thu Nov 10 12:03:50 2016 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Thu, 10 Nov 2016 12:03:50 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.1.15-343-gc7ea98c Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via c7ea98cd3d44abf00e32c081e5049ad1d0b1f12c (commit) from 1062953d5132af674aacfc6372e3e9f066c5d145 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit c7ea98cd3d44abf00e32c081e5049ad1d0b1f12c Author: Werner Koch Date: Thu Nov 10 11:38:42 2016 +0100 dirmngr: Improve concurrency in the non-adns case. * dirmngr/dns-stuff.c (map_adns_status_to_gpg_error): New. (resolve_name_adns, get_dns_cert, get_dns_cname): Use that function. (getsrv) [!USE_ADNS]: Call res_query outside of nPth. Signed-off-by: Werner Koch diff --git a/dirmngr/dns-stuff.c b/dirmngr/dns-stuff.c index 70554f6..6849af4 100644 --- a/dirmngr/dns-stuff.c +++ b/dirmngr/dns-stuff.c @@ -195,6 +195,21 @@ map_eai_to_gpg_error (int ec) return err; } +#ifdef USE_ADNS +static gpg_error_t +map_adns_status_to_gpg_error (adns_status status) +{ + gpg_err_code_t ec; + + switch (status) + { + /* case adns_s_netunreach: ec = GPG_ERR_ENETUNREACH; break; */ + default: ec = GPG_ERR_GENERAL; break; + } + return gpg_error (ec); +} +#endif /*USE_ADNS*/ + #ifdef USE_ADNS /* Init ADNS and store the new state at R_STATE. Returns 0 on @@ -286,6 +301,9 @@ resolve_name_adns (const char *name, unsigned short port, err = gpg_error (GPG_ERR_NOT_FOUND); if (answer->status != adns_s_ok || answer->type != adns_r_addr) { + err = map_adns_status_to_gpg_error (answer->status); + if (gpg_err_code (err) == GPG_ERR_GENERAL) + err = gpg_error (GPG_ERR_NOT_FOUND); log_error ("DNS query returned an error: %s (%s)\n", adns_strerror (answer->status), adns_errabbrev (answer->status)); @@ -692,7 +710,9 @@ get_dns_cert (const char *name, int want_certtype, /* log_error ("DNS query returned an error: %s (%s)\n", */ /* adns_strerror (answer->status), */ /* adns_errabbrev (answer->status)); */ - err = gpg_error (GPG_ERR_NOT_FOUND); + err = map_adns_status_to_gpg_error (answer->status); + if (gpg_err_code (err) == GPG_ERR_GENERAL) + err = gpg_error (GPG_ERR_NOT_FOUND); goto leave; } @@ -1095,7 +1115,9 @@ getsrv (const char *name,struct srventry **list) if (tor_mode) return -1; + my_unprotect (); r = res_query (name, C_IN, T_SRV, answer, sizeof answer); + my_protect (); if (r < sizeof (HEADER) || r > sizeof answer || header->rcode != NOERROR || !(count=ntohs (header->ancount))) return 0; /* Error or no record found. */ @@ -1289,7 +1311,7 @@ get_dns_cname (const char *name, char **r_cname) if (answer->status != adns_s_ok || answer->type != adns_r_cname || answer->nrrs != 1) { - err = gpg_error (GPG_ERR_GENERAL); + err = map_adns_status_to_gpg_error (answer->status); log_error ("DNS query returned an error or no records: %s (%s)\n", adns_strerror (answer->status), adns_errabbrev (answer->status)); diff --git a/dirmngr/ks-engine-hkp.c b/dirmngr/ks-engine-hkp.c index 8530851..3b5e75d 100644 --- a/dirmngr/ks-engine-hkp.c +++ b/dirmngr/ks-engine-hkp.c @@ -447,45 +447,48 @@ map_host (ctrl_t ctrl, const char *name, int force_reselect, } hi = hosttable[idx]; -#ifdef USE_DNS_SRV - /* Check for SRV records. */ - srvrecord = xtryasprintf ("_hkp._tcp.%s", name); - if (srvrecord == NULL) - { - err = gpg_error_from_syserror (); - xfree (reftbl); - return err; - } - - srvscount = getsrv (srvrecord, &srvs); - xfree (srvrecord); - if (srvscount < 0) +#ifdef USE_DNS_SRV + if (!is_ip_address (name)) { - err = gpg_error_from_syserror (); - xfree (reftbl); - return err; - } - - if (srvscount > 0) - { - int i; - is_pool = srvscount > 1; + /* Check for SRV records. */ + srvrecord = xtryasprintf ("_hkp._tcp.%s", name); + if (srvrecord == NULL) + { + err = gpg_error_from_syserror (); + xfree (reftbl); + return err; + } - for (i = 0; i < srvscount; i++) + srvscount = getsrv (srvrecord, &srvs); + xfree (srvrecord); + if (srvscount < 0) { - err = resolve_dns_name (srvs[i].target, 0, - AF_UNSPEC, SOCK_STREAM, - &ai, &cname); - if (err) - continue; - dirmngr_tick (ctrl); - add_host (name, is_pool, ai, srvs[i].port, - reftbl, reftblsize, &refidx); + err = gpg_error_from_syserror (); + xfree (reftbl); + return err; } - xfree (srvs); + if (srvscount > 0) + { + int i; + is_pool = srvscount > 1; + + for (i = 0; i < srvscount; i++) + { + err = resolve_dns_name (srvs[i].target, 0, + AF_UNSPEC, SOCK_STREAM, + &ai, &cname); + if (err) + continue; + dirmngr_tick (ctrl); + add_host (name, is_pool, ai, srvs[i].port, + reftbl, reftblsize, &refidx); + } + + xfree (srvs); + } } -#endif /* USE_DNS_SRV */ +#endif /* USE_DNS_SRV */ /* Find all A records for this entry and put them into the pool list - if any. */ ----------------------------------------------------------------------- Summary of changes: dirmngr/dns-stuff.c | 26 +++++++++++++++++-- dirmngr/ks-engine-hkp.c | 69 ++++++++++++++++++++++++++----------------------- 2 files changed, 60 insertions(+), 35 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Thu Nov 10 12:21:43 2016 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Thu, 10 Nov 2016 12:21:43 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.1.15-344-g088d955 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via 088d955bd8a6ec8bbf76c8a4c01eb08499d1d9fa (commit) from c7ea98cd3d44abf00e32c081e5049ad1d0b1f12c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 088d955bd8a6ec8bbf76c8a4c01eb08499d1d9fa Author: Werner Koch Date: Thu Nov 10 12:18:33 2016 +0100 gpg: Improve error message for --quick-gen-key. * g10/keygen.c (parse_algo_usage_expire): Use a different error message for an unknown algorithm name. -- GnuPG-bug-id: 2832 Signed-off-by: Werner Koch diff --git a/g10/keygen.c b/g10/keygen.c index e3cf818..b424c98 100644 --- a/g10/keygen.c +++ b/g10/keygen.c @@ -4532,7 +4532,7 @@ parse_algo_usage_expire (ctrl_t ctrl, int for_subkey, use = PUBKEY_USAGE_ENC; } else - return gpg_error (GPG_ERR_INV_CURVE); + return gpg_error (GPG_ERR_UNKNOWN_CURVE); /* Parse the usage string. */ if (!usagestr || !*usagestr ----------------------------------------------------------------------- Summary of changes: g10/keygen.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Thu Nov 10 13:39:47 2016 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Thu, 10 Nov 2016 13:39:47 +0100 Subject: [git] GPGME - branch, master, updated. gpgme-1.7.1-25-g09b6455 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 09b64554328445e99a8cc78fc34ea49c2ea2e7f9 (commit) from f1f341062e24724e26928d893dd5769d3ccf5fa2 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 09b64554328445e99a8cc78fc34ea49c2ea2e7f9 Author: Andre Heinecke Date: Tue Nov 8 15:32:14 2016 +0100 core: Use gpgrt locking for thread safeness * configure.ac: Require libgpg-error 1.17. No longer check for pthread. * doc/gpgme.texi: Document removed neccessity for thread safe gpgme flavours. * src/sema.h (DEFINE_GLOBAL_LOCK), (DEFINE_STATIC_LOCK, INIT_LOCK, DECLARE_LOCK) (DESTROY_LOCK, LOCK, UNLOCK): Change to gpgrt equivalents. * src/posix-sema.c, src/w32-sema.c: Removed. * src/Makefile.am: Remove libpthread and Update accordingly. * src/ath.c, src/ath.h (ath_mutex_init) (ath_mutex_destroy, ath_mutex_lock, ath_mutex_unlock): Removed. * src/ath.h (ATH_MUTEX_INITIALIZER): Removed. * src/version.c (do_subsystem_inits): sema_subsystem_init is no longer required. * tests/gpg/Makefile.am: Add new threading tests. (t_thread1_LDADD, t_cancel_LDADD): Use just gpgme. * tests/gpg/t-thread-keylist-verify.c, tests/gpg/t-thread-keylist.c: New. * src/gpgme-config.in: Use -lgpgme for thread-model pthread. -- Using gpgrt locks instead of pthread locks removes the neccessity to link pthread directly to gpgme and have a different, thread safe flavor of gpgme. Now gpgme is thread-safe if the conditions mentioned in the doc are met. As the cpp bindings linked against libgpgme and not libgpgme-pthread this fixes threading problems with them. libgpgme-pthread is removed but gpgme-config still supports --thread=pthread for compatibility with find scripts. diff --git a/configure.ac b/configure.ac index b52f214..4afad85 100644 --- a/configure.ac +++ b/configure.ac @@ -71,7 +71,7 @@ LIBQGPGME_LT_REVISION=0 GPGME_CONFIG_API_VERSION=1 ############################################## -NEED_GPG_ERROR_VERSION=1.11 +NEED_GPG_ERROR_VERSION=1.17 NEED_LIBASSUAN_API=2 NEED_LIBASSUAN_VERSION=2.0.2 @@ -211,11 +211,6 @@ case "${host}" in ;; *) - AC_CHECK_LIB(pthread,pthread_create,have_pthread=yes) - if test "$have_pthread" = yes; then - AC_DEFINE(HAVE_PTHREAD, ,[Define if we have pthread.]) - fi - # XXX: Probably use exec-prefix here? # GPG_DEFAULT='/usr/bin/gpg' # GPGSM_DEFAULT='/usr/bin/gpgsm' @@ -257,8 +252,6 @@ AM_CONDITIONAL(HAVE_ANDROID_SYSTEM, test "$have_android_system" = yes) AM_CONDITIONAL(BUILD_W32_GLIB, test "$build_w32_glib" = yes) -AM_CONDITIONAL(HAVE_PTHREAD, test "$have_pthread" = "yes") - AC_ARG_ENABLE([fixed-path], AC_HELP_STRING([--enable-fixed-path=PATH], @@ -905,7 +898,6 @@ echo " UI Server: $uiserver FD Passing: $use_descriptor_passing - GPGME Pthread: $have_pthread Language bindings: ${enabled_languages_v:-$enabled_languages} " diff --git a/doc/gpgme.texi b/doc/gpgme.texi index a70418d..42c16a8 100644 --- a/doc/gpgme.texi +++ b/doc/gpgme.texi @@ -458,12 +458,6 @@ specifying both options to @command{gpgme-config}: gcc -o foo foo.c `gpgme-config --cflags --libs` @end example -If you want to link to one of the thread-safe versions of - at acronym{GPGME}, you must specify the @option{--thread} option before -any other option to select the thread package you want to link with. -Supported thread packages are @option{--thread=pth} and - at option{--thread=pthread}. - If you need to detect the installed language bindings you can use list them using: @@ -614,7 +608,9 @@ that can be used with GNU Pth, and defines @code{GPGME_PTH_CFLAGS} and @code{AM_PATH_GPGME_PTHREAD} checks for the version of @acronym{GPGME} that can be used with the native pthread implementation, and defines - at code{GPGME_PTHREAD_CFLAGS} and @code{GPGME_PTHREAD_LIBS}. + at code{GPGME_PTHREAD_CFLAGS} and @code{GPGME_PTHREAD_LIBS}. Since +version 1.8.0 this is no longer required to GPGME_PTHREAD as + at acronym{GPGME} itself is thread safe. This macro searches for @command{gpgme-config} along the PATH. If you are cross-compiling, it is useful to set the environment variable @@ -814,32 +810,12 @@ application is multi-threaded, and you install a signal action for @cindex thread-safeness @cindex multi-threading -The @acronym{GPGME} library is not entirely thread-safe, but it can -still be used in a multi-threaded environment if some care is taken. -If the following requirements are met, there should be no race -conditions to worry about: +The @acronym{GPGME} library is mostly thread-safe, an can be used +in a mulithreaded environment but there are some requirements +for mutlithreaded use: @itemize @bullet @item - at acronym{GPGME} supports the thread libraries pthread and GNU Pth. -The support for this has to be enabled at compile time. - at acronym{GPGME} will automatically detect the location in which the -thread libraries are installed and activate the support for them at -build time. - -Support for other thread libraries is very easy to add. Please -contact us if you have the need. - - at item -If you want to use @acronym{GPGME} with threads, you must link to the -right version of the library. The name of the right library is - at code{libgpgme-} followed by the name of the thread package you use. -For example, if you use GNU Pth, the right name is - at code{libgpgme-pth}. Use the Automake macros or - at command{gpgme-config} program for simplicity. - - - at item The function @code{gpgme_check_version} must be called before any other function in the library, because it initializes the thread support subsystem in @acronym{GPGME}. To achieve this in diff --git a/src/Makefile.am b/src/Makefile.am index eddd192..dfe480c 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -28,20 +28,13 @@ nodist_include_HEADERS = gpgme.h bin_PROGRAMS = gpgme-tool -if HAVE_PTHREAD -ltlib_gpgme_pthread = libgpgme-pthread.la -else -ltlib_gpgme_pthread = -endif - if BUILD_W32_GLIB ltlib_gpgme_glib = libgpgme-glib.la else ltlib_gpgme_glib = endif -lib_LTLIBRARIES = libgpgme.la $(ltlib_gpgme_glib) $(ltlib_gpgme_qt) \ - $(ltlib_gpgme_pthread) +lib_LTLIBRARIES = libgpgme.la $(ltlib_gpgme_glib) if HAVE_LD_VERSION_SCRIPT libgpgme_version_script_cmd = -Wl,--version-script=$(srcdir)/libgpgme.vers @@ -50,10 +43,10 @@ libgpgme_version_script_cmd = endif if HAVE_DOSISH_SYSTEM -system_components = w32-util.c w32-sema.c +system_components = w32-util.c system_components_not_extra = w32-io.c else -system_components = ath.h posix-util.c posix-sema.c posix-io.c +system_components = ath.h posix-util.c posix-io.c system_components_not_extra = endif @@ -93,12 +86,10 @@ main_sources = \ engine-spawn.c \ gpgconf.c queryswdb.c \ sema.h priv-io.h $(system_components) sys-util.h dirinfo.c \ - debug.c debug.h gpgme.c version.c error.c - -libgpgme_la_SOURCES = $(main_sources) \ + debug.c debug.h gpgme.c version.c error.c \ ath.h ath.c $(system_components_not_extra) -libgpgme_pthread_la_SOURCES = $(main_sources) \ - ath.h ath-pthread.c $(system_components_not_extra) + +libgpgme_la_SOURCES = $(main_sources) if BUILD_W32_GLIB libgpgme_glib_la_SOURCES = $(main_sources) ath.h ath.c w32-glib-io.c @@ -163,14 +154,6 @@ libgpgme_la_DEPENDENCIES = @LTLIBOBJS@ $(srcdir)/libgpgme.vers $(gpgme_deps) libgpgme_la_LIBADD = $(gpgme_res) @LIBASSUAN_LIBS@ @LTLIBOBJS@ \ @GPG_ERROR_LIBS@ -libgpgme_pthread_la_LDFLAGS = \ - $(no_undefined) $(export_symbols) $(extra_ltoptions) \ - $(libgpgme_version_script_cmd) -version-info \ - @LIBGPGME_LT_CURRENT@:@LIBGPGME_LT_REVISION@:@LIBGPGME_LT_AGE@ -libgpgme_pthread_la_DEPENDENCIES = @LTLIBOBJS@ $(srcdir)/libgpgme.vers -libgpgme_pthread_la_LIBADD = $(gpgme_res) @LIBASSUAN_LIBS@ @LTLIBOBJS@ \ - -lpthread @GPG_ERROR_LIBS@ - if BUILD_W32_GLIB libgpgme_glib_la_LDFLAGS = \ $(no_undefined) $(export_symbols) $(extra_ltoptions) \ diff --git a/src/ath-pthread.c b/src/ath-pthread.c deleted file mode 100644 index 47b38ee..0000000 --- a/src/ath-pthread.c +++ /dev/null @@ -1,188 +0,0 @@ -/* ath-pthread.c - pthread module for self-adapting thread-safeness library - Copyright (C) 2002, 2003, 2004 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, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include -#ifdef HAVE_UNISTD_H -# include -#endif -#ifdef HAVE_SYS_SELECT_H -# include -#else -# ifdef HAVE_SYS_TIME_H -# include -# endif -#endif -#include -#include - -#include - -#include "gpgme.h" - -#include "ath.h" - - -/* The lock we take while checking for lazy lock initialization. */ -static pthread_mutex_t check_init_lock = PTHREAD_MUTEX_INITIALIZER; - -/* Initialize the mutex *PRIV. If JUST_CHECK is true, only do this if - it is not already initialized. */ -static int -mutex_pthread_init (ath_mutex_t *priv, int just_check) -{ - int err = 0; - - if (just_check) - pthread_mutex_lock (&check_init_lock); - if (!*priv || !just_check) - { - pthread_mutex_t *lock = malloc (sizeof (pthread_mutex_t)); - if (!lock) - err = ENOMEM; - if (!err) - { - err = pthread_mutex_init (lock, NULL); - if (err) - free (lock); - else - *priv = (ath_mutex_t) lock; - } - } - if (just_check) - pthread_mutex_unlock (&check_init_lock); - return err; -} - - -void -ath_init (void) -{ - /* Nothing to do. */ -} - - -uintptr_t -ath_self (void) -{ - return (uintptr_t) pthread_self (); -} - - -int -ath_mutex_init (ath_mutex_t *lock) -{ - return mutex_pthread_init (lock, 0); -} - - -int -ath_mutex_destroy (ath_mutex_t *lock) -{ - int err = mutex_pthread_init (lock, 1); - if (!err) - { - err = pthread_mutex_destroy ((pthread_mutex_t *) *lock); - free (*lock); - } - return err; -} - - -int -ath_mutex_lock (ath_mutex_t *lock) -{ - int ret = mutex_pthread_init (lock, 1); - if (ret) - return ret; - - return pthread_mutex_lock ((pthread_mutex_t *) *lock); -} - - -int -ath_mutex_unlock (ath_mutex_t *lock) -{ - int ret = mutex_pthread_init (lock, 1); - if (ret) - return ret; - - return pthread_mutex_unlock ((pthread_mutex_t *) *lock); -} - - -gpgme_ssize_t -ath_read (int fd, void *buf, size_t nbytes) -{ - return read (fd, buf, nbytes); -} - - -gpgme_ssize_t -ath_write (int fd, const void *buf, size_t nbytes) -{ - return write (fd, buf, nbytes); -} - - -gpgme_ssize_t -ath_select (int nfd, fd_set *rset, fd_set *wset, fd_set *eset, - struct timeval *timeout) -{ - return select (nfd, rset, wset, eset, timeout); -} - - -gpgme_ssize_t -ath_waitpid (pid_t pid, int *status, int options) -{ - return waitpid (pid, status, options); -} - - -int -ath_accept (int s, struct sockaddr *addr, socklen_t *length_ptr) -{ - return accept (s, addr, length_ptr); -} - - -int -ath_connect (int s, const struct sockaddr *addr, socklen_t length) -{ - return connect (s, addr, length); -} - -int -ath_sendmsg (int s, const struct msghdr *msg, int flags) -{ - return sendmsg (s, msg, flags); -} - - -int -ath_recvmsg (int s, struct msghdr *msg, int flags) -{ - return recvmsg (s, msg, flags); -} diff --git a/src/ath.c b/src/ath.c index ddd8a87..6b4667e 100644 --- a/src/ath.c +++ b/src/ath.c @@ -49,11 +49,6 @@ #include "ath.h" -#define MUTEX_UNLOCKED ((ath_mutex_t) 0) -#define MUTEX_LOCKED ((ath_mutex_t) 1) -#define MUTEX_DESTROYED ((ath_mutex_t) 2) - - #ifdef HAVE_W32_SYSTEM #include uintptr_t @@ -80,52 +75,6 @@ ath_self (void) #endif -int -ath_mutex_init (ath_mutex_t *lock) -{ -#ifndef NDEBUG - *lock = MUTEX_UNLOCKED; -#endif - return 0; -} - - -int -ath_mutex_destroy (ath_mutex_t *lock) -{ -#ifndef NDEBUG - assert (*lock == MUTEX_UNLOCKED); - - *lock = MUTEX_DESTROYED; -#endif - return 0; -} - - -int -ath_mutex_lock (ath_mutex_t *lock) -{ -#ifndef NDEBUG - assert (*lock == MUTEX_UNLOCKED); - - *lock = MUTEX_LOCKED; -#endif - return 0; -} - - -int -ath_mutex_unlock (ath_mutex_t *lock) -{ -#ifndef NDEBUG - assert (*lock == MUTEX_LOCKED); - - *lock = MUTEX_UNLOCKED; -#endif - return 0; -} - - gpgme_ssize_t ath_read (int fd, void *buf, size_t nbytes) { diff --git a/src/ath.h b/src/ath.h index 8eb9eb9..a1be9e5 100644 --- a/src/ath.h +++ b/src/ath.h @@ -60,10 +60,6 @@ #define _ATH_PREFIX1(x,y) x ## y #define _ATH_PREFIX2(x,y) _ATH_PREFIX1(x,y) #define _ATH_PREFIX(x) _ATH_PREFIX2(_ATH_EXT_SYM_PREFIX,x) -#define ath_mutex_init _ATH_PREFIX(ath_mutex_init) -#define ath_mutex_destroy _ATH_PREFIX(ath_mutex_destroy) -#define ath_mutex_lock _ATH_PREFIX(ath_mutex_lock) -#define ath_mutex_unlock _ATH_PREFIX(ath_mutex_unlock) #define ath_read _ATH_PREFIX(ath_read) #define ath_write _ATH_PREFIX(ath_write) #define ath_select _ATH_PREFIX(ath_select) @@ -75,17 +71,8 @@ #endif -typedef void *ath_mutex_t; -#define ATH_MUTEX_INITIALIZER 0; - uintptr_t ath_self (void); -/* Functions for mutual exclusion. */ -int ath_mutex_init (ath_mutex_t *mutex); -int ath_mutex_destroy (ath_mutex_t *mutex); -int ath_mutex_lock (ath_mutex_t *mutex); -int ath_mutex_unlock (ath_mutex_t *mutex); - /* Replacement for the POSIX functions, which can be used to allow other (user-level) threads to run. */ gpgme_ssize_t ath_read (int fd, void *buf, size_t nbytes); diff --git a/src/gpgme-config.in b/src/gpgme-config.in index 0d9fda2..a4d152e 100644 --- a/src/gpgme-config.in +++ b/src/gpgme-config.in @@ -32,7 +32,9 @@ gpg_error_libs="@GPG_ERROR_LIBS@" # Configure thread packages. thread_modules="" - at HAVE_PTHREAD_TRUE@thread_modules="$thread_modules pthread" +# For compatibility we keep proving the +# thread modules variable. +thread_modules="$thread_modules pthread" libs_pthread="-lpthread" cflags_pthread="" @@ -50,7 +52,6 @@ usage() cat < -#endif -#include -#include -#include -#include -#include -#include -#include -#ifdef HAVE_UNISTD_H -# include -#endif -#ifdef HAVE_SYS_TIME_H -# include -#endif -#ifdef HAVE_SYS_TYPES_H -# include -#endif - -#include "util.h" -#include "sema.h" -#include "ath.h" - -void -_gpgme_sema_subsystem_init () -{ -} - -void -_gpgme_sema_cs_enter (struct critsect_s *s) -{ - _gpgme_ath_mutex_lock (&s->priv); -} - -void -_gpgme_sema_cs_leave (struct critsect_s *s) -{ - _gpgme_ath_mutex_unlock (&s->priv); -} - -void -_gpgme_sema_cs_destroy (struct critsect_s *s) -{ - _gpgme_ath_mutex_destroy (&s->priv); - s->priv = NULL; -} diff --git a/src/sema.h b/src/sema.h index 4b7c0af..5b0d53d 100644 --- a/src/sema.h +++ b/src/sema.h @@ -22,46 +22,23 @@ #ifndef SEMA_H #define SEMA_H -struct critsect_s -{ - const char *name; - void *priv; -}; +#include #define DEFINE_GLOBAL_LOCK(name) \ - struct critsect_s name = { #name, NULL } + gpgrt_lock_t name = GPGRT_LOCK_INITIALIZER + #define DEFINE_STATIC_LOCK(name) \ - static struct critsect_s name = { #name, NULL } + static gpgrt_lock_t name = GPGRT_LOCK_INITIALIZER -#define DECLARE_LOCK(name) \ - struct critsect_s name -#define INIT_LOCK(a) \ - do \ - { \ - (a).name = #a; \ - (a).priv = NULL; \ - } \ - while (0) -#define DESTROY_LOCK(name) _gpgme_sema_cs_destroy (&(name)) +#define INIT_LOCK(name) \ + name = (gpgrt_lock_t) GPGRT_LOCK_INITIALIZER +#define DECLARE_LOCK(name) gpgrt_lock_t name -#define LOCK(name) \ - do \ - { \ - _gpgme_sema_cs_enter (&(name)); \ - } \ - while (0) +#define DESTROY_LOCK(name) gpgrt_lock_destroy(&name) -#define UNLOCK(name) \ - do \ - { \ - _gpgme_sema_cs_leave (&(name)); \ - } \ - while (0) +#define LOCK(name) gpgrt_lock_lock(&name) -void _gpgme_sema_subsystem_init (void); -void _gpgme_sema_cs_enter (struct critsect_s *s); -void _gpgme_sema_cs_leave (struct critsect_s *s); -void _gpgme_sema_cs_destroy (struct critsect_s *s); +#define UNLOCK(name) gpgrt_lock_unlock(&name) #endif /* SEMA_H */ diff --git a/src/version.c b/src/version.c index 8bc898f..99698fa 100644 --- a/src/version.c +++ b/src/version.c @@ -74,7 +74,6 @@ do_subsystem_inits (void) } #endif - _gpgme_sema_subsystem_init (); _gpgme_debug_subsystem_init (); _gpgme_io_subsystem_init (); _gpgme_status_init (); diff --git a/src/w32-sema.c b/src/w32-sema.c deleted file mode 100644 index 648a6bb..0000000 --- a/src/w32-sema.c +++ /dev/null @@ -1,117 +0,0 @@ -/* w32-sema.c - Copyright (C) 2001 Werner Koch (dd9jn) - Copyright (C) 2001, 2002, 2004, 2007 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, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include -#include -#ifdef HAVE_SYS_TIME_H -# include -#endif -#ifdef HAVE_SYS_TYPES_H -# include -#endif -#include - -#include "util.h" -#include "sema.h" -#include "debug.h" - -static void -sema_fatal (const char *text) -{ - fprintf (stderr, "sema.c: %s\n", text); - abort (); -} - - -static void -critsect_init (struct critsect_s *s) -{ - CRITICAL_SECTION *mp; - static CRITICAL_SECTION init_lock; - static int initialized; - - if (!initialized) { - /* The very first time we call this function, we assume that - only one thread is running, so that we can bootstrap the - semaphore code. */ - InitializeCriticalSection (&init_lock); - initialized = 1; - } - if (!s) - return; /* we just want to initialize ourself */ - - /* first test whether it is really not initialized */ - EnterCriticalSection (&init_lock); - if ( s->priv ) { - LeaveCriticalSection (&init_lock); - return; - } - /* now init it */ - mp = malloc ( sizeof *mp ); - if (!mp) { - LeaveCriticalSection (&init_lock); - sema_fatal ("out of core while creating critical section lock"); - } - InitializeCriticalSection (mp); - s->priv = mp; - LeaveCriticalSection (&init_lock); -} - -void -_gpgme_sema_subsystem_init () -{ - /* fixme: we should check that there is only one thread running */ - critsect_init (NULL); -} - - -void -_gpgme_sema_cs_enter ( struct critsect_s *s ) -{ - if (!s->priv) - critsect_init (s); - EnterCriticalSection ( (CRITICAL_SECTION*)s->priv ); -} - -void -_gpgme_sema_cs_leave (struct critsect_s *s) -{ - if (!s->priv) - critsect_init (s); - LeaveCriticalSection ((CRITICAL_SECTION*)s->priv); -} - -void -_gpgme_sema_cs_destroy ( struct critsect_s *s ) -{ - if (s && s->priv) { - DeleteCriticalSection ((CRITICAL_SECTION*)s->priv); - free (s->priv); - s->priv = NULL; - } -} diff --git a/tests/gpg/Makefile.am b/tests/gpg/Makefile.am index 2538f63..dd33b0a 100644 --- a/tests/gpg/Makefile.am +++ b/tests/gpg/Makefile.am @@ -38,7 +38,8 @@ c_tests = \ t-encrypt t-encrypt-sym t-encrypt-sign t-sign t-signers \ t-decrypt t-verify t-decrypt-verify t-sig-notation t-export \ t-import t-trustlist t-edit t-keylist t-keylist-sig t-wait \ - t-encrypt-large t-file-name t-gpgconf t-encrypt-mixed $(tests_unix) + t-encrypt-large t-file-name t-gpgconf t-encrypt-mixed $(tests_unix) \ + t-thread-keylist t-thread-keylist-verify TESTS = initial.test $(c_tests) final.test @@ -61,8 +62,10 @@ EXTRA_DIST = initial.test final.test \ AM_CPPFLAGS = -I$(top_builddir)/src @GPG_ERROR_CFLAGS@ AM_LDFLAGS = -no-install LDADD = ../../src/libgpgme.la -t_thread1_LDADD = ../../src/libgpgme-pthread.la -lpthread -t_cancel_LDADD = ../../src/libgpgme-pthread.la -lpthread +t_thread1_LDADD = ../../src/libgpgme.la -lpthread +t_thread_keylist_LDADD = ../../src/libgpgme.la -lpthread +t_thread_keylist_verify_LDADD = ../../src/libgpgme.la -lpthread +t_cancel_LDADD = ../../src/libgpgme.la -lpthread # We don't run t-genkey and t-cancel in the test suite, because it # takes too long diff --git a/tests/gpg/t-thread-keylist-verify.c b/tests/gpg/t-thread-keylist-verify.c new file mode 100644 index 0000000..55af88a --- /dev/null +++ b/tests/gpg/t-thread-keylist-verify.c @@ -0,0 +1,129 @@ +/* t-thread-verify.c - Regression test. + Copyright (C) 2015 Intevation 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, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include +#include + +#include + +#include + +#include "t-support.h" + +#define THREAD_COUNT 500 + +static const char test_text1[] = "Just GNU it!\n"; +static const char test_sig1[] = +"-----BEGIN PGP SIGNATURE-----\n" +"\n" +"iN0EABECAJ0FAjoS+i9FFIAAAAAAAwA5YmFyw7bDpMO8w58gZGFzIHdhcmVuIFVt\n" +"bGF1dGUgdW5kIGpldHp0IGVpbiBwcm96ZW50JS1aZWljaGVuNRSAAAAAAAgAJGZv\n" +"b2Jhci4xdGhpcyBpcyBhIG5vdGF0aW9uIGRhdGEgd2l0aCAyIGxpbmVzGhpodHRw\n" +"Oi8vd3d3Lmd1Lm9yZy9wb2xpY3kvAAoJEC1yfMdoaXc0JBIAoIiLlUsvpMDOyGEc\n" +"dADGKXF/Hcb+AKCJWPphZCphduxSvrzH0hgzHdeQaA==\n" +"=nts1\n" +"-----END PGP SIGNATURE-----\n"; + +void * +start_keylist (void *arg) +{ + gpgme_error_t err; + gpgme_ctx_t ctx; + gpgme_key_t key; + + err = gpgme_new (&ctx); + fail_if_err (err); + + err = gpgme_op_keylist_start (ctx, NULL, 0); + fail_if_err (err); + + while (!(err = gpgme_op_keylist_next (ctx, &key))); + + return NULL; +} + +void * +start_verify (void *arg) +{ + gpgme_ctx_t ctx; + gpgme_error_t err; + gpgme_data_t sig, text; + gpgme_verify_result_t result; + gpgme_signature_t signature; + + err = gpgme_new (&ctx); + fail_if_err (err); + + /* Checking a valid message. */ + err = gpgme_data_new_from_mem (&text, test_text1, strlen (test_text1), 0); + fail_if_err (err); + err = gpgme_data_new_from_mem (&sig, test_sig1, strlen (test_sig1), 0); + fail_if_err (err); + err = gpgme_op_verify (ctx, sig, text, NULL); + fail_if_err (err); + result = gpgme_op_verify_result (ctx); + + signature = result->signatures; + + if (strcmp (signature->fpr, "A0FF4590BB6122EDEF6E3C542D727CC768697734")) + { + fprintf (stderr, "%s:%i: Unexpected fingerprint: %s\n", + __FILE__, __LINE__, signature->fpr); + exit (1); + } + if (gpgme_err_code (signature->status) != GPG_ERR_NO_ERROR) + { + fprintf (stderr, "%s:%i: Unexpected signature status: %s\n", + __FILE__, __LINE__, gpgme_strerror (signature->status)); + exit (1); + } + return NULL; +} + +int +main (int argc, char *argv[]) +{ + int i; + pthread_t verify_threads[THREAD_COUNT]; + pthread_t keylist_threads[THREAD_COUNT]; + init_gpgme (GPGME_PROTOCOL_OpenPGP); + + for (i = 0; i < THREAD_COUNT; i++) + { + if (pthread_create(&verify_threads[i], NULL, start_verify, NULL) || + pthread_create(&keylist_threads[i], NULL, start_keylist, NULL)) + { + fprintf(stderr, "%s:%i: failed to create threads \n", + __FILE__, __LINE__); + exit(1); + } + } + for (i = 0; i < THREAD_COUNT; i++) + { + pthread_join (verify_threads[i], NULL); + pthread_join (keylist_threads[i], NULL); + } + return 0; +} diff --git a/tests/gpg/t-thread-keylist.c b/tests/gpg/t-thread-keylist.c new file mode 100644 index 0000000..14f7718 --- /dev/null +++ b/tests/gpg/t-thread-keylist.c @@ -0,0 +1,76 @@ +/* t-thread-verify.c - Regression test. + Copyright (C) 2015 Intevation 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, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + 02111-1307, USA. */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include +#include + +#include + +#include + +#include "t-support.h" + +#define THREAD_COUNT 500 + +void * +start_keylist (void *arg) +{ + gpgme_error_t err; + gpgme_ctx_t ctx; + gpgme_key_t key; + + err = gpgme_new (&ctx); + fail_if_err (err); + + err = gpgme_op_keylist_start (ctx, NULL, 0); + fail_if_err (err); + + while (!(err = gpgme_op_keylist_next (ctx, &key))); + + return NULL; +} + +int +main (int argc, char *argv[]) +{ + int i; + pthread_t keylist_threads[THREAD_COUNT]; + init_gpgme (GPGME_PROTOCOL_OpenPGP); + + for (i = 0; i < THREAD_COUNT; i++) + { + if (pthread_create(&keylist_threads[i], NULL, start_keylist, NULL)) + { + fprintf(stderr, "%s:%i: failed to create threads \n", + __FILE__, __LINE__); + exit(1); + } + } + for (i = 0; i < THREAD_COUNT; i++) + { + pthread_join (keylist_threads[i], NULL); + } + return 0; +} ----------------------------------------------------------------------- Summary of changes: configure.ac | 10 +- doc/gpgme.texi | 36 +---- src/Makefile.am | 29 +--- src/ath-pthread.c | 188 ------------------------ src/ath.c | 51 ------- src/ath.h | 13 -- src/gpgme-config.in | 8 +- src/posix-sema.c | 68 --------- src/sema.h | 43 ++---- src/version.c | 1 - src/w32-sema.c | 117 --------------- tests/gpg/Makefile.am | 9 +- tests/gpg/t-thread-keylist-verify.c | 129 ++++++++++++++++ tests/gpg/{t-trustlist.c => t-thread-keylist.c} | 59 ++++---- 14 files changed, 197 insertions(+), 564 deletions(-) delete mode 100644 src/ath-pthread.c delete mode 100644 src/posix-sema.c delete mode 100644 src/w32-sema.c create mode 100644 tests/gpg/t-thread-keylist-verify.c copy tests/gpg/{t-trustlist.c => t-thread-keylist.c} (61%) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Thu Nov 10 14:15:26 2016 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Thu, 10 Nov 2016 14:15:26 +0100 Subject: [git] GPGME - branch, master, updated. gpgme-1.7.1-26-g4d5174e Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 4d5174e4a83dcd524f8085f6646145f81b50a02a (commit) from 09b64554328445e99a8cc78fc34ea49c2ea2e7f9 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 4d5174e4a83dcd524f8085f6646145f81b50a02a Author: Andre Heinecke Date: Thu Nov 10 14:10:11 2016 +0100 tests: Improve new thread tests * tests/gpg/t-thread-keylist-verify.c (start_keylist): Mark arg as unused. Release context. (start_verify): Ditto. (main): Mark args as unused. * tests/gpg/t-thread-keylist.c (start_keylist): Mark arg as unused. Release context. (main): Mark args as unused. diff --git a/tests/gpg/t-thread-keylist-verify.c b/tests/gpg/t-thread-keylist-verify.c index 55af88a..c77d6da 100644 --- a/tests/gpg/t-thread-keylist-verify.c +++ b/tests/gpg/t-thread-keylist-verify.c @@ -53,6 +53,7 @@ start_keylist (void *arg) gpgme_ctx_t ctx; gpgme_key_t key; + (void)arg; err = gpgme_new (&ctx); fail_if_err (err); @@ -61,6 +62,7 @@ start_keylist (void *arg) while (!(err = gpgme_op_keylist_next (ctx, &key))); + gpgme_release (ctx); return NULL; } @@ -73,6 +75,8 @@ start_verify (void *arg) gpgme_verify_result_t result; gpgme_signature_t signature; + (void)arg; + err = gpgme_new (&ctx); fail_if_err (err); @@ -99,6 +103,7 @@ start_verify (void *arg) __FILE__, __LINE__, gpgme_strerror (signature->status)); exit (1); } + gpgme_release (ctx); return NULL; } @@ -110,6 +115,9 @@ main (int argc, char *argv[]) pthread_t keylist_threads[THREAD_COUNT]; init_gpgme (GPGME_PROTOCOL_OpenPGP); + (void)argc; + (void)argv; + for (i = 0; i < THREAD_COUNT; i++) { if (pthread_create(&verify_threads[i], NULL, start_verify, NULL) || diff --git a/tests/gpg/t-thread-keylist.c b/tests/gpg/t-thread-keylist.c index 14f7718..d585bf4 100644 --- a/tests/gpg/t-thread-keylist.c +++ b/tests/gpg/t-thread-keylist.c @@ -41,6 +41,7 @@ start_keylist (void *arg) gpgme_ctx_t ctx; gpgme_key_t key; + (void) arg; err = gpgme_new (&ctx); fail_if_err (err); @@ -49,6 +50,8 @@ start_keylist (void *arg) while (!(err = gpgme_op_keylist_next (ctx, &key))); + gpgme_release (ctx); + return NULL; } @@ -59,6 +62,9 @@ main (int argc, char *argv[]) pthread_t keylist_threads[THREAD_COUNT]; init_gpgme (GPGME_PROTOCOL_OpenPGP); + (void)argc; + (void)argv; + for (i = 0; i < THREAD_COUNT; i++) { if (pthread_create(&keylist_threads[i], NULL, start_keylist, NULL)) ----------------------------------------------------------------------- Summary of changes: tests/gpg/t-thread-keylist-verify.c | 8 ++++++++ tests/gpg/t-thread-keylist.c | 6 ++++++ 2 files changed, 14 insertions(+) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Thu Nov 10 15:05:52 2016 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Thu, 10 Nov 2016 15:05:52 +0100 Subject: [git] GPGME - branch, master, updated. gpgme-1.7.1-27-gd0030ef Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via d0030efb45ec8436dd84a9623d2f66b80c6b9e10 (commit) from 4d5174e4a83dcd524f8085f6646145f81b50a02a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit d0030efb45ec8436dd84a9623d2f66b80c6b9e10 Author: Andre Heinecke Date: Thu Nov 10 15:04:17 2016 +0100 tests: Fix additional memleaks in thread tests * tests/gpg/t-thread-keylist-verify.c (start_verify): Release data. (start_keylist): Unref keys. * tests/gpg/t-thread-keylist.c (start_keylist): Unref keys. diff --git a/tests/gpg/t-thread-keylist-verify.c b/tests/gpg/t-thread-keylist-verify.c index c77d6da..9f37857 100644 --- a/tests/gpg/t-thread-keylist-verify.c +++ b/tests/gpg/t-thread-keylist-verify.c @@ -60,7 +60,10 @@ start_keylist (void *arg) err = gpgme_op_keylist_start (ctx, NULL, 0); fail_if_err (err); - while (!(err = gpgme_op_keylist_next (ctx, &key))); + while (!(err = gpgme_op_keylist_next (ctx, &key))) + { + gpgme_key_unref (key); + } gpgme_release (ctx); return NULL; @@ -103,6 +106,8 @@ start_verify (void *arg) __FILE__, __LINE__, gpgme_strerror (signature->status)); exit (1); } + gpgme_free (text); + gpgme_free (sig); gpgme_release (ctx); return NULL; } diff --git a/tests/gpg/t-thread-keylist.c b/tests/gpg/t-thread-keylist.c index d585bf4..6b9cee0 100644 --- a/tests/gpg/t-thread-keylist.c +++ b/tests/gpg/t-thread-keylist.c @@ -48,7 +48,10 @@ start_keylist (void *arg) err = gpgme_op_keylist_start (ctx, NULL, 0); fail_if_err (err); - while (!(err = gpgme_op_keylist_next (ctx, &key))); + while (!(err = gpgme_op_keylist_next (ctx, &key))) + { + gpgme_key_unref (key); + } gpgme_release (ctx); ----------------------------------------------------------------------- Summary of changes: tests/gpg/t-thread-keylist-verify.c | 7 ++++++- tests/gpg/t-thread-keylist.c | 5 ++++- 2 files changed, 10 insertions(+), 2 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Thu Nov 10 15:58:27 2016 From: cvs at cvs.gnupg.org (by Justus Winter) Date: Thu, 10 Nov 2016 15:58:27 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.1.15-350-gee08677 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via ee08677d63a900cea85228024861a4f5c5a87c69 (commit) via e0cbd3389e2dd6ec19ee3a4c7bad81fa0f1907f5 (commit) via d3a98ff5bc972a4c9b01b9e5338a4a59b5b4ac48 (commit) via 568cfcde45a0d6c456d8f8be1ea0e408416badad (commit) via 9ee184bc0afaea06785d836ed175b851b9ae532f (commit) via d7c5799c282a03dcce0e3d327075233353cb76cc (commit) from 088d955bd8a6ec8bbf76c8a4c01eb08499d1d9fa (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit ee08677d63a900cea85228024861a4f5c5a87c69 Author: Justus Winter Date: Thu Nov 10 14:47:00 2016 +0100 gpgscm: Recover cells from the list of recently allocated cells. * tests/gpgscm/scheme.c (ok_to_freely_gc): Recover cells. Signed-off-by: Justus Winter diff --git a/tests/gpgscm/scheme.c b/tests/gpgscm/scheme.c index 105d2a1..146b9e6 100644 --- a/tests/gpgscm/scheme.c +++ b/tests/gpgscm/scheme.c @@ -805,6 +805,17 @@ static void push_recent_alloc(scheme *sc, pointer recent, pointer extra) car(sc->sink) = holder; } +static INLINE void ok_to_freely_gc(scheme *sc) +{ + pointer a = car(sc->sink), next; + car(sc->sink) = sc->NIL; + while (a != sc->NIL) + { + next = cdr(a); + free_cell(sc, a); + a = next; + } +} static pointer get_cell(scheme *sc, pointer a, pointer b) { @@ -832,12 +843,6 @@ static pointer get_vector_object(scheme *sc, int len, pointer init) return cells; } -static INLINE void ok_to_freely_gc(scheme *sc) -{ - car(sc->sink) = sc->NIL; -} - - #if defined TSGRIND static void check_cell_alloced(pointer p, int expect_alloced) { commit e0cbd3389e2dd6ec19ee3a4c7bad81fa0f1907f5 Author: Justus Winter Date: Thu Nov 10 14:02:11 2016 +0100 gpgscm: Recover cells used to maintain interpreter state. * tests/gpgscm/scheme.c (free_cell): New function. (free_cons): Likewise. (_s_return): Use the new function to recover cells used to save the state of the interpreter in 's_save'. This reduces the need to do a garbage collection considerably. Signed-off-by: Justus Winter diff --git a/tests/gpgscm/scheme.c b/tests/gpgscm/scheme.c index 90cb8fd..105d2a1 100644 --- a/tests/gpgscm/scheme.c +++ b/tests/gpgscm/scheme.c @@ -773,6 +773,26 @@ static pointer find_consecutive_cells(scheme *sc, int n) { return sc->NIL; } +/* Free a cell. This is dangerous. Only free cells that are not + * referenced. */ +static INLINE void +free_cell(scheme *sc, pointer a) +{ + cdr(a) = sc->free_cell; + sc->free_cell = a; + sc->fcells += 1; +} + +/* Free a cell and retrieve its content. This is dangerous. Only + * free cells that are not referenced. */ +static INLINE void +free_cons(scheme *sc, pointer a, pointer *r_car, pointer *r_cdr) +{ + *r_car = car(a); + *r_cdr = cdr(a); + free_cell(sc, a); +} + /* To retain recent allocs before interpreter knows about them - Tehom */ @@ -2481,14 +2501,17 @@ static void dump_stack_free(scheme *sc) } static pointer _s_return(scheme *sc, pointer a) { - sc->value = (a); - if(sc->dump==sc->NIL) return sc->NIL; - sc->op = ivalue(car(sc->dump)); - sc->args = cadr(sc->dump); - sc->envir = caddr(sc->dump); - sc->code = cadddr(sc->dump); - sc->dump = cddddr(sc->dump); - return sc->T; + pointer dump = sc->dump; + pointer op; + sc->value = (a); + if (dump == sc->NIL) + return sc->NIL; + free_cons(sc, dump, &op, &dump); + sc->op = ivalue(op); + free_cons(sc, dump, &sc->args, &dump); + free_cons(sc, dump, &sc->envir, &dump); + free_cons(sc, dump, &sc->code, &sc->dump); + return sc->T; } static void s_save(scheme *sc, enum scheme_opcodes op, pointer args, pointer code) { commit d3a98ff5bc972a4c9b01b9e5338a4a59b5b4ac48 Author: Justus Winter Date: Thu Nov 10 11:47:08 2016 +0100 gpgscm: Reduce opcode dispatch overhead. * tests/gpgscm/scheme.c (s_thread_to): New macro. (CASE): Likewise. (opexe_[0-6]): Use 'CASE' instead of 'case' statements, replace 's_goto' with 's_thread_to' where applicable. -- This is a straight-forward optimization that replaces 's_goto' in certain cases. Instead of returning to the calling function, and dispatching the next opcode, we can jump to the opcode handler. Signed-off-by: Justus Winter diff --git a/tests/gpgscm/scheme.c b/tests/gpgscm/scheme.c index 884ffd5..90cb8fd 100644 --- a/tests/gpgscm/scheme.c +++ b/tests/gpgscm/scheme.c @@ -2436,10 +2436,33 @@ static pointer _Error_1(scheme *sc, const char *s, pointer a) { /* Too small to turn into function */ # define BEGIN do { # define END } while (0) + +/* Bounce back to Eval_Cycle and execute A. */ #define s_goto(sc,a) BEGIN \ sc->op = (int)(a); \ return sc->T; END +#if USE_THREADED_CODE + +/* Do not bounce back to Eval_Cycle but execute A by jumping directly + * to it. Only applicable if A is part of the same dispatch + * function. */ +#define s_thread_to(sc, a) \ + BEGIN \ + op = (int) (a); \ + goto a; \ + END + +/* Define a label OP and emit a case statement for OP. For use in the + * dispatch functions. The slightly peculiar goto that is never + * executed avoids warnings about unused labels. */ +#define CASE(OP) if (0) goto OP; OP: case OP + +#else /* USE_THREADED_CODE */ +#define s_thread_to(sc, a) s_goto(sc, a) +#define CASE(OP) case OP +#endif /* USE_THREADED_CODE */ + #define s_return(sc,a) return _s_return(sc,a) static INLINE void dump_stack_reset(scheme *sc) @@ -2485,7 +2508,7 @@ static pointer opexe_0(scheme *sc, enum scheme_opcodes op) { pointer x, y; switch (op) { - case OP_LOAD: /* load */ + CASE(OP_LOAD): /* load */ if(file_interactive(sc)) { fprintf(sc->outport->_object._port->rep.stdio.file, "Loading %s\n", strvalue(car(sc->args))); @@ -2496,10 +2519,10 @@ static pointer opexe_0(scheme *sc, enum scheme_opcodes op) { else { sc->args = mk_integer(sc,sc->file_i); - s_goto(sc,OP_T0LVL); + s_thread_to(sc,OP_T0LVL); } - case OP_T0LVL: /* top level */ + CASE(OP_T0LVL): /* top level */ /* If we reached the end of file, this loop is done. */ if(sc->loadport->_object._port->kind & port_saw_EOF) { @@ -2533,23 +2556,23 @@ static pointer opexe_0(scheme *sc, enum scheme_opcodes op) { s_save(sc,OP_T0LVL, sc->NIL, sc->NIL); s_save(sc,OP_VALUEPRINT, sc->NIL, sc->NIL); s_save(sc,OP_T1LVL, sc->NIL, sc->NIL); - s_goto(sc,OP_READ_INTERNAL); + s_thread_to(sc,OP_READ_INTERNAL); - case OP_T1LVL: /* top level */ + CASE(OP_T1LVL): /* top level */ sc->code = sc->value; sc->inport=sc->save_inport; - s_goto(sc,OP_EVAL); + s_thread_to(sc,OP_EVAL); - case OP_READ_INTERNAL: /* internal read */ + CASE(OP_READ_INTERNAL): /* internal read */ sc->tok = token(sc); if(sc->tok==TOK_EOF) { s_return(sc,sc->EOF_OBJ); } s_goto(sc,OP_RDSEXPR); - case OP_GENSYM: + CASE(OP_GENSYM): s_return(sc, gensym(sc)); - case OP_VALUEPRINT: /* print evaluation result */ + CASE(OP_VALUEPRINT): /* print evaluation result */ /* OP_VALUEPRINT is always pushed, because when changing from non-interactive to interactive mode, it needs to be already on the stack */ @@ -2564,7 +2587,7 @@ static pointer opexe_0(scheme *sc, enum scheme_opcodes op) { s_return(sc,sc->value); } - case OP_EVAL: /* main part of evaluation */ + CASE(OP_EVAL): /* main part of evaluation */ #if USE_TRACING if(sc->tracing) { /*s_save(sc,OP_VALUEPRINT,sc->NIL,sc->NIL);*/ @@ -2574,7 +2597,7 @@ static pointer opexe_0(scheme *sc, enum scheme_opcodes op) { s_goto(sc,OP_P0LIST); } /* fall through */ - case OP_REAL_EVAL: + CASE(OP_REAL_EVAL): #endif if (is_symbol(sc->code)) { /* symbol */ x=find_slot_in_env(sc,sc->envir,sc->code,1); @@ -2591,46 +2614,46 @@ static pointer opexe_0(scheme *sc, enum scheme_opcodes op) { s_save(sc,OP_E0ARGS, sc->NIL, sc->code); /* If no macros => s_save(sc,OP_E1ARGS, sc->NIL, cdr(sc->code));*/ sc->code = car(sc->code); - s_goto(sc,OP_EVAL); + s_thread_to(sc,OP_EVAL); } } else { s_return(sc,sc->code); } - case OP_E0ARGS: /* eval arguments */ + CASE(OP_E0ARGS): /* eval arguments */ if (is_macro(sc->value)) { /* macro expansion */ s_save(sc,OP_DOMACRO, sc->NIL, sc->NIL); sc->args = cons(sc,sc->code, sc->NIL); sc->code = sc->value; - s_goto(sc,OP_APPLY); + s_thread_to(sc,OP_APPLY); } else { sc->code = cdr(sc->code); - s_goto(sc,OP_E1ARGS); + s_thread_to(sc,OP_E1ARGS); } - case OP_E1ARGS: /* eval arguments */ + CASE(OP_E1ARGS): /* eval arguments */ sc->args = cons(sc, sc->value, sc->args); if (is_pair(sc->code)) { /* continue */ s_save(sc,OP_E1ARGS, sc->args, cdr(sc->code)); sc->code = car(sc->code); sc->args = sc->NIL; - s_goto(sc,OP_EVAL); + s_thread_to(sc,OP_EVAL); } else { /* end */ sc->args = reverse_in_place(sc, sc->NIL, sc->args); sc->code = car(sc->args); sc->args = cdr(sc->args); - s_goto(sc,OP_APPLY); + s_thread_to(sc,OP_APPLY); } #if USE_TRACING - case OP_TRACING: { + CASE(OP_TRACING): { int tr=sc->tracing; sc->tracing=ivalue(car(sc->args)); s_return(sc,mk_integer(sc,tr)); } #endif - case OP_APPLY: /* apply 'code' to 'args' */ + CASE(OP_APPLY): /* apply 'code' to 'args' */ #if USE_TRACING if(sc->tracing) { s_save(sc,OP_REAL_APPLY,sc->args,sc->code); @@ -2640,7 +2663,7 @@ static pointer opexe_0(scheme *sc, enum scheme_opcodes op) { s_goto(sc,OP_P0LIST); } /* fall through */ - case OP_REAL_APPLY: + CASE(OP_REAL_APPLY): #endif if (is_proc(sc->code)) { s_goto(sc,procnum(sc->code)); /* PROCEDURE */ @@ -2676,7 +2699,7 @@ static pointer opexe_0(scheme *sc, enum scheme_opcodes op) { } sc->code = cdr(closure_code(sc->code)); sc->args = sc->NIL; - s_goto(sc,OP_BEGIN); + s_thread_to(sc,OP_BEGIN); } else if (is_continuation(sc->code)) { /* CONTINUATION */ sc->dump = cont_dump(sc->code); s_return(sc,sc->args != sc->NIL ? car(sc->args) : sc->NIL); @@ -2684,12 +2707,12 @@ static pointer opexe_0(scheme *sc, enum scheme_opcodes op) { Error_1(sc,"illegal function",sc->code); } - case OP_DOMACRO: /* do macro */ + CASE(OP_DOMACRO): /* do macro */ sc->code = sc->value; - s_goto(sc,OP_EVAL); + s_thread_to(sc,OP_EVAL); #if USE_COMPILE_HOOK - case OP_LAMBDA: /* lambda */ + CASE(OP_LAMBDA): /* lambda */ /* If the hook is defined, apply it to sc->code, otherwise set sc->value fall through */ { @@ -2701,20 +2724,20 @@ static pointer opexe_0(scheme *sc, enum scheme_opcodes op) { s_save(sc,OP_LAMBDA1,sc->args,sc->code); sc->args=cons(sc,sc->code,sc->NIL); sc->code=slot_value_in_env(f); - s_goto(sc,OP_APPLY); + s_thread_to(sc,OP_APPLY); } } - case OP_LAMBDA1: + CASE(OP_LAMBDA1): s_return(sc,mk_closure(sc, sc->value, sc->envir)); #else - case OP_LAMBDA: /* lambda */ + CASE(OP_LAMBDA): /* lambda */ s_return(sc,mk_closure(sc, sc->code, sc->envir)); #endif - case OP_MKCLOSURE: /* make-closure */ + CASE(OP_MKCLOSURE): /* make-closure */ x=car(sc->args); if(car(x)==sc->LAMBDA) { x=cdr(x); @@ -2726,10 +2749,10 @@ static pointer opexe_0(scheme *sc, enum scheme_opcodes op) { } s_return(sc,mk_closure(sc, x, y)); - case OP_QUOTE: /* quote */ + CASE(OP_QUOTE): /* quote */ s_return(sc,car(sc->code)); - case OP_DEF0: /* define */ + CASE(OP_DEF0): /* define */ if(is_immutable(car(sc->code))) Error_1(sc,"define: unable to alter immutable", car(sc->code)); @@ -2744,9 +2767,9 @@ static pointer opexe_0(scheme *sc, enum scheme_opcodes op) { Error_0(sc,"variable is not a symbol"); } s_save(sc,OP_DEF1, sc->NIL, x); - s_goto(sc,OP_EVAL); + s_thread_to(sc,OP_EVAL); - case OP_DEF1: /* define */ + CASE(OP_DEF1): /* define */ x=find_slot_in_env(sc,sc->envir,sc->code,0); if (x != sc->NIL) { set_slot_in_env(sc, x, sc->value); @@ -2756,21 +2779,21 @@ static pointer opexe_0(scheme *sc, enum scheme_opcodes op) { s_return(sc,sc->code); - case OP_DEFP: /* defined? */ + CASE(OP_DEFP): /* defined? */ x=sc->envir; if(cdr(sc->args)!=sc->NIL) { x=cadr(sc->args); } s_retbool(find_slot_in_env(sc,x,car(sc->args),1)!=sc->NIL); - case OP_SET0: /* set! */ + CASE(OP_SET0): /* set! */ if(is_immutable(car(sc->code))) Error_1(sc,"set!: unable to alter immutable variable",car(sc->code)); s_save(sc,OP_SET1, sc->NIL, car(sc->code)); sc->code = cadr(sc->code); - s_goto(sc,OP_EVAL); + s_thread_to(sc,OP_EVAL); - case OP_SET1: /* set! */ + CASE(OP_SET1): /* set! */ y=find_slot_in_env(sc,sc->envir,sc->code,1); if (y != sc->NIL) { set_slot_in_env(sc, y, sc->value); @@ -2780,7 +2803,7 @@ static pointer opexe_0(scheme *sc, enum scheme_opcodes op) { } - case OP_BEGIN: /* begin */ + CASE(OP_BEGIN): /* begin */ if (!is_pair(sc->code)) { s_return(sc,sc->code); } @@ -2788,28 +2811,28 @@ static pointer opexe_0(scheme *sc, enum scheme_opcodes op) { s_save(sc,OP_BEGIN, sc->NIL, cdr(sc->code)); } sc->code = car(sc->code); - s_goto(sc,OP_EVAL); + s_thread_to(sc,OP_EVAL); - case OP_IF0: /* if */ + CASE(OP_IF0): /* if */ s_save(sc,OP_IF1, sc->NIL, cdr(sc->code)); sc->code = car(sc->code); - s_goto(sc,OP_EVAL); + s_thread_to(sc,OP_EVAL); - case OP_IF1: /* if */ + CASE(OP_IF1): /* if */ if (is_true(sc->value)) sc->code = car(sc->code); else sc->code = cadr(sc->code); /* (if #f 1) ==> () because * car(sc->NIL) = sc->NIL */ - s_goto(sc,OP_EVAL); + s_thread_to(sc,OP_EVAL); - case OP_LET0: /* let */ + CASE(OP_LET0): /* let */ sc->args = sc->NIL; sc->value = sc->code; sc->code = is_symbol(car(sc->code)) ? cadr(sc->code) : car(sc->code); - s_goto(sc,OP_LET1); + s_thread_to(sc,OP_LET1); - case OP_LET1: /* let (calculate parameters) */ + CASE(OP_LET1): /* let (calculate parameters) */ sc->args = cons(sc, sc->value, sc->args); if (is_pair(sc->code)) { /* continue */ if (!is_pair(car(sc->code)) || !is_pair(cdar(sc->code))) { @@ -2819,15 +2842,15 @@ static pointer opexe_0(scheme *sc, enum scheme_opcodes op) { s_save(sc,OP_LET1, sc->args, cdr(sc->code)); sc->code = cadar(sc->code); sc->args = sc->NIL; - s_goto(sc,OP_EVAL); + s_thread_to(sc,OP_EVAL); } else { /* end */ sc->args = reverse_in_place(sc, sc->NIL, sc->args); sc->code = car(sc->args); sc->args = cdr(sc->args); - s_goto(sc,OP_LET2); + s_thread_to(sc,OP_LET2); } - case OP_LET2: /* let */ + CASE(OP_LET2): /* let */ new_frame_in_env(sc, sc->envir); for (x = is_symbol(car(sc->code)) ? cadr(sc->code) : car(sc->code), y = sc->args; y != sc->NIL; x = cdr(x), y = cdr(y)) { @@ -2849,37 +2872,37 @@ static pointer opexe_0(scheme *sc, enum scheme_opcodes op) { sc->code = cdr(sc->code); sc->args = sc->NIL; } - s_goto(sc,OP_BEGIN); + s_thread_to(sc,OP_BEGIN); - case OP_LET0AST: /* let* */ + CASE(OP_LET0AST): /* let* */ if (car(sc->code) == sc->NIL) { new_frame_in_env(sc, sc->envir); sc->code = cdr(sc->code); - s_goto(sc,OP_BEGIN); + s_thread_to(sc,OP_BEGIN); } if(!is_pair(car(sc->code)) || !is_pair(caar(sc->code)) || !is_pair(cdaar(sc->code))) { Error_1(sc,"Bad syntax of binding spec in let* :",car(sc->code)); } s_save(sc,OP_LET1AST, cdr(sc->code), car(sc->code)); sc->code = cadaar(sc->code); - s_goto(sc,OP_EVAL); + s_thread_to(sc,OP_EVAL); - case OP_LET1AST: /* let* (make new frame) */ + CASE(OP_LET1AST): /* let* (make new frame) */ new_frame_in_env(sc, sc->envir); - s_goto(sc,OP_LET2AST); + s_thread_to(sc,OP_LET2AST); - case OP_LET2AST: /* let* (calculate parameters) */ + CASE(OP_LET2AST): /* let* (calculate parameters) */ new_slot_in_env(sc, caar(sc->code), sc->value); sc->code = cdr(sc->code); if (is_pair(sc->code)) { /* continue */ s_save(sc,OP_LET2AST, sc->args, sc->code); sc->code = cadar(sc->code); sc->args = sc->NIL; - s_goto(sc,OP_EVAL); + s_thread_to(sc,OP_EVAL); } else { /* end */ sc->code = sc->args; sc->args = sc->NIL; - s_goto(sc,OP_BEGIN); + s_thread_to(sc,OP_BEGIN); } default: snprintf(sc->strbuff,STRBUFFSIZE,"%d: illegal operator", sc->op); @@ -2892,14 +2915,14 @@ static pointer opexe_1(scheme *sc, enum scheme_opcodes op) { pointer x, y; switch (op) { - case OP_LET0REC: /* letrec */ + CASE(OP_LET0REC): /* letrec */ new_frame_in_env(sc, sc->envir); sc->args = sc->NIL; sc->value = sc->code; sc->code = car(sc->code); - s_goto(sc,OP_LET1REC); + s_thread_to(sc,OP_LET1REC); - case OP_LET1REC: /* letrec (calculate parameters) */ + CASE(OP_LET1REC): /* letrec (calculate parameters) */ sc->args = cons(sc, sc->value, sc->args); if (is_pair(sc->code)) { /* continue */ if (!is_pair(car(sc->code)) || !is_pair(cdar(sc->code))) { @@ -2914,10 +2937,10 @@ static pointer opexe_1(scheme *sc, enum scheme_opcodes op) { sc->args = reverse_in_place(sc, sc->NIL, sc->args); sc->code = car(sc->args); sc->args = cdr(sc->args); - s_goto(sc,OP_LET2REC); + s_thread_to(sc,OP_LET2REC); } - case OP_LET2REC: /* letrec */ + CASE(OP_LET2REC): /* letrec */ for (x = car(sc->code), y = sc->args; y != sc->NIL; x = cdr(x), y = cdr(y)) { new_slot_in_env(sc, caar(x), car(y)); } @@ -2925,7 +2948,7 @@ static pointer opexe_1(scheme *sc, enum scheme_opcodes op) { sc->args = sc->NIL; s_goto(sc,OP_BEGIN); - case OP_COND0: /* cond */ + CASE(OP_COND0): /* cond */ if (!is_pair(sc->code)) { Error_0(sc,"syntax error in cond"); } @@ -2933,7 +2956,7 @@ static pointer opexe_1(scheme *sc, enum scheme_opcodes op) { sc->code = caar(sc->code); s_goto(sc,OP_EVAL); - case OP_COND1: /* cond */ + CASE(OP_COND1): /* cond */ if (is_true(sc->value)) { if ((sc->code = cdar(sc->code)) == sc->NIL) { s_return(sc,sc->value); @@ -2957,12 +2980,12 @@ static pointer opexe_1(scheme *sc, enum scheme_opcodes op) { } } - case OP_DELAY: /* delay */ + CASE(OP_DELAY): /* delay */ x = mk_closure(sc, cons(sc, sc->NIL, sc->code), sc->envir); typeflag(x)=T_PROMISE; s_return(sc,x); - case OP_AND0: /* and */ + CASE(OP_AND0): /* and */ if (sc->code == sc->NIL) { s_return(sc,sc->T); } @@ -2970,7 +2993,7 @@ static pointer opexe_1(scheme *sc, enum scheme_opcodes op) { sc->code = car(sc->code); s_goto(sc,OP_EVAL); - case OP_AND1: /* and */ + CASE(OP_AND1): /* and */ if (is_false(sc->value)) { s_return(sc,sc->value); } else if (sc->code == sc->NIL) { @@ -2981,7 +3004,7 @@ static pointer opexe_1(scheme *sc, enum scheme_opcodes op) { s_goto(sc,OP_EVAL); } - case OP_OR0: /* or */ + CASE(OP_OR0): /* or */ if (sc->code == sc->NIL) { s_return(sc,sc->F); } @@ -2989,7 +3012,7 @@ static pointer opexe_1(scheme *sc, enum scheme_opcodes op) { sc->code = car(sc->code); s_goto(sc,OP_EVAL); - case OP_OR1: /* or */ + CASE(OP_OR1): /* or */ if (is_true(sc->value)) { s_return(sc,sc->value); } else if (sc->code == sc->NIL) { @@ -3000,18 +3023,18 @@ static pointer opexe_1(scheme *sc, enum scheme_opcodes op) { s_goto(sc,OP_EVAL); } - case OP_C0STREAM: /* cons-stream */ + CASE(OP_C0STREAM): /* cons-stream */ s_save(sc,OP_C1STREAM, sc->NIL, cdr(sc->code)); sc->code = car(sc->code); s_goto(sc,OP_EVAL); - case OP_C1STREAM: /* cons-stream */ + CASE(OP_C1STREAM): /* cons-stream */ sc->args = sc->value; /* save sc->value to register sc->args for gc */ x = mk_closure(sc, cons(sc, sc->NIL, sc->code), sc->envir); typeflag(x)=T_PROMISE; s_return(sc,cons(sc, sc->args, x)); - case OP_MACRO0: /* macro */ + CASE(OP_MACRO0): /* macro */ if (is_pair(car(sc->code))) { x = caar(sc->code); sc->code = cons(sc, sc->LAMBDA, cons(sc, cdar(sc->code), cdr(sc->code))); @@ -3025,7 +3048,7 @@ static pointer opexe_1(scheme *sc, enum scheme_opcodes op) { s_save(sc,OP_MACRO1, sc->NIL, x); s_goto(sc,OP_EVAL); - case OP_MACRO1: /* macro */ + CASE(OP_MACRO1): /* macro */ typeflag(sc->value) = T_MACRO; x = find_slot_in_env(sc, sc->envir, sc->code, 0); if (x != sc->NIL) { @@ -3035,12 +3058,12 @@ static pointer opexe_1(scheme *sc, enum scheme_opcodes op) { } s_return(sc,sc->code); - case OP_CASE0: /* case */ + CASE(OP_CASE0): /* case */ s_save(sc,OP_CASE1, sc->NIL, cdr(sc->code)); sc->code = car(sc->code); s_goto(sc,OP_EVAL); - case OP_CASE1: /* case */ + CASE(OP_CASE1): /* case */ for (x = sc->code; x != sc->NIL; x = cdr(x)) { if (!is_pair(y = caar(x))) { break; @@ -3067,27 +3090,27 @@ static pointer opexe_1(scheme *sc, enum scheme_opcodes op) { s_return(sc,sc->NIL); } - case OP_CASE2: /* case */ + CASE(OP_CASE2): /* case */ if (is_true(sc->value)) { s_goto(sc,OP_BEGIN); } else { s_return(sc,sc->NIL); } - case OP_PAPPLY: /* apply */ + CASE(OP_PAPPLY): /* apply */ sc->code = car(sc->args); sc->args = list_star(sc,cdr(sc->args)); /*sc->args = cadr(sc->args);*/ s_goto(sc,OP_APPLY); - case OP_PEVAL: /* eval */ + CASE(OP_PEVAL): /* eval */ if(cdr(sc->args)!=sc->NIL) { sc->envir=cadr(sc->args); } sc->code = car(sc->args); s_goto(sc,OP_EVAL); - case OP_CONTINUATION: /* call-with-current-continuation */ + CASE(OP_CONTINUATION): /* call-with-current-continuation */ sc->code = car(sc->args); sc->args = cons(sc, mk_continuation(sc, sc->dump), sc->NIL); s_goto(sc,OP_APPLY); @@ -3108,7 +3131,7 @@ static pointer opexe_2(scheme *sc, enum scheme_opcodes op) { switch (op) { #if USE_MATH - case OP_INEX2EX: /* inexact->exact */ + CASE(OP_INEX2EX): /* inexact->exact */ x=car(sc->args); if(num_is_integer(x)) { s_return(sc,x); @@ -3118,35 +3141,35 @@ static pointer opexe_2(scheme *sc, enum scheme_opcodes op) { Error_1(sc,"inexact->exact: not integral:",x); } - case OP_EXP: + CASE(OP_EXP): x=car(sc->args); s_return(sc, mk_real(sc, exp(rvalue(x)))); - case OP_LOG: + CASE(OP_LOG): x=car(sc->args); s_return(sc, mk_real(sc, log(rvalue(x)))); - case OP_SIN: + CASE(OP_SIN): x=car(sc->args); s_return(sc, mk_real(sc, sin(rvalue(x)))); - case OP_COS: + CASE(OP_COS): x=car(sc->args); s_return(sc, mk_real(sc, cos(rvalue(x)))); - case OP_TAN: + CASE(OP_TAN): x=car(sc->args); s_return(sc, mk_real(sc, tan(rvalue(x)))); - case OP_ASIN: + CASE(OP_ASIN): x=car(sc->args); s_return(sc, mk_real(sc, asin(rvalue(x)))); - case OP_ACOS: + CASE(OP_ACOS): x=car(sc->args); s_return(sc, mk_real(sc, acos(rvalue(x)))); - case OP_ATAN: + CASE(OP_ATAN): x=car(sc->args); if(cdr(sc->args)==sc->NIL) { s_return(sc, mk_real(sc, atan(rvalue(x)))); @@ -3155,11 +3178,11 @@ static pointer opexe_2(scheme *sc, enum scheme_opcodes op) { s_return(sc, mk_real(sc, atan2(rvalue(x),rvalue(y)))); } - case OP_SQRT: + CASE(OP_SQRT): x=car(sc->args); s_return(sc, mk_real(sc, sqrt(rvalue(x)))); - case OP_EXPT: { + CASE(OP_EXPT): { double result; int real_result=1; pointer y=cadr(sc->args); @@ -3188,15 +3211,15 @@ static pointer opexe_2(scheme *sc, enum scheme_opcodes op) { } } - case OP_FLOOR: + CASE(OP_FLOOR): x=car(sc->args); s_return(sc, mk_real(sc, floor(rvalue(x)))); - case OP_CEILING: + CASE(OP_CEILING): x=car(sc->args); s_return(sc, mk_real(sc, ceil(rvalue(x)))); - case OP_TRUNCATE : { + CASE(OP_TRUNCATE ): { double rvalue_of_x ; x=car(sc->args); rvalue_of_x = rvalue(x) ; @@ -3207,28 +3230,28 @@ static pointer opexe_2(scheme *sc, enum scheme_opcodes op) { } } - case OP_ROUND: + CASE(OP_ROUND): x=car(sc->args); if (num_is_integer(x)) s_return(sc, x); s_return(sc, mk_real(sc, round_per_R5RS(rvalue(x)))); #endif - case OP_ADD: /* + */ + CASE(OP_ADD): /* + */ v=num_zero; for (x = sc->args; x != sc->NIL; x = cdr(x)) { v=num_add(v,nvalue(car(x))); } s_return(sc,mk_number(sc, v)); - case OP_MUL: /* * */ + CASE(OP_MUL): /* * */ v=num_one; for (x = sc->args; x != sc->NIL; x = cdr(x)) { v=num_mul(v,nvalue(car(x))); } s_return(sc,mk_number(sc, v)); - case OP_SUB: /* - */ + CASE(OP_SUB): /* - */ if(cdr(sc->args)==sc->NIL) { x=sc->args; v=num_zero; @@ -3241,7 +3264,7 @@ static pointer opexe_2(scheme *sc, enum scheme_opcodes op) { } s_return(sc,mk_number(sc, v)); - case OP_DIV: /* / */ + CASE(OP_DIV): /* / */ if(cdr(sc->args)==sc->NIL) { x=sc->args; v=num_one; @@ -3258,7 +3281,7 @@ static pointer opexe_2(scheme *sc, enum scheme_opcodes op) { } s_return(sc,mk_number(sc, v)); - case OP_INTDIV: /* quotient */ + CASE(OP_INTDIV): /* quotient */ if(cdr(sc->args)==sc->NIL) { x=sc->args; v=num_one; @@ -3275,7 +3298,7 @@ static pointer opexe_2(scheme *sc, enum scheme_opcodes op) { } s_return(sc,mk_number(sc, v)); - case OP_REM: /* remainder */ + CASE(OP_REM): /* remainder */ v = nvalue(car(sc->args)); if (ivalue(cadr(sc->args)) != 0) v=num_rem(v,nvalue(cadr(sc->args))); @@ -3284,7 +3307,7 @@ static pointer opexe_2(scheme *sc, enum scheme_opcodes op) { } s_return(sc,mk_number(sc, v)); - case OP_MOD: /* modulo */ + CASE(OP_MOD): /* modulo */ v = nvalue(car(sc->args)); if (ivalue(cadr(sc->args)) != 0) v=num_mod(v,nvalue(cadr(sc->args))); @@ -3293,17 +3316,17 @@ static pointer opexe_2(scheme *sc, enum scheme_opcodes op) { } s_return(sc,mk_number(sc, v)); - case OP_CAR: /* car */ + CASE(OP_CAR): /* car */ s_return(sc,caar(sc->args)); - case OP_CDR: /* cdr */ + CASE(OP_CDR): /* cdr */ s_return(sc,cdar(sc->args)); - case OP_CONS: /* cons */ + CASE(OP_CONS): /* cons */ cdr(sc->args) = cadr(sc->args); s_return(sc,sc->args); - case OP_SETCAR: /* set-car! */ + CASE(OP_SETCAR): /* set-car! */ if(!is_immutable(car(sc->args))) { caar(sc->args) = cadr(sc->args); s_return(sc,car(sc->args)); @@ -3311,7 +3334,7 @@ static pointer opexe_2(scheme *sc, enum scheme_opcodes op) { Error_0(sc,"set-car!: unable to alter immutable pair"); } - case OP_SETCDR: /* set-cdr! */ + CASE(OP_SETCDR): /* set-cdr! */ if(!is_immutable(car(sc->args))) { cdar(sc->args) = cadr(sc->args); s_return(sc,car(sc->args)); @@ -3319,36 +3342,36 @@ static pointer opexe_2(scheme *sc, enum scheme_opcodes op) { Error_0(sc,"set-cdr!: unable to alter immutable pair"); } - case OP_CHAR2INT: { /* char->integer */ + CASE(OP_CHAR2INT): { /* char->integer */ char c; c=(char)ivalue(car(sc->args)); s_return(sc,mk_integer(sc,(unsigned char)c)); } - case OP_INT2CHAR: { /* integer->char */ + CASE(OP_INT2CHAR): { /* integer->char */ unsigned char c; c=(unsigned char)ivalue(car(sc->args)); s_return(sc,mk_character(sc,(char)c)); } - case OP_CHARUPCASE: { + CASE(OP_CHARUPCASE): { unsigned char c; c=(unsigned char)ivalue(car(sc->args)); c=toupper(c); s_return(sc,mk_character(sc,(char)c)); } - case OP_CHARDNCASE: { + CASE(OP_CHARDNCASE): { unsigned char c; c=(unsigned char)ivalue(car(sc->args)); c=tolower(c); s_return(sc,mk_character(sc,(char)c)); } - case OP_STR2SYM: /* string->symbol */ + CASE(OP_STR2SYM): /* string->symbol */ s_return(sc,mk_symbol(sc,strvalue(car(sc->args)))); - case OP_STR2ATOM: /* string->atom */ { + CASE(OP_STR2ATOM): /* string->atom */ { char *s=strvalue(car(sc->args)); long pf = 0; if(cdr(sc->args)!=sc->NIL) { @@ -3383,12 +3406,12 @@ static pointer opexe_2(scheme *sc, enum scheme_opcodes op) { } } - case OP_SYM2STR: /* symbol->string */ + CASE(OP_SYM2STR): /* symbol->string */ x=mk_string(sc,symname(car(sc->args))); setimmutable(x); s_return(sc,x); - case OP_ATOM2STR: /* atom->string */ { + CASE(OP_ATOM2STR): /* atom->string */ { long pf = 0; x=car(sc->args); if(cdr(sc->args)!=sc->NIL) { @@ -3414,7 +3437,7 @@ static pointer opexe_2(scheme *sc, enum scheme_opcodes op) { } } - case OP_MKSTRING: { /* make-string */ + CASE(OP_MKSTRING): { /* make-string */ int fill=' '; int len; @@ -3426,10 +3449,10 @@ static pointer opexe_2(scheme *sc, enum scheme_opcodes op) { s_return(sc,mk_empty_string(sc,len,(char)fill)); } - case OP_STRLEN: /* string-length */ + CASE(OP_STRLEN): /* string-length */ s_return(sc,mk_integer(sc,strlength(car(sc->args)))); - case OP_STRREF: { /* string-ref */ + CASE(OP_STRREF): { /* string-ref */ char *str; int index; @@ -3444,7 +3467,7 @@ static pointer opexe_2(scheme *sc, enum scheme_opcodes op) { s_return(sc,mk_character(sc,((unsigned char*)str)[index])); } - case OP_STRSET: { /* string-set! */ + CASE(OP_STRSET): { /* string-set! */ char *str; int index; int c; @@ -3465,7 +3488,7 @@ static pointer opexe_2(scheme *sc, enum scheme_opcodes op) { s_return(sc,car(sc->args)); } - case OP_STRAPPEND: { /* string-append */ + CASE(OP_STRAPPEND): { /* string-append */ /* in 1.29 string-append was in Scheme in init.scm but was too slow */ int len = 0; pointer newstr; @@ -3484,7 +3507,7 @@ static pointer opexe_2(scheme *sc, enum scheme_opcodes op) { s_return(sc, newstr); } - case OP_SUBSTR: { /* substring */ + CASE(OP_SUBSTR): { /* substring */ char *str; int index0; int index1; @@ -3515,7 +3538,7 @@ static pointer opexe_2(scheme *sc, enum scheme_opcodes op) { s_return(sc,x); } - case OP_VECTOR: { /* vector */ + CASE(OP_VECTOR): { /* vector */ int i; pointer vec; int len=list_length(sc,sc->args); @@ -3530,7 +3553,7 @@ static pointer opexe_2(scheme *sc, enum scheme_opcodes op) { s_return(sc,vec); } - case OP_MKVECTOR: { /* make-vector */ + CASE(OP_MKVECTOR): { /* make-vector */ pointer fill=sc->NIL; int len; pointer vec; @@ -3548,10 +3571,10 @@ static pointer opexe_2(scheme *sc, enum scheme_opcodes op) { s_return(sc,vec); } - case OP_VECLEN: /* vector-length */ + CASE(OP_VECLEN): /* vector-length */ s_return(sc,mk_integer(sc,ivalue(car(sc->args)))); - case OP_VECREF: { /* vector-ref */ + CASE(OP_VECREF): { /* vector-ref */ int index; index=ivalue(cadr(sc->args)); @@ -3563,7 +3586,7 @@ static pointer opexe_2(scheme *sc, enum scheme_opcodes op) { s_return(sc,vector_elem(car(sc->args),index)); } - case OP_VECSET: { /* vector-set! */ + CASE(OP_VECSET): { /* vector-set! */ int index; if(is_immutable(car(sc->args))) { @@ -3634,19 +3657,19 @@ static pointer opexe_3(scheme *sc, enum scheme_opcodes op) { int (*comp_func)(num,num)=0; switch (op) { - case OP_NOT: /* not */ + CASE(OP_NOT): /* not */ s_retbool(is_false(car(sc->args))); - case OP_BOOLP: /* boolean? */ + CASE(OP_BOOLP): /* boolean? */ s_retbool(car(sc->args) == sc->F || car(sc->args) == sc->T); - case OP_EOFOBJP: /* boolean? */ + CASE(OP_EOFOBJP): /* boolean? */ s_retbool(car(sc->args) == sc->EOF_OBJ); - case OP_NULLP: /* null? */ + CASE(OP_NULLP): /* null? */ s_retbool(car(sc->args) == sc->NIL); - case OP_NUMEQ: /* = */ - case OP_LESS: /* < */ - case OP_GRE: /* > */ - case OP_LEQ: /* <= */ - case OP_GEQ: /* >= */ + CASE(OP_NUMEQ): /* = */ + CASE(OP_LESS): /* < */ + CASE(OP_GRE): /* > */ + CASE(OP_LEQ): /* <= */ + CASE(OP_GEQ): /* >= */ switch(op) { case OP_NUMEQ: comp_func=num_eq; break; case OP_LESS: comp_func=num_lt; break; @@ -3666,37 +3689,37 @@ static pointer opexe_3(scheme *sc, enum scheme_opcodes op) { v=nvalue(car(x)); } s_retbool(1); - case OP_SYMBOLP: /* symbol? */ + CASE(OP_SYMBOLP): /* symbol? */ s_retbool(is_symbol(car(sc->args))); - case OP_NUMBERP: /* number? */ + CASE(OP_NUMBERP): /* number? */ s_retbool(is_number(car(sc->args))); - case OP_STRINGP: /* string? */ + CASE(OP_STRINGP): /* string? */ s_retbool(is_string(car(sc->args))); - case OP_INTEGERP: /* integer? */ + CASE(OP_INTEGERP): /* integer? */ s_retbool(is_integer(car(sc->args))); - case OP_REALP: /* real? */ + CASE(OP_REALP): /* real? */ s_retbool(is_number(car(sc->args))); /* All numbers are real */ - case OP_CHARP: /* char? */ + CASE(OP_CHARP): /* char? */ s_retbool(is_character(car(sc->args))); #if USE_CHAR_CLASSIFIERS - case OP_CHARAP: /* char-alphabetic? */ + CASE(OP_CHARAP): /* char-alphabetic? */ s_retbool(Cisalpha(ivalue(car(sc->args)))); - case OP_CHARNP: /* char-numeric? */ + CASE(OP_CHARNP): /* char-numeric? */ s_retbool(Cisdigit(ivalue(car(sc->args)))); - case OP_CHARWP: /* char-whitespace? */ + CASE(OP_CHARWP): /* char-whitespace? */ s_retbool(Cisspace(ivalue(car(sc->args)))); - case OP_CHARUP: /* char-upper-case? */ + CASE(OP_CHARUP): /* char-upper-case? */ s_retbool(Cisupper(ivalue(car(sc->args)))); - case OP_CHARLP: /* char-lower-case? */ + CASE(OP_CHARLP): /* char-lower-case? */ s_retbool(Cislower(ivalue(car(sc->args)))); #endif - case OP_PORTP: /* port? */ + CASE(OP_PORTP): /* port? */ s_retbool(is_port(car(sc->args))); - case OP_INPORTP: /* input-port? */ + CASE(OP_INPORTP): /* input-port? */ s_retbool(is_inport(car(sc->args))); - case OP_OUTPORTP: /* output-port? */ + CASE(OP_OUTPORTP): /* output-port? */ s_retbool(is_outport(car(sc->args))); - case OP_PROCP: /* procedure? */ + CASE(OP_PROCP): /* procedure? */ /*-- * continuation should be procedure by the example * (call-with-current-continuation procedure?) ==> #t @@ -3704,18 +3727,18 @@ static pointer opexe_3(scheme *sc, enum scheme_opcodes op) { */ s_retbool(is_proc(car(sc->args)) || is_closure(car(sc->args)) || is_continuation(car(sc->args)) || is_foreign(car(sc->args))); - case OP_PAIRP: /* pair? */ + CASE(OP_PAIRP): /* pair? */ s_retbool(is_pair(car(sc->args))); - case OP_LISTP: /* list? */ + CASE(OP_LISTP): /* list? */ s_retbool(list_length(sc,car(sc->args)) >= 0); - case OP_ENVP: /* environment? */ + CASE(OP_ENVP): /* environment? */ s_retbool(is_environment(car(sc->args))); - case OP_VECTORP: /* vector? */ + CASE(OP_VECTORP): /* vector? */ s_retbool(is_vector(car(sc->args))); - case OP_EQ: /* eq? */ + CASE(OP_EQ): /* eq? */ s_retbool(car(sc->args) == cadr(sc->args)); - case OP_EQV: /* eqv? */ + CASE(OP_EQV): /* eqv? */ s_retbool(eqv(car(sc->args), cadr(sc->args))); default: snprintf(sc->strbuff,STRBUFFSIZE,"%d: illegal operator", sc->op); @@ -3728,7 +3751,7 @@ static pointer opexe_4(scheme *sc, enum scheme_opcodes op) { pointer x, y; switch (op) { - case OP_FORCE: /* force */ + CASE(OP_FORCE): /* force */ sc->code = car(sc->args); if (is_promise(sc->code)) { /* Should change type to closure here */ @@ -3739,13 +3762,13 @@ static pointer opexe_4(scheme *sc, enum scheme_opcodes op) { s_return(sc,sc->code); } - case OP_SAVE_FORCED: /* Save forced value replacing promise */ + CASE(OP_SAVE_FORCED): /* Save forced value replacing promise */ memcpy(sc->code,sc->value,sizeof(struct cell)); s_return(sc,sc->value); - case OP_WRITE: /* write */ - case OP_DISPLAY: /* display */ - case OP_WRITE_CHAR: /* write-char */ + CASE(OP_WRITE): /* write */ + CASE(OP_DISPLAY): /* display */ + CASE(OP_WRITE_CHAR): /* write-char */ if(is_pair(cdr(sc->args))) { if(cadr(sc->args)!=sc->outport) { x=cons(sc,sc->outport,sc->NIL); @@ -3761,7 +3784,7 @@ static pointer opexe_4(scheme *sc, enum scheme_opcodes op) { } s_goto(sc,OP_P0LIST); - case OP_NEWLINE: /* newline */ + CASE(OP_NEWLINE): /* newline */ if(is_pair(sc->args)) { if(car(sc->args)!=sc->outport) { x=cons(sc,sc->outport,sc->NIL); @@ -3772,7 +3795,7 @@ static pointer opexe_4(scheme *sc, enum scheme_opcodes op) { putstr(sc, "\n"); s_return(sc,sc->T); - case OP_ERR0: /* error */ + CASE(OP_ERR0): /* error */ sc->retcode=-1; if (!is_string(car(sc->args))) { sc->args=cons(sc,mk_string(sc," -- "),sc->args); @@ -3781,9 +3804,9 @@ static pointer opexe_4(scheme *sc, enum scheme_opcodes op) { putstr(sc, "Error: "); putstr(sc, strvalue(car(sc->args))); sc->args = cdr(sc->args); - s_goto(sc,OP_ERR1); + s_thread_to(sc,OP_ERR1); - case OP_ERR1: /* error */ + CASE(OP_ERR1): /* error */ putstr(sc, " "); if (sc->args != sc->NIL) { s_save(sc,OP_ERR1, cdr(sc->args), sc->NIL); @@ -3799,13 +3822,13 @@ static pointer opexe_4(scheme *sc, enum scheme_opcodes op) { } } - case OP_REVERSE: /* reverse */ + CASE(OP_REVERSE): /* reverse */ s_return(sc,reverse(sc, car(sc->args))); - case OP_LIST_STAR: /* list* */ + CASE(OP_LIST_STAR): /* list* */ s_return(sc,list_star(sc,sc->args)); - case OP_APPEND: /* append */ + CASE(OP_APPEND): /* append */ x = sc->NIL; y = sc->args; if (y == x) { @@ -3825,7 +3848,7 @@ static pointer opexe_4(scheme *sc, enum scheme_opcodes op) { s_return(sc, reverse_in_place(sc, car(y), x)); #if USE_PLIST - case OP_PUT: /* put */ + CASE(OP_PUT): /* put */ if (!hasprop(car(sc->args)) || !hasprop(cadr(sc->args))) { Error_0(sc,"illegal use of put"); } @@ -3841,7 +3864,7 @@ static pointer opexe_4(scheme *sc, enum scheme_opcodes op) { symprop(car(sc->args))); s_return(sc,sc->T); - case OP_GET: /* get */ + CASE(OP_GET): /* get */ if (!hasprop(car(sc->args)) || !hasprop(cadr(sc->args))) { Error_0(sc,"illegal use of get"); } @@ -3856,42 +3879,42 @@ static pointer opexe_4(scheme *sc, enum scheme_opcodes op) { s_return(sc,sc->NIL); } #endif /* USE_PLIST */ - case OP_QUIT: /* quit */ + CASE(OP_QUIT): /* quit */ if(is_pair(sc->args)) { sc->retcode=ivalue(car(sc->args)); } return (sc->NIL); - case OP_GC: /* gc */ + CASE(OP_GC): /* gc */ gc(sc, sc->NIL, sc->NIL); s_return(sc,sc->T); - case OP_GCVERB: /* gc-verbose */ + CASE(OP_GCVERB): /* gc-verbose */ { int was = sc->gc_verbose; sc->gc_verbose = (car(sc->args) != sc->F); s_retbool(was); } - case OP_NEWSEGMENT: /* new-segment */ + CASE(OP_NEWSEGMENT): /* new-segment */ if (!is_pair(sc->args) || !is_number(car(sc->args))) { Error_0(sc,"new-segment: argument must be a number"); } alloc_cellseg(sc, (int) ivalue(car(sc->args))); s_return(sc,sc->T); - case OP_OBLIST: /* oblist */ + CASE(OP_OBLIST): /* oblist */ s_return(sc, oblist_all_symbols(sc)); - case OP_CURR_INPORT: /* current-input-port */ + CASE(OP_CURR_INPORT): /* current-input-port */ s_return(sc,sc->inport); - case OP_CURR_OUTPORT: /* current-output-port */ + CASE(OP_CURR_OUTPORT): /* current-output-port */ s_return(sc,sc->outport); - case OP_OPEN_INFILE: /* open-input-file */ - case OP_OPEN_OUTFILE: /* open-output-file */ - case OP_OPEN_INOUTFILE: /* open-input-output-file */ { + CASE(OP_OPEN_INFILE): /* open-input-file */ + CASE(OP_OPEN_OUTFILE): /* open-output-file */ + CASE(OP_OPEN_INOUTFILE): /* open-input-output-file */ { int prop=0; pointer p; switch(op) { @@ -3910,8 +3933,8 @@ static pointer opexe_4(scheme *sc, enum scheme_opcodes op) { } #if USE_STRING_PORTS - case OP_OPEN_INSTRING: /* open-input-string */ - case OP_OPEN_INOUTSTRING: /* open-input-output-string */ { + CASE(OP_OPEN_INSTRING): /* open-input-string */ + CASE(OP_OPEN_INOUTSTRING): /* open-input-output-string */ { int prop=0; pointer p; switch(op) { @@ -3926,7 +3949,7 @@ static pointer opexe_4(scheme *sc, enum scheme_opcodes op) { } s_return(sc,p); } - case OP_OPEN_OUTSTRING: /* open-output-string */ { + CASE(OP_OPEN_OUTSTRING): /* open-output-string */ { pointer p; if(car(sc->args)==sc->NIL) { p=port_from_scratch(sc); @@ -3943,7 +3966,7 @@ static pointer opexe_4(scheme *sc, enum scheme_opcodes op) { } s_return(sc,p); } - case OP_GET_OUTSTRING: /* get-output-string */ { + CASE(OP_GET_OUTSTRING): /* get-output-string */ { port *p; if ((p=car(sc->args)->_object._port)->kind&port_string) { @@ -3966,18 +3989,18 @@ static pointer opexe_4(scheme *sc, enum scheme_opcodes op) { } #endif - case OP_CLOSE_INPORT: /* close-input-port */ + CASE(OP_CLOSE_INPORT): /* close-input-port */ port_close(sc,car(sc->args),port_input); s_return(sc,sc->T); - case OP_CLOSE_OUTPORT: /* close-output-port */ + CASE(OP_CLOSE_OUTPORT): /* close-output-port */ port_close(sc,car(sc->args),port_output); s_return(sc,sc->T); - case OP_INT_ENV: /* interaction-environment */ + CASE(OP_INT_ENV): /* interaction-environment */ s_return(sc,sc->global_env); - case OP_CURR_ENV: /* current-environment */ + CASE(OP_CURR_ENV): /* current-environment */ s_return(sc,sc->envir); } @@ -3996,7 +4019,7 @@ static pointer opexe_5(scheme *sc, enum scheme_opcodes op) { switch (op) { /* ========== reading part ========== */ - case OP_READ: + CASE(OP_READ): if(!is_pair(sc->args)) { s_goto(sc,OP_READ_INTERNAL); } @@ -4012,8 +4035,8 @@ static pointer opexe_5(scheme *sc, enum scheme_opcodes op) { s_save(sc,OP_SET_INPORT, x, sc->NIL); s_goto(sc,OP_READ_INTERNAL); - case OP_READ_CHAR: /* read-char */ - case OP_PEEK_CHAR: /* peek-char */ { + CASE(OP_READ_CHAR): /* read-char */ + CASE(OP_PEEK_CHAR): /* peek-char */ { int c; if(is_pair(sc->args)) { if(car(sc->args)!=sc->inport) { @@ -4033,7 +4056,7 @@ static pointer opexe_5(scheme *sc, enum scheme_opcodes op) { s_return(sc,mk_character(sc,c)); } - case OP_CHAR_READY: /* char-ready? */ { + CASE(OP_CHAR_READY): /* char-ready? */ { pointer p=sc->inport; int res; if(is_pair(sc->args)) { @@ -4043,15 +4066,15 @@ static pointer opexe_5(scheme *sc, enum scheme_opcodes op) { s_retbool(res); } - case OP_SET_INPORT: /* set-input-port */ + CASE(OP_SET_INPORT): /* set-input-port */ sc->inport=car(sc->args); s_return(sc,sc->value); - case OP_SET_OUTPORT: /* set-output-port */ + CASE(OP_SET_OUTPORT): /* set-output-port */ sc->outport=car(sc->args); s_return(sc,sc->value); - case OP_RDSEXPR: + CASE(OP_RDSEXPR): switch (sc->tok) { case TOK_EOF: s_return(sc,sc->EOF_OBJ); @@ -4068,30 +4091,30 @@ static pointer opexe_5(scheme *sc, enum scheme_opcodes op) { } else { sc->nesting_stack[sc->file_i]++; s_save(sc,OP_RDLIST, sc->NIL, sc->NIL); - s_goto(sc,OP_RDSEXPR); + s_thread_to(sc,OP_RDSEXPR); } case TOK_QUOTE: s_save(sc,OP_RDQUOTE, sc->NIL, sc->NIL); sc->tok = token(sc); - s_goto(sc,OP_RDSEXPR); + s_thread_to(sc,OP_RDSEXPR); case TOK_BQUOTE: sc->tok = token(sc); if(sc->tok==TOK_VEC) { s_save(sc,OP_RDQQUOTEVEC, sc->NIL, sc->NIL); sc->tok=TOK_LPAREN; - s_goto(sc,OP_RDSEXPR); + s_thread_to(sc,OP_RDSEXPR); } else { s_save(sc,OP_RDQQUOTE, sc->NIL, sc->NIL); } - s_goto(sc,OP_RDSEXPR); + s_thread_to(sc,OP_RDSEXPR); case TOK_COMMA: s_save(sc,OP_RDUNQUOTE, sc->NIL, sc->NIL); sc->tok = token(sc); - s_goto(sc,OP_RDSEXPR); + s_thread_to(sc,OP_RDSEXPR); case TOK_ATMARK: s_save(sc,OP_RDUQTSP, sc->NIL, sc->NIL); sc->tok = token(sc); - s_goto(sc,OP_RDSEXPR); + s_thread_to(sc,OP_RDSEXPR); case TOK_ATOM: s_return(sc,mk_atom(sc, readstr_upto(sc, DELIMITERS))); case TOK_DQUOTE: @@ -4121,7 +4144,7 @@ static pointer opexe_5(scheme *sc, enum scheme_opcodes op) { } break; - case OP_RDLIST: { + CASE(OP_RDLIST): { sc->args = cons(sc, sc->value, sc->args); sc->tok = token(sc); if (sc->tok == TOK_EOF) @@ -4139,14 +4162,14 @@ static pointer opexe_5(scheme *sc, enum scheme_opcodes op) { } else if (sc->tok == TOK_DOT) { s_save(sc,OP_RDDOT, sc->args, sc->NIL); sc->tok = token(sc); - s_goto(sc,OP_RDSEXPR); + s_thread_to(sc,OP_RDSEXPR); } else { s_save(sc,OP_RDLIST, sc->args, sc->NIL);; - s_goto(sc,OP_RDSEXPR); + s_thread_to(sc,OP_RDSEXPR); } } - case OP_RDDOT: + CASE(OP_RDDOT): if (token(sc) != TOK_RPAREN) { Error_0(sc,"syntax error: illegal dot expression"); } else { @@ -4154,26 +4177,26 @@ static pointer opexe_5(scheme *sc, enum scheme_opcodes op) { s_return(sc,reverse_in_place(sc, sc->value, sc->args)); } - case OP_RDQUOTE: + CASE(OP_RDQUOTE): s_return(sc,cons(sc, sc->QUOTE, cons(sc, sc->value, sc->NIL))); - case OP_RDQQUOTE: + CASE(OP_RDQQUOTE): s_return(sc,cons(sc, sc->QQUOTE, cons(sc, sc->value, sc->NIL))); - case OP_RDQQUOTEVEC: + CASE(OP_RDQQUOTEVEC): s_return(sc,cons(sc, mk_symbol(sc,"apply"), cons(sc, mk_symbol(sc,"vector"), cons(sc,cons(sc, sc->QQUOTE, cons(sc,sc->value,sc->NIL)), sc->NIL)))); - case OP_RDUNQUOTE: + CASE(OP_RDUNQUOTE): s_return(sc,cons(sc, sc->UNQUOTE, cons(sc, sc->value, sc->NIL))); - case OP_RDUQTSP: + CASE(OP_RDUQTSP): s_return(sc,cons(sc, sc->UNQUOTESP, cons(sc, sc->value, sc->NIL))); - case OP_RDVEC: + CASE(OP_RDVEC): /*sc->code=cons(sc,mk_proc(sc,OP_VECTOR),sc->value); s_goto(sc,OP_EVAL); Cannot be quoted*/ /*x=cons(sc,mk_proc(sc,OP_VECTOR),sc->value); @@ -4185,11 +4208,11 @@ static pointer opexe_5(scheme *sc, enum scheme_opcodes op) { s_goto(sc,OP_VECTOR); /* ========== printing part ========== */ - case OP_P0LIST: + CASE(OP_P0LIST): if(is_vector(sc->args)) { putstr(sc,"#("); sc->args=cons(sc,sc->args,mk_integer(sc,0)); - s_goto(sc,OP_PVECFROM); + s_thread_to(sc,OP_PVECFROM); } else if(is_environment(sc->args)) { putstr(sc,"#"); s_return(sc,sc->T); @@ -4199,36 +4222,36 @@ static pointer opexe_5(scheme *sc, enum scheme_opcodes op) { } else if (car(sc->args) == sc->QUOTE && ok_abbrev(cdr(sc->args))) { putstr(sc, "'"); sc->args = cadr(sc->args); - s_goto(sc,OP_P0LIST); + s_thread_to(sc,OP_P0LIST); } else if (car(sc->args) == sc->QQUOTE && ok_abbrev(cdr(sc->args))) { putstr(sc, "`"); sc->args = cadr(sc->args); - s_goto(sc,OP_P0LIST); + s_thread_to(sc,OP_P0LIST); } else if (car(sc->args) == sc->UNQUOTE && ok_abbrev(cdr(sc->args))) { putstr(sc, ","); sc->args = cadr(sc->args); - s_goto(sc,OP_P0LIST); + s_thread_to(sc,OP_P0LIST); } else if (car(sc->args) == sc->UNQUOTESP && ok_abbrev(cdr(sc->args))) { putstr(sc, ",@"); sc->args = cadr(sc->args); - s_goto(sc,OP_P0LIST); + s_thread_to(sc,OP_P0LIST); } else { putstr(sc, "("); s_save(sc,OP_P1LIST, cdr(sc->args), sc->NIL); sc->args = car(sc->args); - s_goto(sc,OP_P0LIST); + s_thread_to(sc,OP_P0LIST); } - case OP_P1LIST: + CASE(OP_P1LIST): if (is_pair(sc->args)) { s_save(sc,OP_P1LIST, cdr(sc->args), sc->NIL); putstr(sc, " "); sc->args = car(sc->args); - s_goto(sc,OP_P0LIST); + s_thread_to(sc,OP_P0LIST); } else if(is_vector(sc->args)) { s_save(sc,OP_P1LIST,sc->NIL,sc->NIL); putstr(sc, " . "); - s_goto(sc,OP_P0LIST); + s_thread_to(sc,OP_P0LIST); } else { if (sc->args != sc->NIL) { putstr(sc, " . "); @@ -4237,7 +4260,7 @@ static pointer opexe_5(scheme *sc, enum scheme_opcodes op) { putstr(sc, ")"); s_return(sc,sc->T); } - case OP_PVECFROM: { + CASE(OP_PVECFROM): { int i=ivalue_unchecked(cdr(sc->args)); pointer vec=car(sc->args); int len=ivalue_unchecked(vec); @@ -4251,7 +4274,7 @@ static pointer opexe_5(scheme *sc, enum scheme_opcodes op) { sc->args=elem; if (i > 0) putstr(sc," "); - s_goto(sc,OP_P0LIST); + s_thread_to(sc,OP_P0LIST); } } @@ -4268,14 +4291,14 @@ static pointer opexe_6(scheme *sc, enum scheme_opcodes op) { long v; switch (op) { - case OP_LIST_LENGTH: /* length */ /* a.k */ + CASE(OP_LIST_LENGTH): /* length */ /* a.k */ v=list_length(sc,car(sc->args)); if(v<0) { Error_1(sc,"length: not a list:",car(sc->args)); } s_return(sc,mk_integer(sc, v)); - case OP_ASSQ: /* assq */ /* a.k */ + CASE(OP_ASSQ): /* assq */ /* a.k */ x = car(sc->args); for (y = cadr(sc->args); is_pair(y); y = cdr(y)) { if (!is_pair(car(y))) { @@ -4291,7 +4314,7 @@ static pointer opexe_6(scheme *sc, enum scheme_opcodes op) { } - case OP_GET_CLOSURE: /* get-closure-code */ /* a.k */ + CASE(OP_GET_CLOSURE): /* get-closure-code */ /* a.k */ sc->args = car(sc->args); if (sc->args == sc->NIL) { s_return(sc,sc->F); @@ -4302,13 +4325,13 @@ static pointer opexe_6(scheme *sc, enum scheme_opcodes op) { } else { s_return(sc,sc->F); } - case OP_CLOSUREP: /* closure? */ + CASE(OP_CLOSUREP): /* closure? */ /* * Note, macro object is also a closure. * Therefore, (closure? <#MACRO>) ==> #t */ s_retbool(is_closure(car(sc->args))); - case OP_MACROP: /* macro? */ + CASE(OP_MACROP): /* macro? */ s_retbool(is_macro(car(sc->args))); default: snprintf(sc->strbuff,STRBUFFSIZE,"%d: illegal operator", sc->op); diff --git a/tests/gpgscm/scheme.h b/tests/gpgscm/scheme.h index 8d6fb42..8e93177 100644 --- a/tests/gpgscm/scheme.h +++ b/tests/gpgscm/scheme.h @@ -90,6 +90,11 @@ extern "C" { # define USE_COMPILE_HOOK 1 #endif +/* Enable faster opcode dispatch. */ +#ifndef USE_THREADED_CODE +# define USE_THREADED_CODE 1 +#endif + #ifndef USE_STRCASECMP /* stricmp for Unix */ # define USE_STRCASECMP 0 #endif commit 568cfcde45a0d6c456d8f8be1ea0e408416badad Author: Justus Winter Date: Wed Nov 9 13:34:54 2016 +0100 gpgscm: Make the compile-hook configurable. * tests/gpgscm/scheme-private.h (struct scheme): Make field 'COMPILE_HOOK' optional. * tests/gpgscm/scheme.c (opexe_0): Fix guard. (scheme_init_custom_alloc): Conditionally initialize 'COMPILE_HOOK'. * tests/gpgscm/scheme.h (USE_COMPILE_HOOK): Define to 1 by default. Signed-off-by: Justus Winter diff --git a/tests/gpgscm/scheme-private.h b/tests/gpgscm/scheme-private.h index f5e4b0a..884889c 100644 --- a/tests/gpgscm/scheme-private.h +++ b/tests/gpgscm/scheme-private.h @@ -115,7 +115,9 @@ pointer FEED_TO; /* => */ pointer COLON_HOOK; /* *colon-hook* */ pointer ERROR_HOOK; /* *error-hook* */ pointer SHARP_HOOK; /* *sharp-hook* */ +#if USE_COMPILE_HOOK pointer COMPILE_HOOK; /* *compile-hook* */ +#endif pointer free_cell; /* pointer to top of free cells */ long fcells; /* # of free cells */ diff --git a/tests/gpgscm/scheme.c b/tests/gpgscm/scheme.c index 6daa280..884ffd5 100644 --- a/tests/gpgscm/scheme.c +++ b/tests/gpgscm/scheme.c @@ -2688,7 +2688,7 @@ static pointer opexe_0(scheme *sc, enum scheme_opcodes op) { sc->code = sc->value; s_goto(sc,OP_EVAL); -#if 1 +#if USE_COMPILE_HOOK case OP_LAMBDA: /* lambda */ /* If the hook is defined, apply it to sc->code, otherwise set sc->value fall through */ @@ -4737,7 +4737,9 @@ int scheme_init_custom_alloc(scheme *sc, func_alloc malloc, func_dealloc free) { sc->COLON_HOOK = mk_symbol(sc,"*colon-hook*"); sc->ERROR_HOOK = mk_symbol(sc, "*error-hook*"); sc->SHARP_HOOK = mk_symbol(sc, "*sharp-hook*"); +#if USE_COMPILE_HOOK sc->COMPILE_HOOK = mk_symbol(sc, "*compile-hook*"); +#endif return !sc->no_memory; } diff --git a/tests/gpgscm/scheme.h b/tests/gpgscm/scheme.h index bd6cda5..8d6fb42 100644 --- a/tests/gpgscm/scheme.h +++ b/tests/gpgscm/scheme.h @@ -40,6 +40,7 @@ extern "C" { # define USE_ERROR_HOOK 0 # define USE_TRACING 0 # define USE_COLON_HOOK 0 +# define USE_COMPILE_HOOK 0 # define USE_DL 0 # define USE_PLIST 0 #endif @@ -83,6 +84,12 @@ extern "C" { # define USE_COLON_HOOK 1 #endif +/* Compile functions using *compile-hook*. The default hook expands + * macros. */ +#ifndef USE_COMPILE_HOOK +# define USE_COMPILE_HOOK 1 +#endif + #ifndef USE_STRCASECMP /* stricmp for Unix */ # define USE_STRCASECMP 0 #endif commit 9ee184bc0afaea06785d836ed175b851b9ae532f Author: Justus Winter Date: Tue Nov 8 18:35:42 2016 +0100 gpgscm: Drop obsolete commented-out code. * tests/gpgscm/scheme.c (opexe_5): Drop obsolete code. Signed-off-by: Justus Winter diff --git a/tests/gpgscm/scheme.c b/tests/gpgscm/scheme.c index c1340d7..6daa280 100644 --- a/tests/gpgscm/scheme.c +++ b/tests/gpgscm/scheme.c @@ -4056,17 +4056,6 @@ static pointer opexe_5(scheme *sc, enum scheme_opcodes op) { case TOK_EOF: s_return(sc,sc->EOF_OBJ); /* NOTREACHED */ -/* - * Commented out because we now skip comments in the scanner - * - case TOK_COMMENT: { - int c; - while ((c=inchar(sc)) != '\n' && c!=EOF) - ; - sc->tok = token(sc); - s_goto(sc,OP_RDSEXPR); - } -*/ case TOK_VEC: s_save(sc,OP_RDVEC,sc->NIL,sc->NIL); /* fall through */ @@ -4135,14 +4124,6 @@ static pointer opexe_5(scheme *sc, enum scheme_opcodes op) { case OP_RDLIST: { sc->args = cons(sc, sc->value, sc->args); sc->tok = token(sc); -/* We now skip comments in the scanner - while (sc->tok == TOK_COMMENT) { - int c; - while ((c=inchar(sc)) != '\n' && c!=EOF) - ; - sc->tok = token(sc); - } -*/ if (sc->tok == TOK_EOF) { s_return(sc,sc->EOF_OBJ); } else if (sc->tok == TOK_RPAREN) { commit d7c5799c282a03dcce0e3d327075233353cb76cc Author: Justus Winter Date: Tue Nov 8 18:08:42 2016 +0100 gpgscm: Remove dubious stack implementation. * tests/gpgscm/scheme-private.h (struct scheme): Remove related fields. * tests/gpgscm/scheme.c: Drop all !USE_SCHEME_STACK code. * tests/gpgscm/scheme.h (USE_SCHEME_STACK): Remove macro. Signed-off-by: Justus Winter diff --git a/tests/gpgscm/scheme-private.h b/tests/gpgscm/scheme-private.h index 727e0c0..f5e4b0a 100644 --- a/tests/gpgscm/scheme-private.h +++ b/tests/gpgscm/scheme-private.h @@ -155,8 +155,6 @@ void *ext_data; /* For the benefit of foreign functions */ long gensym_cnt; struct scheme_interface *vptr; -void *dump_base; /* pointer to base of allocated dump stack */ -int dump_size; /* number of frames allocated for dump stack */ }; /* operator code */ diff --git a/tests/gpgscm/scheme.c b/tests/gpgscm/scheme.c index 44dd165..c1340d7 100644 --- a/tests/gpgscm/scheme.c +++ b/tests/gpgscm/scheme.c @@ -2442,93 +2442,6 @@ static pointer _Error_1(scheme *sc, const char *s, pointer a) { #define s_return(sc,a) return _s_return(sc,a) -#ifndef USE_SCHEME_STACK - -/* this structure holds all the interpreter's registers */ -struct dump_stack_frame { - enum scheme_opcodes op; - pointer args; - pointer envir; - pointer code; -}; - -#define STACK_GROWTH 3 - -static void s_save(scheme *sc, enum scheme_opcodes op, pointer args, pointer code) -{ - int nframes = (int)sc->dump; - struct dump_stack_frame *next_frame; - - /* enough room for the next frame? */ - if (nframes >= sc->dump_size) { - sc->dump_size += STACK_GROWTH; - /* alas there is no sc->realloc */ - sc->dump_base = realloc(sc->dump_base, - sizeof(struct dump_stack_frame) * sc->dump_size); - } - next_frame = (struct dump_stack_frame *)sc->dump_base + nframes; - next_frame->op = op; - next_frame->args = args; - next_frame->envir = sc->envir; - next_frame->code = code; - sc->dump = (pointer)(nframes+1); -} - -static pointer _s_return(scheme *sc, pointer a) -{ - int nframes = (int)sc->dump; - struct dump_stack_frame *frame; - - sc->value = (a); - if (nframes <= 0) { - return sc->NIL; - } - nframes--; - frame = (struct dump_stack_frame *)sc->dump_base + nframes; - sc->op = frame->op; - sc->args = frame->args; - sc->envir = frame->envir; - sc->code = frame->code; - sc->dump = (pointer)nframes; - return sc->T; -} - -static INLINE void dump_stack_reset(scheme *sc) -{ - /* in this implementation, sc->dump is the number of frames on the stack */ - sc->dump = (pointer)0; -} - -static INLINE void dump_stack_initialize(scheme *sc) -{ - sc->dump_size = 0; - sc->dump_base = NULL; - dump_stack_reset(sc); -} - -static void dump_stack_free(scheme *sc) -{ - free(sc->dump_base); - sc->dump_base = NULL; - sc->dump = (pointer)0; - sc->dump_size = 0; -} - -static INLINE void dump_stack_mark(scheme *sc) -{ - int nframes = (int)sc->dump; - int i; - for(i=0; idump_base + i; - mark(frame->args); - mark(frame->envir); - mark(frame->code); - } -} - -#else - static INLINE void dump_stack_reset(scheme *sc) { sc->dump = sc->NIL; @@ -2565,7 +2478,6 @@ static INLINE void dump_stack_mark(scheme *sc) { mark(sc->dump); } -#endif #define s_retbool(tf) s_return(sc,(tf) ? sc->T : sc->F) diff --git a/tests/gpgscm/scheme.h b/tests/gpgscm/scheme.h index f4231c4..bd6cda5 100644 --- a/tests/gpgscm/scheme.h +++ b/tests/gpgscm/scheme.h @@ -44,11 +44,6 @@ extern "C" { # define USE_PLIST 0 #endif -/* - * Leave it defined if you want continuations, and also for the Sharp Zaurus. - * Undefine it if you only care about faster speed and not strict Scheme compatibility. - */ -#define USE_SCHEME_STACK #if USE_DL # define USE_INTERFACE 1 ----------------------------------------------------------------------- Summary of changes: tests/gpgscm/scheme-private.h | 4 +- tests/gpgscm/scheme.c | 640 +++++++++++++++++++----------------------- tests/gpgscm/scheme.h | 17 +- 3 files changed, 307 insertions(+), 354 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Thu Nov 10 17:10:49 2016 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Thu, 10 Nov 2016 17:10:49 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.1.15-352-g5d13581 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via 5d13581f4737c18430f6572dd4ef486d1ad80dd1 (commit) via c8044c6e335f044d7386b9e8869bc4a0d3adff70 (commit) from ee08677d63a900cea85228024861a4f5c5a87c69 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 5d13581f4737c18430f6572dd4ef486d1ad80dd1 Author: Werner Koch Date: Thu Nov 10 17:01:19 2016 +0100 gpg,sm: Add STATUS_ERROR keydb_search and keydb_add-resource. * g10/keydb.c (keydb_add_resource): Make ANY_REGISTERED file-global. Write a STATUS_ERROR. (maybe_create_keyring_or_box): Check for non-accessible but existant file. (keydb_search): Write a STATUS_ERROR if no keyring has been registered but continue to return NOT_FOUND. * sm/keydb.c (keydb_add_resource): Rename ANY_PUBLIC to ANY_REGISTERED and make file-global. Write a STATUS_ERROR. (keydb_search): Write a STATUS_ERROR if no keyring has been registered but continue to return NOT_FOUND. Also add new arg CTRL and change all callers to pass it down. Signed-off-by: Werner Koch diff --git a/g10/keydb.c b/g10/keydb.c index 76850f9..1467b2d 100644 --- a/g10/keydb.c +++ b/g10/keydb.c @@ -64,6 +64,8 @@ static int used_resources; to the struct resource_item's TOKEN. */ static void *primary_keydb; +/* Whether we have successfully registered any resource. */ +static int any_registered; /* This is a simple cache used to return the last result of a successful fingerprint search. This works only for keybox resources @@ -277,7 +279,7 @@ maybe_create_keyring_or_box (char *filename, int is_box, int force_create) /* A quick test whether the filename already exists. */ if (!access (filename, F_OK)) - return 0; + return !access (filename, R_OK)? 0 : gpg_error (GPG_ERR_EACCES); /* If we don't want to create a new file at all, there is no need to go any further - bail out right here. */ @@ -616,8 +618,6 @@ keydb_search_desc_dump (struct keydb_search_desc *desc) gpg_error_t keydb_add_resource (const char *url, unsigned int flags) { - /* Whether we have successfully registered a resource. */ - static int any_registered; /* The file named by the URL (i.e., without the prototype). */ const char *resname = url; @@ -819,7 +819,11 @@ keydb_add_resource (const char *url, unsigned int flags) leave: if (err) - log_error (_("keyblock resource '%s': %s\n"), filename, gpg_strerror (err)); + { + log_error (_("keyblock resource '%s': %s\n"), + filename, gpg_strerror (err)); + write_status_error ("add_keyblock_resource", err); + } else any_registered = 1; xfree (filename); @@ -1875,6 +1879,12 @@ keydb_search (KEYDB_HANDLE hd, KEYDB_SEARCH_DESC *desc, if (!hd) return gpg_error (GPG_ERR_INV_ARG); + if (!any_registered) + { + write_status_error ("keydb_search", gpg_error (GPG_ERR_KEYRING_OPEN)); + return gpg_error (GPG_ERR_NOT_FOUND); + } + if (DBG_CLOCK) log_clock ("keydb_search enter"); diff --git a/sm/call-agent.c b/sm/call-agent.c index 6dbaba5..11e6ae7 100644 --- a/sm/call-agent.c +++ b/sm/call-agent.c @@ -967,7 +967,7 @@ learn_cb (void *opaque, const void *buffer, size_t length) { int existed; - if (!keydb_store_cert (cert, 0, &existed)) + if (!keydb_store_cert (parm->ctrl, cert, 0, &existed)) { if (opt.verbose > 1 && existed) log_info ("certificate already in DB\n"); diff --git a/sm/call-dirmngr.c b/sm/call-dirmngr.c index dd56641..d025063 100644 --- a/sm/call-dirmngr.c +++ b/sm/call-dirmngr.c @@ -78,6 +78,7 @@ struct lookup_parm_s { }; struct run_command_parm_s { + ctrl_t ctrl; assuan_context_t ctx; }; @@ -407,7 +408,7 @@ inq_certificate (void *opaque, const char *line) ksba_cert_t cert; - err = gpgsm_find_cert (line, ski, &cert); + err = gpgsm_find_cert (parm->ctrl, line, ski, &cert); if (err) { log_error ("certificate not found: %s\n", gpg_strerror (err)); @@ -580,7 +581,7 @@ gpgsm_dirmngr_isvalid (ctrl_t ctrl, if (!kh) rc = gpg_error (GPG_ERR_ENOMEM); if (!rc) - rc = keydb_search_fpr (kh, stparm.fpr); + rc = keydb_search_fpr (ctrl, kh, stparm.fpr); if (!rc) rc = keydb_get_cert (kh, &rspcert); if (rc) @@ -928,7 +929,7 @@ run_command_inq_cb (void *opaque, const char *line) if (!*line) return gpg_error (GPG_ERR_ASS_PARAMETER); - err = gpgsm_find_cert (line, NULL, &cert); + err = gpgsm_find_cert (parm->ctrl, line, NULL, &cert); if (err) { log_error ("certificate not found: %s\n", gpg_strerror (err)); @@ -1002,6 +1003,7 @@ gpgsm_dirmngr_run_command (ctrl_t ctrl, const char *command, if (rc) return rc; + parm.ctrl = ctrl; parm.ctx = dirmngr_ctx; len = strlen (command) + 1; diff --git a/sm/certchain.c b/sm/certchain.c index 1ac7228..083c3ad 100644 --- a/sm/certchain.c +++ b/sm/certchain.c @@ -438,7 +438,7 @@ check_cert_policy (ksba_cert_t cert, int listmode, estream_t fplist) for an issuer ISSUER with a subjectKeyIdentifier of KEYID. Returns 0 on success or -1 when not found. */ static int -find_up_search_by_keyid (KEYDB_HANDLE kh, +find_up_search_by_keyid (ctrl_t ctrl, KEYDB_HANDLE kh, const char *issuer, ksba_sexp_t keyid) { int rc; @@ -448,7 +448,7 @@ find_up_search_by_keyid (KEYDB_HANDLE kh, ksba_isotime_t not_before, last_not_before; keydb_search_reset (kh); - while (!(rc = keydb_search_subject (kh, issuer))) + while (!(rc = keydb_search_subject (ctrl, kh, issuer))) { ksba_cert_release (cert); cert = NULL; rc = keydb_get_cert (kh, &cert); @@ -499,12 +499,20 @@ find_up_search_by_keyid (KEYDB_HANDLE kh, } +struct find_up_store_certs_s +{ + ctrl_t ctrl; + int count; +}; + static void find_up_store_certs_cb (void *cb_value, ksba_cert_t cert) { - if (keydb_store_cert (cert, 1, NULL)) + struct find_up_store_certs_s *parm = cb_value; + + if (keydb_store_cert (parm->ctrl, cert, 1, NULL)) log_error ("error storing issuer certificate as ephemeral\n"); - ++*(int*)cb_value; + parm->count++; } @@ -519,10 +527,13 @@ find_up_external (ctrl_t ctrl, KEYDB_HANDLE kh, { int rc; strlist_t names = NULL; - int count = 0; + struct find_up_store_certs_s find_up_store_certs_parm; char *pattern; const char *s; + find_up_store_certs_parm.ctrl = ctrl; + find_up_store_certs_parm.count = 0; + if (opt.verbose) log_info (_("looking up issuer at external location\n")); /* The Dirmngr process is confused about unknown attributes. As a @@ -539,17 +550,19 @@ find_up_external (ctrl_t ctrl, KEYDB_HANDLE kh, add_to_strlist (&names, pattern); xfree (pattern); - rc = gpgsm_dirmngr_lookup (ctrl, names, 0, find_up_store_certs_cb, &count); + rc = gpgsm_dirmngr_lookup (ctrl, names, 0, find_up_store_certs_cb, + &find_up_store_certs_parm); free_strlist (names); if (opt.verbose) - log_info (_("number of issuers matching: %d\n"), count); + log_info (_("number of issuers matching: %d\n"), + find_up_store_certs_parm.count); if (rc) { log_error ("external key lookup failed: %s\n", gpg_strerror (rc)); rc = -1; } - else if (!count) + else if (!find_up_store_certs_parm.count) rc = -1; else { @@ -558,11 +571,11 @@ find_up_external (ctrl_t ctrl, KEYDB_HANDLE kh, we temporary switch to ephemeral mode. */ old = keydb_set_ephemeral (kh, 1); if (keyid) - rc = find_up_search_by_keyid (kh, issuer, keyid); + rc = find_up_search_by_keyid (ctrl, kh, issuer, keyid); else { keydb_search_reset (kh); - rc = keydb_search_subject (kh, issuer); + rc = keydb_search_subject (ctrl, kh, issuer); } keydb_set_ephemeral (kh, old); } @@ -581,11 +594,14 @@ find_up_dirmngr (ctrl_t ctrl, KEYDB_HANDLE kh, { int rc; strlist_t names = NULL; - int count = 0; + struct find_up_store_certs_s find_up_store_certs_parm; char *pattern; (void)kh; + find_up_store_certs_parm.ctrl = ctrl; + find_up_store_certs_parm.count = 0; + if (opt.verbose) log_info (_("looking up issuer from the Dirmngr cache\n")); if (subject_mode) @@ -607,15 +623,17 @@ find_up_dirmngr (ctrl_t ctrl, KEYDB_HANDLE kh, add_to_strlist (&names, pattern); xfree (pattern); - rc = gpgsm_dirmngr_lookup (ctrl, names, 1, find_up_store_certs_cb, &count); + rc = gpgsm_dirmngr_lookup (ctrl, names, 1, find_up_store_certs_cb, + &find_up_store_certs_parm); free_strlist (names); if (opt.verbose) - log_info (_("number of matching certificates: %d\n"), count); + log_info (_("number of matching certificates: %d\n"), + find_up_store_certs_parm.count); if (rc && !opt.quiet) log_info (_("dirmngr cache-only key lookup failed: %s\n"), gpg_strerror (rc)); - return (!rc && count)? 0 : -1; + return (!rc && find_up_store_certs_parm.count)? 0 : -1; } @@ -642,7 +660,7 @@ find_up (ctrl_t ctrl, KEYDB_HANDLE kh, const char *s = ksba_name_enum (authid, 0); if (s && *authidno) { - rc = keydb_search_issuer_sn (kh, s, authidno); + rc = keydb_search_issuer_sn (ctrl, kh, s, authidno); if (rc) keydb_search_reset (kh); @@ -665,7 +683,7 @@ find_up (ctrl_t ctrl, KEYDB_HANDLE kh, int old = keydb_set_ephemeral (kh, 1); if (!old) { - rc = keydb_search_issuer_sn (kh, s, authidno); + rc = keydb_search_issuer_sn (ctrl, kh, s, authidno); if (rc) keydb_search_reset (kh); @@ -685,14 +703,14 @@ find_up (ctrl_t ctrl, KEYDB_HANDLE kh, subject and stop for the one with a matching subjectKeyIdentifier. */ /* Fixme: Should we also search in the dirmngr? */ - rc = find_up_search_by_keyid (kh, issuer, keyid); + rc = find_up_search_by_keyid (ctrl, kh, issuer, keyid); if (!rc && DBG_X509) log_debug (" found via authid and keyid\n"); if (rc) { int old = keydb_set_ephemeral (kh, 1); if (!old) - rc = find_up_search_by_keyid (kh, issuer, keyid); + rc = find_up_search_by_keyid (ctrl, kh, issuer, keyid); if (!rc && DBG_X509) log_debug (" found via authid and keyid (ephem)\n"); keydb_set_ephemeral (kh, old); @@ -709,11 +727,11 @@ find_up (ctrl_t ctrl, KEYDB_HANDLE kh, { int old = keydb_set_ephemeral (kh, 1); if (keyid) - rc = find_up_search_by_keyid (kh, issuer, keyid); + rc = find_up_search_by_keyid (ctrl, kh, issuer, keyid); else { keydb_search_reset (kh); - rc = keydb_search_subject (kh, issuer); + rc = keydb_search_subject (ctrl, kh, issuer); } keydb_set_ephemeral (kh, old); } @@ -765,7 +783,7 @@ find_up (ctrl_t ctrl, KEYDB_HANDLE kh, } if (rc) /* Not found via authorithyKeyIdentifier, try regular issuer name. */ - rc = keydb_search_subject (kh, issuer); + rc = keydb_search_subject (ctrl, kh, issuer); if (rc == -1 && !find_next) { int old; @@ -779,7 +797,7 @@ find_up (ctrl_t ctrl, KEYDB_HANDLE kh, if (!old) { keydb_search_reset (kh); - rc = keydb_search_subject (kh, issuer); + rc = keydb_search_subject (ctrl, kh, issuer); } keydb_set_ephemeral (kh, old); @@ -983,7 +1001,7 @@ is_cert_still_valid (ctrl_t ctrl, int force_ocsp, int lm, estream_t fp, /* Store that in the keybox so that key listings are able to return the revoked flag. We don't care about error, though. */ - keydb_set_cert_flags (subject_cert, 1, KEYBOX_FLAG_VALIDITY, 0, + keydb_set_cert_flags (ctrl, subject_cert, 1, KEYBOX_FLAG_VALIDITY, 0, ~0, VALIDITY_REVOKED); break; @@ -1786,7 +1804,7 @@ do_validate_chain (ctrl_t ctrl, ksba_cert_t cert, ksba_isotime_t checktime_arg, been stored in the keybox and thus the flag can't be set. We ignore this error because it will later be stored anyway. */ - err = keydb_set_cert_flags (ci->cert, 1, KEYBOX_FLAG_BLOB, 0, + err = keydb_set_cert_flags (ctrl, ci->cert, 1, KEYBOX_FLAG_BLOB, 0, KEYBOX_FLAG_BLOB_EPHEMERAL, 0); if (!ci->next && gpg_err_code (err) == GPG_ERR_NOT_FOUND) ; diff --git a/sm/certlist.c b/sm/certlist.c index a041a75..7baec65 100644 --- a/sm/certlist.c +++ b/sm/certlist.c @@ -329,7 +329,7 @@ gpgsm_add_to_certlist (ctrl_t ctrl, const char *name, int secret, char *first_issuer = NULL; get_next: - rc = keydb_search (kh, &desc, 1); + rc = keydb_search (ctrl, kh, &desc, 1); if (!rc) rc = keydb_get_cert (kh, &cert); if (!rc) @@ -376,7 +376,7 @@ gpgsm_add_to_certlist (ctrl_t ctrl, const char *name, int secret, certlist_t dup_certs = NULL; next_ambigious: - rc = keydb_search (kh, &desc, 1); + rc = keydb_search (ctrl, kh, &desc, 1); if (rc == -1) rc = 0; else if (!rc) @@ -488,7 +488,8 @@ gpgsm_release_certlist (certlist_t list) additional filter value which must match the subjectKeyIdentifier. */ int -gpgsm_find_cert (const char *name, ksba_sexp_t keyid, ksba_cert_t *r_cert) +gpgsm_find_cert (ctrl_t ctrl, + const char *name, ksba_sexp_t keyid, ksba_cert_t *r_cert) { int rc; KEYDB_SEARCH_DESC desc; @@ -504,7 +505,7 @@ gpgsm_find_cert (const char *name, ksba_sexp_t keyid, ksba_cert_t *r_cert) else { nextone: - rc = keydb_search (kh, &desc, 1); + rc = keydb_search (ctrl, kh, &desc, 1); if (!rc) { rc = keydb_get_cert (kh, r_cert); @@ -537,7 +538,7 @@ gpgsm_find_cert (const char *name, ksba_sexp_t keyid, ksba_cert_t *r_cert) if (!rc && !keyid) { next_ambiguous: - rc = keydb_search (kh, &desc, 1); + rc = keydb_search (ctrl, kh, &desc, 1); if (rc == -1) rc = 0; else diff --git a/sm/decrypt.c b/sm/decrypt.c index 9ae87d8..11c1cf8 100644 --- a/sm/decrypt.c +++ b/sm/decrypt.c @@ -400,7 +400,7 @@ gpgsm_decrypt (ctrl_t ctrl, int in_fd, estream_t out_fp) } keydb_search_reset (kh); - rc = keydb_search_issuer_sn (kh, issuer, serial); + rc = keydb_search_issuer_sn (ctrl, kh, issuer, serial); if (rc) { log_error ("failed to find the certificate: %s\n", diff --git a/sm/delete.c b/sm/delete.c index ae06261..3536968 100644 --- a/sm/delete.c +++ b/sm/delete.c @@ -72,7 +72,7 @@ delete_one (ctrl_t ctrl, const char *username) keydb_set_ephemeral (kh, 1); } - rc = keydb_search (kh, &desc, 1); + rc = keydb_search (ctrl, kh, &desc, 1); if (!rc) rc = keydb_get_cert (kh, &cert); if (!rc && !is_ephem) @@ -82,7 +82,7 @@ delete_one (ctrl_t ctrl, const char *username) gpgsm_get_fingerprint (cert, 0, fpr, NULL); next_ambigious: - rc = keydb_search (kh, &desc, 1); + rc = keydb_search (ctrl, kh, &desc, 1); if (rc == -1) rc = 0; else if (!rc) @@ -126,7 +126,7 @@ delete_one (ctrl_t ctrl, const char *username) do { keydb_search_reset (kh); - rc = keydb_search (kh, &desc, 1); + rc = keydb_search (ctrl, kh, &desc, 1); if (rc) { log_error ("problem re-searching certificate: %s\n", diff --git a/sm/export.c b/sm/export.c index 4fedfa2..a32414e 100644 --- a/sm/export.c +++ b/sm/export.c @@ -206,7 +206,7 @@ gpgsm_export (ctrl_t ctrl, strlist_t names, estream_t stream) keydb_set_ephemeral (hd, 1); } - while (!(rc = keydb_search (hd, desc, ndesc))) + while (!(rc = keydb_search (ctrl, hd, desc, ndesc))) { unsigned char fpr[20]; int exists; @@ -362,7 +362,7 @@ gpgsm_p12_export (ctrl_t ctrl, const char *name, estream_t stream, int rawmode) } /* Lookup the certificate and make sure that it is unique. */ - err = keydb_search (hd, desc, 1); + err = keydb_search (ctrl, hd, desc, 1); if (!err) { err = keydb_get_cert (hd, &cert); @@ -373,7 +373,7 @@ gpgsm_p12_export (ctrl_t ctrl, const char *name, estream_t stream, int rawmode) } next_ambiguous: - err = keydb_search (hd, desc, 1); + err = keydb_search (ctrl, hd, desc, 1); if (!err) { ksba_cert_t cert2 = NULL; diff --git a/sm/gpgsm.c b/sm/gpgsm.c index ae447ee..d012465 100644 --- a/sm/gpgsm.c +++ b/sm/gpgsm.c @@ -1616,7 +1616,7 @@ main ( int argc, char **argv) { int created; - keydb_add_resource ("pubring.kbx", 0, &created); + keydb_add_resource (&ctrl, "pubring.kbx", 0, &created); if (created && !no_common_certs_import) { /* Import the standard certificates for a new default keybox. */ @@ -1634,7 +1634,7 @@ main ( int argc, char **argv) } } for (sl = nrings; sl; sl = sl->next) - keydb_add_resource (sl->d, 0, NULL); + keydb_add_resource (&ctrl, sl->d, 0, NULL); FREE_STRLIST(nrings); @@ -1996,7 +1996,7 @@ main ( int argc, char **argv) ksba_cert_t cert = NULL; char *grip = NULL; - rc = gpgsm_find_cert (*argv, NULL, &cert); + rc = gpgsm_find_cert (&ctrl, *argv, NULL, &cert); if (rc) ; else if (!(grip = gpgsm_get_keygrip_hexstring (cert))) diff --git a/sm/gpgsm.h b/sm/gpgsm.h index 88db670..76ff327 100644 --- a/sm/gpgsm.h +++ b/sm/gpgsm.h @@ -244,6 +244,8 @@ gpg_error_t gpgsm_status (ctrl_t ctrl, int no, const char *text); gpg_error_t gpgsm_status2 (ctrl_t ctrl, int no, ...) GPGRT_ATTR_SENTINEL(0); gpg_error_t gpgsm_status_with_err_code (ctrl_t ctrl, int no, const char *text, gpg_err_code_t ec); +gpg_error_t gpgsm_status_with_error (ctrl_t ctrl, int no, const char *text, + gpg_error_t err); gpg_error_t gpgsm_proxy_pinentry_notify (ctrl_t ctrl, const unsigned char *line); @@ -339,7 +341,8 @@ int gpgsm_add_cert_to_certlist (ctrl_t ctrl, ksba_cert_t cert, int gpgsm_add_to_certlist (ctrl_t ctrl, const char *name, int secret, certlist_t *listaddr, int is_encrypt_to); void gpgsm_release_certlist (certlist_t list); -int gpgsm_find_cert (const char *name, ksba_sexp_t keyid, ksba_cert_t *r_cert); +int gpgsm_find_cert (ctrl_t ctrl, const char *name, ksba_sexp_t keyid, + ksba_cert_t *r_cert); /*-- keylist.c --*/ gpg_error_t gpgsm_list_keys (ctrl_t ctrl, strlist_t names, diff --git a/sm/import.c b/sm/import.c index bd1af27..4a8ecf7 100644 --- a/sm/import.c +++ b/sm/import.c @@ -199,7 +199,7 @@ check_and_store (ctrl_t ctrl, struct stats_s *stats, { int existed; - if (!keydb_store_cert (cert, 0, &existed)) + if (!keydb_store_cert (ctrl, cert, 0, &existed)) { ksba_cert_t next = NULL; @@ -442,7 +442,7 @@ reimport_one (ctrl_t ctrl, struct stats_s *stats, int in_fd) } keydb_search_reset (kh); - err = keydb_search (kh, &desc, 1); + err = keydb_search (ctrl, kh, &desc, 1); if (err) { print_import_problem (ctrl, NULL, 0); @@ -476,7 +476,7 @@ reimport_one (ctrl_t ctrl, struct stats_s *stats, int in_fd) continue; } - err = keydb_set_cert_flags (cert, 1, KEYBOX_FLAG_BLOB, 0, + err = keydb_set_cert_flags (ctrl, cert, 1, KEYBOX_FLAG_BLOB, 0, KEYBOX_FLAG_BLOB_EPHEMERAL, 0); if (err) { diff --git a/sm/keydb.c b/sm/keydb.c index 64b06e7..44dd9ca 100644 --- a/sm/keydb.c +++ b/sm/keydb.c @@ -53,6 +53,10 @@ struct resource_item { static struct resource_item all_resources[MAX_KEYDB_RESOURCES]; static int used_resources; +/* Whether we have successfully registered any resource. */ +static int any_registered; + + struct keydb_handle { int locked; int found; @@ -121,7 +125,7 @@ maybe_create_keybox (char *filename, int force, int *r_created) /* A quick test whether the filename already exists. */ if (!access (filename, F_OK)) - return 0; + return !access (filename, R_OK)? 0 : gpg_error (GPG_ERR_EACCES); /* If we don't want to create a new file at all, there is no need to go any further - bail out right here. */ @@ -249,9 +253,8 @@ maybe_create_keybox (char *filename, int force, int *r_created) * if the function has created a new keybox. */ gpg_error_t -keydb_add_resource (const char *url, int force, int *auto_created) +keydb_add_resource (ctrl_t ctrl, const char *url, int force, int *auto_created) { - static int any_public; const char *resname = url; char *filename = NULL; gpg_error_t err = 0; @@ -292,7 +295,7 @@ keydb_add_resource (const char *url, int force, int *auto_created) filename = xstrdup (resname); if (!force) - force = !any_public; + force = !any_registered; /* see whether we can determine the filetype */ if (rt == KEYDB_RESOURCE_TYPE_NONE) @@ -380,9 +383,13 @@ keydb_add_resource (const char *url, int force, int *auto_created) leave: if (err) - log_error ("keyblock resource '%s': %s\n", filename, gpg_strerror (err)); + { + log_error ("keyblock resource '%s': %s\n", filename, gpg_strerror (err)); + gpgsm_status_with_error (ctrl, STATUS_ERROR, + "add_keyblock_resource", err); + } else - any_public = 1; + any_registered = 1; xfree (filename); return err; } @@ -962,7 +969,8 @@ keydb_search_reset (KEYDB_HANDLE hd) * for a keyblock which contains one of the keys described in the DESC array. */ int -keydb_search (KEYDB_HANDLE hd, KEYDB_SEARCH_DESC *desc, size_t ndesc) +keydb_search (ctrl_t ctrl, KEYDB_HANDLE hd, + KEYDB_SEARCH_DESC *desc, size_t ndesc) { int rc = -1; unsigned long skipped; @@ -970,6 +978,13 @@ keydb_search (KEYDB_HANDLE hd, KEYDB_SEARCH_DESC *desc, size_t ndesc) if (!hd) return gpg_error (GPG_ERR_INV_VALUE); + if (!any_registered) + { + gpgsm_status_with_error (ctrl, STATUS_ERROR, "keydb_search", + gpg_error (GPG_ERR_KEYRING_OPEN)); + return gpg_error (GPG_ERR_NOT_FOUND); + } + while (rc == -1 && hd->current >= 0 && hd->current < hd->used) { switch (hd->active[hd->current].type) @@ -996,27 +1011,27 @@ keydb_search (KEYDB_HANDLE hd, KEYDB_SEARCH_DESC *desc, size_t ndesc) int -keydb_search_first (KEYDB_HANDLE hd) +keydb_search_first (ctrl_t ctrl, KEYDB_HANDLE hd) { KEYDB_SEARCH_DESC desc; memset (&desc, 0, sizeof desc); desc.mode = KEYDB_SEARCH_MODE_FIRST; - return keydb_search (hd, &desc, 1); + return keydb_search (ctrl, hd, &desc, 1); } int -keydb_search_next (KEYDB_HANDLE hd) +keydb_search_next (ctrl_t ctrl, KEYDB_HANDLE hd) { KEYDB_SEARCH_DESC desc; memset (&desc, 0, sizeof desc); desc.mode = KEYDB_SEARCH_MODE_NEXT; - return keydb_search (hd, &desc, 1); + return keydb_search (ctrl, hd, &desc, 1); } int -keydb_search_kid (KEYDB_HANDLE hd, u32 *kid) +keydb_search_kid (ctrl_t ctrl, KEYDB_HANDLE hd, u32 *kid) { KEYDB_SEARCH_DESC desc; @@ -1026,22 +1041,22 @@ keydb_search_kid (KEYDB_HANDLE hd, u32 *kid) desc.mode = KEYDB_SEARCH_MODE_LONG_KID; desc.u.kid[0] = kid[0]; desc.u.kid[1] = kid[1]; - return keydb_search (hd, &desc, 1); + return keydb_search (ctrl, hd, &desc, 1); } int -keydb_search_fpr (KEYDB_HANDLE hd, const byte *fpr) +keydb_search_fpr (ctrl_t ctrl, KEYDB_HANDLE hd, const byte *fpr) { KEYDB_SEARCH_DESC desc; memset (&desc, 0, sizeof desc); desc.mode = KEYDB_SEARCH_MODE_FPR; memcpy (desc.u.fpr, fpr, 20); - return keydb_search (hd, &desc, 1); + return keydb_search (ctrl, hd, &desc, 1); } int -keydb_search_issuer (KEYDB_HANDLE hd, const char *issuer) +keydb_search_issuer (ctrl_t ctrl, KEYDB_HANDLE hd, const char *issuer) { KEYDB_SEARCH_DESC desc; int rc; @@ -1049,12 +1064,12 @@ keydb_search_issuer (KEYDB_HANDLE hd, const char *issuer) memset (&desc, 0, sizeof desc); desc.mode = KEYDB_SEARCH_MODE_ISSUER; desc.u.name = issuer; - rc = keydb_search (hd, &desc, 1); + rc = keydb_search (ctrl, hd, &desc, 1); return rc; } int -keydb_search_issuer_sn (KEYDB_HANDLE hd, +keydb_search_issuer_sn (ctrl_t ctrl, KEYDB_HANDLE hd, const char *issuer, ksba_const_sexp_t serial) { KEYDB_SEARCH_DESC desc; @@ -1073,12 +1088,12 @@ keydb_search_issuer_sn (KEYDB_HANDLE hd, return gpg_error (GPG_ERR_INV_VALUE); desc.sn = s+1; desc.u.name = issuer; - rc = keydb_search (hd, &desc, 1); + rc = keydb_search (ctrl, hd, &desc, 1); return rc; } int -keydb_search_subject (KEYDB_HANDLE hd, const char *name) +keydb_search_subject (ctrl_t ctrl, KEYDB_HANDLE hd, const char *name) { KEYDB_SEARCH_DESC desc; int rc; @@ -1086,7 +1101,7 @@ keydb_search_subject (KEYDB_HANDLE hd, const char *name) memset (&desc, 0, sizeof desc); desc.mode = KEYDB_SEARCH_MODE_SUBJECT; desc.u.name = name; - rc = keydb_search (hd, &desc, 1); + rc = keydb_search (ctrl, hd, &desc, 1); return rc; } @@ -1097,7 +1112,7 @@ keydb_search_subject (KEYDB_HANDLE hd, const char *name) If EXISTED is not NULL it will be set to true if the certificate was already in the DB. */ int -keydb_store_cert (ksba_cert_t cert, int ephemeral, int *existed) +keydb_store_cert (ctrl_t ctrl, ksba_cert_t cert, int ephemeral, int *existed) { KEYDB_HANDLE kh; int rc; @@ -1127,7 +1142,7 @@ keydb_store_cert (ksba_cert_t cert, int ephemeral, int *existed) if (rc) return rc; - rc = keydb_search_fpr (kh, fpr); + rc = keydb_search_fpr (ctrl, kh, fpr); if (rc != -1) { keydb_release (kh); @@ -1139,7 +1154,7 @@ keydb_store_cert (ksba_cert_t cert, int ephemeral, int *existed) { /* Remove ephemeral flags from existing certificate to "store" it permanently. */ - rc = keydb_set_cert_flags (cert, 1, KEYBOX_FLAG_BLOB, 0, + rc = keydb_set_cert_flags (ctrl, cert, 1, KEYBOX_FLAG_BLOB, 0, KEYBOX_FLAG_BLOB_EPHEMERAL, 0); if (rc) { @@ -1183,7 +1198,7 @@ keydb_store_cert (ksba_cert_t cert, int ephemeral, int *existed) transaction by locating the certificate in the DB and updating the flags. */ gpg_error_t -keydb_set_cert_flags (ksba_cert_t cert, int ephemeral, +keydb_set_cert_flags (ctrl_t ctrl, ksba_cert_t cert, int ephemeral, int which, int idx, unsigned int mask, unsigned int value) { @@ -1216,7 +1231,7 @@ keydb_set_cert_flags (ksba_cert_t cert, int ephemeral, return err; } - err = keydb_search_fpr (kh, fpr); + err = keydb_search_fpr (ctrl, kh, fpr); if (err) { if (err == -1) @@ -1313,7 +1328,7 @@ keydb_clear_some_cert_flags (ctrl_t ctrl, strlist_t names) goto leave; } - while (!(rc = keydb_search (hd, desc, ndesc))) + while (!(rc = keydb_search (ctrl, hd, desc, ndesc))) { if (!names) desc[0].mode = KEYDB_SEARCH_MODE_NEXT; diff --git a/sm/keydb.h b/sm/keydb.h index bdf4a2d..6234625 100644 --- a/sm/keydb.h +++ b/sm/keydb.h @@ -31,7 +31,8 @@ typedef struct keydb_handle *KEYDB_HANDLE; /*-- keydb.c --*/ -gpg_error_t keydb_add_resource (const char *url, int force, int *auto_created); +gpg_error_t keydb_add_resource (ctrl_t ctrl, const char *url, + int force, int *auto_created); KEYDB_HANDLE keydb_new (void); void keydb_release (KEYDB_HANDLE hd); int keydb_set_ephemeral (KEYDB_HANDLE hd, int yes); @@ -54,18 +55,20 @@ int keydb_locate_writable (KEYDB_HANDLE hd, const char *reserved); void keydb_rebuild_caches (void); gpg_error_t keydb_search_reset (KEYDB_HANDLE hd); -int keydb_search (KEYDB_HANDLE hd, KEYDB_SEARCH_DESC *desc, size_t ndesc); -int keydb_search_first (KEYDB_HANDLE hd); -int keydb_search_next (KEYDB_HANDLE hd); -int keydb_search_kid (KEYDB_HANDLE hd, u32 *kid); -int keydb_search_fpr (KEYDB_HANDLE hd, const byte *fpr); -int keydb_search_issuer (KEYDB_HANDLE hd, const char *issuer); -int keydb_search_issuer_sn (KEYDB_HANDLE hd, +int keydb_search (ctrl_t ctrl, KEYDB_HANDLE hd, + KEYDB_SEARCH_DESC *desc, size_t ndesc); +int keydb_search_first (ctrl_t ctrl, KEYDB_HANDLE hd); +int keydb_search_next (ctrl_t ctrl, KEYDB_HANDLE hd); +int keydb_search_kid (ctrl_t ctrl, KEYDB_HANDLE hd, u32 *kid); +int keydb_search_fpr (ctrl_t ctrl, KEYDB_HANDLE hd, const byte *fpr); +int keydb_search_issuer (ctrl_t ctrl, KEYDB_HANDLE hd, const char *issuer); +int keydb_search_issuer_sn (ctrl_t ctrl, KEYDB_HANDLE hd, const char *issuer, const unsigned char *serial); -int keydb_search_subject (KEYDB_HANDLE hd, const char *issuer); +int keydb_search_subject (ctrl_t ctrl, KEYDB_HANDLE hd, const char *issuer); -int keydb_store_cert (ksba_cert_t cert, int ephemeral, int *existed); -gpg_error_t keydb_set_cert_flags (ksba_cert_t cert, int ephemeral, +int keydb_store_cert (ctrl_t ctrl, ksba_cert_t cert, int ephemeral, + int *existed); +gpg_error_t keydb_set_cert_flags (ctrl_t ctrl, ksba_cert_t cert, int ephemeral, int which, int idx, unsigned int mask, unsigned int value); diff --git a/sm/keylist.c b/sm/keylist.c index 7bd20dd..88a9c4f 100644 --- a/sm/keylist.c +++ b/sm/keylist.c @@ -1401,7 +1401,7 @@ list_internal_keys (ctrl_t ctrl, strlist_t names, estream_t fp, /* Suppress duplicates at least when they follow each other. */ lastresname = NULL; - while (!(rc = keydb_search (hd, desc, ndesc))) + while (!(rc = keydb_search (ctrl, hd, desc, ndesc))) { unsigned int validity; @@ -1462,8 +1462,7 @@ list_internal_keys (ctrl_t ctrl, strlist_t names, estream_t fp, } } - if (!mode - || ((mode & 1) && !have_secret) + if (!mode || ((mode & 1) && !have_secret) || ((mode & 2) && have_secret) ) { if (ctrl->with_colons) @@ -1507,7 +1506,7 @@ list_external_cb (void *cb_value, ksba_cert_t cert) { struct list_external_parm_s *parm = cb_value; - if (keydb_store_cert (cert, 1, NULL)) + if (keydb_store_cert (parm->ctrl, cert, 1, NULL)) log_error ("error storing certificate as ephemeral\n"); if (parm->print_header) diff --git a/sm/server.c b/sm/server.c index d6a2dbb..0fadcad 100644 --- a/sm/server.c +++ b/sm/server.c @@ -1179,7 +1179,7 @@ cmd_passwd (assuan_context_t ctx, char *line) line = skip_options (line); - err = gpgsm_find_cert (line, NULL, &cert); + err = gpgsm_find_cert (ctrl, line, NULL, &cert); if (err) ; else if (!(grip = gpgsm_get_keygrip_hexstring (cert))) @@ -1469,6 +1469,19 @@ gpgsm_status_with_err_code (ctrl_t ctrl, int no, const char *text, return gpgsm_status2 (ctrl, no, buf, NULL); } +gpg_error_t +gpgsm_status_with_error (ctrl_t ctrl, int no, const char *text, + gpg_error_t err) +{ + char buf[30]; + + snprintf (buf, sizeof buf, "%u", err); + if (text) + return gpgsm_status2 (ctrl, no, text, buf, NULL); + else + return gpgsm_status2 (ctrl, no, buf, NULL); +} + /* Helper to notify the client about Pinentry events. Because that might disturb some older clients, this is only done when enabled diff --git a/sm/sign.c b/sm/sign.c index ff7215f..9153d58 100644 --- a/sm/sign.c +++ b/sm/sign.c @@ -144,7 +144,7 @@ gpgsm_get_default_cert (ctrl_t ctrl, ksba_cert_t *r_cert) hd = keydb_new (); if (!hd) return gpg_error (GPG_ERR_GENERAL); - rc = keydb_search_first (hd); + rc = keydb_search_first (ctrl, hd); if (rc) { keydb_release (hd); @@ -180,7 +180,7 @@ gpgsm_get_default_cert (ctrl_t ctrl, ksba_cert_t *r_cert) ksba_cert_release (cert); cert = NULL; } - while (!(rc = keydb_search_next (hd))); + while (!(rc = keydb_search_next (ctrl, hd))); if (rc && rc != -1) log_error ("keydb_search_next failed: %s\n", gpg_strerror (rc)); @@ -222,7 +222,7 @@ get_default_signer (ctrl_t ctrl) if (!kh) return NULL; - rc = keydb_search (kh, &desc, 1); + rc = keydb_search (ctrl, kh, &desc, 1); if (rc) { log_debug ("failed to find default certificate: rc=%d\n", rc); diff --git a/sm/verify.c b/sm/verify.c index 7a9f7e1..a046883 100644 --- a/sm/verify.c +++ b/sm/verify.c @@ -270,7 +270,7 @@ gpgsm_verify (ctrl_t ctrl, int in_fd, int data_fd, estream_t out_fp) we would avoid cluttering the DB with invalid certificates. */ audit_log_cert (ctrl->audit, AUDIT_SAVE_CERT, cert, - keydb_store_cert (cert, 0, NULL)); + keydb_store_cert (ctrl, cert, 0, NULL)); ksba_cert_release (cert); } @@ -417,7 +417,7 @@ gpgsm_verify (ctrl_t ctrl, int in_fd, int data_fd, estream_t out_fp) /* Find the certificate of the signer */ keydb_search_reset (kh); - rc = keydb_search_issuer_sn (kh, issuer, serial); + rc = keydb_search_issuer_sn (ctrl, kh, issuer, serial); if (rc) { if (rc == -1) commit c8044c6e335f044d7386b9e8869bc4a0d3adff70 Author: Werner Koch Date: Thu Nov 10 15:38:14 2016 +0100 sm: Remove unused arg SECRET from keydb functions. * sm/keydb.c (struct resource_item): Remove field 'secret'. (keydb_add_resource): Remove arg 'secret' and change all callers. (keydb_new): Ditto. Signed-off-by: Werner Koch diff --git a/sm/call-dirmngr.c b/sm/call-dirmngr.c index ea1bb5f..dd56641 100644 --- a/sm/call-dirmngr.c +++ b/sm/call-dirmngr.c @@ -576,7 +576,7 @@ gpgsm_dirmngr_isvalid (ctrl_t ctrl, from the dirmngr. Try our own cert store now. */ KEYDB_HANDLE kh; - kh = keydb_new (0); + kh = keydb_new (); if (!kh) rc = gpg_error (GPG_ERR_ENOMEM); if (!rc) diff --git a/sm/certchain.c b/sm/certchain.c index feefbb7..1ac7228 100644 --- a/sm/certchain.c +++ b/sm/certchain.c @@ -807,7 +807,7 @@ gpgsm_walk_cert_chain (ctrl_t ctrl, ksba_cert_t start, ksba_cert_t *r_next) int rc = 0; char *issuer = NULL; char *subject = NULL; - KEYDB_HANDLE kh = keydb_new (0); + KEYDB_HANDLE kh = keydb_new (); *r_next = NULL; if (!kh) @@ -1303,7 +1303,7 @@ do_validate_chain (ctrl_t ctrl, ksba_cert_t cert, ksba_isotime_t checktime_arg, return 0; } - kh = keydb_new (0); + kh = keydb_new (); if (!kh) { log_error (_("failed to allocate keyDB handle\n")); @@ -1941,7 +1941,7 @@ gpgsm_basic_cert_check (ctrl_t ctrl, ksba_cert_t cert) return 0; } - kh = keydb_new (0); + kh = keydb_new (); if (!kh) { log_error (_("failed to allocate keyDB handle\n")); diff --git a/sm/certlist.c b/sm/certlist.c index 616f4f1..a041a75 100644 --- a/sm/certlist.c +++ b/sm/certlist.c @@ -319,7 +319,7 @@ gpgsm_add_to_certlist (ctrl_t ctrl, const char *name, int secret, rc = classify_user_id (name, &desc, 0); if (!rc) { - kh = keydb_new (0); + kh = keydb_new (); if (!kh) rc = gpg_error (GPG_ERR_ENOMEM); else @@ -498,7 +498,7 @@ gpgsm_find_cert (const char *name, ksba_sexp_t keyid, ksba_cert_t *r_cert) rc = classify_user_id (name, &desc, 0); if (!rc) { - kh = keydb_new (0); + kh = keydb_new (); if (!kh) rc = gpg_error (GPG_ERR_ENOMEM); else diff --git a/sm/decrypt.c b/sm/decrypt.c index 3cee54b..9ae87d8 100644 --- a/sm/decrypt.c +++ b/sm/decrypt.c @@ -256,7 +256,7 @@ gpgsm_decrypt (ctrl_t ctrl, int in_fd, estream_t out_fp) audit_set_type (ctrl->audit, AUDIT_TYPE_DECRYPT); - kh = keydb_new (0); + kh = keydb_new (); if (!kh) { log_error (_("failed to allocate keyDB handle\n")); diff --git a/sm/delete.c b/sm/delete.c index e8638c3..ae06261 100644 --- a/sm/delete.c +++ b/sm/delete.c @@ -54,7 +54,7 @@ delete_one (ctrl_t ctrl, const char *username) goto leave; } - kh = keydb_new (0); + kh = keydb_new (); if (!kh) { log_error ("keydb_new failed\n"); diff --git a/sm/encrypt.c b/sm/encrypt.c index 8555f4a..2c664f8 100644 --- a/sm/encrypt.c +++ b/sm/encrypt.c @@ -336,7 +336,7 @@ gpgsm_encrypt (ctrl_t ctrl, certlist_t recplist, int data_fd, estream_t out_fp) count++; audit_log_i (ctrl->audit, AUDIT_GOT_RECIPIENTS, count); - kh = keydb_new (0); + kh = keydb_new (); if (!kh) { log_error (_("failed to allocate keyDB handle\n")); diff --git a/sm/export.c b/sm/export.c index 1317945..4fedfa2 100644 --- a/sm/export.c +++ b/sm/export.c @@ -150,7 +150,7 @@ gpgsm_export (ctrl_t ctrl, strlist_t names, estream_t stream) goto leave; } - hd = keydb_new (0); + hd = keydb_new (); if (!hd) { log_error ("keydb_new failed\n"); @@ -338,8 +338,7 @@ gpgsm_p12_export (ctrl_t ctrl, const char *name, estream_t stream, int rawmode) void *data; size_t datalen; - - hd = keydb_new (0); + hd = keydb_new (); if (!hd) { log_error ("keydb_new failed\n"); diff --git a/sm/gpgsm.c b/sm/gpgsm.c index 6c9d85c..ae447ee 100644 --- a/sm/gpgsm.c +++ b/sm/gpgsm.c @@ -1616,7 +1616,7 @@ main ( int argc, char **argv) { int created; - keydb_add_resource ("pubring.kbx", 0, 0, &created); + keydb_add_resource ("pubring.kbx", 0, &created); if (created && !no_common_certs_import) { /* Import the standard certificates for a new default keybox. */ @@ -1634,7 +1634,7 @@ main ( int argc, char **argv) } } for (sl = nrings; sl; sl = sl->next) - keydb_add_resource (sl->d, 0, 0, NULL); + keydb_add_resource (sl->d, 0, NULL); FREE_STRLIST(nrings); diff --git a/sm/import.c b/sm/import.c index 2011fb5..bd1af27 100644 --- a/sm/import.c +++ b/sm/import.c @@ -403,7 +403,7 @@ reimport_one (ctrl_t ctrl, struct stats_s *stats, int in_fd) ksba_cert_t cert = NULL; unsigned int flags; - kh = keydb_new (0); + kh = keydb_new (); if (!kh) { err = gpg_error (GPG_ERR_ENOMEM);; diff --git a/sm/keydb.c b/sm/keydb.c index 02ca5ad..64b06e7 100644 --- a/sm/keydb.c +++ b/sm/keydb.c @@ -47,7 +47,6 @@ struct resource_item { KEYBOX_HANDLE kr; } u; void *token; - int secret; dotlock_t lockhandle; }; @@ -250,9 +249,9 @@ maybe_create_keybox (char *filename, int force, int *r_created) * if the function has created a new keybox. */ gpg_error_t -keydb_add_resource (const char *url, int force, int secret, int *auto_created) +keydb_add_resource (const char *url, int force, int *auto_created) { - static int any_secret, any_public; + static int any_public; const char *resname = url; char *filename = NULL; gpg_error_t err = 0; @@ -293,7 +292,7 @@ keydb_add_resource (const char *url, int force, int secret, int *auto_created) filename = xstrdup (resname); if (!force) - force = secret? !any_secret : !any_public; + force = !any_public; /* see whether we can determine the filetype */ if (rt == KEYDB_RESOURCE_TYPE_NONE) @@ -335,7 +334,7 @@ keydb_add_resource (const char *url, int force, int secret, int *auto_created) { void *token; - err = keybox_register_file (filename, secret, &token); + err = keybox_register_file (filename, 0, &token); if (gpg_err_code (err) == GPG_ERR_EEXIST) ; /* Already registered - ignore. */ else if (err) @@ -347,7 +346,6 @@ keydb_add_resource (const char *url, int force, int secret, int *auto_created) all_resources[used_resources].type = rt; all_resources[used_resources].u.kr = NULL; /* Not used here */ all_resources[used_resources].token = token; - all_resources[used_resources].secret = secret; all_resources[used_resources].lockhandle = dotlock_create (filename, 0); @@ -357,7 +355,7 @@ keydb_add_resource (const char *url, int force, int secret, int *auto_created) /* Do a compress run if needed and the file is not locked. */ if (!dotlock_take (all_resources[used_resources].lockhandle, 0)) { - KEYBOX_HANDLE kbxhd = keybox_new_x509 (token, secret); + KEYBOX_HANDLE kbxhd = keybox_new_x509 (token, 0); if (kbxhd) { @@ -383,8 +381,6 @@ keydb_add_resource (const char *url, int force, int secret, int *auto_created) leave: if (err) log_error ("keyblock resource '%s': %s\n", filename, gpg_strerror (err)); - else if (secret) - any_secret = 1; else any_public = 1; xfree (filename); @@ -393,7 +389,7 @@ keydb_add_resource (const char *url, int force, int secret, int *auto_created) KEYDB_HANDLE -keydb_new (int secret) +keydb_new (void) { KEYDB_HANDLE hd; int i, j; @@ -405,8 +401,6 @@ keydb_new (int secret) assert (used_resources <= MAX_KEYDB_RESOURCES); for (i=j=0; i < used_resources; i++) { - if (!all_resources[i].secret != !secret) - continue; switch (all_resources[i].type) { case KEYDB_RESOURCE_TYPE_NONE: /* ignore */ @@ -414,9 +408,8 @@ keydb_new (int secret) case KEYDB_RESOURCE_TYPE_KEYBOX: hd->active[j].type = all_resources[i].type; hd->active[j].token = all_resources[i].token; - hd->active[j].secret = all_resources[i].secret; hd->active[j].lockhandle = all_resources[i].lockhandle; - hd->active[j].u.kr = keybox_new_x509 (all_resources[i].token, secret); + hd->active[j].u.kr = keybox_new_x509 (all_resources[i].token, 0); if (!hd->active[j].u.kr) { xfree (hd); @@ -919,8 +912,6 @@ keydb_rebuild_caches (void) for (i=0; i < used_resources; i++) { - if (all_resources[i].secret) - continue; switch (all_resources[i].type) { case KEYDB_RESOURCE_TYPE_NONE: /* ignore */ @@ -1121,7 +1112,7 @@ keydb_store_cert (ksba_cert_t cert, int ephemeral, int *existed) return gpg_error (GPG_ERR_GENERAL); } - kh = keydb_new (0); + kh = keydb_new (); if (!kh) { log_error (_("failed to allocate keyDB handle\n")); @@ -1207,7 +1198,7 @@ keydb_set_cert_flags (ksba_cert_t cert, int ephemeral, return gpg_error (GPG_ERR_GENERAL); } - kh = keydb_new (0); + kh = keydb_new (); if (!kh) { log_error (_("failed to allocate keyDB handle\n")); @@ -1278,7 +1269,7 @@ keydb_clear_some_cert_flags (ctrl_t ctrl, strlist_t names) (void)ctrl; - hd = keydb_new (0); + hd = keydb_new (); if (!hd) { log_error ("keydb_new failed\n"); diff --git a/sm/keydb.h b/sm/keydb.h index 5713fde..bdf4a2d 100644 --- a/sm/keydb.h +++ b/sm/keydb.h @@ -31,9 +31,8 @@ typedef struct keydb_handle *KEYDB_HANDLE; /*-- keydb.c --*/ -gpg_error_t keydb_add_resource (const char *url, int force, int secret, - int *auto_created); -KEYDB_HANDLE keydb_new (int secret); +gpg_error_t keydb_add_resource (const char *url, int force, int *auto_created); +KEYDB_HANDLE keydb_new (void); void keydb_release (KEYDB_HANDLE hd); int keydb_set_ephemeral (KEYDB_HANDLE hd, int yes); const char *keydb_get_resource_name (KEYDB_HANDLE hd); diff --git a/sm/keylist.c b/sm/keylist.c index c4d475c..7bd20dd 100644 --- a/sm/keylist.c +++ b/sm/keylist.c @@ -1329,7 +1329,7 @@ list_internal_keys (ctrl_t ctrl, strlist_t names, estream_t fp, int have_secret; int want_ephemeral = ctrl->with_ephemeral_keys; - hd = keydb_new (0); + hd = keydb_new (); if (!hd) { log_error ("keydb_new failed\n"); diff --git a/sm/sign.c b/sm/sign.c index 6eec2e9..ff7215f 100644 --- a/sm/sign.c +++ b/sm/sign.c @@ -141,7 +141,7 @@ gpgsm_get_default_cert (ctrl_t ctrl, ksba_cert_t *r_cert) int rc; char *p; - hd = keydb_new (0); + hd = keydb_new (); if (!hd) return gpg_error (GPG_ERR_GENERAL); rc = keydb_search_first (hd); @@ -218,7 +218,7 @@ get_default_signer (ctrl_t ctrl) return NULL; } - kh = keydb_new (0); + kh = keydb_new (); if (!kh) return NULL; @@ -331,7 +331,7 @@ gpgsm_sign (ctrl_t ctrl, certlist_t signerlist, audit_set_type (ctrl->audit, AUDIT_TYPE_SIGN); - kh = keydb_new (0); + kh = keydb_new (); if (!kh) { log_error (_("failed to allocate keyDB handle\n")); diff --git a/sm/verify.c b/sm/verify.c index 4df1cc0..7a9f7e1 100644 --- a/sm/verify.c +++ b/sm/verify.c @@ -108,7 +108,7 @@ gpgsm_verify (ctrl_t ctrl, int in_fd, int data_fd, estream_t out_fp) audit_set_type (ctrl->audit, AUDIT_TYPE_VERIFY); - kh = keydb_new (0); + kh = keydb_new (); if (!kh) { log_error (_("failed to allocate keyDB handle\n")); ----------------------------------------------------------------------- Summary of changes: g10/keydb.c | 18 ++++++++--- sm/call-agent.c | 2 +- sm/call-dirmngr.c | 10 +++--- sm/certchain.c | 72 +++++++++++++++++++++++++++---------------- sm/certlist.c | 15 ++++----- sm/decrypt.c | 4 +-- sm/delete.c | 8 ++--- sm/encrypt.c | 2 +- sm/export.c | 11 +++---- sm/gpgsm.c | 6 ++-- sm/gpgsm.h | 5 ++- sm/import.c | 8 ++--- sm/keydb.c | 92 +++++++++++++++++++++++++++++-------------------------- sm/keydb.h | 28 +++++++++-------- sm/keylist.c | 9 +++--- sm/server.c | 15 ++++++++- sm/sign.c | 12 ++++---- sm/verify.c | 6 ++-- 18 files changed, 188 insertions(+), 135 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Thu Nov 10 17:19:23 2016 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Thu, 10 Nov 2016 17:19:23 +0100 Subject: [git] GPGME - branch, master, updated. gpgme-1.7.1-28-g2a39bd6 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 2a39bd6c30d21c43c86645a7908ce6c57dad5e20 (commit) from d0030efb45ec8436dd84a9623d2f66b80c6b9e10 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 2a39bd6c30d21c43c86645a7908ce6c57dad5e20 Author: Werner Koch Date: Thu Nov 10 17:13:02 2016 +0100 core: Detect unreadable keyrings. * src/keylist.c (op_data_t): Add field keydb_search_err. (keylist_status_handler): Parse STATUS_ERROR into that var. (gpgme_op_keylist_next): Use that err instead of GPG_ERR_EOF. -- With a recent GnuPG version this allows to detect a keyring with wrong permissions (i.e. no read access). GPG_ERR_OPEN_KEYRING will be returned instead of GPG_ERR_EOF. Signed-off-by: Werner Koch diff --git a/src/keylist.c b/src/keylist.c index 8a0c5a3..6e22e16 100644 --- a/src/keylist.c +++ b/src/keylist.c @@ -54,6 +54,9 @@ typedef struct { struct _gpgme_op_keylist_result result; + /* The error code from ERROR keydb_search. */ + gpgme_error_t keydb_search_err; + gpgme_key_t tmp_key; /* This points to the last uid in tmp_key. */ @@ -135,10 +138,17 @@ keylist_status_handler (void *priv, gpgme_status_code_t code, char *args) opd->result.truncated = 1; break; + case GPGME_STATUS_ERROR: + err = _gpgme_parse_failure (args); + if (!opd->keydb_search_err && !strcmp (args, "keydb_search")) + opd->keydb_search_err = err; + err = 0; + break; + default: break; } - return 0; + return err; } @@ -1138,7 +1148,8 @@ gpgme_op_keylist_next (gpgme_ctx_t ctx, gpgme_key_t *r_key) return TRACE_ERR (err); if (!opd->key_cond) - return TRACE_ERR (gpg_error (GPG_ERR_EOF)); + return TRACE_ERR (opd->keydb_search_err? opd->keydb_search_err + /**/ : gpg_error (GPG_ERR_EOF)); opd->key_cond = 0; assert (opd->key_queue); ----------------------------------------------------------------------- Summary of changes: src/keylist.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Thu Nov 10 17:23:53 2016 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Thu, 10 Nov 2016 17:23:53 +0100 Subject: [git] GPG-ERROR - branch, master, updated. libgpg-error-1.24-10-gbae57a2 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Error codes used by GnuPG et al.". The branch, master has been updated via bae57a21cfab25ad11c82dc6e69d82d1f2f7a415 (commit) from 49e32eed4550869644d706352d683ddba5696d4e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit bae57a21cfab25ad11c82dc6e69d82d1f2f7a415 Author: Werner Koch Date: Thu Nov 10 17:20:53 2016 +0100 Change description of GPG_ERR_OPEN_KEYRING. Signed-off-by: Werner Koch diff --git a/doc/errorref.txt b/doc/errorref.txt index 0ea7d76..0203724 100644 --- a/doc/errorref.txt +++ b/doc/errorref.txt @@ -106,7 +106,7 @@ GPG_ERR_BAD_PASSPHRASE Bad passphrase 12 GPG_ERR_CIPHER_ALGO Invalid cipher algorithm -13 GPG_ERR_KEYRING_OPEN Keyring open +13 GPG_ERR_KEYRING_OPEN Cannot open keyring 14 GPG_ERR_INV_PACKET Invalid packet 15 GPG_ERR_INV_ARMOR Invalid armor 16 GPG_ERR_NO_USER_ID No user ID diff --git a/po/cs.po b/po/cs.po index f4b0bcf..22324e1 100644 --- a/po/cs.po +++ b/po/cs.po @@ -131,7 +131,7 @@ msgstr "Chybn? heslo" msgid "Invalid cipher algorithm" msgstr "Neplatn? ?ifrovac? algoritmus" -msgid "Keyring open" +msgid "Cannot open keyring" msgstr "Kl??enka otev?ena" msgid "Invalid packet" diff --git a/po/da.po b/po/da.po index a55872c..9079e39 100644 --- a/po/da.po +++ b/po/da.po @@ -127,7 +127,7 @@ msgstr "?delagt adgangsfrase" msgid "Invalid cipher algorithm" msgstr "Ugyldig chifferalgoritme" -msgid "Keyring open" +msgid "Cannot open keyring" msgstr "N?glering ?ben" msgid "Invalid packet" diff --git a/po/de.po b/po/de.po index 9620d17..b7b0e23 100644 --- a/po/de.po +++ b/po/de.po @@ -123,7 +123,7 @@ msgstr "Falsche Passphrase" msgid "Invalid cipher algorithm" msgstr "Ung?ltiges Verschl?sselungsverfahren" -msgid "Keyring open" +msgid "Cannot open keyring" msgstr "Schl?sselbund kann nicht ge?ffnet werden" msgid "Invalid packet" diff --git a/po/eo.po b/po/eo.po index 79d5054..7fb7c1b 100644 --- a/po/eo.po +++ b/po/eo.po @@ -123,7 +123,7 @@ msgstr "Mal?usta pasfrazo" msgid "Invalid cipher algorithm" msgstr "Malvalida ?ifra algoritmo" -msgid "Keyring open" +msgid "Cannot open keyring" msgstr "Malfermo de ?losilringo" msgid "Invalid packet" diff --git a/po/fr.po b/po/fr.po index b807d1b..add5c90 100644 --- a/po/fr.po +++ b/po/fr.po @@ -126,7 +126,7 @@ msgstr "Mauvaise phrase secr?te" msgid "Invalid cipher algorithm" msgstr "Algorithme de chiffrement incorrect" -msgid "Keyring open" +msgid "Cannot open keyring" msgstr "Porte-clefs ouvert" msgid "Invalid packet" diff --git a/po/hu.po b/po/hu.po index 8e60405..75ddfdb 100644 --- a/po/hu.po +++ b/po/hu.po @@ -125,7 +125,7 @@ msgstr "Rossz jelmondat" msgid "Invalid cipher algorithm" msgstr "?rv?nytelen titkos?t? algoritmus" -msgid "Keyring open" +msgid "Cannot open keyring" msgstr "Kulcstart? nyitva" msgid "Invalid packet" diff --git a/po/it.po b/po/it.po index c6afd2d..5b764f8 100644 --- a/po/it.po +++ b/po/it.po @@ -124,7 +124,7 @@ msgstr "Passphrase errata" msgid "Invalid cipher algorithm" msgstr "Algoritmo di cifratura non valido" -msgid "Keyring open" +msgid "Cannot open keyring" msgstr "Apertura del portachiavi" msgid "Invalid packet" diff --git a/po/ja.po b/po/ja.po index 5b6c88b..402a6ea 100644 --- a/po/ja.po +++ b/po/ja.po @@ -125,7 +125,7 @@ msgstr "???????????" msgid "Invalid cipher algorithm" msgstr "?????????????" -msgid "Keyring open" +msgid "Cannot open keyring" msgstr "????????" msgid "Invalid packet" diff --git a/po/nl.po b/po/nl.po index 90c0f23..5a54707 100644 --- a/po/nl.po +++ b/po/nl.po @@ -125,7 +125,7 @@ msgstr "Ongeldige wachtwoordzin" msgid "Invalid cipher algorithm" msgstr "Ongeldig versleutelingsalgoritme" -msgid "Keyring open" +msgid "Cannot open keyring" msgstr "Sleutelring open" msgid "Invalid packet" diff --git a/po/pl.po b/po/pl.po index f986aa3..8b0a7a2 100644 --- a/po/pl.po +++ b/po/pl.po @@ -123,7 +123,7 @@ msgstr "B??dne has?o" msgid "Invalid cipher algorithm" msgstr "Niepoprawny algorytm szyfru" -msgid "Keyring open" +msgid "Cannot open keyring" msgstr "Zbi?r kluczy otwarty" msgid "Invalid packet" diff --git a/po/pt.po b/po/pt.po index f2709b2..46776a1 100644 --- a/po/pt.po +++ b/po/pt.po @@ -125,7 +125,7 @@ msgstr "Senha errada" msgid "Invalid cipher algorithm" msgstr "Algoritmo de cifra inv?lido" -msgid "Keyring open" +msgid "Cannot open keyring" msgstr "Chaveiro aberto" msgid "Invalid packet" diff --git a/po/ro.po b/po/ro.po index 0402e2d..4faca4f 100644 --- a/po/ro.po +++ b/po/ro.po @@ -127,7 +127,7 @@ msgstr "Fraz msgid "Invalid cipher algorithm" msgstr "Algoritm cifrare invalid" -msgid "Keyring open" +msgid "Cannot open keyring" msgstr "Inel de chei deschis" msgid "Invalid packet" diff --git a/po/ru.po b/po/ru.po index 0e46f24..3cc27f6 100644 --- a/po/ru.po +++ b/po/ru.po @@ -123,7 +123,7 @@ msgstr "?????? ?????-??????" msgid "Invalid cipher algorithm" msgstr "???????????? ???????? ????????????? ??????????" -msgid "Keyring open" +msgid "Cannot open keyring" msgstr "??????? ?????? ???????" msgid "Invalid packet" diff --git a/po/sr.po b/po/sr.po index de76e9b..ffdee12 100644 --- a/po/sr.po +++ b/po/sr.po @@ -124,7 +124,7 @@ msgstr "???? ???????? ???" msgid "Invalid cipher algorithm" msgstr "?????????? ????????? ?????????" -msgid "Keyring open" +msgid "Cannot open keyring" msgstr "???????? ??????? ?? ???????" msgid "Invalid packet" diff --git a/po/sv.po b/po/sv.po index 8477b00..b01c70c 100644 --- a/po/sv.po +++ b/po/sv.po @@ -123,7 +123,7 @@ msgstr "Felaktig l?senfras" msgid "Invalid cipher algorithm" msgstr "Ogiltig chifferalgoritm" -msgid "Keyring open" +msgid "Cannot open keyring" msgstr "Nyckelring ?r ?ppnad" msgid "Invalid packet" diff --git a/po/uk.po b/po/uk.po index 88e8189..c712b3a 100644 --- a/po/uk.po +++ b/po/uk.po @@ -125,7 +125,7 @@ msgstr "?????????? ??????" msgid "Invalid cipher algorithm" msgstr "??????????? ???????? ??????????" -msgid "Keyring open" +msgid "Cannot open keyring" msgstr "????????? ??????? ??????" msgid "Invalid packet" diff --git a/po/vi.po b/po/vi.po index a17f2fa..1636d49 100644 --- a/po/vi.po +++ b/po/vi.po @@ -125,7 +125,7 @@ msgstr "C?m t? m?t kh?u sai" msgid "Invalid cipher algorithm" msgstr "Thu?t to?n m?t m? kh?ng h?p l?" -msgid "Keyring open" +msgid "Cannot open keyring" msgstr "V?ng kho? ?? m?" msgid "Invalid packet" diff --git a/po/zh_CN.po b/po/zh_CN.po index 8db4a72..2170957 100644 --- a/po/zh_CN.po +++ b/po/zh_CN.po @@ -125,7 +125,7 @@ msgstr "?????" msgid "Invalid cipher algorithm" msgstr "???????" -msgid "Keyring open" +msgid "Cannot open keyring" msgstr "" msgid "Invalid packet" diff --git a/po/zh_TW.po b/po/zh_TW.po index 324b9a5..7997c72 100644 --- a/po/zh_TW.po +++ b/po/zh_TW.po @@ -127,7 +127,7 @@ msgstr "?????" msgid "Invalid cipher algorithm" msgstr "????????" -msgid "Keyring open" +msgid "Cannot open keyring" msgstr "?????" msgid "Invalid packet" diff --git a/src/err-codes.h.in b/src/err-codes.h.in index f29c234..833405f 100644 --- a/src/err-codes.h.in +++ b/src/err-codes.h.in @@ -42,7 +42,7 @@ 10 GPG_ERR_CHECKSUM Checksum error 11 GPG_ERR_BAD_PASSPHRASE Bad passphrase 12 GPG_ERR_CIPHER_ALGO Invalid cipher algorithm -13 GPG_ERR_KEYRING_OPEN Keyring open +13 GPG_ERR_KEYRING_OPEN Cannot open keyring 14 GPG_ERR_INV_PACKET Invalid packet 15 GPG_ERR_INV_ARMOR Invalid armor 16 GPG_ERR_NO_USER_ID No user ID ----------------------------------------------------------------------- Summary of changes: doc/errorref.txt | 2 +- po/cs.po | 2 +- po/da.po | 2 +- po/de.po | 2 +- po/eo.po | 2 +- po/fr.po | 2 +- po/hu.po | 2 +- po/it.po | 2 +- po/ja.po | 2 +- po/nl.po | 2 +- po/pl.po | 2 +- po/pt.po | 2 +- po/ro.po | 2 +- po/ru.po | 2 +- po/sr.po | 2 +- po/sv.po | 2 +- po/uk.po | 2 +- po/vi.po | 2 +- po/zh_CN.po | 2 +- po/zh_TW.po | 2 +- src/err-codes.h.in | 2 +- 21 files changed, 21 insertions(+), 21 deletions(-) hooks/post-receive -- Error codes used by GnuPG et al. http://git.gnupg.org From cvs at cvs.gnupg.org Thu Nov 10 17:31:06 2016 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Thu, 10 Nov 2016 17:31:06 +0100 Subject: [git] GPGME - branch, master, updated. gpgme-1.7.1-29-ge166724 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via e166724dcce29b2c9c98e421d07876ece2a63699 (commit) from 2a39bd6c30d21c43c86645a7908ce6c57dad5e20 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit e166724dcce29b2c9c98e421d07876ece2a63699 Author: Werner Koch Date: Thu Nov 10 17:28:29 2016 +0100 doc: s/Multi Threading/Multi-Threading/ -- diff --git a/doc/gpgme.texi b/doc/gpgme.texi index 42c16a8..c790537 100644 --- a/doc/gpgme.texi +++ b/doc/gpgme.texi @@ -130,7 +130,7 @@ Preparation * Using Libtool:: Avoiding compiler options entirely. * Library Version Check:: Getting and verifying the library version. * Signal Handling:: How @acronym{GPGME} affects signal handling. -* Multi Threading:: How @acronym{GPGME} can be used in an MT environment. +* Multi-Threading:: How @acronym{GPGME} can be used in an MT environment. Protocols and Engines @@ -382,7 +382,7 @@ of the library are verified. * Using Libtool:: Avoiding compiler options entirely. * Library Version Check:: Getting and verifying the library version. * Signal Handling:: How @acronym{GPGME} affects signal handling. -* Multi Threading:: How @acronym{GPGME} can be used in an MT environment. +* Multi-Threading:: How @acronym{GPGME} can be used in an MT environment. @end menu @@ -805,14 +805,14 @@ application is multi-threaded, and you install a signal action for @code{gpgme_check_version} is called or afterwards. - at node Multi Threading - at section Multi Threading + at node Multi-Threading + at section Multi-Threading @cindex thread-safeness @cindex multi-threading -The @acronym{GPGME} library is mostly thread-safe, an can be used -in a mulithreaded environment but there are some requirements -for mutlithreaded use: +The @acronym{GPGME} library is mostly thread-safe, and can be used +in a multi-threaded environment but there are some requirements +for multi-threaded use: @itemize @bullet @item ----------------------------------------------------------------------- Summary of changes: doc/gpgme.texi | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Thu Nov 10 18:35:11 2016 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Thu, 10 Nov 2016 18:35:11 +0100 Subject: [git] GPGME - branch, master, updated. gpgme-1.7.1-30-gddd0a3c Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via ddd0a3cf90ac4b0a27ea610ebd7b9b8016ff43c4 (commit) from e166724dcce29b2c9c98e421d07876ece2a63699 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit ddd0a3cf90ac4b0a27ea610ebd7b9b8016ff43c4 Author: Andre Heinecke Date: Thu Nov 10 18:32:26 2016 +0100 tests: Reduce thread count in new thread tests * gpg/t-thread-keylist-verify.c, gpg/t-thread-keylist.c: Reduce threads to 100 -- Due to the limit of FD_SETSIZE the number of parallel threads is limited. So some systems run into this problem when running the testsuite. diff --git a/tests/gpg/t-thread-keylist-verify.c b/tests/gpg/t-thread-keylist-verify.c index 9f37857..6f747a6 100644 --- a/tests/gpg/t-thread-keylist-verify.c +++ b/tests/gpg/t-thread-keylist-verify.c @@ -32,7 +32,7 @@ #include "t-support.h" -#define THREAD_COUNT 500 +#define THREAD_COUNT 100 static const char test_text1[] = "Just GNU it!\n"; static const char test_sig1[] = diff --git a/tests/gpg/t-thread-keylist.c b/tests/gpg/t-thread-keylist.c index 6b9cee0..c03f1ca 100644 --- a/tests/gpg/t-thread-keylist.c +++ b/tests/gpg/t-thread-keylist.c @@ -32,7 +32,7 @@ #include "t-support.h" -#define THREAD_COUNT 500 +#define THREAD_COUNT 100 void * start_keylist (void *arg) ----------------------------------------------------------------------- Summary of changes: tests/gpg/t-thread-keylist-verify.c | 2 +- tests/gpg/t-thread-keylist.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Thu Nov 10 19:52:41 2016 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Thu, 10 Nov 2016 19:52:41 +0100 Subject: [git] GPGME - branch, master, updated. gpgme-1.7.1-31-g6e57379 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 6e57379c8e37c0863f7d12819a5a7d0781bd76d2 (commit) from ddd0a3cf90ac4b0a27ea610ebd7b9b8016ff43c4 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 6e57379c8e37c0863f7d12819a5a7d0781bd76d2 Author: Werner Koch Date: Thu Nov 10 19:49:13 2016 +0100 core: Use better error code when using select with a too high fd. * src/posix-io.c (_gpgme_io_select): Return EMFILE instead of EBADF. -- Also EBADF seem more correct, EMFILE (Too man open files) gives a clearer message to the user that there are somehow too many files open. The problem can be exhibited by running lots of threads, We should eventually move to poll but that would be a large change and so we better fix it with the planned migration of the I/O subsystem to libgpgrt (currently known as libgpg-error). Signed-off-by: Werner Koch diff --git a/src/posix-io.c b/src/posix-io.c index c0b2f4f..c903072 100644 --- a/src/posix-io.c +++ b/src/posix-io.c @@ -607,7 +607,7 @@ _gpgme_io_select (struct io_select_fd_s *fds, size_t nfds, int nonblock) if (fds[i].fd >= FD_SETSIZE) { TRACE_END (dbg_help, " -BAD- ]"); - gpg_err_set_errno (EBADF); + gpg_err_set_errno (EMFILE); return TRACE_SYSRES (-1); } assert (!FD_ISSET (fds[i].fd, &readfds)); @@ -622,7 +622,7 @@ _gpgme_io_select (struct io_select_fd_s *fds, size_t nfds, int nonblock) if (fds[i].fd >= FD_SETSIZE) { TRACE_END (dbg_help, " -BAD- ]"); - gpg_err_set_errno (EBADF); + gpg_err_set_errno (EMFILE); return TRACE_SYSRES (-1); } assert (!FD_ISSET (fds[i].fd, &writefds)); ----------------------------------------------------------------------- Summary of changes: src/posix-io.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Fri Nov 11 08:49:06 2016 From: cvs at cvs.gnupg.org (by Daniel Kahn Gillmor) Date: Fri, 11 Nov 2016 08:49:06 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.1.15-355-g57e95f5 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via 57e95f5413e21cfcb957af2346b292686a5647b7 (commit) via e51912f467fda963c7abcfcd4082d6eb084ba5be (commit) via 1854f0f6112651c4fc3b92372b98c932e830ed21 (commit) from 5d13581f4737c18430f6572dd4ef486d1ad80dd1 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 57e95f5413e21cfcb957af2346b292686a5647b7 Author: Daniel Kahn Gillmor Date: Thu Oct 27 14:19:18 2016 -0400 doc: Include config examples for socket-activated user services. -- These configuration files and instructions enable clean and simple daemon supervision on machines that run systemd. Signed-off-by: Daniel Kahn Gillmor - Removed the detailed ChangeLog entry because that is not needed for doc changes. - Added an entry to doc/examples/README. Signed-off-by: Werner Koch diff --git a/doc/Makefile.am b/doc/Makefile.am index 0791dbc..53cd639 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -21,7 +21,14 @@ AM_CPPFLAGS = include $(top_srcdir)/am/cmacros.am -examples = examples/README examples/scd-event examples/trustlist.txt \ +examples = examples/README examples/scd-event examples/trustlist.txt \ + examples/systemd-user/README \ + examples/systemd-user/dirmngr.service \ + examples/systemd-user/dirmngr.socket \ + examples/systemd-user/gpg-agent.service \ + examples/systemd-user/gpg-agent.socket \ + examples/systemd-user/gpg-agent-ssh.socket \ + examples/systemd-user/gpg-agent-extra.socket \ examples/gpgconf.conf examples/pwpattern.list helpfiles = help.txt help.be.txt help.ca.txt help.cs.txt \ diff --git a/doc/examples/README b/doc/examples/README index 3444822..77ee807 100644 --- a/doc/examples/README +++ b/doc/examples/README @@ -3,7 +3,9 @@ Files in this directory: scd-event A handler script used with scdaemon -trustlist.txt A list of trustworthy root certificates +trustlist.txt A list of trustworthy root certificates (Please check yourself whether you actually trust them) gpgconf.conf A sample configuration file for gpgconf. + +systemd-user Sample files for a Linux-only init system. diff --git a/doc/examples/systemd-user/README b/doc/examples/systemd-user/README new file mode 100644 index 0000000..43122f5 --- /dev/null +++ b/doc/examples/systemd-user/README @@ -0,0 +1,66 @@ +Socket-activated dirmngr and gpg-agent with systemd +=================================================== + +When used on a GNU/Linux system supervised by systemd, you can ensure +that the GnuPG daemons dirmngr and gpg-agent are launched +automatically the first time they're needed, and shut down cleanly at +session logout. This is done by enabling user services via +socket-activation. + +System distributors +------------------- + +The *.service and *.socket files (from this directory) should be +placed in /usr/lib/systemd/user/ alongside other user-session services +and sockets. + +To enable socket-activated dirmngr for all accounts on the system, +use: + + systemctl --user --global enable dirmngr.socket + +To enable socket-activated gpg-agent for all accounts on the system, +use: + + systemctl --user --global enable gpg-agent.socket + +Additionally, you can enable socket-activated gpg-agent ssh-agent +emulation for all accounts on the system with: + + systemctl --user --global enable gpg-agent-ssh.socket + +You can also enable restricted ("--extra-socket"-style) gpg-agent +sockets for all accounts on the system with: + + systemctl --user --global enable gpg-agent-extra.socket + +Individual users +---------------- + +A user on a system with systemd where this has not been installed +system-wide can place these files in ~/.config/systemd/user/ to make +them available. + +If a given service isn't installed system-wide, or if it's installed +system-wide but not globally enabled, individual users will still need +to enable them. For example, to enable socket-activated dirmngr for +all future sessions: + + systemctl --user enable dirmngr.socket + +To enable socket-activated gpg-agent with ssh support, do: + + systemctl --user enable gpg-agent.socket gpg-agent-ssh.socket + +These changes won't take effect until your next login after you've +fully logged out (be sure to terminate any running daemons before +logging out). + +If you'd rather try a socket-activated GnuPG daemon in an +already-running session without logging out (with or without enabling +it for all future sessions), kill any existing daemon and start the +user socket directly. For example, to set up socket-activated dirmgnr +in the current session: + + gpgconf --kill dirmngr + systemctl --user start dirmngr.socket diff --git a/doc/examples/systemd-user/dirmngr.service b/doc/examples/systemd-user/dirmngr.service new file mode 100644 index 0000000..c79dfc5 --- /dev/null +++ b/doc/examples/systemd-user/dirmngr.service @@ -0,0 +1,10 @@ +[Unit] +Description=GnuPG network certificate management daemon +Documentation=man:dirmngr(8) +Requires=dirmngr.socket +After=dirmngr.socket +## This is a socket-activated service: +RefuseManualStart=true + +[Service] +ExecStart=/usr/bin/dirmngr --supervised diff --git a/doc/examples/systemd-user/dirmngr.socket b/doc/examples/systemd-user/dirmngr.socket new file mode 100644 index 0000000..ebabf89 --- /dev/null +++ b/doc/examples/systemd-user/dirmngr.socket @@ -0,0 +1,11 @@ +[Unit] +Description=GnuPG network certificate management daemon +Documentation=man:dirmngr(8) + +[Socket] +ListenStream=%t/gnupg/S.dirmngr +SocketMode=0600 +DirectoryMode=0700 + +[Install] +WantedBy=sockets.target diff --git a/doc/examples/systemd-user/gpg-agent-browser.socket b/doc/examples/systemd-user/gpg-agent-browser.socket new file mode 100644 index 0000000..bc8d344 --- /dev/null +++ b/doc/examples/systemd-user/gpg-agent-browser.socket @@ -0,0 +1,13 @@ +[Unit] +Description=GnuPG cryptographic agent and passphrase cache (access for web browsers) +Documentation=man:gpg-agent(1) + +[Socket] +ListenStream=%t/gnupg/S.gpg-agent.browser +FileDescriptorName=browser +Service=gpg-agent.service +SocketMode=0600 +DirectoryMode=0700 + +[Install] +WantedBy=sockets.target diff --git a/doc/examples/systemd-user/gpg-agent-extra.socket b/doc/examples/systemd-user/gpg-agent-extra.socket new file mode 100644 index 0000000..5b87d09 --- /dev/null +++ b/doc/examples/systemd-user/gpg-agent-extra.socket @@ -0,0 +1,13 @@ +[Unit] +Description=GnuPG cryptographic agent and passphrase cache (restricted) +Documentation=man:gpg-agent(1) + +[Socket] +ListenStream=%t/gnupg/S.gpg-agent.extra +FileDescriptorName=extra +Service=gpg-agent.service +SocketMode=0600 +DirectoryMode=0700 + +[Install] +WantedBy=sockets.target diff --git a/doc/examples/systemd-user/gpg-agent-ssh.socket b/doc/examples/systemd-user/gpg-agent-ssh.socket new file mode 100644 index 0000000..798c1d9 --- /dev/null +++ b/doc/examples/systemd-user/gpg-agent-ssh.socket @@ -0,0 +1,13 @@ +[Unit] +Description=GnuPG cryptographic agent (ssh-agent emulation) +Documentation=man:gpg-agent(1) man:ssh-add(1) man:ssh-agent(1) man:ssh(1) + +[Socket] +ListenStream=%t/gnupg/S.gpg-agent.ssh +FileDescriptorName=ssh +Service=gpg-agent.service +SocketMode=0600 +DirectoryMode=0700 + +[Install] +WantedBy=sockets.target diff --git a/doc/examples/systemd-user/gpg-agent.service b/doc/examples/systemd-user/gpg-agent.service new file mode 100644 index 0000000..9ab9220 --- /dev/null +++ b/doc/examples/systemd-user/gpg-agent.service @@ -0,0 +1,10 @@ +[Unit] +Description=GnuPG cryptographic agent and passphrase cache +Documentation=man:gpg-agent(1) +Requires=gpg-agent.socket +After=gpg-agent.socket +## This is a socket-activated service: +RefuseManualStart=true + +[Service] +ExecStart=/usr/bin/gpg-agent --supervised diff --git a/doc/examples/systemd-user/gpg-agent.socket b/doc/examples/systemd-user/gpg-agent.socket new file mode 100644 index 0000000..4257c2c --- /dev/null +++ b/doc/examples/systemd-user/gpg-agent.socket @@ -0,0 +1,12 @@ +[Unit] +Description=GnuPG cryptographic agent and passphrase cache +Documentation=man:gpg-agent(1) + +[Socket] +ListenStream=%t/gnupg/S.gpg-agent +FileDescriptorName=std +SocketMode=0600 +DirectoryMode=0700 + +[Install] +WantedBy=sockets.target commit e51912f467fda963c7abcfcd4082d6eb084ba5be Author: Daniel Kahn Gillmor Date: Thu Nov 10 07:17:17 2016 -0600 agent: Clean up comments. * agent/agent.h: Clean up comments. Signed-off-by: Daniel Kahn Gillmor diff --git a/agent/agent.h b/agent/agent.h index 9ba7dc8..2dfbf5c 100644 --- a/agent/agent.h +++ b/agent/agent.h @@ -154,12 +154,12 @@ struct int keep_tty; /* Don't switch the TTY (for pinentry) on request */ int keep_display; /* Don't switch the DISPLAY (for pinentry) on request */ - /* This global options indicates the use of an extra socket. Note + /* This global option indicates the use of an extra socket. Note that we use a hack for cleanup handling in gpg-agent.c: If the value is less than 2 the name has not yet been malloced. */ int extra_socket; - /* This global options indicates the use of an extra socket for web + /* This global option indicates the use of an extra socket for web browsers. Note that we use a hack for cleanup handling in gpg-agent.c: If the value is less than 2 the name has not yet been malloced. */ commit 1854f0f6112651c4fc3b92372b98c932e830ed21 Author: Werner Koch Date: Fri Nov 11 08:25:04 2016 +0100 doc: Clarify dirmngr option --daemon. -- With commit d83ba4897bf217d1045c58d1b99e52bd31c58812 all system daemon features have been removed and thus this should be reflected in the man page. Signed-off-by: Werner Koch diff --git a/doc/dirmngr.texi b/doc/dirmngr.texi index 6620a87..300068e 100644 --- a/doc/dirmngr.texi +++ b/doc/dirmngr.texi @@ -82,8 +82,9 @@ This is only used for testing. @item --daemon @opindex daemon Run in background daemon mode and listen for commands on a socket. -Note that this also changes the default home directory and enables the -internal certificate validation code. This mode is deprecated. +This is the way @command{dirmngr} is started on demand by the other +GnuPG components. To force starting @command{dirmngr} it is in +general best to use @code{gpgconf --launch dirmngr}. @item --supervised @opindex supervised @@ -141,21 +142,11 @@ per-user configuration file. The default configuration file is named @item --homedir @var{dir} @opindex options Set the name of the home directory to @var{dir}. This option is only -effective when used on the command line. The default depends on the -running mode: - - at table @asis - - at item With @code{--daemon} given on the commandline -the directory named @file{@value{SYSCONFDIR}} is used for configuration files -and @file{@value{LOCALCACHEDIR}} for cached CRLs. - - at item Without @code{--daemon} given on the commandline +effective when used on the command line. The default os the directory named @file{.gnupg} directly below the home directory of the user unless the environment variable @code{GNUPGHOME} has been set in which case its value will be used. All kind of data is stored below this directory. - at end table @item -v @@ -345,8 +336,7 @@ configured LDAP server if the connection using the "proxy" failed. @opindex ldapserverlist-file Read the list of LDAP servers to consult for CRLs and certificates from file instead of the default per-user ldap server list file. The default -value for @var{file} is @file{dirmngr_ldapservers.conf} or - at file{ldapservers.conf} when running in @option{--daemon} mode. +value for @var{file} is @file{dirmngr_ldapservers.conf}. This server list file contains one LDAP server per line in the format ----------------------------------------------------------------------- Summary of changes: agent/agent.h | 4 +- doc/Makefile.am | 9 ++- doc/dirmngr.texi | 20 ++----- doc/examples/README | 4 +- doc/examples/systemd-user/README | 66 ++++++++++++++++++++++ doc/examples/systemd-user/dirmngr.service | 10 ++++ doc/examples/systemd-user/dirmngr.socket | 11 ++++ doc/examples/systemd-user/gpg-agent-browser.socket | 13 +++++ doc/examples/systemd-user/gpg-agent-extra.socket | 13 +++++ doc/examples/systemd-user/gpg-agent-ssh.socket | 13 +++++ doc/examples/systemd-user/gpg-agent.service | 10 ++++ doc/examples/systemd-user/gpg-agent.socket | 12 ++++ 12 files changed, 166 insertions(+), 19 deletions(-) create mode 100644 doc/examples/systemd-user/README create mode 100644 doc/examples/systemd-user/dirmngr.service create mode 100644 doc/examples/systemd-user/dirmngr.socket create mode 100644 doc/examples/systemd-user/gpg-agent-browser.socket create mode 100644 doc/examples/systemd-user/gpg-agent-extra.socket create mode 100644 doc/examples/systemd-user/gpg-agent-ssh.socket create mode 100644 doc/examples/systemd-user/gpg-agent.service create mode 100644 doc/examples/systemd-user/gpg-agent.socket hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Fri Nov 11 09:20:33 2016 From: cvs at cvs.gnupg.org (by Alon Bar-Lev) Date: Fri, 11 Nov 2016 09:20:33 +0100 Subject: [git] GPGME - branch, master, updated. gpgme-1.7.1-32-g41d8c7e Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 41d8c7e51a8989be633b9ada124c58a01fae7d54 (commit) from 6e57379c8e37c0863f7d12819a5a7d0781bd76d2 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 41d8c7e51a8989be633b9ada124c58a01fae7d54 Author: Alon Bar-Lev Date: Wed Oct 19 12:04:07 2016 +0300 tests,python: Atomic directory creation * lang/python/tests/Makefile.am: Use MIDIR_P. * tests/gpg/Makefile.am: Ditto. * tests/gpgsm/Makefile.am: Ditto. -- Solves race in parallel build when mkdir fails if directory exists. Signed-off-by: Alon Bar-Lev - Tweaked the ChangeLog Signed-off-by: Werner Koch diff --git a/lang/python/tests/Makefile.am b/lang/python/tests/Makefile.am index aa88bdc..39f532c 100644 --- a/lang/python/tests/Makefile.am +++ b/lang/python/tests/Makefile.am @@ -89,7 +89,7 @@ clean-local: ./private-keys-v1.d/gpg-sample.stamp: $(private_keys) - test -d ./private-keys-v1.d || mkdir ./private-keys-v1.d + $(MKDIR_P) ./private-keys-v1.d for k in $(private_keys); do \ cp $$k private-keys-v1.d/$${k#$(test_srcdir)/}.key; \ done diff --git a/tests/gpg/Makefile.am b/tests/gpg/Makefile.am index dd33b0a..c46feb0 100644 --- a/tests/gpg/Makefile.am +++ b/tests/gpg/Makefile.am @@ -93,7 +93,7 @@ export GNUPGHOME := $(abs_builddir) export GPG_AGENT_INFO := ./private-keys-v1.d/gpg-sample.stamp: $(srcdir)/$(private_keys) - test -d ./private-keys-v1.d || mkdir ./private-keys-v1.d + $(MKDIR_P) ./private-keys-v1.d for k in $(private_keys); do \ cp $(srcdir)/$$k private-keys-v1.d/$$k.key; \ done diff --git a/tests/gpgsm/Makefile.am b/tests/gpgsm/Makefile.am index 41645b6..46d6a9b 100644 --- a/tests/gpgsm/Makefile.am +++ b/tests/gpgsm/Makefile.am @@ -70,7 +70,7 @@ export GPG_AGENT_INFO := echo faked-system-time 1008241200 >> ./gpgsm.conf ./private-keys-v1.d/$(key_id).key: $(srcdir)/$(key_id) - test -d ./private-keys-v1.d || mkdir ./private-keys-v1.d + $(MKDIR_P) ./private-keys-v1.d cp $(srcdir)/$(key_id) private-keys-v1.d/$(key_id).key ./trustlist.txt: ----------------------------------------------------------------------- Summary of changes: lang/python/tests/Makefile.am | 2 +- tests/gpg/Makefile.am | 2 +- tests/gpgsm/Makefile.am | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Fri Nov 11 09:52:06 2016 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Fri, 11 Nov 2016 09:52:06 +0100 Subject: [git] Poldi - branch, master, updated. release-0.4.1-42-g83891ae Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "PAM for the OpenPGP card". The branch, master has been updated via 83891ae71db2ba6f7d0e48db746fb5caaeba2c4b (commit) via 56b759da589bdfa3af31ed95839ba59f12e94fb7 (commit) from 16912be8d2685e82a3fe40e94912e90cbb73e47b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 83891ae71db2ba6f7d0e48db746fb5caaeba2c4b Author: NIIBE Yutaka Date: Fri Nov 11 17:51:36 2016 +0900 Fix info entry of poldi.texi diff --git a/doc/poldi.texi b/doc/poldi.texi index 17fe3b9..f6b3d80 100644 --- a/doc/poldi.texi +++ b/doc/poldi.texi @@ -15,7 +15,7 @@ @dircategory GNU Utilities @direntry -* poldi: (poldi) PAM authentication via OpenPGP smartcards. +* poldi: (poldi). PAM authentication via OpenPGP smartcards. @end direntry @include version.texi commit 56b759da589bdfa3af31ed95839ba59f12e94fb7 Author: NIIBE Yutaka Date: Fri Nov 11 17:50:12 2016 +0900 Add "use-agent" PAM option. * configure.ac (GNUPG_DEFAULT_GPGCONF): New. * src/pam/pam_poldi.c (pam_poldi_options_cb): Support the option. (pam_sm_authenticate): Call scd_connect with use_agent option. * src/scd/scd.c (get_agent_socket_name): New. (agent_scd_getinfo_socket_name): Revert the change of removing this function. Clean it up. (get_scd_socket_from_agent): New. (scd_connect): Clean up and support use_agent. -- Using Poldi for su/sudo with gpg-agent is questionable usage. However, for backward compatibility, the feature is back. Signed-off-by: NIIBE Yutaka diff --git a/NEWS b/NEWS index a52f269..d3d8c46 100644 --- a/NEWS +++ b/NEWS @@ -5,15 +5,23 @@ Changes since version 0.4.1: * poldi-ctrl is removed Please use gpg-connect-agent instead. -* Poldi always invokes scdaemon to connect it through pipe +* New "use-agent" PAM option for backward compatibility + In GnuPG 2.1, the environment variable GPG_AGENT_INFO is gone. And + now, Poldi's default is invoking scdaemon directly. Still, there + are use cases (like su/sudo) which expect connecting user's + gpg-agent. For this purpose, we now have "use-agent" option. Don't + enable this option for login authentication. + +* Poldi invokes scdaemon to connect it through pipe Older Poldi has a feature of connecting to scdaemon with help of gpg-agent using the GPG_AGENT_INFO enviornment variable. In GnuPG - 2.1, the GPG_AGENT_INFO is gone and scdaemon no longer keeps locking - the reader after card removal, it is good to always invoke scdaemon - for the authentication. If there is an existing scdaemon with card - inserted, a failure is expected and this is safer fallback. That's - because Poldi should not connect to a smartcard which is in use for - other purpose and possibly already authenticated. + 2.1, the environment variable GPG_AGENT_INFO is gone and scdaemon no + longer keeps locking the reader after card removal, it is good to + always invoke scdaemon for the authentication by default. If there + is an existing scdaemon with card inserted, a failure is expected + and this is safer fallback. That's because Poldi should not connect + to a smartcard which is in use for other purpose and possibly + already authenticated. * New option "scdaemon-options" Added a new option "scdaemon-options", which can be used to specify diff --git a/configure.ac b/configure.ac index 1886e2c..0aba308 100644 --- a/configure.ac +++ b/configure.ac @@ -68,6 +68,9 @@ AC_DEFINE_UNQUOTED(NEED_KSBA_VERSION, "$NEED_KSBA_VERSION", AH_BOTTOM([ /* Setup the hardwired names of modules. */ +#ifndef GNUPG_DEFAULT_GPGCONF +#define GNUPG_DEFAULT_GPGCONF ( GNUPG_BINDIR "/gpgconf" ) +#endif #ifndef GNUPG_DEFAULT_SCD #define GNUPG_DEFAULT_SCD ( GNUPG_LIBEXECDIR "/scdaemon" ) #endif diff --git a/src/pam/auth-support/ctx.h b/src/pam/auth-support/ctx.h index 98f1034..3de2407 100644 --- a/src/pam/auth-support/ctx.h +++ b/src/pam/auth-support/ctx.h @@ -67,6 +67,7 @@ struct poldi_ctx_s PAM environment. */ int quiet; /* Be more quiet during PAM conversation with user. */ + int use_agent; /* Use gpg-agent to connect scdaemon. */ /* Scdaemon. */ char *scdaemon_program; /* Path of Scdaemon program to execute. */ diff --git a/src/pam/pam_poldi.c b/src/pam/pam_poldi.c index 6ed3cc4..a27a3e9 100644 --- a/src/pam/pam_poldi.c +++ b/src/pam/pam_poldi.c @@ -84,7 +84,8 @@ enum opt_ids opt_scdaemon_program, opt_scdaemon_options, opt_modify_environment, - opt_quiet + opt_quiet, + opt_use_agent, }; /* Full specifications for options. */ @@ -104,6 +105,8 @@ static simpleparse_opt_spec_t opt_specs[] = 0, SIMPLEPARSE_ARG_NONE, 0, "Set Poldi related variables in the PAM environment" }, { opt_quiet, "quiet", 0, SIMPLEPARSE_ARG_NONE, 0, "Be more quiet during PAM conversation with user" }, + { opt_use_agent, "use-agent", + 0, SIMPLEPARSE_ARG_NONE, 0, "Use gpg-agent for scdaemon" }, { 0 } }; @@ -202,6 +205,10 @@ pam_poldi_options_cb (void *cookie, simpleparse_opt_spec_t spec, const char *arg /* QUIET. */ ctx->quiet = 1; } + else if (!strcmp (spec.long_opt, "use-agent")) + { + ctx->use_agent = 1; + } return gpg_error (err); } @@ -549,7 +556,8 @@ pam_sm_authenticate (pam_handle_t *pam_handle, /*** Connect to Scdaemon. ***/ - err = scd_connect (&scd_ctx, ctx->scdaemon_program, ctx->scdaemon_options, + err = scd_connect (&scd_ctx, ctx->use_agent, + ctx->scdaemon_program, ctx->scdaemon_options, ctx->loghandle); if (err) goto out; diff --git a/src/scd/scd.c b/src/scd/scd.c index a565f78..06a26d8 100644 --- a/src/scd/scd.c +++ b/src/scd/scd.c @@ -94,6 +94,111 @@ static gpg_error_t scd_serialno_internal (assuan_context_t ctx, char **r_serialno); + +/* Get the socket of GPG-AGENT by gpgconf. */ +static gpg_error_t +get_agent_socket_name (char **gpg_agent_sockname) +{ + gpg_error_t err = 0; + FILE *input; + char *result; + size_t len; + + *gpg_agent_sockname = NULL; + + result = xtrymalloc (256); + if (!result) + return gpg_error_from_syserror (); + + input = popen ("gpgconf --list-dirs agent-socket", "r"); + if (input == NULL) + { + xfree (result); + return gpg_error (GPG_ERR_NOT_FOUND); + } + + len = fread (result, 1, 256, input); + fclose (input); + + if (len) + { + *gpg_agent_sockname = result; + result[len-1] = 0; /* Chop off the newline. */ + } + else + { + xfree (result); + err = gpg_error (GPG_ERR_NOT_FOUND); + } + + return err; +} + +/* Helper function for get_scd_socket_from_agent(), which is used by + scd_connect(). + + Try to retrieve the SCDaemons socket name from the gpg-agent + context CTX. On success, *SOCKET_NAME is filled with a copy ot the + socket name. Return proper error code or zero on success. */ +static gpg_error_t +agent_scd_getinfo_socket_name (assuan_context_t ctx, char **socket_name) +{ + membuf_t data; + gpg_error_t err = 0; + unsigned char *databuf; + size_t datalen; + + init_membuf (&data, 256); + *socket_name = NULL; + + err = assuan_transact (ctx, "SCD GETINFO socket_name", membuf_data_cb, &data, + NULL, NULL, NULL, NULL); + databuf = get_membuf (&data, &datalen); + if (!err) + { + if (databuf && datalen) + { + char *res = xtrymalloc (datalen + 1); + if (!res) + err = gpg_error_from_syserror (); + else + { + memcpy (res, databuf, datalen); + res[datalen] = 0; + *socket_name = res; + } + } + } + + xfree (databuf); + + return err; +} + +/* Retrieve SCDaemons socket name through a running gpg-agent. On + Success, *SOCKET_NAME contains a copy of the socket name. Returns + proper error code or zero on success. */ +static gpg_error_t +get_scd_socket_from_agent (char **socket_name) +{ + assuan_context_t ctx = NULL; + gpg_error_t err; + char *gpg_agent_sockname; + + err = get_agent_socket_name (&gpg_agent_sockname); + if (err) + return err; + + err = assuan_socket_connect (&ctx, gpg_agent_sockname, 0); + xfree (gpg_agent_sockname); + if (!err) + err = agent_scd_getinfo_socket_name (ctx, socket_name); + + assuan_disconnect (ctx); + + return err; +} + /* Send a RESTART to SCDaemon. */ static void restart_scd (scd_context_t ctx) @@ -107,7 +212,7 @@ restart_scd (scd_context_t ctx) /* Fork off scdaemon and work by pipes. Returns proper error code or zero on success. */ gpg_error_t -scd_connect (scd_context_t *scd_ctx, const char *scd_path, +scd_connect (scd_context_t *scd_ctx, int use_agent, const char *scd_path, const char *scd_options, log_handle_t loghandle) { assuan_context_t assuan_ctx; @@ -116,40 +221,58 @@ scd_connect (scd_context_t *scd_ctx, const char *scd_path, assuan_ctx = NULL; + if (fflush (NULL)) + { + rc = gpg_error_from_syserror (); + log_msg_error (loghandle, + _("error flushing pending output: %s"), + strerror (errno)); + return rc; + } + ctx = xtrymalloc (sizeof (*ctx)); - if (! ctx) + if (!ctx) { rc = gpg_error_from_syserror (); - goto out; + return rc; } ctx->assuan_ctx = NULL; ctx->flags = 0; - if (1) + if (use_agent) { - const char *pgmname; - const char *argv[5]; - int no_close_list[3]; - int i; + /* Retrieve a scdaemon socket name from gpg-agent. */ + char *scd_socket_name = NULL; -#if 0 + rc = get_scd_socket_from_agent (&scd_socket_name); + if (!rc) + rc = assuan_socket_connect (&assuan_ctx, scd_socket_name, 0); + + if (!rc) log_msg_debug (loghandle, - _("no running scdaemon - starting one")); -#endif + _("got scdaemon socket name from gpg-agent, " + "connected to socket '%s'"), scd_socket_name); - if (fflush (NULL)) - { - rc = gpg_error_from_syserror (); + xfree (scd_socket_name); + + if (rc) + { log_msg_error (loghandle, - _("error flushing pending output: %s"), - strerror (errno)); - goto out; - } + _("could not connect to scdaemon: %s"), + gpg_strerror (rc)); + } + } + else + { + const char *pgmname; + const char *argv[5]; + int no_close_list[3]; + int i; if (!scd_path || !*scd_path) scd_path = GNUPG_DEFAULT_SCD; - if ( !(pgmname = strrchr (scd_path, '/'))) + if (!(pgmname = strrchr (scd_path, '/'))) pgmname = scd_path; else pgmname++; @@ -168,9 +291,9 @@ scd_connect (scd_context_t *scd_ctx, const char *scd_path, i=0; +#if 0 /* FIXME! Am I right in assumung that we do not need this? -mo */ -#if 0 if (log_get_fd () != -1) no_close_list[i++] = log_get_fd (); #endif @@ -181,26 +304,24 @@ scd_connect (scd_context_t *scd_ctx, const char *scd_path, /* connect to the scdaemon and perform initial handshaking */ rc = assuan_pipe_connect (&assuan_ctx, scd_path, argv, no_close_list); - if (!rc) + if (rc) + { + log_msg_error (loghandle, + _("could not spawn scdaemon: %s"), + gpg_strerror (rc)); + } + else { log_msg_debug (loghandle, _("spawned a new scdaemon (path: '%s')"), scd_path); - goto out; } } - log_msg_error (loghandle, - _("could not connect to any scdaemon: %s"), - gpg_strerror (rc)); - - out: - if (rc) { assuan_disconnect (assuan_ctx); xfree (ctx); - } else { @@ -212,10 +333,6 @@ scd_connect (scd_context_t *scd_ctx, const char *scd_path, ctx->flags = 0; ctx->loghandle = loghandle; *scd_ctx = ctx; -#if 0 - log_msg_debug (loghandle, - _("connection to scdaemon established")); -#endif } return rc; diff --git a/src/scd/scd.h b/src/scd/scd.h index 25680f8..8910497 100644 --- a/src/scd/scd.h +++ b/src/scd/scd.h @@ -49,8 +49,9 @@ typedef struct scd_cardinfo scd_cardinfo_t; /* Fork it off and work by pipes. Returns proper error code or zero on success. */ -gpg_error_t scd_connect (scd_context_t *scd_ctx, const char *scd_path, - const char *scd_options, log_handle_t loghandle); +gpg_error_t scd_connect (scd_context_t *scd_ctx, int use_agent, + const char *scd_path, const char *scd_options, + log_handle_t loghandle); /* Disconnect from SCDaemon; destroy the context SCD_CTX. */ void scd_disconnect (scd_context_t scd_ctx); ----------------------------------------------------------------------- Summary of changes: NEWS | 22 ++++-- configure.ac | 3 + doc/poldi.texi | 2 +- src/pam/auth-support/ctx.h | 1 + src/pam/pam_poldi.c | 12 ++- src/scd/scd.c | 183 +++++++++++++++++++++++++++++++++++++-------- src/scd/scd.h | 5 +- 7 files changed, 183 insertions(+), 45 deletions(-) hooks/post-receive -- PAM for the OpenPGP card http://git.gnupg.org From cvs at cvs.gnupg.org Fri Nov 11 15:13:40 2016 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Fri, 11 Nov 2016 15:13:40 +0100 Subject: [git] GPGME - branch, master, updated. gpgme-1.7.1-33-g05775b5 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 05775b52485a0d37033b26d696f36c622a4aa32e (commit) from 41d8c7e51a8989be633b9ada124c58a01fae7d54 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 05775b52485a0d37033b26d696f36c622a4aa32e Author: Werner Koch Date: Fri Nov 11 15:10:57 2016 +0100 doc: Fix regression in macro handling -- The way macros are handled seem to have changed since 2008. Fix that: Reported-by: dkg at fifthhorseman.net Signed-off-by: Werner Koch diff --git a/doc/gpgme.texi b/doc/gpgme.texi index c790537..ee5ba6d 100644 --- a/doc/gpgme.texi +++ b/doc/gpgme.texi @@ -31,11 +31,11 @@ General Public License for more details. @end copying @c Macros used by the description of the UI server protocol - at macro clnt - @sc{c:} @c + at macro clnt{string} + @sc{c:} \string\ @end macro - at macro srvr - @sc{s:} @c + at macro srvr{string} + @sc{s:} \string\ @end macro diff --git a/doc/uiserver.texi b/doc/uiserver.texi index 16e8f85..aae3b60 100644 --- a/doc/uiserver.texi +++ b/doc/uiserver.texi @@ -158,21 +158,21 @@ indicated by a @sc{c:}, server responses by @sc{c:}: @smallexample @group - @clnt RESET - @srvr OK - @clnt RECIPIENT foo@@example.net - @srvr OK - @clnt RECIPIENT bar@@example.com - @srvr OK - @clnt PREP_ENCRYPT - @srvr S PROTOCOL OpenPGP - @srvr OK - @clnt INPUT FD=17 - @srvr OK - @clnt OUTPUT FD=18 - @srvr OK - @clnt ENCRYPT - @srvr OK + @clnt{RESET} + @srvr{OK} + @clnt{RECIPIENT foo@@example.net} + @srvr{OK} + @clnt{RECIPIENT bar@@example.com} + @srvr{OK} + @clnt{PREP_ENCRYPT} + @srvr{S PROTOCOL OpenPGP} + @srvr{OK} + @clnt{INPUT FD=17} + @srvr{OK} + @clnt{OUTPUT FD=18} + @srvr{OK} + @clnt{ENCRYPT} + @srvr{OK} @end group @end smallexample ----------------------------------------------------------------------- Summary of changes: doc/gpgme.texi | 8 ++++---- doc/uiserver.texi | 30 +++++++++++++++--------------- 2 files changed, 19 insertions(+), 19 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Fri Nov 11 15:14:54 2016 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Fri, 11 Nov 2016 15:14:54 +0100 Subject: [git] GpgOL - branch, nomapi, updated. gpgol-1.4.0-154-g49b9fd0 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG extension for MS Outlook". The branch, nomapi has been updated via 49b9fd0697088a25c260e4acd14be96252fe3988 (commit) via d16f3075cfa8db3a162c996035a21680386d69a1 (commit) via 574ff72396de2ab6e71d6f078e3caa56c623c13a (commit) via d77e4135ecc23f3dd9390b5650ed5d926fdcecec (commit) via d7192df3f3fa1543326acef17cd344d3412cce25 (commit) via 6e085dd895b2ae922a320a8c0501e59de68642a4 (commit) via ea6f44cc0508db178a986874525d170105d95678 (commit) via 22ea51b3672f68ffde6923c0720e4bf36f66f712 (commit) from fd27fa2fc04ba2172e4007b472d000153286b311 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 49b9fd0697088a25c260e4acd14be96252fe3988 Author: Andre Heinecke Date: Fri Nov 11 15:14:07 2016 +0100 Clean up some debug output * src/ribbon-callbacks.cpp (get_mail_from_control): Don't print the Subject diff --git a/src/ribbon-callbacks.cpp b/src/ribbon-callbacks.cpp index 977145a..596d74f 100644 --- a/src/ribbon-callbacks.cpp +++ b/src/ribbon-callbacks.cpp @@ -1471,9 +1471,8 @@ get_mail_from_control (LPDISPATCH ctrl) uid = mapi_get_uid (mailitem); if (!uid) { - log_oom ("%s:%s: Failed to get uid for %p .", + log_debug ("%s:%s: Failed to get uid for %p", SRCNAME, __func__, mailitem); - log_debug ("subject: %s", get_oom_string(mailitem, "Subject")); gpgol_release (mailitem); return NULL; } commit d16f3075cfa8db3a162c996035a21680386d69a1 Author: Andre Heinecke Date: Fri Nov 11 15:11:56 2016 +0100 Remove accidentally commited AddRef experiment * src/mailitem-events.cpp (EVENT_SINK_INVOKE): Do not add another ref on read. -- This was part of an experiment if the additional ref prevented an unload. diff --git a/src/mailitem-events.cpp b/src/mailitem-events.cpp index e1e5881..bd37d5d 100644 --- a/src/mailitem-events.cpp +++ b/src/mailitem-events.cpp @@ -196,7 +196,6 @@ EVENT_SINK_INVOKE(MailItemEvents) { log_oom_extra ("%s:%s: Read : %p", SRCNAME, __func__, m_mail); - m_object->AddRef(); if (!m_mail->is_crypto_mail()) { /* Not for us. */ commit 574ff72396de2ab6e71d6f078e3caa56c623c13a Author: Andre Heinecke Date: Fri Nov 11 15:07:30 2016 +0100 Fix WM_CLOSE handling * src/windowmessages.h (add_explorer, remove_explorer): Use LPDISPATCH * src/windowmessages.cpp (add_explorer, remove_explorer): Update accordingly. (gpgol_hook): Use FindWindowEx to find all explorer windows. * src/gpgoladdin.cpp (install_explorer_sinks): Register explorer dispatch. * src/explorer-events.cpp (EVENT_SINK_INVOKE): Remove explorer on close. -- At least with Outlook 2016 casting to IOlewindow and using GetWindow did not work anymore. The returned handle was always 1. FindWindowEx should work reliably. diff --git a/src/explorer-events.cpp b/src/explorer-events.cpp index c794a91..4b8a7ab 100644 --- a/src/explorer-events.cpp +++ b/src/explorer-events.cpp @@ -100,9 +100,7 @@ EVENT_SINK_INVOKE(ExplorerEvents) log_oom_extra ("%s:%s: Deleting event handler: %p", SRCNAME, __func__, this); - HWND hwnd; - ((LPOLEWINDOW)m_object)->GetWindow(&hwnd); - remove_explorer_window (hwnd); + remove_explorer (m_object); delete this; return S_OK; } diff --git a/src/gpgoladdin.cpp b/src/gpgoladdin.cpp index 0f43663..fda79a5 100644 --- a/src/gpgoladdin.cpp +++ b/src/gpgoladdin.cpp @@ -407,9 +407,7 @@ install_explorer_sinks (LPDISPATCH application) log_oom_extra ("%s:%s: created sink %p for explorer %i", SRCNAME, __func__, sink, i); } - HWND hwnd; - ((LPOLEWINDOW)explorer)->GetWindow(&hwnd); - add_explorer_window (hwnd); + add_explorer (explorer); gpgol_release (explorer); } /* Now install the event sink to handle new explorers */ diff --git a/src/windowmessages.cpp b/src/windowmessages.cpp index 7268299..0760cdf 100644 --- a/src/windowmessages.cpp +++ b/src/windowmessages.cpp @@ -191,19 +191,19 @@ do_in_ui_thread (gpgol_wmsg_type type, void *data) return ctx.err; } -static std::vector explorers; +static std::vector explorers; void -add_explorer_window (HWND hwnd) +add_explorer (LPDISPATCH explorer) { - explorers.push_back (hwnd); + explorers.push_back (explorer); } -void remove_explorer_window (HWND hwnd) +void remove_explorer (LPDISPATCH explorer) { explorers.erase(std::remove(explorers.begin(), explorers.end(), - hwnd), + explorer), explorers.end()); } @@ -220,15 +220,34 @@ gpgol_hook(int code, WPARAM wParam, LPARAM lParam) { case WM_CLOSE: { - if (std::find(explorers.begin(), explorers.end(), cwp->hwnd) == explorers.end()) + HWND lastChild = NULL; + for (const auto explorer: explorers) { - /* Not an explorer window */ - break; + /* Casting to LPOLEWINDOW and calling GetWindow + succeeded in Outlook 2016 but always returned + the number 1. So we need this hack. */ + char *caption = get_oom_string (explorer, "Caption"); + if (!caption) + { + log_debug ("%s:%s: No caption.", + SRCNAME, __func__); + continue; + } + /* rctrl_renwnd32 is the window class of outlook. */ + HWND hwnd = FindWindowExA(NULL, lastChild, "rctrl_renwnd32", + caption); + xfree (caption); + lastChild = hwnd; + if (hwnd == cwp->hwnd) + { + log_debug ("%s:%s: WM_CLOSE windowmessage for explorer. " + "Closing all mails.", + SRCNAME, __func__); + Mail::close_all_mails(); + break; + } } - log_debug ("%s:%s: WM_CLOSE windowmessage for explorer. " - "Closing all mails.", - SRCNAME, __func__); - Mail::close_all_mails(); + break; } case WM_SYSCOMMAND: if (cwp->wParam == SC_CLOSE) diff --git a/src/windowmessages.h b/src/windowmessages.h index 366e67e..7c07ae3 100644 --- a/src/windowmessages.h +++ b/src/windowmessages.h @@ -70,7 +70,7 @@ do_in_ui_thread (gpgol_wmsg_type type, void *data); HHOOK create_message_hook(); -void add_explorer_window (HWND hwnd); -void remove_explorer_window (HWND hwnd); +void add_explorer (LPDISPATCH explorer); +void remove_explorer (LPDISPATCH explorer); #endif // WINDOWMESSAGES_H commit d77e4135ecc23f3dd9390b5650ed5d926fdcecec Author: Andre Heinecke Date: Fri Nov 11 15:05:16 2016 +0100 Fix UI Invalidation after selection change * src/explorer-events.cpp (EVENT_SINK_INVOKE): Invalidate again on selection change. (invalidate_ui): Delay invalidation. -- We sleep before the invalidation to give outlook a chance to actually read the mail properly after the selection is changed before we invalidate the ui. This fixes some races after selection change. diff --git a/src/explorer-events.cpp b/src/explorer-events.cpp index c8130a7..c794a91 100644 --- a/src/explorer-events.cpp +++ b/src/explorer-events.cpp @@ -61,6 +61,17 @@ typedef enum ViewSwitch = 0xF004 } ExplorerEvent; +static DWORD WINAPI +invalidate_ui (LPVOID) +{ + /* We sleep here a bit to prevent invalidtion immediately + after the selection change before we have started processing + the mail. */ + Sleep (1000); + do_in_ui_thread (INVALIDATE_UI, nullptr); + return 0; +} + EVENT_SINK_INVOKE(ExplorerEvents) { USE_INVOKE_ARGS @@ -70,7 +81,18 @@ EVENT_SINK_INVOKE(ExplorerEvents) { log_oom_extra ("%s:%s: Selection change in explorer: %p", SRCNAME, __func__, this); - // gpgoladdin_invalidate_ui (); + HANDLE thread = CreateThread (NULL, 0, invalidate_ui, (LPVOID) this, 0, + NULL); + + if (!thread) + { + log_error ("%s:%s: Failed to create invalidate_ui thread.", + SRCNAME, __func__); + } + else + { + CloseHandle (thread); + } break; } case Close: diff --git a/src/windowmessages.cpp b/src/windowmessages.cpp index a650810..7268299 100644 --- a/src/windowmessages.cpp +++ b/src/windowmessages.cpp @@ -113,6 +113,15 @@ gpgol_window_proc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) gpgol_window_proc (hWnd, message, wParam, (LPARAM) ctx); break; } + case (INVALIDATE_UI): + { + log_debug ("%s:%s: Invalidating UI", + SRCNAME, __func__); + gpgoladdin_invalidate_ui(); + log_debug ("%s:%s: Invalidation done", + SRCNAME, __func__); + break; + } default: log_debug ("Unknown msg"); } diff --git a/src/windowmessages.h b/src/windowmessages.h index 0af0a3c..366e67e 100644 --- a/src/windowmessages.h +++ b/src/windowmessages.h @@ -33,11 +33,10 @@ The Responder Window should be initalized on startup. */ - - typedef enum _gpgol_wmsg_type { UNKNOWN = 0, + INVALIDATE_UI = 1, /* The UI should be invalidated. */ PARSING_DONE = 2, /* A mail was parsed. Data should be a pointer to the mail object. */ REQUEST_DECRYPT = 3, commit d7192df3f3fa1543326acef17cd344d3412cce25 Author: Andre Heinecke Date: Fri Nov 11 15:01:51 2016 +0100 Ensure uuid's are always logged * src/mail.cpp (Mail::set_uuid): Log uuid changes. diff --git a/src/mail.cpp b/src/mail.cpp index e262d7b..e34cb53 100644 --- a/src/mail.cpp +++ b/src/mail.cpp @@ -1257,6 +1257,8 @@ Mail::set_uuid() else { uuid = get_unique_id (m_mailitem, 1, nullptr); + log_debug ("%s:%s: uuid for %p set to %s", + SRCNAME, __func__, this, uuid); } if (!uuid) commit 6e085dd895b2ae922a320a8c0501e59de68642a4 Author: Andre Heinecke Date: Fri Nov 11 14:58:56 2016 +0100 Fix sigstate code for multiple signatures * src/mail.cpp (Mail::update_sigstate): Fix signature selection code. -- Previously the first signature was selected always even if this signature did not have the uid belonging to the sender. This might be considered a security problem but was thankfully not released yet. Thanks to Daniel Vr?til for seeing this issue. diff --git a/src/mail.cpp b/src/mail.cpp index 4694ed3..e262d7b 100644 --- a/src/mail.cpp +++ b/src/mail.cpp @@ -1169,6 +1169,7 @@ Mail::update_sigstate () m_sig = sig; m_uid = uid; m_is_valid = true; + return; } log_debug ("%s:%s: No signature with enough trust. Using first", commit ea6f44cc0508db178a986874525d170105d95678 Author: Andre Heinecke Date: Fri Nov 11 14:58:23 2016 +0100 Set uuid again in close * src/mail.cpp (Mail::close): Set uuid again. -- This fixes the decrypt again code. diff --git a/src/mail.cpp b/src/mail.cpp index 06dc278..4694ed3 100644 --- a/src/mail.cpp +++ b/src/mail.cpp @@ -1043,18 +1043,20 @@ Mail::close () dispparams.cArgs = 1; dispparams.cNamedArgs = 0; + log_oom_extra ("%s:%s: Invoking close for: %p", + SRCNAME, __func__, this); int rc = invoke_oom_method_with_parms (m_mailitem, "Close", NULL, &dispparams); /* Reset the uuid after discarding all changes in the oom so that we can still find ourself. */ -// set_uuid (); + set_uuid (); - /* Now that we have closed it with discard changes we no - longer need to wipe the mail because the plaintext was - discarded. */ if (!rc) { + /* Now that we have closed it with discard changes we no + longer need to wipe the mail because the plaintext was + discarded. */ m_needs_wipe = false; } return rc; commit 22ea51b3672f68ffde6923c0720e4bf36f66f712 Author: Andre Heinecke Date: Fri Nov 11 14:56:53 2016 +0100 Remove old error message template * src/mail.cpp (HTML_TEMPLATE): Remove. (Mail::wipe): Just empty out body. -- This should no longer be needed. Only if close errors out is wipe actually called. diff --git a/src/mail.cpp b/src/mail.cpp index a727b23..06dc278 100644 --- a/src/mail.cpp +++ b/src/mail.cpp @@ -57,34 +57,6 @@ static std::map g_uid_map; in get_valid_sig why.*/ #define GPGOL_BASIC_TOFU_TRUST 10 -/* TODO: Localize this once it is less bound to change. - TODO: Use a dedicated message for failed decryption. */ -#define HTML_TEMPLATE \ -"" \ -"" \ -"" \ -"" \ -"" \ -"" \ -"
" \ -"

This message is encrypted

" \ -"
" \ -"
You can decrypt this message with GnuPG" \ -"
Open this message to decrypt it." \ -"
Opening any attachments while this message is shown will only give you access to encrypted data.
" \ -"

If you have GpgOL (The GnuPG Outlook plugin installed) this message should have been automatically decrypted." \ -"
Reasons that you still see this message can be: " \ -"
    " \ -"
  • Decryption failed:
    • Refer to the Decrypt / Verify popup window for details.
  • " \ -"
  • Outlook tried to save the decrypted content:" \ -"
      "\ -"
    • To protect your data GpgOL encrypts a message when it is saved by Outlook.
    • " \ -"
    • You will need to restart Outlook to allow GpgOL to decrypt this message again.
    • " \ -"
    " \ -"
  • GpgOL is not activated:
    • Check under Options -> Add-Ins -> COM-Add-Ins to see if this is the case.
  • " \ -"
"\ -"
" - Mail::Mail (LPDISPATCH mailitem) : m_mailitem(mailitem), m_processed(false), @@ -766,10 +738,15 @@ Mail::wipe () log_debug ("%s:%s: Removing plaintext from mailitem: %p.", SRCNAME, __func__, m_mailitem); if (put_oom_string (m_mailitem, "HTMLBody", - HTML_TEMPLATE)) + "")) { - log_debug ("%s:%s: Failed to wipe mailitem: %p.", - SRCNAME, __func__, m_mailitem); + if (put_oom_string (m_mailitem, "Body", + "")) + { + log_debug ("%s:%s: Failed to wipe mailitem: %p.", + SRCNAME, __func__, m_mailitem); + return -1; + } return -1; } m_needs_wipe = false; ----------------------------------------------------------------------- Summary of changes: src/explorer-events.cpp | 28 ++++++++++++++++++++++---- src/gpgoladdin.cpp | 4 +--- src/mail.cpp | 52 ++++++++++++++++-------------------------------- src/mailitem-events.cpp | 1 - src/ribbon-callbacks.cpp | 3 +-- src/windowmessages.cpp | 52 +++++++++++++++++++++++++++++++++++++----------- src/windowmessages.h | 7 +++---- 7 files changed, 86 insertions(+), 61 deletions(-) hooks/post-receive -- GnuPG extension for MS Outlook http://git.gnupg.org From cvs at cvs.gnupg.org Fri Nov 11 15:35:18 2016 From: cvs at cvs.gnupg.org (by Daniel Kahn Gillmor) Date: Fri, 11 Nov 2016 15:35:18 +0100 Subject: [git] GPGME - branch, master, updated. gpgme-1.7.1-36-g16a3020 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 16a30205064914eef578d84d07141b5d51d82838 (commit) via d50bdb269e86db36a443958e3bfc6816a44d468e (commit) via da035768bd9a880becee5d0d553dfe12299f96eb (commit) from 05775b52485a0d37033b26d696f36c622a4aa32e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 16a30205064914eef578d84d07141b5d51d82838 Author: Daniel Kahn Gillmor Date: Fri Nov 11 15:16:43 2016 +0900 doc: Correct deftypefun for gpgme_op_decrypt_verify_start. * doc/gpgme.texi: Documentationabout gpgme_op_decrypt_verify_start was stored under the name gpgme_op_decrypt_verify instead. Signed-off-by: Daniel Kahn Gillmor diff --git a/doc/gpgme.texi b/doc/gpgme.texi index 414de34..801a53f 100644 --- a/doc/gpgme.texi +++ b/doc/gpgme.texi @@ -5117,7 +5117,7 @@ secret key could not be retrieved, and passes through any errors that are reported by the crypto engine support routines. @end deftypefun - at deftypefun gpgme_error_t gpgme_op_decrypt_verify (@w{gpgme_ctx_t @var{ctx}}, @w{gpgme_data_t @var{cipher}}, @w{gpgme_data_t @var{plain}}) + at deftypefun gpgme_error_t gpgme_op_decrypt_verify_start (@w{gpgme_ctx_t @var{ctx}}, @w{gpgme_data_t @var{cipher}}, @w{gpgme_data_t @var{plain}}) The function @code{gpgme_op_decrypt_verify_start} initiates a @code{gpgme_op_decrypt_verify} operation. It can be completed by calling @code{gpgme_wait} on the context. @xref{Waiting For commit d50bdb269e86db36a443958e3bfc6816a44d468e Author: Daniel Kahn Gillmor Date: Fri Nov 11 14:25:19 2016 +0900 doc: Correct text about gpgme_cancel_async. * doc/gpgme.texi: Documentation about gpgme_cancel_async should refer to the correct name. Signed-off-by: Daniel Kahn Gillmor diff --git a/doc/gpgme.texi b/doc/gpgme.texi index ee5ba6d..414de34 100644 --- a/doc/gpgme.texi +++ b/doc/gpgme.texi @@ -6537,7 +6537,7 @@ case the state of @var{ctx} is not modified). @deftypefun gpgme_ctx_t gpgme_cancel_async (@w{gpgme_ctx_t @var{ctx}}) -The function @code{gpgme_cancel} attempts to cancel a pending +The function @code{gpgme_cancel_async} attempts to cancel a pending operation in the context @var{ctx}. This can be called by any thread at any time after starting an operation on the context, but will not take effect immediately. The actual cancellation happens at the next commit da035768bd9a880becee5d0d553dfe12299f96eb Author: Daniel Kahn Gillmor Date: Thu Nov 10 15:47:48 2016 -0800 core: Non-zero values should set _armor, _textmode, and _online. * src/gpgme.c (gpgme_set_armor, gpgme_set_textmode, gpgme_set_offline): Ensure that non-zero values actually set the appropriate internal bit. -- The documentation for these functions says things like "disabled if YES is zero, and enabled otherwise", where YES is an integer. However, if you pass an even integer, it will be aliased back to 0 because the context member variables are declared as single bits. This should make the implementation match the documentation. Signed-off-by: Daniel Kahn Gillmor diff --git a/src/gpgme.c b/src/gpgme.c index 6d0dbff..443cb76 100644 --- a/src/gpgme.c +++ b/src/gpgme.c @@ -504,7 +504,7 @@ gpgme_set_armor (gpgme_ctx_t ctx, int use_armor) if (!ctx) return; - ctx->use_armor = use_armor; + ctx->use_armor = !!use_armor; } @@ -531,7 +531,7 @@ gpgme_set_textmode (gpgme_ctx_t ctx, int use_textmode) if (!ctx) return; - ctx->use_textmode = use_textmode; + ctx->use_textmode = !!use_textmode; } /* Return the state of the textmode flag. */ @@ -555,7 +555,7 @@ gpgme_set_offline (gpgme_ctx_t ctx, int offline) if (!ctx) return; - ctx->offline = offline; + ctx->offline = !!offline; } /* Return the state of the offline flag. */ ----------------------------------------------------------------------- Summary of changes: doc/gpgme.texi | 4 ++-- src/gpgme.c | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Fri Nov 11 16:02:42 2016 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Fri, 11 Nov 2016 16:02:42 +0100 Subject: [git] GpgOL - branch, nomapi, updated. gpgol-1.4.0-156-ga8891e3 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG extension for MS Outlook". The branch, nomapi has been updated via a8891e3a6ef1cb32842f203656ada790d7581957 (commit) via 957f2441efb15e4a51342ff3f73a86bec4dabee7 (commit) from 49b9fd0697088a25c260e4acd14be96252fe3988 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit a8891e3a6ef1cb32842f203656ada790d7581957 Author: Andre Heinecke Date: Fri Nov 11 16:01:18 2016 +0100 Add property change warning * src/mailitem-events.cpp (EVENT_SINK_INVOKE): Warn on property change done by the user. -- See the comment in the PropertyChange event why we can't handle this. diff --git a/src/mailitem-events.cpp b/src/mailitem-events.cpp index bd37d5d..d8bc897 100644 --- a/src/mailitem-events.cpp +++ b/src/mailitem-events.cpp @@ -28,14 +28,15 @@ #include "mail.h" #include "mapihelp.h" -const wchar_t * save_props[] = { +const wchar_t *prop_blacklist[] = { + L"Body", + L"HTMLBody", + L"To", /* Somehow this is done when a mail is opened */ + L"CC", /* Ditto */ + L"BCC", /* Ditto */ L"Categories", - L"FlagRequest", - L"TaskCompletedDate", - L"FlagStatus", NULL }; - typedef enum { AfterWrite = 0xFC8D, @@ -125,6 +126,8 @@ request_close (LPVOID arg) return 0; } +static bool propchangeWarnShown = false; + /* The main Invoke function. The return value of this function does not appear to have any effect on outlook although I have read in an example somewhere that you @@ -221,11 +224,9 @@ EVENT_SINK_INVOKE(MailItemEvents) } break; } -#if 0 case PropertyChange: { - wchar_t *prop_name; - const wchar_t **cur; + const wchar_t *prop_name; if (!m_mail->is_crypto_mail ()) { break; @@ -238,22 +239,70 @@ EVENT_SINK_INVOKE(MailItemEvents) SRCNAME, __func__); break; } - prop_name = parms->rgvarg[0].bstrVal; - - for (cur = save_props; *cur; cur++) + for (const wchar_t **cur = prop_blacklist; *cur; cur++) { if (!wcscmp (prop_name, *cur)) { - m_mail->set_needs_save (true); - break; + log_oom ("%s:%s: Message %p propchange: %ls discarded.", + SRCNAME, __func__, m_object, prop_name); + return S_OK; } } log_oom ("%s:%s: Message %p propchange: %ls.", SRCNAME, __func__, m_object, prop_name); + + /* We have tried several scenarios to handle propery changes. + Only save the property in MAPI and call MAPI SaveChanges + worked and did not leak plaintext but this caused outlook + still to break the attachments of PGP/MIME Mails into two + attachments and add them as winmail.dat so other clients + are broken. + + Alternatively reverting the mail, saving the property and + then decrypt again also worked a bit but there were some + weird side effects and breakages. But this has the usual + problem of a revert that the mail is created by outlook and + e.g. multipart/signed signatures from most MUA's are broken. + + Close -> discard changes -> then setting the property and + then saving also works but then the mail is closed / unloaded + and we can't decrypt again. + + Some things to try out might be the close approach and then + another open or a selection change. But for now we just warn. + + As a workardound a user should make property changes when + the mail was not read by us. */ + if (propchangeWarnShown) + { + return S_OK; + } + + wchar_t *title = utf8_to_wchar (_("Sorry, that's not possible, yet")); + char *fmt; + gpgrt_asprintf (&fmt, _("GpgOL has prevented the change to the \"%s\" property.\n" + "Property changes are not yet handled for crypto messages.\n\n" + "To workaround this limitation please change the property when the" + "message is not open in any window and not selected in the" + "messagelist.\n\nFor example by right clicking but not selecting the message.\n"), + wchar_to_utf8(prop_name)); + wchar_t *msg = utf8_to_wchar (fmt); + xfree (fmt); + MessageBoxW (get_active_hwnd(), msg, title, + MB_ICONINFORMATION | MB_OK); + xfree (msg); + xfree (title); + propchangeWarnShown = true; return S_OK; } -#endif + case CustomPropertyChange: + { + log_oom_extra ("%s:%s: CustomPropertyChange : %p", + SRCNAME, __func__, m_mail); + /* TODO */ + break; + } case Send: { /* This is the only event where we can cancel the send of an @@ -386,8 +435,8 @@ EVENT_SINK_INVOKE(MailItemEvents) break; } *(parms->rgvarg[0].pboolVal) = VARIANT_TRUE; - log_oom ("%s:%s: Canceling close event.", - SRCNAME, __func__); + log_oom_extra ("%s:%s: Canceling close event.", + SRCNAME, __func__); m_decrypt_after_write = true; m_ignore_unloads = false; m_ignore_next_unload = true; commit 957f2441efb15e4a51342ff3f73a86bec4dabee7 Author: Andre Heinecke Date: Fri Nov 11 16:00:34 2016 +0100 Add helper method to get active window handle * src/oomhelp.cpp, src/oomhelp.h (get_active_hwnd): New get the handle of the active window. diff --git a/src/oomhelp.cpp b/src/oomhelp.cpp index bb8df36..1b23d75 100644 --- a/src/oomhelp.cpp +++ b/src/oomhelp.cpp @@ -1652,3 +1652,40 @@ get_unique_id (LPDISPATCH mail, int create, const char *uuid) SRCNAME, __func__, mail, newuid); return newuid; } + +HWND +get_active_hwnd () +{ + LPDISPATCH app = GpgolAddin::get_instance ()->get_application (); + + if (!app) + { + TRACEPOINT; + return nullptr; + } + + LPDISPATCH activeWindow = get_oom_object (app, "ActiveWindow"); + gpgol_release (app); + + if (!activeWindow) + { + TRACEPOINT; + return nullptr; + } + + /* Both explorer and inspector have this. */ + char *caption = get_oom_string (activeWindow, "Caption"); + gpgol_release (activeWindow); + if (!caption) + { + TRACEPOINT; + return nullptr; + } + /* Might not be completly true for multiple explorers + on the same folder but good enugh. */ + HWND hwnd = FindWindowExA(NULL, NULL, "rctrl_renwnd32", + caption); + xfree (caption); + + return hwnd; +} diff --git a/src/oomhelp.h b/src/oomhelp.h index 35991ce..1c6aa94 100644 --- a/src/oomhelp.h +++ b/src/oomhelp.h @@ -302,6 +302,11 @@ remove_category (LPDISPATCH mail, const char *category); char * get_unique_id (LPDISPATCH mail, int create, const char* uuid); + +/* Uses the Application->ActiveWindow to determine the hwnd + through FindWindow and the caption. Does not use IOleWindow + because that was unreliable somhow. */ +HWND get_active_hwnd (void); #ifdef __cplusplus } #endif ----------------------------------------------------------------------- Summary of changes: src/mailitem-events.cpp | 81 +++++++++++++++++++++++++++++++++++++++---------- src/oomhelp.cpp | 37 ++++++++++++++++++++++ src/oomhelp.h | 5 +++ 3 files changed, 107 insertions(+), 16 deletions(-) hooks/post-receive -- GnuPG extension for MS Outlook http://git.gnupg.org From cvs at cvs.gnupg.org Fri Nov 11 16:02:58 2016 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Fri, 11 Nov 2016 16:02:58 +0100 Subject: [git] GpgOL - branch, master, updated. gpgol-1.4.0-156-ga8891e3 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG extension for MS Outlook". The branch, master has been updated via a8891e3a6ef1cb32842f203656ada790d7581957 (commit) via 957f2441efb15e4a51342ff3f73a86bec4dabee7 (commit) via 49b9fd0697088a25c260e4acd14be96252fe3988 (commit) via d16f3075cfa8db3a162c996035a21680386d69a1 (commit) via 574ff72396de2ab6e71d6f078e3caa56c623c13a (commit) via d77e4135ecc23f3dd9390b5650ed5d926fdcecec (commit) via d7192df3f3fa1543326acef17cd344d3412cce25 (commit) via 6e085dd895b2ae922a320a8c0501e59de68642a4 (commit) via ea6f44cc0508db178a986874525d170105d95678 (commit) via 22ea51b3672f68ffde6923c0720e4bf36f66f712 (commit) via fd27fa2fc04ba2172e4007b472d000153286b311 (commit) via 7ba4f6e43ffc999945f7c9298b44572d237723e4 (commit) via b6b1b43ca1f29bf3afebd53d8afb0b3d7b3e7f4d (commit) via 2d411103d6ce9ff3b69353a095ac862c15312783 (commit) via 68835bfc6096603361038b985e9a93a9b42eb850 (commit) via 7c002f5b713786022964df6eae09f6dd06ddb0e0 (commit) via c21454e49cff01b0200f02c58812a696f7127050 (commit) via aadd8026eca38983fa14e1045400e8e9c0f50508 (commit) via 765e04b5e0fb6ce3ebcf2374a6e09dc8e3005ca9 (commit) via b41e5bcfaeab4964c0609d755177f31ecb5e458c (commit) via 24e1932dc7c974ce18f8171a9e8c16bdc1a359a5 (commit) via ada53e40e5c3907e8ae9539bd3212b57b48aba43 (commit) via 51e12dd2dddcdf91031b4f7eee0cfafbbd5a68ef (commit) via 86b7dcc999038425993dd0ed6b45df50d20a6831 (commit) via 4f2b76c0e1d4bb84e477dbf3fea1f6d23873e3de (commit) via 9a2ef44b0e36537cb91a35a107809a80f46bf499 (commit) via 80e972f8b4260c619c9eaea8c1762917a20c7a33 (commit) via 920a9c0d1a29a3d73b902d15ff6bd061ae414052 (commit) via 1d734d5938224e02236245223cf925a61563e2fc (commit) via 0431a7025858e1a52f681ae3f2d5e38c00dea26e (commit) via a8a71cbbee57cb732f29fc85b88b0c304514b075 (commit) via 43352f377a9ca283428a709a1d6e4d39bee57911 (commit) via 2b1d0ffeb16a4ac4b8e63ed9bef2302e10dd850f (commit) via 5579c4b4f4edf53c00078d3ac671386ac65492c5 (commit) via 7c189012f464ac448583f8921649a943ebc6cd15 (commit) via 2b376a48241aaef927ab1ffd6e7d213480d6751e (commit) via 2ff3d5e90c146c4056ab9b2c38c0157caa92b7ff (commit) via 09284b0ab35a701c078147c2f6c2fb017c96cbfb (commit) via a20666844db52b53ea082934a304e7e90f687acc (commit) via d90adfc3d5e7b8aed8040f483a91914771ba2429 (commit) via 318ba6646a5564fdbde2eec027b84f2b3825d6bb (commit) via 1c0f6b6ac6281c13bd004ba4118aa88a12c50dc2 (commit) via cb089330c44f37412a47501660b09d09cc382c45 (commit) via e1420cc2a8f0bb8c45c8253212fcc32475531f41 (commit) via 71b06f0662a24f66381d349d8ee8da93a33f500b (commit) via b8e39830594d87a41056e7d9dd8dff2ff4904aac (commit) via a4cb385ee539570d6a5d67a9c7651173905be0c3 (commit) via 525680f952ed3f2e361c8582f5df3a12f07defb8 (commit) via ed7b79ff86d7c0a3cc1ecac2fc304fe098f29cfb (commit) via 256f0265bcf8b09e76ad7fcfe348083db26a0965 (commit) via d089674c175e3342d44cad8cf6a1c5725b1af641 (commit) via 6665230511a34cdef88417f73b849c0d396f7309 (commit) via 906d853b7194413ac1ed40f351dc61a61d38dea3 (commit) via 50baf81a7eae15ca0d52d4dc4bfa2db70b39e1b7 (commit) via ef3ce7817e907ee472ef93dba0a94f43e9cb81e8 (commit) via 9f9fa94c5d094a9f0e1f50df67db72971540ea87 (commit) via 2504182ba54075776645838354a91f07b1f5c585 (commit) via c0ee14685f1f42c5c4e60bc616fc8f188cbd7ac6 (commit) via 1a962ea6f281eecf98b3bf1b410831ae7eb5d255 (commit) via 9f5274d8f75f27bcbc803ea606c4548d32144dcb (commit) via cdf5d93e22ad19730a7bd31c3b751f8738b87bd4 (commit) via 20dace4ab5dd5e3e0590929698767327d8e5db70 (commit) via bdc38c2c812fc4806927d3a574bea55c568a90a6 (commit) via 376084db0aa59c44a2ccc4e0f7878033fd76d2a6 (commit) via 51f5a2d9628c60ac490fbd5ee0c1511179ec74a0 (commit) via 608ba6ac6170ff0e2bc8884a5a234d8775c1beb0 (commit) via 5c7b1ba75cb929b9caa9b1805215eaf1768efc66 (commit) via 95012778c925908aff80a4df2705d32549de53fc (commit) via cbfe240a04e9ca530c7ba6050616a099f946f522 (commit) via 13f607ec249e7b923b15af0aa6b1eaba73ba1d75 (commit) via 015d515c6b591e73f54c275fe4e664b7a49e605e (commit) via 0499861a0dda3fd159d93e3638550e7fcd768501 (commit) via 04be440d4d1aad06a6d6f2f9f91a56b4be53d2eb (commit) via d299d6357ed98e31914bfc3cfe09f681b3deb73a (commit) via d3a2f213e0fd0ac0771d57d7af474332b81c63f9 (commit) via cf5689b2cd8226a440e8dbc8b17e226186e52781 (commit) via 6cb1c3fd4f31fa90a1cc003a4ae162c89614add4 (commit) via fb3c90c8852edf41ac97ef3e821228dc4a54bafe (commit) via 4d3b317569e3637692f7f925064cccf31d6671f9 (commit) via b4708d27c6a03dbcfb9eb5a29be15fff159be662 (commit) via 06369d42f7a4b486dd1023824d7584709d337f2a (commit) via 7bfc018dc713996e48c6db60cd78ce6490712720 (commit) via f8073ceb48e0dc0248165127dd731840d6a7b3b9 (commit) via d9d6454e9e8ac31c68e0dddcba14198e267ef686 (commit) via 30db9ee468bee6921c94c64033299eb84c6ab9da (commit) via 2eb057e3a033b34a20fd3c03115ece6938f75b0a (commit) via 1966b2b09940aa60f9f96553ef18860d4781d630 (commit) via ce29969cced4f9bd78061c27ed3b97e66ba9dc60 (commit) via a2240672cf62c7caea7b4d442f83d36b6c122ee7 (commit) via c50e22b8d996be374905e977deaaaacce040b15c (commit) via 9c4c7cdebd018a2e4bcb4fb519ba06cc0c6550ed (commit) via f0b818676f11d0c7395f6cf11a24e6a6ad6940a5 (commit) via 037b2aa3cba5d354586c1c7d311e86775ebb341e (commit) via e482433121af2301ca34d5a9f45bae7378ae2464 (commit) via e0cd79c6ef2afd91e3594cb1d8fc8e662f03c5b1 (commit) via ef8ea4a537110d49503a4ceb2bb6d7214c7b2594 (commit) via a03012210f54663f276f9e043363c3dd6f9e41bf (commit) via 6138fb13820c312bb94664241d06f64359a9d650 (commit) via dbf10ad74b3ba1bd3955e4c1ef3fae57b3fee3af (commit) via 3600d2b2e9193458e47d3849dcd2df58429aed05 (commit) via 88bf7d19654ba1e0726fcbdc19e99e5704e75182 (commit) via 1ae8bc5317557369a68d7270104b2e03bb4dd263 (commit) via 38131c6136d95989c018e26305e77e55fb5626a0 (commit) via 7e1688e578bb724a5d2a647bf95bebc1e314262d (commit) via 5d47b7be70199f6c40040b38ac90529808a0d2ed (commit) via 5dd67199e2e9d4aaf8edc6def1e11da0f79ea5a4 (commit) via d4f11b756f1811d123759b96815fbd6aac3cb76f (commit) via 57ab9c118291ba25af0db667f33de59314d98637 (commit) via 27a18489402923163fd2358f1bd24dbf9b227c76 (commit) via 0b12e8baa959b72450dec98339cbe9f8c4fa4730 (commit) via f0aacc3bfb2b89ddc86188c577111e511197c228 (commit) via b84b06533884150e68d6846bde8e57c97114a041 (commit) via c680a4d6715576df021c869a48c1e74b77273472 (commit) via 03353e62d35b54051198f1ef2f076c2fdbdf3136 (commit) via 0059fed320744657ab758b6b87b53c2121f6ec6c (commit) via 66ff2a0a37f61da5561a12926ea4846025c00686 (commit) via 1c75086691a62c79c95a142acf61cd84724876c7 (commit) via 487288bf5fe607949913a90d582bc9407d25a0f1 (commit) via 4e54e266a582cddbcfd3b88c65822913cbc9d0ce (commit) via a4a113aed3dda2525181796ef4bc5765db0a5391 (commit) via e4ea280498f406a24973d16917a94dea1ff18d06 (commit) via baa0515e7fb4b4ec2ee000afd69096156bc86d9f (commit) via 28116b887c2ae7a3f3e12b6dd372fdd5ba341646 (commit) via b0dc069e851a60c3d21ac4ce377cfc5bfc6f48d9 (commit) via 17cba4015346d91b5621ac9ce01de1fbe9fd41ed (commit) via 3f17fcf8e1b78e26b60a35b76edd90c7fb29c493 (commit) via 189df5c7393e105bb3102879fd0c83f978e31c7a (commit) via 856584d19be40206645f0da0f772bb2c47a5d310 (commit) via 9ad22d62a4b7d730d790cda1dd20854bdc3373f9 (commit) via ea18ca66c257d9bdc1b8abf7e7066cca77d87aee (commit) via 465341884bf2f37f39f22473dc189c6430166a65 (commit) via 6e056e6add2ace99a3128f87504d08b5bb942c99 (commit) via 0bc8549af4dac98b4f13a6889474c2c224a788bd (commit) via 3985969e5557b472f74ac4cd7e247aeeb555b1fe (commit) via 4229a56e2e3b1018cafec9a833eb36d948041f51 (commit) via 553db6ba3cfaca7275669abbc5024037363630be (commit) via 7f9f7bf99de356d794df06852bc12faf9c6e99ba (commit) via 3b27162dcb06c99aa62ab12403312854871e2214 (commit) via 87d57374bbe502b121d68874e9e807e89a20f358 (commit) via c1398da89a56f4c2cad743af8eb687d33e7f3246 (commit) via 2bdf9f9b3afabfe5ce039ba61b72cfcd20ef2da8 (commit) via 78b87db761b72e8c7f9fad3f0c8ba1f44de71bb9 (commit) via edb74e9f77e294d0aa9f29d8daf89d7149cfada6 (commit) via 7e5e8e0ebc5e880beafb39d59319fbabb0241c11 (commit) via 5c8b946a694b9e856c5513a8c3f275272d9b445f (commit) via 268212abb5f0403cc03f1127f2014cef780450ff (commit) from 2b7009cb713145d858be3f7ec418799f447054aa (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: .gitattributes | 2 + COPYING-ICONS | 213 ++++ Makefile.am | 5 +- README | 15 +- configure.ac | 29 +- forms/Makefile.am | 9 +- forms/encr-s.ico | Bin 2238 -> 2238 bytes forms/encr-s.xcf | Bin 0 -> 1588 bytes forms/{gpgol-cs_en.cfg => gpgol-cs.cfg} | 1 - forms/{gpgol_de.cfg => gpgol-form-encrypted.cfg} | 8 +- forms/{gpgol-cs_de.cfg => gpgol-form-signed.cfg} | 7 +- forms/{gpgol-ms_en.cfg => gpgol-ms.cfg} | 1 - forms/gpgol-ms_de.cfg | 35 - forms/{gpgol_en.cfg => gpgol.cfg} | 2 - forms/ribbon.xcf | Bin 0 -> 1488 bytes forms/sign-s.ico | Bin 2238 -> 2238 bytes m4/gpgme.m4 | 25 + src/Makefile.am | 46 +- src/addin-options.cpp | 20 + src/application-events.cpp | 5 + src/attachment.cpp | 316 +---- src/attachment.h | 46 +- src/common.c | 554 ++------- src/common.h | 213 +--- src/common_indep.c | 765 ++++++++++++ src/common_indep.h | 400 +++++++ src/dialogs.h | 6 + src/dialogs.rc | 67 +- src/engine-assuan.c | 74 -- src/eventsinks.h | 4 + src/explorer-events.cpp | 116 ++ src/explorers-events.cpp | 75 ++ src/gpgoladdin.cpp | 231 +++- src/gpgoladdin.h | 3 +- src/gpgolstr.cpp | 2 +- src/icons/Makefile.am | 29 + src/{ => icons}/README.icons | 22 +- src/{ => icons}/decrypt-16.bmp | Bin src/{ => icons}/decrypt-16.png | Bin src/{ => icons}/decrypt-16m.bmp | Bin src/{ => icons}/decrypt-48.png | Bin src/{ => icons}/decrypt-verify-16.bmp | Bin src/{ => icons}/decrypt-verify-16m.bmp | Bin src/icons/emblem-information-64.png | Bin 0 -> 1266 bytes src/icons/emblem-information.svg | 21 + src/icons/emblem-question-64.png | Bin 0 -> 1518 bytes src/icons/emblem-question.svg | 10 + src/icons/emblem-success-64.png | Bin 0 -> 1462 bytes src/icons/emblem-success.svg | 18 + src/icons/emblem-warning-64.png | Bin 0 -> 1117 bytes src/icons/emblem-warning.svg | 18 + src/{ => icons}/encrypt-16.bmp | Bin src/{ => icons}/encrypt-16.png | Bin src/{ => icons}/encrypt-16m.bmp | Bin src/{ => icons}/encrypt-48.png | Bin src/{ => icons}/encrypt-sign-file-48.png | Bin src/{ => icons}/key-manager-16.bmp | Bin src/{ => icons}/key-manager-16m.bmp | Bin src/{ => icons}/key-manager-64.png | Bin src/{ => icons}/kleopatra.bmp | Bin src/{ => icons}/sign-16.bmp | Bin src/{ => icons}/sign-16m.bmp | Bin src/{ => icons}/sign-48.png | Bin src/{ => icons}/verify-16.bmp | Bin src/{ => icons}/verify-16m.bmp | Bin src/{ => icons}/verify-48.png | Bin src/mail.cpp | 1254 ++++++++++++++++++-- src/mail.h | 153 ++- src/mailitem-events.cpp | 307 +++-- src/main.c | 317 +---- src/mapihelp.cpp | 333 +++++- src/mapihelp.h | 73 +- src/message.cpp | 151 +-- src/message.h | 8 +- src/mimedataprovider.cpp | 918 ++++++++++++++ src/mimedataprovider.h | 154 +++ src/{mimemaker.c => mimemaker.cpp} | 93 +- src/mimemaker.h | 8 +- src/mlang-charset.cpp | 8 +- src/mlang-charset.h | 4 +- src/msgcache.c | 2 +- src/mymapi.h | 31 + src/olflange-dlgs.cpp | 2 +- src/olflange.cpp | 33 +- src/oomhelp.cpp | 468 +++++++- src/oomhelp.h | 98 +- src/parsecontroller.cpp | 379 ++++++ src/parsecontroller.h | 105 ++ src/revert.cpp | 20 +- src/rfc2047parse.c | 27 +- src/rfc2047parse.h | 13 + src/ribbon-callbacks.cpp | 259 +++- src/ribbon-callbacks.h | 22 +- src/util.h | 197 --- src/windowmessages.cpp | 204 +++- src/windowmessages.h | 18 +- tests/Makefile.am | 44 + tests/data/inlinepgpencrypted.mbox | 28 + tests/data/inlinepgpencrypted.plain | 1 + tests/data/openpgp-encrypted+signed.mbox | 46 + tests/data/openpgp-encrypted+signed.plain | 1 + tests/data/openpgp-encrypted-attachment-gpgol.mbox | 42 + .../data/openpgp-encrypted-attachment-gpgol.plain | 8 + .../openpgp-encrypted-attachment-no-headers.mbox | 32 + tests/data/openpgp-encrypted-attachment.mbox | 57 + tests/data/openpgp-encrypted-attachment.plain | 1 + tests/data/openpgp-encrypted.mbox | 36 + tests/data/openpgp-encrypted.plain | 1 + tests/data/openpgp-signed-no-attach-gpgol.mbox | 32 + tests/data/openpgp-signed-no-attach-gpgol.plain | 5 + tests/data/openpgp-signed-no-attach.mbox | 41 + tests/data/openpgp-signed-no-attach.plain | 5 + tests/data/openpgp-signed-two-attachments.mbox | 54 + tests/data/openpgp-signed-two-attachments.plain | 1 + tests/data/smime-encrypted.mbox | 22 + tests/data/smime-encrypted.plain | 1 + tests/data/smime-opaque-sign.mbox | 25 + tests/data/smime-opaque-sign.plain | 1 + .../smime-opaque-signed-encrypted-attachment.mbox | 50 + .../smime-opaque-signed-encrypted-attachment.plain | 1 + tests/gnupg_home/.gpg-v21-migrated | 0 tests/gnupg_home/dirmngr-cache.d/DIR.txt | 3 + ...crl-4E31CEB57DDD4A7B9991AB05507B1ED4293FF952.db | Bin 0 -> 2130 bytes ...crl-7F2A402CBB016A9146D613568C89D3596A4111AA.db | Bin 0 -> 2048 bytes tests/gnupg_home/dirmngr.conf | 8 + tests/gnupg_home/gpg-agent.conf | 3 + tests/gnupg_home/gpg.conf | 244 ++++ tests/gnupg_home/gpgsm.conf | 3 + tests/gnupg_home/pinentry-fake.sh | 9 + .../01A7EA42DB00E28D85BB27378D7A47829B63FDB6.key | Bin 0 -> 797 bytes .../1AA8BA52430E51AE249AF0DA97D59F869E4101A8.key | Bin 0 -> 528 bytes .../3BD9080DE9C88A88A67965B8E49F677004D6F6B7.key | Bin 0 -> 797 bytes .../53F70182AE3A9CFDDA3DA5B3A1742B875F43524B.key | Bin 0 -> 1377 bytes .../61A7BB3E7F89151CFB8B18AC27668585CE77A7A7.key | Bin 0 -> 797 bytes .../B8E914E1B03F0238FF0A999E69DE8C8D1FDFFFCD.key | Bin 0 -> 798 bytes .../EC06D8C339EF73304D5B2CCF5363B437E0C915F2.key | Bin 0 -> 978 bytes tests/gnupg_home/pubring.gpg | Bin 0 -> 6757 bytes tests/gnupg_home/pubring.kbx | Bin 0 -> 2017 bytes tests/gnupg_home/scdaemon.conf | 8 + tests/gnupg_home/secring.gpg | Bin 0 -> 5163 bytes tests/gnupg_home/trustdb.gpg | Bin 0 -> 1440 bytes tests/gnupg_home/trustlist.txt | 9 + tests/run-parser.cpp | 126 ++ tests/t-parser.cpp | 205 ++++ 144 files changed, 7954 insertions(+), 2271 deletions(-) create mode 100644 .gitattributes create mode 100644 COPYING-ICONS create mode 100644 forms/encr-s.xcf rename forms/{gpgol-cs_en.cfg => gpgol-cs.cfg} (98%) rename forms/{gpgol_de.cfg => gpgol-form-encrypted.cfg} (78%) rename forms/{gpgol-cs_de.cfg => gpgol-form-signed.cfg} (78%) rename forms/{gpgol-ms_en.cfg => gpgol-ms.cfg} (98%) delete mode 100644 forms/gpgol-ms_de.cfg rename forms/{gpgol_en.cfg => gpgol.cfg} (97%) create mode 100644 forms/ribbon.xcf create mode 100644 src/common_indep.c create mode 100644 src/common_indep.h create mode 100644 src/explorer-events.cpp create mode 100644 src/explorers-events.cpp create mode 100644 src/icons/Makefile.am rename src/{ => icons}/README.icons (91%) rename src/{ => icons}/decrypt-16.bmp (100%) rename src/{ => icons}/decrypt-16.png (100%) rename src/{ => icons}/decrypt-16m.bmp (100%) rename src/{ => icons}/decrypt-48.png (100%) rename src/{ => icons}/decrypt-verify-16.bmp (100%) rename src/{ => icons}/decrypt-verify-16m.bmp (100%) create mode 100644 src/icons/emblem-information-64.png create mode 100644 src/icons/emblem-information.svg create mode 100644 src/icons/emblem-question-64.png create mode 100644 src/icons/emblem-question.svg create mode 100644 src/icons/emblem-success-64.png create mode 100644 src/icons/emblem-success.svg create mode 100644 src/icons/emblem-warning-64.png create mode 100644 src/icons/emblem-warning.svg rename src/{ => icons}/encrypt-16.bmp (100%) rename src/{ => icons}/encrypt-16.png (100%) rename src/{ => icons}/encrypt-16m.bmp (100%) rename src/{ => icons}/encrypt-48.png (100%) rename src/{ => icons}/encrypt-sign-file-48.png (100%) rename src/{ => icons}/key-manager-16.bmp (100%) rename src/{ => icons}/key-manager-16m.bmp (100%) rename src/{ => icons}/key-manager-64.png (100%) rename src/{ => icons}/kleopatra.bmp (100%) rename src/{ => icons}/sign-16.bmp (100%) rename src/{ => icons}/sign-16m.bmp (100%) rename src/{ => icons}/sign-48.png (100%) rename src/{ => icons}/verify-16.bmp (100%) rename src/{ => icons}/verify-16m.bmp (100%) rename src/{ => icons}/verify-48.png (100%) create mode 100644 src/mimedataprovider.cpp create mode 100644 src/mimedataprovider.h rename src/{mimemaker.c => mimemaker.cpp} (96%) create mode 100644 src/parsecontroller.cpp create mode 100644 src/parsecontroller.h delete mode 100644 src/util.h create mode 100644 tests/Makefile.am create mode 100644 tests/data/inlinepgpencrypted.mbox create mode 100644 tests/data/inlinepgpencrypted.plain create mode 100644 tests/data/openpgp-encrypted+signed.mbox create mode 100644 tests/data/openpgp-encrypted+signed.plain create mode 100644 tests/data/openpgp-encrypted-attachment-gpgol.mbox create mode 100644 tests/data/openpgp-encrypted-attachment-gpgol.plain create mode 100644 tests/data/openpgp-encrypted-attachment-no-headers.mbox create mode 100644 tests/data/openpgp-encrypted-attachment.mbox create mode 100644 tests/data/openpgp-encrypted-attachment.plain create mode 100644 tests/data/openpgp-encrypted.mbox create mode 100644 tests/data/openpgp-encrypted.plain create mode 100644 tests/data/openpgp-signed-no-attach-gpgol.mbox create mode 100644 tests/data/openpgp-signed-no-attach-gpgol.plain create mode 100644 tests/data/openpgp-signed-no-attach.mbox create mode 100644 tests/data/openpgp-signed-no-attach.plain create mode 100644 tests/data/openpgp-signed-two-attachments.mbox create mode 100644 tests/data/openpgp-signed-two-attachments.plain create mode 100644 tests/data/smime-encrypted.mbox create mode 100644 tests/data/smime-encrypted.plain create mode 100644 tests/data/smime-opaque-sign.mbox create mode 100644 tests/data/smime-opaque-sign.plain create mode 100644 tests/data/smime-opaque-signed-encrypted-attachment.mbox create mode 100644 tests/data/smime-opaque-signed-encrypted-attachment.plain create mode 100644 tests/gnupg_home/.gpg-v21-migrated create mode 100644 tests/gnupg_home/dirmngr-cache.d/DIR.txt create mode 100644 tests/gnupg_home/dirmngr-cache.d/crl-4E31CEB57DDD4A7B9991AB05507B1ED4293FF952.db create mode 100644 tests/gnupg_home/dirmngr-cache.d/crl-7F2A402CBB016A9146D613568C89D3596A4111AA.db create mode 100644 tests/gnupg_home/dirmngr.conf create mode 100644 tests/gnupg_home/gpg-agent.conf create mode 100644 tests/gnupg_home/gpg.conf create mode 100644 tests/gnupg_home/gpgsm.conf create mode 100755 tests/gnupg_home/pinentry-fake.sh create mode 100644 tests/gnupg_home/private-keys-v1.d/01A7EA42DB00E28D85BB27378D7A47829B63FDB6.key create mode 100644 tests/gnupg_home/private-keys-v1.d/1AA8BA52430E51AE249AF0DA97D59F869E4101A8.key create mode 100644 tests/gnupg_home/private-keys-v1.d/3BD9080DE9C88A88A67965B8E49F677004D6F6B7.key create mode 100644 tests/gnupg_home/private-keys-v1.d/53F70182AE3A9CFDDA3DA5B3A1742B875F43524B.key create mode 100644 tests/gnupg_home/private-keys-v1.d/61A7BB3E7F89151CFB8B18AC27668585CE77A7A7.key create mode 100644 tests/gnupg_home/private-keys-v1.d/B8E914E1B03F0238FF0A999E69DE8C8D1FDFFFCD.key create mode 100644 tests/gnupg_home/private-keys-v1.d/EC06D8C339EF73304D5B2CCF5363B437E0C915F2.key create mode 100644 tests/gnupg_home/pubring.gpg create mode 100644 tests/gnupg_home/pubring.kbx create mode 100644 tests/gnupg_home/scdaemon.conf create mode 100644 tests/gnupg_home/secring.gpg create mode 100644 tests/gnupg_home/trustdb.gpg create mode 100644 tests/gnupg_home/trustlist.txt create mode 100644 tests/run-parser.cpp create mode 100644 tests/t-parser.cpp hooks/post-receive -- GnuPG extension for MS Outlook http://git.gnupg.org From cvs at cvs.gnupg.org Fri Nov 11 16:51:47 2016 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Fri, 11 Nov 2016 16:51:47 +0100 Subject: [git] GpgOL - branch, master, updated. gpgol-1.4.0-157-gbdadab4 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG extension for MS Outlook". The branch, master has been updated via bdadab4da361860fbc1176cfb41dd7561bf50f84 (commit) from a8891e3a6ef1cb32842f203656ada790d7581957 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit bdadab4da361860fbc1176cfb41dd7561bf50f84 Author: Andre Heinecke Date: Fri Nov 11 16:51:13 2016 +0100 Add automake test-driver * build-aux/test-driver: New. From debian jessie. -- Automake told me to do this. diff --git a/build-aux/test-driver b/build-aux/test-driver new file mode 100755 index 0000000..d306056 --- /dev/null +++ b/build-aux/test-driver @@ -0,0 +1,139 @@ +#! /bin/sh +# test-driver - basic testsuite driver script. + +scriptversion=2013-07-13.22; # UTC + +# Copyright (C) 2011-2013 Free Software Foundation, Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# This file is maintained in Automake, please report +# bugs to or send patches to +# . + +# Make unconditional expansion of undefined variables an error. This +# helps a lot in preventing typo-related bugs. +set -u + +usage_error () +{ + echo "$0: $*" >&2 + print_usage >&2 + exit 2 +} + +print_usage () +{ + cat <$log_file 2>&1 +estatus=$? +if test $enable_hard_errors = no && test $estatus -eq 99; then + estatus=1 +fi + +case $estatus:$expect_failure in + 0:yes) col=$red res=XPASS recheck=yes gcopy=yes;; + 0:*) col=$grn res=PASS recheck=no gcopy=no;; + 77:*) col=$blu res=SKIP recheck=no gcopy=yes;; + 99:*) col=$mgn res=ERROR recheck=yes gcopy=yes;; + *:yes) col=$lgn res=XFAIL recheck=no gcopy=yes;; + *:*) col=$red res=FAIL recheck=yes gcopy=yes;; +esac + +# Report outcome to console. +echo "${col}${res}${std}: $test_name" + +# Register the test result, and other relevant metadata. +echo ":test-result: $res" > $trs_file +echo ":global-test-result: $res" >> $trs_file +echo ":recheck: $recheck" >> $trs_file +echo ":copy-in-global-log: $gcopy" >> $trs_file + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: ----------------------------------------------------------------------- Summary of changes: build-aux/test-driver | 139 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 139 insertions(+) create mode 100755 build-aux/test-driver hooks/post-receive -- GnuPG extension for MS Outlook http://git.gnupg.org From cvs at cvs.gnupg.org Fri Nov 11 17:00:31 2016 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Fri, 11 Nov 2016 17:00:31 +0100 Subject: [git] GPG-ERROR - branch, master, updated. libgpg-error-1.24-11-gb1ccab5 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Error codes used by GnuPG et al.". The branch, master has been updated via b1ccab5bf8e1206aae1307ad5d23890be4251c8f (commit) from bae57a21cfab25ad11c82dc6e69d82d1f2f7a415 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit b1ccab5bf8e1206aae1307ad5d23890be4251c8f Author: Andre Heinecke Date: Fri Nov 11 16:54:55 2016 +0100 w32: Fix lock c++ narrowing conversion warning * src/syscfg/lock-obj-pub.mingw32.h (gpgrt_lock_t): Declare priv as unsigned char. -- This fixes error: narrowing conversion of ?255? from ?int? to ?volatile char? inside { } [-Werror=narrowing] diff --git a/src/syscfg/lock-obj-pub.mingw32.h b/src/syscfg/lock-obj-pub.mingw32.h index d6623cc..f35aee1 100644 --- a/src/syscfg/lock-obj-pub.mingw32.h +++ b/src/syscfg/lock-obj-pub.mingw32.h @@ -20,7 +20,7 @@ #pragma pack(push, 8) typedef struct { - volatile char priv[56]; + volatile unsigned char priv[56]; } gpgrt_lock_t; #pragma pack(pop) @@ -34,7 +34,7 @@ typedef struct #pragma pack(push, 8) typedef struct { - volatile char priv[36]; + volatile unsigned char priv[36]; } gpgrt_lock_t; #pragma pack(pop) ----------------------------------------------------------------------- Summary of changes: src/syscfg/lock-obj-pub.mingw32.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) hooks/post-receive -- Error codes used by GnuPG et al. http://git.gnupg.org From cvs at cvs.gnupg.org Fri Nov 11 17:32:34 2016 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Fri, 11 Nov 2016 17:32:34 +0100 Subject: [git] GpgOL - branch, master, updated. gpgol-1.4.0-158-g2d8b5a6 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG extension for MS Outlook". The branch, master has been updated via 2d8b5a6152756104ed96c8002688873397642db3 (commit) from bdadab4da361860fbc1176cfb41dd7561bf50f84 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 2d8b5a6152756104ed96c8002688873397642db3 Author: Andre Heinecke Date: Fri Nov 11 17:23:13 2016 +0100 Use _WIN64 instead of WIN64 to detect arch * common_indep.h, config-dialog.c, olflange-dlgs.cpp: Use _WIN64 instead of WIN64. -- Somehow WIN64 is no longer defined by my mingw like it was before. _WIN64 is more correct. diff --git a/src/common_indep.h b/src/common_indep.h index b1dcb4c..ec7f026 100644 --- a/src/common_indep.h +++ b/src/common_indep.h @@ -35,12 +35,12 @@ #endif /* The Registry key used by Gpg4win. */ -#ifdef WIN64 +#ifdef _WIN64 # define GPG4WIN_REGKEY_2 "Software\\Wow6432Node\\GNU\\GnuPG" #else # define GPG4WIN_REGKEY_2 "Software\\GNU\\GnuPG" #endif -#ifdef WIN64 +#ifdef _WIN64 # define GPG4WIN_REGKEY_3 "Software\\Wow6432Node\\Gpg4win" #else # define GPG4WIN_REGKEY_3 "Software\\Gpg4win" @@ -378,7 +378,7 @@ _gpgol_stpcpy (char *a, const char *b) #define stpcpy(a,b) _gpgol_stpcpy ((a), (b)) #endif /*!HAVE_STPCPY*/ -#ifdef WIN64 +#ifdef _WIN64 #define SIZE_T_FORMAT "%I64u" #else # ifdef HAVE_W32_SYSTEM diff --git a/src/config-dialog.c b/src/config-dialog.c index 9a5508f..2f46a8f 100644 --- a/src/config-dialog.c +++ b/src/config-dialog.c @@ -180,7 +180,7 @@ config_dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam) void config_dialog_box (HWND parent) { -#ifndef WIN64 +#ifndef _WIN64 int resid; resid = IDD_EXT_OPTIONS; diff --git a/src/olflange-dlgs.cpp b/src/olflange-dlgs.cpp index 0fed8a4..dbd0505 100644 --- a/src/olflange-dlgs.cpp +++ b/src/olflange-dlgs.cpp @@ -279,7 +279,7 @@ GPGOptionsDlgProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) break; } -#ifndef WIN64 +#ifndef _WIN64 /* SetWindowLong is not portable according to msdn it should be replaced by SetWindowLongPtr. But as this here is code for Outlook < 2010 we don't ----------------------------------------------------------------------- Summary of changes: src/common_indep.h | 6 +++--- src/config-dialog.c | 2 +- src/olflange-dlgs.cpp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) hooks/post-receive -- GnuPG extension for MS Outlook http://git.gnupg.org From cvs at cvs.gnupg.org Fri Nov 11 17:37:08 2016 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Fri, 11 Nov 2016 17:37:08 +0100 Subject: [git] GpgOL - branch, master, updated. gpgol-1.4.0-159-g74a2915 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG extension for MS Outlook". The branch, master has been updated via 74a291515bcfbf3c679e129d4a46d82e12d95319 (commit) from 2d8b5a6152756104ed96c8002688873397642db3 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 74a291515bcfbf3c679e129d4a46d82e12d95319 Author: Andre Heinecke Date: Fri Nov 11 17:35:55 2016 +0100 Next version will be 2.0.0 * NEWS, configure.ac: Bump version -- This helps beta version numbering. The next version brings major changes. diff --git a/NEWS b/NEWS index 35e9a97..8975aef 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,4 @@ -Noteworthy changes for version 1.4.1 (unreleased) +Noteworthy changes for version 2.0.0 (unreleased) ================================================= diff --git a/configure.ac b/configure.ac index 876977d..4d547de 100644 --- a/configure.ac +++ b/configure.ac @@ -17,7 +17,7 @@ min_automake_version="1.14" # (git tag -s gpgol-k.n.m) and run "./autogen.sh --force". Please # bump the version number immediately *after* the release and do # another commit and push so that the git magic is able to work. -m4_define([mym4_version], [1.4.1]) +m4_define([mym4_version], [2.0.0]) # Below is m4 magic to extract and compute the git revision number, # the decimalized short revision number, a beta version string and a ----------------------------------------------------------------------- Summary of changes: NEWS | 2 +- configure.ac | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) hooks/post-receive -- GnuPG extension for MS Outlook http://git.gnupg.org From cvs at cvs.gnupg.org Fri Nov 11 20:31:43 2016 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Fri, 11 Nov 2016 20:31:43 +0100 Subject: [git] GPG-ERROR - branch, master, updated. libgpg-error-1.24-12-g25d463c Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Error codes used by GnuPG et al.". The branch, master has been updated via 25d463c67821901c8fd6736c815f11e85bbae66f (commit) from b1ccab5bf8e1206aae1307ad5d23890be4251c8f (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 25d463c67821901c8fd6736c815f11e85bbae66f Author: Werner Koch Date: Fri Nov 11 20:26:49 2016 +0100 Use the syscall clamp functions also for lock functions * src/posix-lock.c (pre_lock_func, post_lock_func): New. (_gpgrt_lock_set_lock_clamp): New. (_gpgrt_lock_lock): Use clamp functions. * src/w32-lock.c (pre_lock_func, post_lock_func): New. (_gpgrt_lock_set_lock_clamp): New. (_gpgrt_lock_lock): Use clamp functions. * src/posix-lock.c (pre_syscall_func, post_syscall_func): New. (_gpgrt_thread_set_syscall_clamp): New. (_gpgrt_yield): Use clamp functions. * src/w32-lock.c (pre_syscall_func, post_syscall_func): New. (_gpgrt_thread_set_syscall_clamp): New. (_gpgrt_yield): Use clamp functions. * src/estream.c: Include lock.h and thread.h. (do_deinit): Call _gpgrt_lock_set_lock_clamp. (_gpgrt_set_syscall_clamp): Ditto. Signed-off-by: Werner Koch diff --git a/src/estream.c b/src/estream.c index 95d7211..d0f0ba9 100644 --- a/src/estream.c +++ b/src/estream.c @@ -95,7 +95,8 @@ #include "gpgrt-int.h" #include "estream-printf.h" - +#include "thread.h" +#include "lock.h" #ifndef O_BINARY # define O_BINARY 0 @@ -564,6 +565,8 @@ do_deinit (void) /* Reset the syscall clamp. */ pre_syscall_func = NULL; post_syscall_func = NULL; + _gpgrt_thread_set_syscall_clamp (NULL, NULL); + _gpgrt_lock_set_lock_clamp (NULL, NULL); } @@ -598,6 +601,8 @@ _gpgrt_set_syscall_clamp (void (*pre)(void), void (*post)(void)) { pre_syscall_func = pre; post_syscall_func = post; + _gpgrt_thread_set_syscall_clamp (pre, post); + _gpgrt_lock_set_lock_clamp (pre, post); } diff --git a/src/lock.h b/src/lock.h index a830b36..b7395db 100644 --- a/src/lock.h +++ b/src/lock.h @@ -20,5 +20,7 @@ #ifndef LOCK_H #define LOCK_H +void _gpgrt_lock_set_lock_clamp (void (*pre)(void), void (*post)(void)); + #endif /*LOCK_H*/ diff --git a/src/posix-lock.c b/src/posix-lock.c index 2e0ae92..d251d2f 100644 --- a/src/posix-lock.c +++ b/src/posix-lock.c @@ -44,6 +44,14 @@ #include "posix-lock-obj.h" +/* + * Functions called before and after blocking syscalls. + * gpgrt_set_syscall_clamp is used to set them. + */ +static void (*pre_lock_func)(void); +static void (*post_lock_func)(void); + + #if USE_POSIX_THREADS # if USE_POSIX_THREADS_WEAK /* On ELF systems it is easy to use pthreads using weak @@ -103,6 +111,16 @@ use_pthread_p (void) #endif /*USE_POSIX_THREADS*/ +/* Helper to set the clamp functions. This is called as a helper from + * _gpgrt_set_syscall_clamp to keep the function pointers local. */ +void +_gpgrt_lock_set_lock_clamp (void (*pre)(void), void (*post)(void)) +{ + pre_lock_func = pre; + post_lock_func = post; +} + + static _gpgrt_lock_t * get_lock_object (gpgrt_lock_t *lockhd) @@ -171,9 +189,13 @@ _gpgrt_lock_lock (gpgrt_lock_t *lockhd) #if USE_POSIX_THREADS if (use_pthread_p()) { + if (pre_lock_func) + pre_lock_func (); rc = pthread_mutex_lock (&lock->u.mtx); if (rc) rc = gpg_err_code_from_errno (rc); + if (post_lock_func) + post_lock_func (); } else rc = 0; /* Threads are not used. */ diff --git a/src/posix-thread.c b/src/posix-thread.c index 270dc91..00a43e2 100644 --- a/src/posix-thread.c +++ b/src/posix-thread.c @@ -43,18 +43,44 @@ #include "thread.h" +/* + * Functions called before and after blocking syscalls. + * gpgrt_set_syscall_clamp is used to set them. + */ +static void (*pre_syscall_func)(void); +static void (*post_syscall_func)(void); + + +/* Helper to set the clamp functions. This is called as a helper from + * _gpgrt_set_syscall_clamp to keep the function pointers local. */ +void +_gpgrt_thread_set_syscall_clamp (void (*pre)(void), void (*post)(void)) +{ + pre_syscall_func = pre; + post_syscall_func = post; +} + + gpg_err_code_t _gpgrt_yield (void) { #if USE_POSIX_THREADS # ifdef _POSIX_PRIORITY_SCHEDULING + if (pre_syscall_func) + pre_syscall_func (); sched_yield (); + if (post_syscall_func) + post_syscall_func (); # else return GPG_ERR_NOT_SUPPORTED; # endif #elif USE_SOLARIS_THREADS + if (pre_syscall_func) + pre_syscall_func (); thr_yield (); + if (post_syscall_func) + post_syscall_func (); #else return GPG_ERR_NOT_SUPPORTED; #endif diff --git a/src/thread.h b/src/thread.h index c650a99..f064cce 100644 --- a/src/thread.h +++ b/src/thread.h @@ -20,5 +20,7 @@ #ifndef THREAD_H #define THREAD_H +void _gpgrt_thread_set_syscall_clamp (void (*pre)(void), void (*post)(void)); + #endif /*THREAD_H*/ diff --git a/src/w32-lock.c b/src/w32-lock.c index d1decc9..51b13a1 100644 --- a/src/w32-lock.c +++ b/src/w32-lock.c @@ -37,6 +37,26 @@ #include "w32-lock-obj.h" + +/* + * Functions called before and after blocking syscalls. + * gpgrt_set_syscall_clamp is used to set them. + */ +static void (*pre_lock_func)(void); +static void (*post_lock_func)(void); + + +/* Helper to set the clamp functions. This is called as a helper from + * _gpgrt_set_syscall_clamp to keep the function pointers local. */ +void +_gpgrt_lock_set_lock_clamp (void (*pre)(void), void (*post)(void)) +{ + pre_lock_func = pre; + post_lock_func = post; +} + + + static _gpgrt_lock_t * get_lock_object (gpgrt_lock_t *lockhd) { @@ -101,7 +121,11 @@ _gpgrt_lock_lock (gpgrt_lock_t *lockhd) } } + if (pre_lock_func) + pre_lock_func (); EnterCriticalSection (&lock->csec); + if (post_lock_func) + post_lock_func (); return 0; } diff --git a/src/w32-thread.c b/src/w32-thread.c index 6860075..aef421f 100644 --- a/src/w32-thread.c +++ b/src/w32-thread.c @@ -35,10 +35,32 @@ #include "thread.h" +/* + * Functions called before and after blocking syscalls. + * gpgrt_set_syscall_clamp is used to set them. + */ +static void (*pre_syscall_func)(void); +static void (*post_syscall_func)(void); + + +/* Helper to set the clamp functions. This is called as a helper from + * _gpgrt_set_syscall_clamp to keep the function pointers local. */ +void +_gpgrt_thread_set_syscall_clamp (void (*pre)(void), void (*post)(void)) +{ + pre_syscall_func = pre; + post_syscall_func = post; +} + + gpg_err_code_t _gpgrt_yield (void) { + if (pre_syscall_func) + pre_syscall_func (); Sleep (0); + if (post_syscall_func) + post_syscall_func (); return 0; } ----------------------------------------------------------------------- Summary of changes: src/estream.c | 7 ++++++- src/lock.h | 2 ++ src/posix-lock.c | 22 ++++++++++++++++++++++ src/posix-thread.c | 26 ++++++++++++++++++++++++++ src/thread.h | 2 ++ src/w32-lock.c | 24 ++++++++++++++++++++++++ src/w32-thread.c | 22 ++++++++++++++++++++++ 7 files changed, 104 insertions(+), 1 deletion(-) hooks/post-receive -- Error codes used by GnuPG et al. http://git.gnupg.org From cvs at cvs.gnupg.org Fri Nov 11 20:40:34 2016 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Fri, 11 Nov 2016 20:40:34 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.1.15-357-g4473db1 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via 4473db1ef24031ff4e26c9a9de95dbe898ed2b97 (commit) via 7b04a43c05834b937b32a596f1941e9728add5fa (commit) from 57e95f5413e21cfcb957af2346b292686a5647b7 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 4473db1ef24031ff4e26c9a9de95dbe898ed2b97 Author: Werner Koch Date: Fri Nov 11 20:35:36 2016 +0100 agent: Kludge to mitigate blocking calls in Libgcrypt. * agent/gpg-agent.c (agent_libgcrypt_progress_cb): Sleep for 100ms on "need_entropy". -- During key generation Libgrypt will read from /dev/random which may block. Libgcrypt is not nPth aware and thus the entire process will block. Fortunately there is also a select with a short timeout to run the progress callback. We detect this in gpg-agent and introduce a short delay to give other threads (i.e. connections) an opportunity to run. This alone is not sufficient, an updated Libgpg-error is also required to make the lock functions nPth aware. Signed-off-by: Werner Koch diff --git a/agent/gpg-agent.c b/agent/gpg-agent.c index a3c1aa8..d767879 100644 --- a/agent/gpg-agent.c +++ b/agent/gpg-agent.c @@ -384,9 +384,9 @@ static pid_t parent_pid = (pid_t)(-1); static int active_connections; /* This object is used to dispatch progress messages from Libgcrypt to - * the right thread. Given that we won't have at max a few dozen - * connections at the same time using a linked list is the easiest way - * to handle this. */ + * the right thread. Given that we will have at max only a few dozen + * connections at a time, using a linked list is the easiest way to + * handle this. */ struct progress_dispatch_s { struct progress_dispatch_s *next; @@ -1747,6 +1747,17 @@ agent_libgcrypt_progress_cb (void *data, const char *what, int printchar, break; if (dispatch && dispatch->cb) dispatch->cb (dispatch->ctrl, what, printchar, current, total); + + /* If Libgcrypt tells us that it needs more entropy, we better take + * a nap to give other threads a chance to run. Note that Libgcrypt + * does not know about nPth and thus when it selects and reads from + * /dev/random this will block the process. Maybe we should add a + * function similar to gpgrt_set_syscall_clamp to Libgcrypt or use + * those clamps directly. For now sleeping for 100ms seems to be + * appropriate. */ + if (what && !strcmp (what, "need_entropy")) + npth_usleep (100000); + } commit 7b04a43c05834b937b32a596f1941e9728add5fa Author: Werner Koch Date: Fri Nov 11 17:30:23 2016 +0100 dirmngr: Prepare to trigger jobs by network activity. * dirmngr/http.c (netactivity_cb): New. (http_register_netactivity_cb): New. (notify_netactivity): New. (connect_server): Call that function. * dirmngr/dirmngr.c (main): Call http_register_netactivity_cb. (netactivity_action): New stub handler. Signed-off-by: Werner Koch diff --git a/dirmngr/dirmngr.c b/dirmngr/dirmngr.c index 14189fe..254c543 100644 --- a/dirmngr/dirmngr.c +++ b/dirmngr/dirmngr.c @@ -328,6 +328,7 @@ static void cleanup (void); static ldap_server_t parse_ldapserver_file (const char* filename); #endif /*USE_LDAP*/ static fingerprint_list_t parse_ocsp_signer (const char *string); +static void netactivity_action (void); static void handle_connections (assuan_fd_t listen_fd); /* NPth wrapper function definitions. */ @@ -995,6 +996,7 @@ main (int argc, char **argv) #if USE_LDAP ldap_wrapper_launch_thread (); #endif /*USE_LDAP*/ + http_register_netactivity_cb (netactivity_action); start_command_handler (ASSUAN_INVALID_FD); shutdown_reaper (); } @@ -1032,6 +1034,7 @@ main (int argc, char **argv) #if USE_LDAP ldap_wrapper_launch_thread (); #endif /*USE_LDAP*/ + http_register_netactivity_cb (netactivity_action); handle_connections (3); assuan_sock_close (3); shutdown_reaper (); @@ -1232,6 +1235,7 @@ main (int argc, char **argv) #if USE_LDAP ldap_wrapper_launch_thread (); #endif /*USE_LDAP*/ + http_register_netactivity_cb (netactivity_action); handle_connections (fd); assuan_sock_close (fd); shutdown_reaper (); @@ -1702,6 +1706,16 @@ dirmngr_sighup_action (void) } +/* This function is called if some network activity was done. At this + * point we know the we have a network and we can decide whether to + * run scheduled background tasks soon. The function should return + * quickly and only trigger actions for another thread. */ +static void +netactivity_action (void) +{ + log_debug ("network activity seen\n"); +} + /* The signal handler. */ #ifndef HAVE_W32_SYSTEM diff --git a/dirmngr/http.c b/dirmngr/http.c index 5f5775b..b74a9ef 100644 --- a/dirmngr/http.c +++ b/dirmngr/http.c @@ -261,6 +261,9 @@ static gpg_error_t (*tls_callback) (http_t, http_session_t, int); /* The list of files with trusted CA certificates. */ static strlist_t tls_ca_certlist; +/* The global callback for net activity. */ +static void (*netactivity_cb)(void); + #if defined(HAVE_W32_SYSTEM) && !defined(HTTP_NO_WSASTARTUP) @@ -499,6 +502,25 @@ http_register_tls_ca (const char *fname) } +/* Register a callback which is called every time the HTTP mode has + * made a successful connection to some server. */ +void +http_register_netactivity_cb (void (*cb)(void)) +{ + netactivity_cb = cb; +} + + +/* Call the netactivity callback if any. */ +static void +notify_netactivity (void) +{ + if (netactivity_cb) + netactivity_cb (); +} + + + #ifdef USE_TLS /* Free the TLS session associated with SESS, if any. */ static void @@ -2279,6 +2301,8 @@ connect_server (const char *server, unsigned short port, *r_host_not_found = 1; log_error ("can't connect to '%s': %s\n", server, strerror (errno)); } + else + notify_netactivity (); return sock; #else /*!ASSUAN_SOCK_TOR*/ @@ -2371,7 +2395,10 @@ connect_server (const char *server, unsigned short port, if (ret) last_errno = errno; else - connected = 1; + { + connected = 1; + notify_netactivity (); + } } free_dns_addrinfo (aibuf); } diff --git a/dirmngr/http.h b/dirmngr/http.h index 4a70caf..2a36fda 100644 --- a/dirmngr/http.h +++ b/dirmngr/http.h @@ -98,6 +98,8 @@ typedef struct http_context_s *http_t; void http_register_tls_callback (gpg_error_t (*cb)(http_t,http_session_t,int)); void http_register_tls_ca (const char *fname); +void http_register_netactivity_cb (void (*cb)(void)); + gpg_error_t http_session_new (http_session_t *r_session, const char *tls_priority, ----------------------------------------------------------------------- Summary of changes: agent/gpg-agent.c | 17 ++++++++++++++--- dirmngr/dirmngr.c | 14 ++++++++++++++ dirmngr/http.c | 29 ++++++++++++++++++++++++++++- dirmngr/http.h | 2 ++ 4 files changed, 58 insertions(+), 4 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Sat Nov 12 11:06:06 2016 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Sat, 12 Nov 2016 11:06:06 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.1.15-358-g6bf6981 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via 6bf698197222bf6081c249c815aebb075e8ec820 (commit) from 4473db1ef24031ff4e26c9a9de95dbe898ed2b97 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 6bf698197222bf6081c249c815aebb075e8ec820 Author: Werner Koch Date: Sat Nov 12 11:02:48 2016 +0100 agent: Improve concurrency when Libgcrypt 1.8 is used. * agent/gpg-agent.c (thread_init_once): Tell Libgcrypt to reinit the system call clamp. (agent_libgcrypt_progress_cb): Do not sleep if Libgcrypt is recent enough. -- This patch prepares for a feature comming with Libgcrypt 1.8. Signed-off-by: Werner Koch diff --git a/agent/gpg-agent.c b/agent/gpg-agent.c index d767879..1433f7f 100644 --- a/agent/gpg-agent.c +++ b/agent/gpg-agent.c @@ -901,6 +901,14 @@ thread_init_once (void) npth_init (); } gpgrt_set_syscall_clamp (npth_unprotect, npth_protect); + /* Now that we have set the syscall clamp we need to tell Libgcrypt + * that it should get them from libgpg-error. Note that Libgcrypt + * has already been initialized but at that point nPth was not + * initialized and thus Libgcrypt could not set its system call + * clamp. */ +#if GCRYPT_VERSION_NUMBER >= 0x010800 /* 1.8.0 */ + gcry_control (GCRYCTL_REINIT_SYSCALL_CLAMP, 0, 0); +#endif } @@ -1748,16 +1756,14 @@ agent_libgcrypt_progress_cb (void *data, const char *what, int printchar, if (dispatch && dispatch->cb) dispatch->cb (dispatch->ctrl, what, printchar, current, total); - /* If Libgcrypt tells us that it needs more entropy, we better take - * a nap to give other threads a chance to run. Note that Libgcrypt - * does not know about nPth and thus when it selects and reads from - * /dev/random this will block the process. Maybe we should add a - * function similar to gpgrt_set_syscall_clamp to Libgcrypt or use - * those clamps directly. For now sleeping for 100ms seems to be - * appropriate. */ + /* Libgcrypt < 1.8 does not know about nPth and thus when it reads + * from /dev/random this will block the process. To mitigate this + * problem we take a short nap when Libgcrypt tells us that it needs + * more entropy. This way other threads have chance to run. */ +#if GCRYPT_VERSION_NUMBER < 0x010800 /* 1.8.0 */ if (what && !strcmp (what, "need_entropy")) - npth_usleep (100000); - + npth_usleep (100000); /* 100ms */ +#endif } ----------------------------------------------------------------------- Summary of changes: agent/gpg-agent.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Sat Nov 12 11:09:29 2016 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Sat, 12 Nov 2016 11:09:29 +0100 Subject: [git] GPG-ERROR - branch, master, updated. libgpg-error-1.24-13-gb797276 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Error codes used by GnuPG et al.". The branch, master has been updated via b7972767513c8748096ebed78d1e1621bd2bd459 (commit) from 25d463c67821901c8fd6736c815f11e85bbae66f (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit b7972767513c8748096ebed78d1e1621bd2bd459 Author: Werner Koch Date: Sat Nov 12 11:06:22 2016 +0100 Add new interface gpgrt_get_syscall_clamp. * src/visibility.c (gpgrt_get_syscall_clamp): New. * src/gpg-error.vers, src/gpg-error.def.in: Add function. * src/gpg-error.h.in: Ditto. * src/estream.c (_gpgrt_get_syscall_clamp): New. -- This function can be used by other libraries to set their own system clamp functions. Signed-off-by: Werner Koch diff --git a/NEWS b/NEWS index b1c8c6c..3b373c5 100644 --- a/NEWS +++ b/NEWS @@ -12,6 +12,7 @@ Noteworthy changes in version 1.25 (unreleased) [C19/A19/R_) GPG_ERR_DUP_NAME NEW. GPG_ERR_TOO_OLD NEW. GPG_ERR_TOO_YOUNG NEW. + gpgrt_get_syscall_clamp NEW. Noteworthy changes in version 1.24 (2016-07-14) [C19/A19/R1) diff --git a/src/estream.c b/src/estream.c index d0f0ba9..752d22e 100644 --- a/src/estream.c +++ b/src/estream.c @@ -605,6 +605,17 @@ _gpgrt_set_syscall_clamp (void (*pre)(void), void (*post)(void)) _gpgrt_lock_set_lock_clamp (pre, post); } +/* + * Return the current sycall clamp functions. This can be used by + * other libraries which have blocking functions. + */ +void +_gpgrt_get_syscall_clamp (void (**r_pre)(void), void (**r_post)(void)) +{ + *r_pre = pre_syscall_func; + *r_post = post_syscall_func; +} + /* diff --git a/src/gpg-error.def.in b/src/gpg-error.def.in index 1fa8866..19e87fa 100644 --- a/src/gpg-error.def.in +++ b/src/gpg-error.def.in @@ -150,4 +150,6 @@ EXPORTS gpgrt_w32_iconv @111 #endif + gpgrt_get_syscall_clamp @112 + ;; end of file with public symbols for Windows. diff --git a/src/gpg-error.h.in b/src/gpg-error.h.in index a79f6ba..86f3241 100644 --- a/src/gpg-error.h.in +++ b/src/gpg-error.h.in @@ -303,6 +303,9 @@ void gpg_err_deinit (int mode); /* Register blocking system I/O clamping functions. */ void gpgrt_set_syscall_clamp (void (*pre)(void), void (*post)(void)); +/* Get current I/O clamping functions. */ +void gpgrt_get_syscall_clamp (void (**r_pre)(void), void (**r_post)(void)); + /* Register a custom malloc/realloc/free function. */ void gpgrt_set_alloc_func (void *(*f)(void *a, size_t n)); diff --git a/src/gpg-error.vers b/src/gpg-error.vers index cdff0e3..802ff3d 100644 --- a/src/gpg-error.vers +++ b/src/gpg-error.vers @@ -39,6 +39,7 @@ GPG_ERROR_1.0 { gpgrt_lock_trylock; gpgrt_set_syscall_clamp; + gpgrt_get_syscall_clamp; gpgrt_fopen; gpgrt_mopen; diff --git a/src/gpgrt-int.h b/src/gpgrt-int.h index d69fe2c..b2b553b 100644 --- a/src/gpgrt-int.h +++ b/src/gpgrt-int.h @@ -53,6 +53,7 @@ gpg_err_code_t _gpgrt_yield (void); /* Local prototypes for estream. */ int _gpgrt_es_init (void); void _gpgrt_set_syscall_clamp (void (*pre)(void), void (*post)(void)); +void _gpgrt_get_syscall_clamp (void (**r_pre)(void), void (**r_post)(void)); gpgrt_stream_t _gpgrt_fopen (const char *_GPGRT__RESTRICT path, const char *_GPGRT__RESTRICT mode); diff --git a/src/visibility.c b/src/visibility.c index e3ac8a7..89b5623 100644 --- a/src/visibility.c +++ b/src/visibility.c @@ -97,6 +97,12 @@ gpgrt_set_syscall_clamp (void (*pre)(void), void (*post)(void)) } void +gpgrt_get_syscall_clamp (void (**r_pre)(void), void (**r_post)(void)) +{ + _gpgrt_get_syscall_clamp (r_pre, r_post); +} + +void gpgrt_set_alloc_func (void *(*f)(void *a, size_t n)) { _gpgrt_set_alloc_func (f); diff --git a/src/visibility.h b/src/visibility.h index 1de6c62..479186f 100644 --- a/src/visibility.h +++ b/src/visibility.h @@ -142,6 +142,7 @@ MARK_VISIBLE (gpgrt_vbsprintf) MARK_VISIBLE (gpgrt_snprintf) MARK_VISIBLE (gpgrt_vsnprintf) MARK_VISIBLE (gpgrt_set_syscall_clamp) +MARK_VISIBLE (gpgrt_get_syscall_clamp) MARK_VISIBLE (gpgrt_set_alloc_func) #undef MARK_VISIBLE @@ -251,6 +252,7 @@ MARK_VISIBLE (gpgrt_set_alloc_func) #define gpgrt_vsnprintf _gpgrt_USE_UNDERSCORED_FUNCTION #define gpgrt_set_syscall_clamp _gpgrt_USE_UNDERSCORED_FUNCTION +#define gpgrt_get_syscall_clamp _gpgrt_USE_UNDERSCORED_FUNCTION #define gpgrt_set_alloc_func _gpgrt_USE_UNDERSCORED_FUNCTION ----------------------------------------------------------------------- Summary of changes: NEWS | 1 + src/estream.c | 11 +++++++++++ src/gpg-error.def.in | 2 ++ src/gpg-error.h.in | 3 +++ src/gpg-error.vers | 1 + src/gpgrt-int.h | 1 + src/visibility.c | 6 ++++++ src/visibility.h | 2 ++ 8 files changed, 27 insertions(+) hooks/post-receive -- Error codes used by GnuPG et al. http://git.gnupg.org From cvs at cvs.gnupg.org Sat Nov 12 11:38:00 2016 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Sat, 12 Nov 2016 11:38:00 +0100 Subject: [git] GCRYPT - branch, master, updated. libgcrypt-1.7.3-12-gb829dfe Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU crypto library". The branch, master has been updated via b829dfe9f0eeff08c956ba3f3a6b559b9d2199dd (commit) from bf6d5b10cb4173826f47ac080506b68bb001acb2 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit b829dfe9f0eeff08c956ba3f3a6b559b9d2199dd Author: Werner Koch Date: Sat Nov 12 11:34:49 2016 +0100 Put blocking calls into Libgpg-error's system call clamp. * src/gcrypt.h.in (GCRYCTL_REINIT_SYSCALL_CLAMP): New. * configure.ac: Require Libgpg-error 1.25. Set version number to 1.8.0. * src/gcrypt-int.h: Remove error code emulation. * src/global.c (pre_syscall_func, post_syscall_func): New. (global_init): Call gpgrt_get_syscall_clamp. (_gcry_vcontrol) : Ditto. (_gcry_pre_syscall, _gcry_post_syscall): New. * random/rndlinux.c (_gcry_rndlinux_gather_random): Use the new functions. Signed-off-by: Werner Koch diff --git a/NEWS b/NEWS index cdf1ef4..0aaf863 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,24 @@ -Noteworthy changes in version 1.7.4 (unreleased) [C21/A1/R_] +Noteworthy changes in version 1.8.0 (unreleased) [C21/A1/R_] ------------------------------------------------ + * New interfaces: + + - GCRYCTL_REINIT_SYSCALL_CLAMP allows to init nPth after Libgcrypt. + + * Internal changes: + + - Libgpg-error 1.25 is now required. This avoids stalling of nPth + threads due to contention on internal Libgcrypt locks (e.g. the + random pool lock). + + - The system call clamp of libgpg-error is now used to wrap the + blocking read of /dev/random. This allows other nPth threads to + run while Libgcrypt is gathering entropy. + + + * Interface changes relative to the 1.6.0 release: + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + GCRYCTL_REINIT_SYSCALL_CLAMP NEW macro. Noteworthy changes in version 1.7.3 (2016-08-17) [C21/A1/R3] ------------------------------------------------ diff --git a/configure.ac b/configure.ac index 7bbf4bd..17ff407 100644 --- a/configure.ac +++ b/configure.ac @@ -29,8 +29,8 @@ min_automake_version="1.14" # commit and push so that the git magic is able to work. See below # for the LT versions. m4_define(mym4_version_major, [1]) -m4_define(mym4_version_minor, [7]) -m4_define(mym4_version_micro, [4]) +m4_define(mym4_version_minor, [8]) +m4_define(mym4_version_micro, [0]) # Below is m4 magic to extract and compute the revision number, the # decimalized short revision number, a beta version string, and a flag @@ -67,7 +67,7 @@ LIBGCRYPT_CONFIG_API_VERSION=1 # If you change the required gpg-error version, please remove # unnecessary error code defines in src/gcrypt-int.h. -NEED_GPG_ERROR_VERSION=1.13 +NEED_GPG_ERROR_VERSION=1.25 PACKAGE=$PACKAGE_NAME VERSION=$PACKAGE_VERSION diff --git a/doc/gcrypt.texi b/doc/gcrypt.texi index c2c39ad..933d22d 100644 --- a/doc/gcrypt.texi +++ b/doc/gcrypt.texi @@ -905,6 +905,21 @@ detection code might be run if the feature has been disabled. This command must be used at initialization time; i.e. before calling @code{gcry_check_version}. + at item GCRYCTL_REINIT_SYSCALL_CLAMP; Arguments: none + +Libgcrypt wraps blocking system calls with two functions calls +(``system call clamp'') to give user land threading libraries a hook +for re-scheduling. This works by reading the system call clamp from +Libgpg-error at initialization time. However sometimes Libgcrypt +needs to be initialized before the user land threading systems and at +that point the system call clamp has not been registered with +Libgpg-error and in turn Libgcrypt would not use them. The control +code can be used to tell Libgcrypt that a system call clamp has now +been registered with Libgpg-error and advised it to read the clamp +again. Obviously this control code may only be used before a second +thread is started in a process. + + @end table @end deftypefun diff --git a/random/rndlinux.c b/random/rndlinux.c index 2b563bf..562149a 100644 --- a/random/rndlinux.c +++ b/random/rndlinux.c @@ -220,7 +220,10 @@ _gcry_rndlinux_gather_random (void (*add)(const void*, size_t, FD_SET(fd, &rfds); tv.tv_sec = delay; tv.tv_usec = delay? 0 : 100000; - if ( !(rc=select(fd+1, &rfds, NULL, NULL, &tv)) ) + _gcry_pre_syscall (); + rc = select (fd+1, &rfds, NULL, NULL, &tv); + _gcry_post_syscall (); + if (!rc) { any_need_entropy = 1; delay = 3; /* Use 3 seconds henceforth. */ @@ -256,8 +259,10 @@ _gcry_rndlinux_gather_random (void (*add)(const void*, size_t, nbytes = length < sizeof(buffer)? length : sizeof(buffer); if (nbytes > 256) nbytes = 256; + _gcry_pre_syscall (); ret = syscall (__NR_getrandom, (void*)buffer, (size_t)nbytes, (unsigned int)0); + _gcry_post_syscall (); } while (ret == -1 && errno == EINTR); if (ret == -1 && errno == ENOSYS) diff --git a/src/g10lib.h b/src/g10lib.h index 444c868..d4e3fef 100644 --- a/src/g10lib.h +++ b/src/g10lib.h @@ -93,7 +93,9 @@ /*-- src/global.c -*/ int _gcry_global_is_operational (void); gcry_err_code_t _gcry_vcontrol (enum gcry_ctl_cmds cmd, va_list arg_ptr); -void _gcry_check_heap (const void *a); +void _gcry_check_heap (const void *a); +void _gcry_pre_syscall (void); +void _gcry_post_syscall (void); int _gcry_get_debug_flag (unsigned int mask); /* Malloc functions and common wrapper macros. */ diff --git a/src/gcrypt-int.h b/src/gcrypt-int.h index d367307..729f54a 100644 --- a/src/gcrypt-int.h +++ b/src/gcrypt-int.h @@ -28,19 +28,8 @@ #include "types.h" /* These error codes are used but not defined in the required - libgpg-error 1.11. Define them here. */ -#if GPG_ERROR_VERSION_NUMBER < 0x010c00 /* 1.12 */ -# define GPG_ERR_NO_CRYPT_CTX 191 -# define GPG_ERR_WRONG_CRYPT_CTX 192 -# define GPG_ERR_BAD_CRYPT_CTX 193 -# define GPG_ERR_CRYPT_CTX_CONFLICT 194 -# define GPG_ERR_BROKEN_PUBKEY 195 -# define GPG_ERR_BROKEN_SECKEY 196 -#endif + * libgpg-error N.MM. Define them here. [None right now.] */ -#if GPG_ERROR_VERSION_NUMBER < 0x010d00 /* 1.13 */ -# define GPG_ERR_MAC_ALGO 197 -#endif /* Context used with elliptic curve functions. */ diff --git a/src/gcrypt.h.in b/src/gcrypt.h.in index 02b8772..f896a78 100644 --- a/src/gcrypt.h.in +++ b/src/gcrypt.h.in @@ -331,7 +331,8 @@ enum gcry_ctl_cmds GCRYCTL_SET_SBOX = 73, GCRYCTL_DRBG_REINIT = 74, GCRYCTL_SET_TAGLEN = 75, - GCRYCTL_GET_TAGLEN = 76 + GCRYCTL_GET_TAGLEN = 76, + GCRYCTL_REINIT_SYSCALL_CLAMP = 77 }; /* Perform various operations defined by CMD. */ diff --git a/src/global.c b/src/global.c index 8669a46..8e54efe 100644 --- a/src/global.c +++ b/src/global.c @@ -56,6 +56,15 @@ static int force_fips_mode; /* Controlled by global_init(). */ static int any_init_done; +/* + * Functions called before and after blocking syscalls. + * Initialized by global_init and used via + * _gcry_pre_syscall and _gcry_post_syscall. + */ +static void (*pre_syscall_func)(void); +static void (*post_syscall_func)(void); + + /* Memory management. */ static gcry_handler_alloc_t alloc_func; @@ -89,6 +98,10 @@ global_init (void) /* Tell the random module that we have seen an init call. */ _gcry_set_preferred_rng_type (0); + /* Get the system call clamp functions. */ + if (!pre_syscall_func) + gpgrt_get_syscall_clamp (&pre_syscall_func, &post_syscall_func); + /* See whether the system is in FIPS mode. This needs to come as early as possible but after ATH has been initialized. */ _gcry_initialize_fips_mode (force_fips_mode); @@ -673,6 +686,11 @@ _gcry_vcontrol (enum gcry_ctl_cmds cmd, va_list arg_ptr) } break; + case GCRYCTL_REINIT_SYSCALL_CLAMP: + if (!pre_syscall_func) + gpgrt_get_syscall_clamp (&pre_syscall_func, &post_syscall_func); + break; + default: _gcry_set_preferred_rng_type (0); rc = GPG_ERR_INV_OP; @@ -1059,6 +1077,24 @@ _gcry_xstrdup (const char *string) } +/* Used before blocking system calls. */ +void +_gcry_pre_syscall (void) +{ + if (pre_syscall_func) + pre_syscall_func (); +} + + +/* Used after blocking system calls. */ +void +_gcry_post_syscall (void) +{ + if (post_syscall_func) + post_syscall_func (); +} + + int _gcry_get_debug_flag (unsigned int mask) { ----------------------------------------------------------------------- Summary of changes: NEWS | 20 +++++++++++++++++++- configure.ac | 6 +++--- doc/gcrypt.texi | 15 +++++++++++++++ random/rndlinux.c | 7 ++++++- src/g10lib.h | 4 +++- src/gcrypt-int.h | 13 +------------ src/gcrypt.h.in | 3 ++- src/global.c | 36 ++++++++++++++++++++++++++++++++++++ 8 files changed, 85 insertions(+), 19 deletions(-) hooks/post-receive -- The GNU crypto library http://git.gnupg.org From cvs at cvs.gnupg.org Sat Nov 12 11:42:41 2016 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Sat, 12 Nov 2016 11:42:41 +0100 Subject: [git] GCRYPT - branch, LIBGCRYPT-1-7-BRANCH, updated. libgcrypt-1.7.3-11-gbf6d5b1 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU crypto library". The branch, LIBGCRYPT-1-7-BRANCH has been updated via bf6d5b10cb4173826f47ac080506b68bb001acb2 (commit) via bfd732f53a9b5dfe14217a68a0fa289bf6913ec0 (commit) via 27747921cb1dfced83c5666cd1c474764724c52b (commit) via 5418d9ca4c0e087fd6872ad350a996fe74880d86 (commit) via de73a2e7237ba7c34ce48bb5fb671aa3993de832 (commit) via 4cd8d40d698564d24ece2af24546e34c58bf2961 (commit) via 0b332c1aef03a735c1fb0df184f74d523deb2f98 (commit) via 2d4bbc0ad62c54bbdef77799f9db82d344b7219e (commit) via e4eb03f56683317c908cb55be727832810dc8c72 (commit) via 595251ad37bf1968261d7e781752513f67525803 (commit) from bf3388a17d1871b03c630b5a66b31e2e44b44edf (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: cipher/Makefile.am | 13 +- cipher/{camellia-arm.S => camellia-aarch64.S} | 291 +++--- cipher/camellia-glue.c | 10 +- cipher/camellia.h | 7 +- cipher/cipher-gcm-armv8-aarch32-ce.S | 321 +++++-- cipher/cipher-gcm-armv8-aarch64-ce.S | 413 ++++++++ cipher/cipher-internal.h | 4 + cipher/idea.c | 2 +- cipher/{rijndael-arm.S => rijndael-aarch64.S} | 389 ++++---- cipher/rijndael-arm.S | 2 +- cipher/rijndael-armv8-aarch32-ce.S | 2 +- cipher/rijndael-armv8-aarch64-ce.S | 1265 +++++++++++++++++++++++++ cipher/rijndael-internal.h | 9 + cipher/sha1-armv8-aarch64-ce.S | 204 ++++ cipher/sha1.c | 4 + cipher/sha256-armv8-aarch32-ce.S | 27 +- cipher/sha256-armv8-aarch64-ce.S | 218 +++++ cipher/sha256.c | 4 + cipher/{twofish-arm.S => twofish-aarch64.S} | 214 ++--- cipher/twofish.c | 5 + configure.ac | 54 +- tests/basic.c | 119 ++- 22 files changed, 2941 insertions(+), 636 deletions(-) copy cipher/{camellia-arm.S => camellia-aarch64.S} (80%) create mode 100644 cipher/cipher-gcm-armv8-aarch64-ce.S copy cipher/{rijndael-arm.S => rijndael-aarch64.S} (65%) create mode 100644 cipher/rijndael-armv8-aarch64-ce.S create mode 100644 cipher/sha1-armv8-aarch64-ce.S create mode 100644 cipher/sha256-armv8-aarch64-ce.S copy cipher/{twofish-arm.S => twofish-aarch64.S} (60%) hooks/post-receive -- The GNU crypto library http://git.gnupg.org From cvs at cvs.gnupg.org Sat Nov 12 20:06:08 2016 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Sat, 12 Nov 2016 20:06:08 +0100 Subject: [git] GPG-ERROR - branch, master, updated. libgpg-error-1.24-18-gc26117b Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Error codes used by GnuPG et al.". The branch, master has been updated via c26117b2eda43258d4e3e8fd3ed602b2eaaa51f4 (commit) via 40e5ff0a0084c0d9521b401db4f38885bfdae233 (commit) via e15416d3668ea9dcc6a64cbb98140a99be8a7865 (commit) via a0651e910f962a49b0b7f7942512f17a5fe39a7d (commit) via 135319b5d1f9a88187687646c762759cfa05a7ec (commit) from b7972767513c8748096ebed78d1e1621bd2bd459 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit c26117b2eda43258d4e3e8fd3ed602b2eaaa51f4 Author: Werner Koch Date: Sat Nov 12 20:00:06 2016 +0100 estream: Minor portability fix. -- A trailing comma in an enum is not groked by all compilers. Binary operation should have their own parentheses to make it clear that a binary operator was meant. Signed-off-by: Werner Koch diff --git a/src/estream.c b/src/estream.c index c46bc61..58d5d03 100644 --- a/src/estream.c +++ b/src/estream.c @@ -2087,7 +2087,7 @@ es_create (estream_t *stream, void *cookie, es_syshd_t *syshd, stream_new->intern = stream_internal_new; #if _WIN32 - if (xmode & X_POLLABLE) + if ((xmode & X_POLLABLE)) { void *new_cookie; @@ -3243,7 +3243,7 @@ do_fdopen (int filedes, const char *mode, int no_close, int with_locked_list) err = parse_mode (mode, &modeflags, &xmode, NULL); if (err) goto out; - if (xmode & X_SYSOPEN) + if ((xmode & X_SYSOPEN)) { /* Not allowed for fdopen. */ _set_errno (EINVAL); @@ -3307,7 +3307,7 @@ do_fpopen (FILE *fp, const char *mode, int no_close, int with_locked_list) err = parse_mode (mode, &modeflags, &xmode, &cmode); if (err) goto out; - if (xmode & X_SYSOPEN) + if ((xmode & X_SYSOPEN)) { /* Not allowed for fpopen. */ _set_errno (EINVAL); diff --git a/src/gpgrt-int.h b/src/gpgrt-int.h index a6e6036..fba2585 100644 --- a/src/gpgrt-int.h +++ b/src/gpgrt-int.h @@ -82,7 +82,7 @@ typedef enum BACKEND_W32, BACKEND_FP, BACKEND_USER, - BACKEND_W32_POLLABLE, + BACKEND_W32_POLLABLE } gpgrt_stream_backend_kind_t; commit 40e5ff0a0084c0d9521b401db4f38885bfdae233 Author: Justus Winter Date: Wed Oct 19 12:20:44 2016 +0200 estream: Support 'es_poll' on Windows. * src/Makefile.am (arch_sources): Add new file. * src/estream.c (O_NONBLOCK): Move to 'gpgrt-int.h'. (BUFFER_BLOCK_SIZE): Likewise. (BUFFER_UNREAD_SIZE): Likewise. (struct notify_list_s, notify_list_t): Likewise. (struct _gpgrt_stream_internal, estream_internal_t): Likewise. (X_POLLABLE): New macro. (parse_mode): Parse keyword 'pollable', emulate O_NONBLOCK using the same mechanism on Windows. (_gpgrt_poll): Use the new '_gpgrt_w32_poll' on Windows. * src/gpgrt-int.h (_gpgrt_functions_w32_pollable): New declaration. (_gpgrt_w32_pollable_create): New prototype. (_gpgrt_w32_poll): Likewise. * src/w32-estream.c: New file. This code is adapted from GPGME. * tests/t-poll.c (create_pipe): Create pollable streams. GnuPG-bug-id: 2731 Signed-off-by: Justus Winter diff --git a/src/Makefile.am b/src/Makefile.am index c1e86a7..0c18252 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -109,7 +109,8 @@ CLEANFILES = err-sources.h err-codes.h code-to-errno.h code-from-errno.h \ # {{{ Begin Windows part # if HAVE_W32_SYSTEM -arch_sources = w32-gettext.c w32-lock.c w32-lock-obj.h w32-thread.c w32-iconv.c +arch_sources = w32-gettext.c w32-lock.c w32-lock-obj.h w32-thread.c \ + w32-iconv.c w32-estream.c RCCOMPILE = $(RC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ -DLOCALEDIR=\"$(localedir)\" $(AM_CPPFLAGS) $(CPPFLAGS) LTRCCOMPILE = $(LIBTOOL) --mode=compile --tag=RC $(RCCOMPILE) diff --git a/src/estream.c b/src/estream.c index aca7db7..c46bc61 100644 --- a/src/estream.c +++ b/src/estream.c @@ -127,8 +127,6 @@ # ifndef S_IXOTH # define S_IXOTH S_IXUSR # endif -# undef O_NONBLOCK -# define O_NONBLOCK 0 /* FIXME: Not yet supported. */ #endif #if !defined (EWOULDBLOCK) && defined (HAVE_W32_SYSTEM) @@ -174,66 +172,6 @@ typedef void (*func_free_t) (void *mem); /* - * Buffer management layer. - */ - -#define BUFFER_BLOCK_SIZE BUFSIZ -#define BUFFER_UNREAD_SIZE 16 - - -/* - * A type to hold notification functions. - */ -struct notify_list_s -{ - struct notify_list_s *next; - void (*fnc) (estream_t, void*); /* The notification function. */ - void *fnc_value; /* The value to be passed to FNC. */ -}; -typedef struct notify_list_s *notify_list_t; - - -/* - * The private object describing a stream. - */ -struct _gpgrt_stream_internal -{ - unsigned char buffer[BUFFER_BLOCK_SIZE]; - unsigned char unread_buffer[BUFFER_UNREAD_SIZE]; - - gpgrt_lock_t lock; /* Lock. Used by *_stream_lock(). */ - - gpgrt_stream_backend_kind_t kind; - void *cookie; /* Cookie. */ - void *opaque; /* Opaque data. */ - unsigned int modeflags; /* Flags for the backend. */ - char *printable_fname; /* Malloced filename for es_fname_get. */ - gpgrt_off_t offset; - gpgrt_cookie_read_function_t func_read; - gpgrt_cookie_write_function_t func_write; - gpgrt_cookie_seek_function_t func_seek; - gpgrt_cookie_close_function_t func_close; - cookie_ioctl_function_t func_ioctl; - int strategy; - es_syshd_t syshd; /* A copy of the system handle. */ - struct - { - unsigned int err: 1; - unsigned int eof: 1; - unsigned int hup: 1; - } indicators; - unsigned int deallocate_buffer: 1; - unsigned int is_stdstream:1; /* This is a standard stream. */ - unsigned int stdstream_fd:2; /* 0, 1 or 2 for a standard stream. */ - unsigned int printable_fname_inuse: 1; /* es_fname_get has been used. */ - unsigned int samethread: 1; /* The "samethread" mode keyword. */ - size_t print_ntotal; /* Bytes written from in print_writer. */ - notify_list_t onclose; /* On close notify function list. */ -}; -typedef struct _gpgrt_stream_internal *estream_internal_t; - - -/* * A linked list to hold active stream objects. * Protected by ESTREAM_LIST_LOCK. */ @@ -1686,6 +1624,7 @@ func_file_create (void **cookie, int *filedes, /* Flags used by parse_mode and friends. */ #define X_SAMETHREAD (1 << 0) #define X_SYSOPEN (1 << 1) +#define X_POLLABLE (1 << 2) /* Parse the mode flags of fopen et al. In addition to the POSIX * defined mode flags keyword parameters are supported. These are @@ -1723,6 +1662,13 @@ func_file_create (void **cookie, int *filedes, * under Windows the direct W32 API functions (HANDLE) are used * instead of their libc counterparts (fd). * + * pollable + * + * The object is opened in a way suitable for use with es_poll. On + * POSIX this is a NOP but under Windows we create up to two + * threads, one for reading and one for writing, do any I/O there, + * and synchronize with them in order to support es_poll. + * * Note: R_CMODE is optional because is only required by functions * which are able to creat a file. */ @@ -1828,6 +1774,10 @@ parse_mode (const char *modestr, return -1; } oflags |= O_NONBLOCK; +#if HAVE_W32_SYSTEM + /* Currently, nonblock implies pollable on Windows. */ + *r_xmode |= X_POLLABLE; +#endif } else if (!strncmp (modestr, "sysopen", 7)) { @@ -1839,6 +1789,16 @@ parse_mode (const char *modestr, } *r_xmode |= X_SYSOPEN; } + else if (!strncmp (modestr, "pollable", 8)) + { + modestr += 8; + if (*modestr && !strchr (" \t,", *modestr)) + { + _set_errno (EINVAL); + return -1; + } + *r_xmode |= X_POLLABLE; + } } if (!got_cmode) cmode = (S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH); @@ -2126,6 +2086,23 @@ es_create (estream_t *stream, void *cookie, es_syshd_t *syshd, stream_new->unread_buffer_size = sizeof (stream_internal_new->unread_buffer); stream_new->intern = stream_internal_new; +#if _WIN32 + if (xmode & X_POLLABLE) + { + void *new_cookie; + + err = _gpgrt_w32_pollable_create (&new_cookie, modeflags, + functions, cookie); + if (err) + goto out; + + modeflags &= ~O_NONBLOCK; + cookie = new_cookie; + kind = BACKEND_W32_POLLABLE; + functions = _gpgrt_functions_w32_pollable; + } +#endif + init_stream_obj (stream_new, cookie, syshd, kind, functions, modeflags, xmode); init_stream_lock (stream_new); @@ -4731,11 +4708,13 @@ _gpgrt_poll (gpgrt_poll_t *fds, unsigned int nfds, int timeout) { gpgrt_poll_t *item; int count = 0; +#ifndef _WIN32 fd_set readfds, writefds, exceptfds; int any_readfd, any_writefd, any_exceptfd; - int idx; int max_fd; int fd, ret, any; +#endif + int idx; if (!fds) { @@ -4783,6 +4762,15 @@ _gpgrt_poll (gpgrt_poll_t *fds, unsigned int nfds, int timeout) return count; /* Early return without waiting. */ /* Now do the real select. */ +#ifdef _WIN32 + if (pre_syscall_func) + pre_syscall_func (); + + count = _gpgrt_w32_poll (fds, nfds, timeout); + + if (post_syscall_func) + post_syscall_func (); +#else any_readfd = any_writefd = any_exceptfd = 0; max_fd = 0; for (item = fds, idx = 0; idx < nfds; item++, idx++) @@ -4828,11 +4816,6 @@ _gpgrt_poll (gpgrt_poll_t *fds, unsigned int nfds, int timeout) } } -#ifdef _WIN32 - (void)timeout; - ret = -1; - _set_errno (EOPNOTSUPP); -#else if (pre_syscall_func) pre_syscall_func (); do @@ -4850,7 +4833,6 @@ _gpgrt_poll (gpgrt_poll_t *fds, unsigned int nfds, int timeout) while (ret == -1 && errno == EINTR); if (post_syscall_func) post_syscall_func (); -#endif if (ret == -1) return -1; @@ -4876,9 +4858,6 @@ _gpgrt_poll (gpgrt_poll_t *fds, unsigned int nfds, int timeout) item->got_hup = 1; any = 1; } -#ifndef _WIN32 - /* NB.: We can't use FD_ISSET under windows - but we don't have - * support for it anyway. */ if (item->want_read && FD_ISSET (fd, &readfds)) { item->got_read = 1; @@ -4894,11 +4873,11 @@ _gpgrt_poll (gpgrt_poll_t *fds, unsigned int nfds, int timeout) item->got_oob = 1; any = 1; } -#endif /*!_WIN32*/ if (any) count++; } +#endif return count; } diff --git a/src/gpgrt-int.h b/src/gpgrt-int.h index a517cc6..a6e6036 100644 --- a/src/gpgrt-int.h +++ b/src/gpgrt-int.h @@ -52,6 +52,12 @@ gpg_err_code_t _gpgrt_yield (void); /* Local definitions for estream. */ +#if HAVE_W32_SYSTEM +# ifndef O_NONBLOCK +# define O_NONBLOCK 0x40000000 /* FIXME: Is that safe? */ +# endif +#endif + /* * A private cookie function to implement an internal IOCTL service. * and ist IOCTL numbers. @@ -80,6 +86,65 @@ typedef enum } gpgrt_stream_backend_kind_t; +/* + * A type to hold notification functions. + */ +struct notify_list_s +{ + struct notify_list_s *next; + void (*fnc) (estream_t, void*); /* The notification function. */ + void *fnc_value; /* The value to be passed to FNC. */ +}; +typedef struct notify_list_s *notify_list_t; + + +/* + * Buffer management layer. + */ + +#define BUFFER_BLOCK_SIZE BUFSIZ +#define BUFFER_UNREAD_SIZE 16 + + +/* + * The private object describing a stream. + */ +struct _gpgrt_stream_internal +{ + unsigned char buffer[BUFFER_BLOCK_SIZE]; + unsigned char unread_buffer[BUFFER_UNREAD_SIZE]; + + gpgrt_lock_t lock; /* Lock. Used by *_stream_lock(). */ + + gpgrt_stream_backend_kind_t kind; + void *cookie; /* Cookie. */ + void *opaque; /* Opaque data. */ + unsigned int modeflags; /* Flags for the backend. */ + char *printable_fname; /* Malloced filename for es_fname_get. */ + gpgrt_off_t offset; + gpgrt_cookie_read_function_t func_read; + gpgrt_cookie_write_function_t func_write; + gpgrt_cookie_seek_function_t func_seek; + gpgrt_cookie_close_function_t func_close; + cookie_ioctl_function_t func_ioctl; + int strategy; + es_syshd_t syshd; /* A copy of the system handle. */ + struct + { + unsigned int err: 1; + unsigned int eof: 1; + unsigned int hup: 1; + } indicators; + unsigned int deallocate_buffer: 1; + unsigned int is_stdstream:1; /* This is a standard stream. */ + unsigned int stdstream_fd:2; /* 0, 1 or 2 for a standard stream. */ + unsigned int printable_fname_inuse: 1; /* es_fname_get has been used. */ + unsigned int samethread: 1; /* The "samethread" mode keyword. */ + size_t print_ntotal; /* Bytes written from in print_writer. */ + notify_list_t onclose; /* On close notify function list. */ +}; +typedef struct _gpgrt_stream_internal *estream_internal_t; + /* Local prototypes for estream. */ int _gpgrt_es_init (void); @@ -237,5 +302,14 @@ const char *_gpgrt_fname_get (gpgrt_stream_t stream); #include "estream-printf.h" +#if _WIN32 +/* Prototypes for w32-estream.c. */ +struct cookie_io_functions_s _gpgrt_functions_w32_pollable; +int _gpgrt_w32_pollable_create (void *_GPGRT__RESTRICT *_GPGRT__RESTRICT cookie, + unsigned int modeflags, + struct cookie_io_functions_s next_functions, + void *next_cookie); +int _gpgrt_w32_poll (gpgrt_poll_t *fds, size_t nfds, int timeout); +#endif #endif /*_GPGRT_GPGRT_INT_H*/ diff --git a/src/w32-estream.c b/src/w32-estream.c new file mode 100644 index 0000000..516b238 --- /dev/null +++ b/src/w32-estream.c @@ -0,0 +1,1047 @@ +/* w32-estream.c - es_poll support on W32. + * Copyright (C) 2000 Werner Koch (dd9jn) + * Copyright (C) 2001, 2002, 2003, 2004, 2007, 2010, 2016 g10 Code GmbH + * + * This file is part of libgpg-error. + * + * libgpg-error 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. + * + * libgpg-error 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 . + */ + +/* + * This file is based on GPGME's w32-io.c started in 2001. + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include +#include +#include +#include +#include +#ifdef HAVE_SYS_TIME_H +# include +#endif +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#include +#include + +#include "gpgrt-int.h" + +/* + * In order to support es_poll on Windows, we create a proxy shim that + * we use as the estream I/O functions. This shim creates reader and + * writer threads that use the original I/O functions. + */ + + + +/* Tracing/debugging support. */ +#if 0 +#define TRACE(msg, ...) \ + fprintf (stderr, msg, ## __VA_ARGS__) +#define TRACE_CTX(ctx, msg, ...) \ + fprintf (stderr, "%p: " msg "\n", ctx, ## __VA_ARGS__) +#define TRACE_ERR(ctx, err, msg, ...) do { \ + char error_message[128]; \ + FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM \ + | FORMAT_MESSAGE_IGNORE_INSERTS, \ + NULL, \ + err, \ + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), \ + (LPTSTR) &error_message, \ + sizeof error_message, NULL ); \ + fprintf (stderr, "%p: " msg ": %s\n", ctx, \ + ## __VA_ARGS__, error_message); \ + } while (0) +#else +#define TRACE(msg, ...) (void) 0 +#define TRACE_CTX(ctx, msg, ...) (void) 0 +#define TRACE_ERR(ctx, err, msg, ...) (void) 0 +#endif + + + +/* Calculate array dimension. */ +#ifndef DIM +#define DIM(array) (sizeof (array) / sizeof (*array)) +#endif + +#define READBUF_SIZE 4096 +#define WRITEBUF_SIZE 4096 + + +typedef struct estream_cookie_w32_pollable *estream_cookie_w32_pollable_t; + +struct reader_context_s +{ + estream_cookie_w32_pollable_t pcookie; + HANDLE thread_hd; + + gpgrt_lock_t mutex; + + int stop_me; + int eof; + int eof_shortcut; + int error; + int error_code; + + /* This is manually reset. */ + HANDLE have_data_ev; + /* This is automatically reset. */ + HANDLE have_space_ev; + /* This is manually reset but actually only triggered once. */ + HANDLE close_ev; + + size_t readpos, writepos; + char buffer[READBUF_SIZE]; +}; + +struct writer_context_s +{ + estream_cookie_w32_pollable_t pcookie; + HANDLE thread_hd; + + gpgrt_lock_t mutex; + + int stop_me; + int error; + int error_code; + + /* This is manually reset. */ + HANDLE have_data; + HANDLE is_empty; + HANDLE close_ev; + size_t nbytes; + char buffer[WRITEBUF_SIZE]; +}; + +/* Cookie for pollable objects. */ +struct estream_cookie_w32_pollable +{ + unsigned int modeflags; + + struct cookie_io_functions_s next_functions; + void *next_cookie; + + struct reader_context_s *reader; + struct writer_context_s *writer; +}; + + +static HANDLE +set_synchronize (HANDLE hd) +{ +#ifdef HAVE_W32CE_SYSTEM + return hd; +#else + HANDLE new_hd; + + /* For NT we have to set the sync flag. It seems that the only way + to do it is by duplicating the handle. Tsss... */ + if (!DuplicateHandle (GetCurrentProcess (), hd, + GetCurrentProcess (), &new_hd, + EVENT_MODIFY_STATE | SYNCHRONIZE, FALSE, 0)) + { + TRACE_ERR (NULL, GetLastError (), "DuplicateHandle failed"); + /* FIXME: Should translate the error code. */ + _gpg_err_set_errno (EIO); + return INVALID_HANDLE_VALUE; + } + + CloseHandle (hd); + return new_hd; +#endif +} + + +static DWORD CALLBACK +reader (void *arg) +{ + struct reader_context_s *ctx = arg; + int nbytes; + ssize_t nread; + TRACE_CTX (ctx, "reader starting"); + + for (;;) + { + _gpgrt_lock_lock (&ctx->mutex); + /* Leave a 1 byte gap so that we can see whether it is empty or + full. */ + while ((ctx->writepos + 1) % READBUF_SIZE == ctx->readpos) + { + /* Wait for space. */ + if (!ResetEvent (ctx->have_space_ev)) + TRACE_ERR (ctx, GetLastError (), "ResetEvent failed"); + _gpgrt_lock_unlock (&ctx->mutex); + TRACE_CTX (ctx, "waiting for space"); + WaitForSingleObject (ctx->have_space_ev, INFINITE); + TRACE_CTX (ctx, "got space"); + _gpgrt_lock_lock (&ctx->mutex); + } + assert (((ctx->writepos + 1) % READBUF_SIZE != ctx->readpos)); + if (ctx->stop_me) + { + _gpgrt_lock_unlock (&ctx->mutex); + break; + } + nbytes = (ctx->readpos + READBUF_SIZE + - ctx->writepos - 1) % READBUF_SIZE; + assert (nbytes); + if (nbytes > READBUF_SIZE - ctx->writepos) + nbytes = READBUF_SIZE - ctx->writepos; + _gpgrt_lock_unlock (&ctx->mutex); + + TRACE_CTX (ctx, "reading up to %d bytes", nbytes); + + nread = ctx->pcookie->next_functions.public.func_read + (ctx->pcookie->next_cookie, ctx->buffer + ctx->writepos, nbytes); + TRACE_CTX (ctx, "got %d bytes", nread); + if (nread < 0) + { + ctx->error_code = (int) errno; + /* NOTE (W32CE): Do not ignore ERROR_BUSY! Check at + least stop_me if that happens. */ + if (ctx->error_code == ERROR_BROKEN_PIPE) + { + ctx->eof = 1; + TRACE_CTX (ctx, "got EOF (broken pipe)"); + } + else + { + ctx->error = 1; + TRACE_ERR (ctx, ctx->error_code, "read error"); + } + break; + } + + _gpgrt_lock_lock (&ctx->mutex); + if (ctx->stop_me) + { + _gpgrt_lock_unlock (&ctx->mutex); + break; + } + if (!nread) + { + ctx->eof = 1; + TRACE_CTX (ctx, "got eof"); + _gpgrt_lock_unlock (&ctx->mutex); + break; + } + + ctx->writepos = (ctx->writepos + nread) % READBUF_SIZE; + if (!SetEvent (ctx->have_data_ev)) + TRACE_ERR (ctx, GetLastError (), "SetEvent (%p) failed", + ctx->have_data_ev); + _gpgrt_lock_unlock (&ctx->mutex); + } + /* Indicate that we have an error or EOF. */ + if (!SetEvent (ctx->have_data_ev)) + TRACE_ERR (ctx, GetLastError (), "SetEvent (%p) failed", + ctx->have_data_ev); + + TRACE_CTX (ctx, "waiting for close"); + WaitForSingleObject (ctx->close_ev, INFINITE); + + CloseHandle (ctx->close_ev); + CloseHandle (ctx->have_data_ev); + CloseHandle (ctx->have_space_ev); + CloseHandle (ctx->thread_hd); + _gpgrt_lock_destroy (&ctx->mutex); + _gpgrt_free (ctx); + + return 0; +} + + +static struct reader_context_s * +create_reader (estream_cookie_w32_pollable_t pcookie) +{ + struct reader_context_s *ctx; + SECURITY_ATTRIBUTES sec_attr; + DWORD tid; + + memset (&sec_attr, 0, sizeof sec_attr); + sec_attr.nLength = sizeof sec_attr; + sec_attr.bInheritHandle = FALSE; + + ctx = calloc (1, sizeof *ctx); + if (!ctx) + { + return NULL; + } + + ctx->pcookie = pcookie; + + ctx->have_data_ev = CreateEvent (&sec_attr, TRUE, FALSE, NULL); + if (ctx->have_data_ev) + ctx->have_space_ev = CreateEvent (&sec_attr, FALSE, TRUE, NULL); + if (ctx->have_space_ev) + ctx->close_ev = CreateEvent (&sec_attr, TRUE, FALSE, NULL); + if (!ctx->have_data_ev || !ctx->have_space_ev || !ctx->close_ev) + { + TRACE_ERR (ctx, GetLastError (), "CreateEvent failed"); + if (ctx->have_data_ev) + CloseHandle (ctx->have_data_ev); + if (ctx->have_space_ev) + CloseHandle (ctx->have_space_ev); + if (ctx->close_ev) + CloseHandle (ctx->close_ev); + _gpgrt_free (ctx); + return NULL; + } + + ctx->have_data_ev = set_synchronize (ctx->have_data_ev); + _gpgrt_lock_init (&ctx->mutex); + +#ifdef HAVE_W32CE_SYSTEM + ctx->thread_hd = CreateThread (&sec_attr, 64 * 1024, reader, ctx, + STACK_SIZE_PARAM_IS_A_RESERVATION, &tid); +#else + ctx->thread_hd = CreateThread (&sec_attr, 0, reader, ctx, 0, &tid); +#endif + + if (!ctx->thread_hd) + { + TRACE_ERR (ctx, GetLastError (), "CreateThread failed"); + _gpgrt_lock_destroy (&ctx->mutex); + if (ctx->have_data_ev) + CloseHandle (ctx->have_data_ev); + if (ctx->have_space_ev) + CloseHandle (ctx->have_space_ev); + if (ctx->close_ev) + CloseHandle (ctx->close_ev); + _gpgrt_free (ctx); + return NULL; + } + else + { +#if 0 + /* We set the priority of the thread higher because we know that + it only runs for a short time. This greatly helps to + increase the performance of the I/O. */ + SetThreadPriority (ctx->thread_hd, get_desired_thread_priority ()); +#endif + } + + return ctx; +} + + +/* Prepare destruction of the reader thread for CTX. Returns 0 if a + call to this function is sufficient and destroy_reader_finish shall + not be called. */ +static void +destroy_reader (struct reader_context_s *ctx) +{ + _gpgrt_lock_lock (&ctx->mutex); + ctx->stop_me = 1; + if (ctx->have_space_ev) + SetEvent (ctx->have_space_ev); + _gpgrt_lock_unlock (&ctx->mutex); + +#ifdef HAVE_W32CE_SYSTEM + /* Scenario: We never create a full pipe, but already started + reading. Then we need to unblock the reader in the pipe driver + to make our reader thread notice that we want it to go away. */ + + if (ctx->file_hd != INVALID_HANDLE_VALUE) + { + if (!DeviceIoControl (ctx->file_hd, GPGCEDEV_IOCTL_UNBLOCK, + NULL, 0, NULL, 0, NULL, NULL)) + { + TRACE_ERR (ctx, GetLastError (), "unblock control call failed"); + } + } +#endif + + /* XXX is it feasible to unblock the thread? */ + + /* After setting this event CTX is void. */ + SetEvent (ctx->close_ev); +} + + +/* + * Read function for pollable objects. + */ +static gpgrt_ssize_t +func_w32_pollable_read (void *cookie, void *buffer, size_t count) +{ + estream_cookie_w32_pollable_t pcookie = cookie; + gpgrt_ssize_t nread; + struct reader_context_s *ctx; + + ctx = pcookie->reader; + if (ctx == NULL) + { + pcookie->reader = ctx = create_reader (pcookie); + if (!ctx) + { + _gpg_err_set_errno (EBADF); + return -1; + } + } + + TRACE_CTX (ctx, "pollable read buffer=%p, count=%u", buffer, count); + + if (ctx->eof_shortcut) + return 0; + + _gpgrt_lock_lock (&ctx->mutex); + TRACE_CTX (ctx, "readpos: %d, writepos %d", ctx->readpos, ctx->writepos); + if (ctx->readpos == ctx->writepos && !ctx->error) + { + /* No data available. */ + int eof = ctx->eof; + _gpgrt_lock_unlock (&ctx->mutex); + + if (pcookie->modeflags & O_NONBLOCK && ! eof) + { + _gpg_err_set_errno (EAGAIN); + return -1; + } + + TRACE_CTX (ctx, "waiting for data"); + WaitForSingleObject (ctx->have_data_ev, INFINITE); + TRACE_CTX (ctx, "data available"); + _gpgrt_lock_lock (&ctx->mutex); + } + + if (ctx->readpos == ctx->writepos || ctx->error) + { + _gpgrt_lock_unlock (&ctx->mutex); + ctx->eof_shortcut = 1; + if (ctx->eof) + return 0; + if (!ctx->error) + { + TRACE_CTX (ctx, "EOF but ctx->eof flag not set"); + return 0; + } + _gpg_err_set_errno (ctx->error_code); + return -1; + } + + nread = ctx->readpos < ctx->writepos + ? ctx->writepos - ctx->readpos + : READBUF_SIZE - ctx->readpos; + if (nread > count) + nread = count; + memcpy (buffer, ctx->buffer + ctx->readpos, nread); + ctx->readpos = (ctx->readpos + nread) % READBUF_SIZE; + if (ctx->readpos == ctx->writepos && !ctx->eof) + { + if (!ResetEvent (ctx->have_data_ev)) + { + TRACE_ERR (ctx, GetLastError (), "ResetEvent failed"); + _gpgrt_lock_unlock (&ctx->mutex); + /* FIXME: Should translate the error code. */ + _gpg_err_set_errno (EIO); + return -1; + } + } + if (!SetEvent (ctx->have_space_ev)) + { + TRACE_ERR (ctx, GetLastError (), "SetEvent (%p) failed", + ctx->have_space_ev); + _gpgrt_lock_unlock (&ctx->mutex); + /* FIXME: Should translate the error code. */ + _gpg_err_set_errno (EIO); + return -1; + } + _gpgrt_lock_unlock (&ctx->mutex); + + return nread; +} + + +/* The writer does use a simple buffering strategy so that we are + informed about write errors as soon as possible (i. e. with the the + next call to the write function. */ +static DWORD CALLBACK +writer (void *arg) +{ + struct writer_context_s *ctx = arg; + ssize_t nwritten; + + TRACE_CTX (ctx, "writer starting"); + + for (;;) + { + _gpgrt_lock_lock (&ctx->mutex); + if (ctx->stop_me && !ctx->nbytes) + { + _gpgrt_lock_unlock (&ctx->mutex); + break; + } + if (!ctx->nbytes) + { + if (!SetEvent (ctx->is_empty)) + TRACE_ERR (ctx, GetLastError (), "SetEvent failed"); + if (!ResetEvent (ctx->have_data)) + TRACE_ERR (ctx, GetLastError (), "ResetEvent failed"); + _gpgrt_lock_unlock (&ctx->mutex); + TRACE_CTX (ctx, "idle"); + WaitForSingleObject (ctx->have_data, INFINITE); + TRACE_CTX (ctx, "got data to write"); + _gpgrt_lock_lock (&ctx->mutex); + } + if (ctx->stop_me && !ctx->nbytes) + { + _gpgrt_lock_unlock (&ctx->mutex); + break; + } + _gpgrt_lock_unlock (&ctx->mutex); + + TRACE_CTX (ctx, "writing up to %d bytes", ctx->nbytes); + + nwritten = ctx->pcookie->next_functions.public.func_write + (ctx->pcookie->next_cookie, ctx->buffer, ctx->nbytes); + TRACE_CTX (ctx, "wrote %d bytes", nwritten); + if (nwritten < 1) + { + /* XXX */ + if (errno == ERROR_BUSY) + { + /* Probably stop_me is set now. */ + TRACE_CTX (ctx, "pipe busy (unblocked?)"); + continue; + } + + ctx->error_code = errno; + ctx->error = 1; + TRACE_ERR (ctx, ctx->error_code, "write error"); + break; + } + + _gpgrt_lock_lock (&ctx->mutex); + ctx->nbytes -= nwritten; + _gpgrt_lock_unlock (&ctx->mutex); + } + /* Indicate that we have an error. */ + if (!SetEvent (ctx->is_empty)) + TRACE_ERR (ctx, GetLastError (), "SetEvent failed"); + + TRACE_CTX (ctx, "waiting for close"); + WaitForSingleObject (ctx->close_ev, INFINITE); + + if (ctx->nbytes) + TRACE_CTX (ctx, "still %d bytes in buffer at close time", ctx->nbytes); + + CloseHandle (ctx->close_ev); + CloseHandle (ctx->have_data); + CloseHandle (ctx->is_empty); + CloseHandle (ctx->thread_hd); + _gpgrt_lock_destroy (&ctx->mutex); + _gpgrt_free (ctx); + + return 0; +} + + +static struct writer_context_s * +create_writer (estream_cookie_w32_pollable_t pcookie) +{ + struct writer_context_s *ctx; + SECURITY_ATTRIBUTES sec_attr; + DWORD tid; + + memset (&sec_attr, 0, sizeof sec_attr); + sec_attr.nLength = sizeof sec_attr; + sec_attr.bInheritHandle = FALSE; + + ctx = calloc (1, sizeof *ctx); + if (!ctx) + { + return NULL; + } + + ctx->pcookie = pcookie; + + ctx->have_data = CreateEvent (&sec_attr, TRUE, FALSE, NULL); + if (ctx->have_data) + ctx->is_empty = CreateEvent (&sec_attr, TRUE, TRUE, NULL); + if (ctx->is_empty) + ctx->close_ev = CreateEvent (&sec_attr, TRUE, FALSE, NULL); + if (!ctx->have_data || !ctx->is_empty || !ctx->close_ev) + { + TRACE_ERR (ctx, GetLastError (), "CreateEvent failed"); + if (ctx->have_data) + CloseHandle (ctx->have_data); + if (ctx->is_empty) + CloseHandle (ctx->is_empty); + if (ctx->close_ev) + CloseHandle (ctx->close_ev); + _gpgrt_free (ctx); + return NULL; + } + + ctx->is_empty = set_synchronize (ctx->is_empty); + _gpgrt_lock_init (&ctx->mutex); + +#ifdef HAVE_W32CE_SYSTEM + ctx->thread_hd = CreateThread (&sec_attr, 64 * 1024, writer, ctx, + STACK_SIZE_PARAM_IS_A_RESERVATION, &tid); +#else + ctx->thread_hd = CreateThread (&sec_attr, 0, writer, ctx, 0, &tid ); +#endif + + if (!ctx->thread_hd) + { + TRACE_ERR (ctx, GetLastError (), "CreateThread failed"); + _gpgrt_lock_destroy (&ctx->mutex); + if (ctx->have_data) + CloseHandle (ctx->have_data); + if (ctx->is_empty) + CloseHandle (ctx->is_empty); + if (ctx->close_ev) + CloseHandle (ctx->close_ev); + _gpgrt_free (ctx); + return NULL; + } + else + { +#if 0 + /* We set the priority of the thread higher because we know + that it only runs for a short time. This greatly helps to + increase the performance of the I/O. */ + SetThreadPriority (ctx->thread_hd, get_desired_thread_priority ()); +#endif + } + + return ctx; +} + + +static void +destroy_writer (struct writer_context_s *ctx) +{ + _gpgrt_lock_lock (&ctx->mutex); + ctx->stop_me = 1; + if (ctx->have_data) + SetEvent (ctx->have_data); + _gpgrt_lock_unlock (&ctx->mutex); + + /* Give the writer a chance to flush the buffer. */ + WaitForSingleObject (ctx->is_empty, INFINITE); + +#ifdef HAVE_W32CE_SYSTEM + /* Scenario: We never create a full pipe, but already started + writing more than the pipe buffer. Then we need to unblock the + writer in the pipe driver to make our writer thread notice that + we want it to go away. */ + + if (!DeviceIoControl (ctx->file_hd, GPGCEDEV_IOCTL_UNBLOCK, + NULL, 0, NULL, 0, NULL, NULL)) + { + TRACE_ERR (ctx, GetLastError (), "unblock control call failed"); + } +#endif + + /* After setting this event CTX is void. */ + SetEvent (ctx->close_ev); +} + + +/* + * Write function for pollable objects. + */ +static gpgrt_ssize_t +func_w32_pollable_write (void *cookie, const void *buffer, size_t count) +{ + estream_cookie_w32_pollable_t pcookie = cookie; + struct writer_context_s *ctx; + + if (count == 0) + return 0; + + ctx = pcookie->writer; + if (ctx == NULL) + { + pcookie->writer = ctx = create_writer (pcookie); + if (!ctx) + return -1; + } + + _gpgrt_lock_lock (&ctx->mutex); + TRACE_CTX (ctx, "pollable write buffer: %p, count: %d, nbytes: %d", + buffer, count, ctx->nbytes); + if (!ctx->error && ctx->nbytes) + { + /* Bytes are pending for send. */ + + /* Reset the is_empty event. Better safe than sorry. */ + if (!ResetEvent (ctx->is_empty)) + { + TRACE_ERR (ctx, GetLastError (), "ResetEvent failed"); + _gpgrt_lock_unlock (&ctx->mutex); + /* FIXME: Should translate the error code. */ + _gpg_err_set_errno (EIO); + return -1; + } + _gpgrt_lock_unlock (&ctx->mutex); + + if (pcookie->modeflags & O_NONBLOCK) + { + TRACE_CTX (ctx, "would block"); + _gpg_err_set_errno (EAGAIN); + return -1; + } + + TRACE_CTX (ctx, "waiting for empty buffer"); + WaitForSingleObject (ctx->is_empty, INFINITE); + TRACE_CTX (ctx, "buffer is empty"); + _gpgrt_lock_lock (&ctx->mutex); + } + + if (ctx->error) + { + _gpgrt_lock_unlock (&ctx->mutex); + if (ctx->error_code == ERROR_NO_DATA) + _gpg_err_set_errno (EPIPE); + else + _gpg_err_set_errno (EIO); + return -1; + } + + /* If no error occurred, the number of bytes in the buffer must be + zero. */ + assert (!ctx->nbytes); + + if (count > WRITEBUF_SIZE) + count = WRITEBUF_SIZE; + memcpy (ctx->buffer, buffer, count); + ctx->nbytes = count; + + /* We have to reset the is_empty event early, because it is also + used by the select() implementation to probe the channel. */ + if (!ResetEvent (ctx->is_empty)) + { + TRACE_ERR (ctx, GetLastError (), "ResetEvent failed"); + _gpgrt_lock_unlock (&ctx->mutex); + /* FIXME: Should translate the error code. */ + _gpg_err_set_errno (EIO); + return -1; + } + if (!SetEvent (ctx->have_data)) + { + TRACE_ERR (ctx, GetLastError (), "SetEvent failed"); + _gpgrt_lock_unlock (&ctx->mutex); + /* FIXME: Should translate the error code. */ + _gpg_err_set_errno (EIO); + return -1; + } + _gpgrt_lock_unlock (&ctx->mutex); + + return (int) count; +} + + +int +_gpgrt_w32_poll (gpgrt_poll_t *fds, size_t nfds, int timeout) +{ + HANDLE waitbuf[MAXIMUM_WAIT_OBJECTS]; + int waitidx[MAXIMUM_WAIT_OBJECTS]; + int code; + int nwait; + int i; + int any; + int count; + +#if 0 + restart: +#endif + + TRACE ("poll on [ "); + any = 0; + nwait = 0; + count = 0; + for (i = 0; i < nfds; i++) + { + struct estream_cookie_w32_pollable *pcookie; + + if (fds[i].ignore) + continue; + + if (fds[i].stream->intern->kind != BACKEND_W32_POLLABLE) + { + /* This stream does not support polling. */ + fds[i].got_err = 1; + continue; + } + + pcookie = fds[i].stream->intern->cookie; + + if (fds[i].want_read || fds[i].want_write) + { + /* XXX: What if one wants read and write, is that supported? */ + if (fds[i].want_read) + { + struct reader_context_s *ctx = pcookie->reader; + TRACE ("%d/read ", i); + if (ctx == NULL) + { + pcookie->reader = ctx = create_reader (pcookie); + if (!ctx) + { + /* FIXME: Is the error code appropriate? */ + _gpg_err_set_errno (EBADF); + return -1; + } + } + + if (nwait >= DIM (waitbuf)) + { + TRACE ("oops ]: Too many objects for WFMO!\n"); + /* FIXME: Should translate the error code. */ + _gpg_err_set_errno (EIO); + return -1; + } + waitidx[nwait] = i; + waitbuf[nwait++] = ctx->have_data_ev; + any = 1; + } + else if (fds[i].want_write) + { + struct writer_context_s *ctx = pcookie->writer; + TRACE ("%d/write ", i); + if (ctx == NULL) + { + pcookie->writer = ctx = create_writer (pcookie); + if (!ctx) + { + /* FIXME: Is the error code appropriate? */ + _gpg_err_set_errno (EBADF); + return -1; + } + } + + if (nwait >= DIM (waitbuf)) + { + TRACE ("oops ]: Too many objects for WFMO!"); + /* FIXME: Should translate the error code. */ + _gpg_err_set_errno (EIO); + return -1; + } + waitidx[nwait] = i; + waitbuf[nwait++] = ctx->is_empty; + any = 1; + } + } + } + TRACE ("]\n"); + if (!any) + return 0; + + code = WaitForMultipleObjects (nwait, waitbuf, 0, + timeout == -1 ? INFINITE : timeout); + if (code >= WAIT_OBJECT_0 && code < WAIT_OBJECT_0 + nwait) + { + /* This WFMO is a really silly function: It does return either + the index of the signaled object or if 2 objects have been + signalled at the same time, the index of the object with the + lowest object is returned - so and how do we find out how + many objects have been signaled???. The only solution I can + imagine is to test each object starting with the returned + index individually - how dull. */ + any = 0; + for (i = code - WAIT_OBJECT_0; i < nwait; i++) + { + if (WaitForSingleObject (waitbuf[i], 0) == WAIT_OBJECT_0) + { + assert (waitidx[i] >=0 && waitidx[i] < nfds); + /* XXX: What if one wants read and write, is that + supported? */ + if (fds[waitidx[i]].want_read) + fds[waitidx[i]].got_read = 1; + else if (fds[waitidx[i]].want_write) + fds[waitidx[i]].got_write = 1; + any = 1; + count++; + } + } + if (!any) + { + TRACE ("no signaled objects found after WFMO\n"); + count = -1; + } + } + else if (code == WAIT_TIMEOUT) + TRACE ("WFMO timed out\n"); + else if (code == WAIT_FAILED) + { + TRACE_ERR (NULL, GetLastError (), "WFMO failed"); +#if 0 + if (GetLastError () == ERROR_INVALID_HANDLE) + { + int k; + int j = handle_to_fd (waitbuf[i]); + + TRACE ("WFMO invalid handle %d removed\n", j); + for (k = 0 ; k < nfds; k++) + { + if (fds[k].fd == j) + { + fds[k].want_read = fds[k].want_write = 0; + goto restart; + } + } + TRACE (" oops, or not???\n"); + } +#endif + count = -1; + } + else + { + TRACE ("WFMO returned %d\n", code); + count = -1; + } + + if (count > 0) + { + TRACE ("poll OK [ "); + for (i = 0; i < nfds; i++) + { + if (fds[i].ignore) + continue; + if (fds[i].got_read || fds[i].got_write) + TRACE ("%c%d ", fds[i].want_read ? 'r' : 'w', i); + } + TRACE ("]\n"); + } + + if (count < 0) + { + /* FIXME: Should determine a proper error code. */ + _gpg_err_set_errno (EIO); + } + + return count; +} + + + +/* + * Implementation of pollable I/O on Windows. + */ + +/* + * Constructor for pollable objects. + */ +int +_gpgrt_w32_pollable_create (void *_GPGRT__RESTRICT *_GPGRT__RESTRICT cookie, + unsigned int modeflags, + struct cookie_io_functions_s next_functions, + void *next_cookie) +{ + estream_cookie_w32_pollable_t pcookie; + int err; + + pcookie = _gpgrt_malloc (sizeof *pcookie); + if (!pcookie) + err = -1; + else + { + pcookie->modeflags = modeflags; + pcookie->next_functions = next_functions; + pcookie->next_cookie = next_cookie; + pcookie->reader = NULL; + pcookie->writer = NULL; + *cookie = pcookie; + err = 0; + } + + return err; +} + + +/* + * Seek function for pollable objects. + */ +static int +func_w32_pollable_seek (void *cookie, gpgrt_off_t *offset, int whence) +{ + estream_cookie_w32_pollable_t pcookie = cookie; + (void) pcookie; + (void) offset; + (void) whence; + /* XXX */ + _gpg_err_set_errno (EOPNOTSUPP); + return -1; +} + + +/* + * The IOCTL function for pollable objects. + */ +static int +func_w32_pollable_ioctl (void *cookie, int cmd, void *ptr, size_t *len) +{ + estream_cookie_w32_pollable_t pcookie = cookie; + cookie_ioctl_function_t func_ioctl = pcookie->next_functions.func_ioctl; + + if (cmd == COOKIE_IOCTL_NONBLOCK) + { + if (ptr) + pcookie->modeflags |= O_NONBLOCK; + else + pcookie->modeflags &= ~O_NONBLOCK; + return 0; + } + + if (func_ioctl) + return func_ioctl (pcookie->next_cookie, cmd, ptr, len); + + _gpg_err_set_errno (EOPNOTSUPP); + return -1; +} + + +/* + * The destroy function for pollable objects. + */ +static int +func_w32_pollable_destroy (void *cookie) +{ + estream_cookie_w32_pollable_t pcookie = cookie; + + if (cookie) + { + if (pcookie->reader) + destroy_reader (pcookie->reader); + if (pcookie->writer) + destroy_writer (pcookie->writer); + pcookie->next_functions.public.func_close (pcookie->next_cookie); + _gpgrt_free (pcookie); + } + return 0; +} + +/* + * Access object for the pollable functions. + */ +struct cookie_io_functions_s _gpgrt_functions_w32_pollable = + { + { + func_w32_pollable_read, + func_w32_pollable_write, + func_w32_pollable_seek, + func_w32_pollable_destroy, + }, + func_w32_pollable_ioctl, + }; diff --git a/tests/t-poll.c b/tests/t-poll.c index 026bb88..d39797a 100644 --- a/tests/t-poll.c +++ b/tests/t-poll.c @@ -191,14 +191,14 @@ create_pipe (estream_t *r_in, estream_t *r_out) show ("created pipe [%d, %d]\n", filedes[0], filedes[1]); - *r_in = es_fdopen (filedes[0], "r"); + *r_in = es_fdopen (filedes[0], "r,pollable"); if (!*r_in) { err = gpg_error_from_syserror (); die ("error creating a stream for a pipe: %s\n", gpg_strerror (err)); } - *r_out = es_fdopen (filedes[1], "w"); + *r_out = es_fdopen (filedes[1], "w,pollable"); if (!*r_out) { err = gpg_error_from_syserror (); commit e15416d3668ea9dcc6a64cbb98140a99be8a7865 Author: Justus Winter Date: Wed Oct 19 12:20:43 2016 +0200 estream: Track the kind of backend used. * src/estream.c (struct _gpgrt_stream_internal): Add 'kind'. (init_stream_obj): New parameter 'kind', initialize field. (es_create): New parameter 'kind'. Update all callers. * src/gpgrt-int.h (gpgrt_stream_backend_kind_t): New type. Signed-off-by: Justus Winter diff --git a/src/estream.c b/src/estream.c index 696e1e3..aca7db7 100644 --- a/src/estream.c +++ b/src/estream.c @@ -203,6 +203,7 @@ struct _gpgrt_stream_internal gpgrt_lock_t lock; /* Lock. Used by *_stream_lock(). */ + gpgrt_stream_backend_kind_t kind; void *cookie; /* Cookie. */ void *opaque; /* Opaque data. */ unsigned int modeflags; /* Flags for the backend. */ @@ -2007,9 +2008,11 @@ es_empty (estream_t stream) static void init_stream_obj (estream_t stream, void *cookie, es_syshd_t *syshd, + gpgrt_stream_backend_kind_t kind, struct cookie_io_functions_s functions, unsigned int modeflags, unsigned int xmode) { + stream->intern->kind = kind; stream->intern->cookie = cookie; stream->intern->opaque = NULL; stream->intern->offset = 0; @@ -2092,6 +2095,7 @@ es_deinitialize (estream_t stream) */ static int es_create (estream_t *stream, void *cookie, es_syshd_t *syshd, + gpgrt_stream_backend_kind_t kind, struct cookie_io_functions_s functions, unsigned int modeflags, unsigned int xmode, int with_locked_list) { @@ -2122,7 +2126,8 @@ es_create (estream_t *stream, void *cookie, es_syshd_t *syshd, stream_new->unread_buffer_size = sizeof (stream_internal_new->unread_buffer); stream_new->intern = stream_internal_new; - init_stream_obj (stream_new, cookie, syshd, functions, modeflags, xmode); + init_stream_obj (stream_new, cookie, syshd, kind, functions, modeflags, + xmode); init_stream_lock (stream_new); err = do_list_add (stream_new, with_locked_list); @@ -2829,7 +2834,7 @@ doreadline (estream_t _GPGRT__RESTRICT stream, size_t max_length, goto out; memset (&syshd, 0, sizeof syshd); - err = es_create (&line_stream, line_stream_cookie, &syshd, + err = es_create (&line_stream, line_stream_cookie, &syshd, BACKEND_MEM, estream_functions_mem, O_RDWR, 1, 0); if (err) goto out; @@ -3080,8 +3085,8 @@ _gpgrt_fopen (const char *_GPGRT__RESTRICT path, syshd.type = ES_SYSHD_FD; syshd.u.fd = fd; create_called = 1; - err = es_create (&stream, cookie, &syshd, estream_functions_fd, modeflags, - xmode, 0); + err = es_create (&stream, cookie, &syshd, BACKEND_FD, + estream_functions_fd, modeflags, xmode, 0); if (err) goto out; @@ -3137,7 +3142,7 @@ _gpgrt_mopen (void *_GPGRT__RESTRICT data, size_t data_n, size_t data_len, memset (&syshd, 0, sizeof syshd); create_called = 1; - err = es_create (&stream, cookie, &syshd, + err = es_create (&stream, cookie, &syshd, BACKEND_MEM, estream_functions_mem, modeflags, xmode, 0); out: @@ -3171,8 +3176,8 @@ _gpgrt_fopenmem (size_t memlimit, const char *_GPGRT__RESTRICT mode) return NULL; memset (&syshd, 0, sizeof syshd); - if (es_create (&stream, cookie, &syshd, estream_functions_mem, modeflags, - xmode, 0)) + if (es_create (&stream, cookie, &syshd, BACKEND_MEM, + estream_functions_mem, modeflags, xmode, 0)) (*estream_functions_mem.public.func_close) (cookie); return stream; @@ -3233,8 +3238,8 @@ _gpgrt_fopencookie (void *_GPGRT__RESTRICT cookie, goto out; memset (&syshd, 0, sizeof syshd); - err = es_create (&stream, cookie, &syshd, io_functions, modeflags, - xmode, 0); + err = es_create (&stream, cookie, &syshd, BACKEND_USER, io_functions, + modeflags, xmode, 0); if (err) goto out; @@ -3276,7 +3281,7 @@ do_fdopen (int filedes, const char *mode, int no_close, int with_locked_list) syshd.type = ES_SYSHD_FD; syshd.u.fd = filedes; create_called = 1; - err = es_create (&stream, cookie, &syshd, estream_functions_fd, + err = es_create (&stream, cookie, &syshd, BACKEND_FD, estream_functions_fd, modeflags, xmode, with_locked_list); if (!err && stream) @@ -3342,7 +3347,7 @@ do_fpopen (FILE *fp, const char *mode, int no_close, int with_locked_list) syshd.type = ES_SYSHD_FD; syshd.u.fd = fp? fileno (fp): -1; create_called = 1; - err = es_create (&stream, cookie, &syshd, estream_functions_fp, + err = es_create (&stream, cookie, &syshd, BACKEND_FP, estream_functions_fp, modeflags, xmode, with_locked_list); out: @@ -3402,8 +3407,8 @@ do_w32open (HANDLE hd, const char *mode, syshd.type = ES_SYSHD_HANDLE; syshd.u.handle = hd; create_called = 1; - err = es_create (&stream, cookie, &syshd, estream_functions_w32, - modeflags, xmode, with_locked_list); + err = es_create (&stream, cookie, &syshd, BACKEND_W32, + estream_functions_w32, modeflags, xmode, with_locked_list); leave: if (err && create_called) @@ -3581,8 +3586,8 @@ _gpgrt_freopen (const char *_GPGRT__RESTRICT path, syshd.type = ES_SYSHD_FD; syshd.u.fd = fd; create_called = 1; - init_stream_obj (stream, cookie, &syshd, estream_functions_fd, - modeflags, xmode); + init_stream_obj (stream, cookie, &syshd, BACKEND_FD, + estream_functions_fd, modeflags, xmode); leave: @@ -4575,8 +4580,8 @@ _gpgrt_tmpfile (void) syshd.type = ES_SYSHD_FD; syshd.u.fd = fd; create_called = 1; - err = es_create (&stream, cookie, &syshd, estream_functions_fd, modeflags, - 0, 0); + err = es_create (&stream, cookie, &syshd, BACKEND_FD, estream_functions_fd, + modeflags, 0, 0); out: if (err) diff --git a/src/gpgrt-int.h b/src/gpgrt-int.h index 475d38a..a517cc6 100644 --- a/src/gpgrt-int.h +++ b/src/gpgrt-int.h @@ -69,6 +69,17 @@ struct cookie_io_functions_s cookie_ioctl_function_t func_ioctl; }; +typedef enum + { + BACKEND_MEM, + BACKEND_FD, + BACKEND_W32, + BACKEND_FP, + BACKEND_USER, + BACKEND_W32_POLLABLE, + } gpgrt_stream_backend_kind_t; + + /* Local prototypes for estream. */ int _gpgrt_es_init (void); commit a0651e910f962a49b0b7f7942512f17a5fe39a7d Author: Justus Winter Date: Wed Oct 19 12:20:42 2016 +0200 estream: Rework how the cookie functions are handled. * src/estream.c (cookie_ioctl_function_t): Move to 'gpgrt-int.h', along with the macros for the IOCTL numbers. (estream_functions_mem): Use the new type and add the ioctl function. (estream_functions_fd): Likewise. (estream_functions_w32): Likewise. (estream_functions_fp): Likewise. (init_stream_object): Use the new type, and also initialize 'func_ioctl'. (es_create): Use the new type. (_gpgrt_fopen): Adapt. (_gpgrt_mopen): Likewise. (_gpgrt_fopenmem): Likewise. (_gpgrt_fopencookie): Likewise. (_gpgrt_fdopen): Likewise. (_gpgrt_fpopen): Likewise. (do_w32open): Likewise. * src/gpgrt-int.h (struct cookie_io_functions_s): New type. Signed-off-by: Justus Winter diff --git a/src/estream.c b/src/estream.c index 6e3b985..696e1e3 100644 --- a/src/estream.c +++ b/src/estream.c @@ -194,16 +194,6 @@ typedef struct notify_list_s *notify_list_t; /* - * A private cookie function to implement an internal IOCTL service. - * and ist IOCTL numbers. - */ -typedef int (*cookie_ioctl_function_t) (void *cookie, int cmd, - void *ptr, size_t *len); -#define COOKIE_IOCTL_SNATCH_BUFFER 1 -#define COOKIE_IOCTL_NONBLOCK 2 - - -/* * The private object describing a stream. */ struct _gpgrt_stream_internal @@ -946,12 +936,15 @@ func_mem_destroy (void *cookie) /* * Access object for the memory functions. */ -static gpgrt_cookie_io_functions_t estream_functions_mem = +static struct cookie_io_functions_s estream_functions_mem = { - func_mem_read, - func_mem_write, - func_mem_seek, - func_mem_destroy + { + func_mem_read, + func_mem_write, + func_mem_seek, + func_mem_destroy, + }, + func_mem_ioctl, }; @@ -1171,12 +1164,15 @@ func_fd_destroy (void *cookie) /* * Access object for the fd functions. */ -static gpgrt_cookie_io_functions_t estream_functions_fd = +static struct cookie_io_functions_s estream_functions_fd = { - func_fd_read, - func_fd_write, - func_fd_seek, - func_fd_destroy + { + func_fd_read, + func_fd_write, + func_fd_seek, + func_fd_destroy, + }, + func_fd_ioctl, }; @@ -1406,12 +1402,15 @@ func_w32_destroy (void *cookie) /* * Access object for the W32 handle based objects. */ -static gpgrt_cookie_io_functions_t estream_functions_w32 = +static struct cookie_io_functions_s estream_functions_w32 = { - func_w32_read, - func_w32_write, - func_w32_seek, - func_w32_destroy + { + func_w32_read, + func_w32_write, + func_w32_seek, + func_w32_destroy, + }, + NULL, }; #endif /*HAVE_W32_SYSTEM*/ @@ -1617,12 +1616,15 @@ func_fp_destroy (void *cookie) /* * Access object for stdio based objects. */ -static gpgrt_cookie_io_functions_t estream_functions_fp = +static struct cookie_io_functions_s estream_functions_fp = { - func_fp_read, - func_fp_write, - func_fp_seek, - func_fp_destroy + { + func_fp_read, + func_fp_write, + func_fp_seek, + func_fp_destroy, + }, + NULL, }; @@ -2005,17 +2007,17 @@ es_empty (estream_t stream) static void init_stream_obj (estream_t stream, void *cookie, es_syshd_t *syshd, - gpgrt_cookie_io_functions_t functions, + struct cookie_io_functions_s functions, unsigned int modeflags, unsigned int xmode) { stream->intern->cookie = cookie; stream->intern->opaque = NULL; stream->intern->offset = 0; - stream->intern->func_read = functions.func_read; - stream->intern->func_write = functions.func_write; - stream->intern->func_seek = functions.func_seek; - stream->intern->func_ioctl = NULL; - stream->intern->func_close = functions.func_close; + stream->intern->func_read = functions.public.func_read; + stream->intern->func_write = functions.public.func_write; + stream->intern->func_seek = functions.public.func_seek; + stream->intern->func_ioctl = functions.func_ioctl; + stream->intern->func_close = functions.public.func_close; stream->intern->strategy = _IOFBF; stream->intern->syshd = *syshd; stream->intern->print_ntotal = 0; @@ -2090,7 +2092,7 @@ es_deinitialize (estream_t stream) */ static int es_create (estream_t *stream, void *cookie, es_syshd_t *syshd, - gpgrt_cookie_io_functions_t functions, unsigned int modeflags, + struct cookie_io_functions_s functions, unsigned int modeflags, unsigned int xmode, int with_locked_list) { estream_internal_t stream_internal_new; @@ -3089,7 +3091,7 @@ _gpgrt_fopen (const char *_GPGRT__RESTRICT path, out: if (err && create_called) - (*estream_functions_fd.func_close) (cookie); + (*estream_functions_fd.public.func_close) (cookie); return stream; } @@ -3141,7 +3143,7 @@ _gpgrt_mopen (void *_GPGRT__RESTRICT data, size_t data_n, size_t data_len, out: if (err && create_called) - (*estream_functions_mem.func_close) (cookie); + (*estream_functions_mem.public.func_close) (cookie); return stream; } @@ -3171,10 +3173,7 @@ _gpgrt_fopenmem (size_t memlimit, const char *_GPGRT__RESTRICT mode) memset (&syshd, 0, sizeof syshd); if (es_create (&stream, cookie, &syshd, estream_functions_mem, modeflags, xmode, 0)) - (*estream_functions_mem.func_close) (cookie); - - if (stream) - stream->intern->func_ioctl = func_mem_ioctl; + (*estream_functions_mem.public.func_close) (cookie); return stream; } @@ -3224,6 +3223,7 @@ _gpgrt_fopencookie (void *_GPGRT__RESTRICT cookie, estream_t stream; int err; es_syshd_t syshd; + struct cookie_io_functions_s io_functions = { functions, NULL, }; stream = NULL; modeflags = 0; @@ -3233,7 +3233,7 @@ _gpgrt_fopencookie (void *_GPGRT__RESTRICT cookie, goto out; memset (&syshd, 0, sizeof syshd); - err = es_create (&stream, cookie, &syshd, functions, modeflags, + err = es_create (&stream, cookie, &syshd, io_functions, modeflags, xmode, 0); if (err) goto out; @@ -3281,14 +3281,14 @@ do_fdopen (int filedes, const char *mode, int no_close, int with_locked_list) if (!err && stream) { - stream->intern->func_ioctl = func_fd_ioctl; if ((modeflags & O_NONBLOCK)) - err = func_fd_ioctl (cookie, COOKIE_IOCTL_NONBLOCK, "", NULL); + err = stream->intern->func_ioctl (cookie, COOKIE_IOCTL_NONBLOCK, + "", NULL); } out: if (err && create_called) - (*estream_functions_fd.func_close) (cookie); + (*estream_functions_fd.public.func_close) (cookie); return stream; } @@ -3348,7 +3348,7 @@ do_fpopen (FILE *fp, const char *mode, int no_close, int with_locked_list) out: if (err && create_called) - (*estream_functions_fp.func_close) (cookie); + (*estream_functions_fp.public.func_close) (cookie); return stream; } @@ -3407,7 +3407,7 @@ do_w32open (HANDLE hd, const char *mode, leave: if (err && create_called) - (*estream_functions_w32.func_close) (cookie); + (*estream_functions_w32.public.func_close) (cookie); return stream; } diff --git a/src/gpgrt-int.h b/src/gpgrt-int.h index b2b553b..475d38a 100644 --- a/src/gpgrt-int.h +++ b/src/gpgrt-int.h @@ -50,6 +50,26 @@ gpg_err_code_t _gpgrt_lock_destroy (gpgrt_lock_t *lockhd); gpg_err_code_t _gpgrt_yield (void); +/* Local definitions for estream. */ + +/* + * A private cookie function to implement an internal IOCTL service. + * and ist IOCTL numbers. + */ +typedef int (*cookie_ioctl_function_t) (void *cookie, int cmd, + void *ptr, size_t *len); +#define COOKIE_IOCTL_SNATCH_BUFFER 1 +#define COOKIE_IOCTL_NONBLOCK 2 + +/* An internal variant of gpgrt_cookie_close_function_t with a slot + for the ioctl function. */ +struct cookie_io_functions_s +{ + struct _gpgrt_cookie_io_functions public; + cookie_ioctl_function_t func_ioctl; +}; + + /* Local prototypes for estream. */ int _gpgrt_es_init (void); void _gpgrt_set_syscall_clamp (void (*pre)(void), void (*post)(void)); commit 135319b5d1f9a88187687646c762759cfa05a7ec Author: Justus Winter Date: Wed Oct 19 12:20:41 2016 +0200 estream: Rework modestring handling. * src/estream.c (X_SAMETHREAD, X_SYSOPEN): New macros. (parse_mode): Rework how information flows from here to 'es_create'. Instead of using an integer flag per mode, use flags. (init_stream_obj): Adapt accordingly. (es_create): Likewise. (_gpgrt_fopen): Likewise. (_gpgrt_mopen): Likewise. (_gpgrt_fopenmem): Likewise. (_gpgrt_fopencookie): Likewise. (_gpgrt_fdopen): Likewise. (_gpgrt_fpopen): Likewise. (do_w32open): Likewise. (_gpgrt_freopen): Likewise. Signed-off-by: Justus Winter diff --git a/src/estream.c b/src/estream.c index 752d22e..6e3b985 100644 --- a/src/estream.c +++ b/src/estream.c @@ -1680,6 +1680,10 @@ func_file_create (void **cookie, int *filedes, +/* Flags used by parse_mode and friends. */ +#define X_SAMETHREAD (1 << 0) +#define X_SYSOPEN (1 << 1) + /* Parse the mode flags of fopen et al. In addition to the POSIX * defined mode flags keyword parameters are supported. These are * key/value pairs delimited by comma and optional white spaces. @@ -1721,15 +1725,14 @@ func_file_create (void **cookie, int *filedes, */ static int parse_mode (const char *modestr, - unsigned int *modeflags, int *samethread, int *sysopen, + unsigned int *modeflags, + unsigned int *r_xmode, unsigned int *r_cmode) { unsigned int omode, oflags, cmode; int got_cmode = 0; - *samethread = 0; - if (sysopen) - *sysopen = 0; + *r_xmode = 0; switch (*modestr) { @@ -1811,7 +1814,7 @@ parse_mode (const char *modestr, _set_errno (EINVAL); return -1; } - *samethread = 1; + *r_xmode |= X_SAMETHREAD; } else if (!strncmp (modestr, "nonblock", 8)) { @@ -1831,8 +1834,7 @@ parse_mode (const char *modestr, _set_errno (EINVAL); return -1; } - if (sysopen) - *sysopen = 1; + *r_xmode |= X_SYSOPEN; } } if (!got_cmode) @@ -2004,7 +2006,7 @@ static void init_stream_obj (estream_t stream, void *cookie, es_syshd_t *syshd, gpgrt_cookie_io_functions_t functions, - unsigned int modeflags, int samethread) + unsigned int modeflags, unsigned int xmode) { stream->intern->cookie = cookie; stream->intern->opaque = NULL; @@ -2025,7 +2027,7 @@ init_stream_obj (estream_t stream, stream->intern->deallocate_buffer = 0; stream->intern->printable_fname = NULL; stream->intern->printable_fname_inuse = 0; - stream->intern->samethread = !!samethread; + stream->intern->samethread = !! (xmode & X_SAMETHREAD); stream->intern->onclose = NULL; stream->data_len = 0; @@ -2089,7 +2091,7 @@ es_deinitialize (estream_t stream) static int es_create (estream_t *stream, void *cookie, es_syshd_t *syshd, gpgrt_cookie_io_functions_t functions, unsigned int modeflags, - int samethread, int with_locked_list) + unsigned int xmode, int with_locked_list) { estream_internal_t stream_internal_new; estream_t stream_new; @@ -2118,7 +2120,7 @@ es_create (estream_t *stream, void *cookie, es_syshd_t *syshd, stream_new->unread_buffer_size = sizeof (stream_internal_new->unread_buffer); stream_new->intern = stream_internal_new; - init_stream_obj (stream_new, cookie, syshd, functions, modeflags, samethread); + init_stream_obj (stream_new, cookie, syshd, functions, modeflags, xmode); init_stream_lock (stream_new); err = do_list_add (stream_new, with_locked_list); @@ -3053,8 +3055,8 @@ estream_t _gpgrt_fopen (const char *_GPGRT__RESTRICT path, const char *_GPGRT__RESTRICT mode) { - unsigned int modeflags, cmode; - int samethread, sysopen, create_called; + unsigned int modeflags, cmode, xmode; + int create_called; estream_t stream; void *cookie; int err; @@ -3065,7 +3067,7 @@ _gpgrt_fopen (const char *_GPGRT__RESTRICT path, cookie = NULL; create_called = 0; - err = parse_mode (mode, &modeflags, &samethread, &sysopen, &cmode); + err = parse_mode (mode, &modeflags, &xmode, &cmode); if (err) goto out; @@ -3077,7 +3079,7 @@ _gpgrt_fopen (const char *_GPGRT__RESTRICT path, syshd.u.fd = fd; create_called = 1; err = es_create (&stream, cookie, &syshd, estream_functions_fd, modeflags, - samethread, 0); + xmode, 0); if (err) goto out; @@ -3117,12 +3119,11 @@ _gpgrt_mopen (void *_GPGRT__RESTRICT data, size_t data_n, size_t data_len, int create_called = 0; estream_t stream = NULL; void *cookie = NULL; - unsigned int modeflags; - int samethread; + unsigned int modeflags, xmode; int err; es_syshd_t syshd; - err = parse_mode (mode, &modeflags, &samethread, NULL, NULL); + err = parse_mode (mode, &modeflags, &xmode, NULL); if (err) goto out; @@ -3135,7 +3136,7 @@ _gpgrt_mopen (void *_GPGRT__RESTRICT data, size_t data_n, size_t data_len, memset (&syshd, 0, sizeof syshd); create_called = 1; err = es_create (&stream, cookie, &syshd, - estream_functions_mem, modeflags, samethread, 0); + estream_functions_mem, modeflags, xmode, 0); out: @@ -3150,15 +3151,14 @@ _gpgrt_mopen (void *_GPGRT__RESTRICT data, size_t data_n, size_t data_len, estream_t _gpgrt_fopenmem (size_t memlimit, const char *_GPGRT__RESTRICT mode) { - unsigned int modeflags; - int samethread; + unsigned int modeflags, xmode; estream_t stream = NULL; void *cookie = NULL; es_syshd_t syshd; /* Memory streams are always read/write. We use MODE only to get the append flag. */ - if (parse_mode (mode, &modeflags, &samethread, NULL, NULL)) + if (parse_mode (mode, &modeflags, &xmode, NULL)) return NULL; modeflags |= O_RDWR; @@ -3170,7 +3170,7 @@ _gpgrt_fopenmem (size_t memlimit, const char *_GPGRT__RESTRICT mode) memset (&syshd, 0, sizeof syshd); if (es_create (&stream, cookie, &syshd, estream_functions_mem, modeflags, - samethread, 0)) + xmode, 0)) (*estream_functions_mem.func_close) (cookie); if (stream) @@ -3220,8 +3220,7 @@ _gpgrt_fopencookie (void *_GPGRT__RESTRICT cookie, const char *_GPGRT__RESTRICT mode, gpgrt_cookie_io_functions_t functions) { - unsigned int modeflags; - int samethread; + unsigned int modeflags, xmode; estream_t stream; int err; es_syshd_t syshd; @@ -3229,13 +3228,13 @@ _gpgrt_fopencookie (void *_GPGRT__RESTRICT cookie, stream = NULL; modeflags = 0; - err = parse_mode (mode, &modeflags, &samethread, NULL, NULL); + err = parse_mode (mode, &modeflags, &xmode, NULL); if (err) goto out; memset (&syshd, 0, sizeof syshd); err = es_create (&stream, cookie, &syshd, functions, modeflags, - samethread, 0); + xmode, 0); if (err) goto out; @@ -3248,8 +3247,8 @@ _gpgrt_fopencookie (void *_GPGRT__RESTRICT cookie, static estream_t do_fdopen (int filedes, const char *mode, int no_close, int with_locked_list) { - unsigned int modeflags; - int samethread, sysopen, create_called; + unsigned int modeflags, xmode; + int create_called; estream_t stream; void *cookie; int err; @@ -3259,10 +3258,10 @@ do_fdopen (int filedes, const char *mode, int no_close, int with_locked_list) cookie = NULL; create_called = 0; - err = parse_mode (mode, &modeflags, &samethread, &sysopen, NULL); + err = parse_mode (mode, &modeflags, &xmode, NULL); if (err) goto out; - if (sysopen) + if (xmode & X_SYSOPEN) { /* Not allowed for fdopen. */ _set_errno (EINVAL); @@ -3278,7 +3277,7 @@ do_fdopen (int filedes, const char *mode, int no_close, int with_locked_list) syshd.u.fd = filedes; create_called = 1; err = es_create (&stream, cookie, &syshd, estream_functions_fd, - modeflags, samethread, with_locked_list); + modeflags, xmode, with_locked_list); if (!err && stream) { @@ -3312,8 +3311,8 @@ _gpgrt_fdopen_nc (int filedes, const char *mode) static estream_t do_fpopen (FILE *fp, const char *mode, int no_close, int with_locked_list) { - unsigned int modeflags, cmode; - int samethread, sysopen, create_called; + unsigned int modeflags, cmode, xmode; + int create_called; estream_t stream; void *cookie; int err; @@ -3323,10 +3322,10 @@ do_fpopen (FILE *fp, const char *mode, int no_close, int with_locked_list) cookie = NULL; create_called = 0; - err = parse_mode (mode, &modeflags, &samethread, &sysopen, &cmode); + err = parse_mode (mode, &modeflags, &xmode, &cmode); if (err) goto out; - if (sysopen) + if (xmode & X_SYSOPEN) { /* Not allowed for fpopen. */ _set_errno (EINVAL); @@ -3344,7 +3343,7 @@ do_fpopen (FILE *fp, const char *mode, int no_close, int with_locked_list) syshd.u.fd = fp? fileno (fp): -1; create_called = 1; err = es_create (&stream, cookie, &syshd, estream_functions_fp, - modeflags, samethread, with_locked_list); + modeflags, xmode, with_locked_list); out: @@ -3384,8 +3383,7 @@ estream_t do_w32open (HANDLE hd, const char *mode, int no_close, int with_locked_list) { - unsigned int modeflags, cmode; - int samethread; + unsigned int modeflags, cmode, xmode; int create_called = 0; estream_t stream = NULL; void *cookie = NULL; @@ -3393,7 +3391,7 @@ do_w32open (HANDLE hd, const char *mode, es_syshd_t syshd; /* For obvious reasons we ignore sysmode here. */ - err = parse_mode (mode, &modeflags, &samethread, NULL, &cmode); + err = parse_mode (mode, &modeflags, &xmode, &cmode); if (err) goto leave; @@ -3405,7 +3403,7 @@ do_w32open (HANDLE hd, const char *mode, syshd.u.handle = hd; create_called = 1; err = es_create (&stream, cookie, &syshd, estream_functions_w32, - modeflags, samethread, with_locked_list); + modeflags, xmode, with_locked_list); leave: if (err && create_called) @@ -3556,8 +3554,8 @@ _gpgrt_freopen (const char *_GPGRT__RESTRICT path, if (path) { - unsigned int modeflags, cmode; - int dummy, samethread, create_called; + unsigned int modeflags, cmode, xmode, dummy; + int create_called; void *cookie; int fd; es_syshd_t syshd; @@ -3565,13 +3563,13 @@ _gpgrt_freopen (const char *_GPGRT__RESTRICT path, cookie = NULL; create_called = 0; - samethread = stream->intern->samethread; + xmode = stream->intern->samethread ? X_SAMETHREAD : 0; lock_stream (stream); es_deinitialize (stream); - err = parse_mode (mode, &modeflags, &dummy, NULL, &cmode); + err = parse_mode (mode, &modeflags, &dummy, &cmode); if (err) goto leave; (void)dummy; @@ -3584,7 +3582,7 @@ _gpgrt_freopen (const char *_GPGRT__RESTRICT path, syshd.u.fd = fd; create_called = 1; init_stream_obj (stream, cookie, &syshd, estream_functions_fd, - modeflags, samethread); + modeflags, xmode); leave: ----------------------------------------------------------------------- Summary of changes: src/Makefile.am | 3 +- src/estream.c | 336 ++++++++--------- src/gpgrt-int.h | 105 ++++++ src/w32-estream.c | 1047 +++++++++++++++++++++++++++++++++++++++++++++++++++++ tests/t-poll.c | 4 +- 5 files changed, 1315 insertions(+), 180 deletions(-) create mode 100644 src/w32-estream.c hooks/post-receive -- Error codes used by GnuPG et al. http://git.gnupg.org From cvs at cvs.gnupg.org Mon Nov 14 02:31:36 2016 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Mon, 14 Nov 2016 02:31:36 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.1.15-359-g4ee4d0b Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via 4ee4d0b02172cf56d9582bb99e32a65c75315b25 (commit) from 6bf698197222bf6081c249c815aebb075e8ec820 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 4ee4d0b02172cf56d9582bb99e32a65c75315b25 Author: NIIBE Yutaka Date: Mon Nov 14 10:25:43 2016 +0900 scd: Fix status info encoding. * scd/command.c (send_status_info): Do percent plus encoding correctly. -- Reported-by: David H?rdeman Signed-off-by: NIIBE Yutaka diff --git a/scd/command.c b/scd/command.c index 3584593..e771a74 100644 --- a/scd/command.c +++ b/scd/command.c @@ -2137,7 +2137,8 @@ send_status_info (ctrl_t ctrl, const char *keyword, ...) } for ( ; valuelen && n < DIM (buf)-2; n++, valuelen--, value++) { - if (*value < ' ' || *value == '+') + if (*value == '+' || *value == '\"' || *value == '%' + || *value < ' ') { sprintf (p, "%%%02X", *value); p += 3; ----------------------------------------------------------------------- Summary of changes: scd/command.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Mon Nov 14 11:05:19 2016 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Mon, 14 Nov 2016 11:05:19 +0100 Subject: [git] GpgOL - branch, master, updated. gpgol-1.4.0-160-g5888d6d Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG extension for MS Outlook". The branch, master has been updated via 5888d6dcebc5c3e426db597d9d9ecd9c78051a45 (commit) from 74a291515bcfbf3c679e129d4a46d82e12d95319 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 5888d6dcebc5c3e426db597d9d9ecd9c78051a45 Author: Andre Heinecke Date: Mon Nov 14 11:03:36 2016 +0100 Make gpgme install dir selection more flexible * src/main.c (get_gpgme_w32_inst_dir): New. (DllMain): Use it. -- This makes the w32-inst-dir finding work with gpg4win-2 where gpg-w32-spawn is not in the bin dir. diff --git a/src/main.c b/src/main.c index ba379a2..bec5f9f 100644 --- a/src/main.c +++ b/src/main.c @@ -23,6 +23,7 @@ #include #include #include +#include #include "mymapi.h" #include "mymapitags.h" @@ -142,6 +143,32 @@ i18n_init (void) textdomain (PACKAGE_GT); } +static char * +get_gpgme_w32_inst_dir (void) +{ + char *gpg4win_dir = get_gpg4win_dir (); + char *tmp; + gpgrt_asprintf (&tmp, "%s\\bin\\gpgme-w32-spawn.exe", gpg4win_dir); + + if (!access(tmp, R_OK)) + { + xfree (tmp); + gpgrt_asprintf (&tmp, "%s\\bin", gpg4win_dir); + xfree (gpg4win_dir); + return tmp; + } + xfree (tmp); + gpgrt_asprintf (&tmp, "%s\\gpgme-w32-spawn.exe", gpg4win_dir); + + if (!access(tmp, R_OK)) + { + xfree (tmp); + return gpg4win_dir; + } + log_error("%s:%s: Failed to find gpgme-w32-spawn.exe!", + SRCNAME, __func__); + return NULL; +} /* Entry point called by DLL loader. */ int WINAPI @@ -157,8 +184,7 @@ DllMain (HINSTANCE hinst, DWORD reason, LPVOID reserved) /* Set the installation directory for GpgME so that it can find tools like gpgme-w32-spawn correctly. */ - char *instdir; - gpgrt_asprintf (&instdir, "%s\\bin", get_gpg4win_dir ()); + char *instdir = get_gpgme_w32_inst_dir(); gpgme_set_global_flag ("w32-inst-dir", instdir); xfree (instdir); ----------------------------------------------------------------------- Summary of changes: src/main.c | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) hooks/post-receive -- GnuPG extension for MS Outlook http://git.gnupg.org From cvs at cvs.gnupg.org Mon Nov 14 16:16:29 2016 From: cvs at cvs.gnupg.org (by Justus Winter) Date: Mon, 14 Nov 2016 16:16:29 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.1.15-360-g83c184a Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via 83c184a66b73f312425b01008f0495610e5329a4 (commit) from 4ee4d0b02172cf56d9582bb99e32a65c75315b25 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 83c184a66b73f312425b01008f0495610e5329a4 Author: Justus Winter Date: Mon Nov 14 12:37:36 2016 +0100 gpgscm: Avoid cell allocation overhead. * tests/gpgscm/scheme-private.h (struct scheme): New fields 'inhibit_gc', 'reserved_cells', and 'reserved_lineno'. * tests/gpgscm/scheme.c (GC_ENABLED): New macro. (USE_GC_LOCKING): Likewise. (gc_reservations): Likewise. (gc_reservation_failure): New function. (_gc_disable): Likewise. (gc_disable): New macro. (gc_enable): Likewise. (gc_enabled): Likewise. (gc_consume): Likewise. (get_cell_x): Consume reserved cell if garbage collection is disabled. (_get_cell): Assert that gc is enabled. (get_cell): Only record cell in the list of recently allocated cells if gc is enabled. (get_vector_object): Likewise. (gc): Assert that gc is enabled. (s_return): Add comment, adjust call to '_s_return'. (s_return_enable_gc): New macro. (_s_return): Add flag 'enable_gc' and re-enable gc if set. (oblist_add_by_name): Use the new facilities to protect the allocations. (new_frame_in_env): Likewise. (new_slot_spec_in_env): Likewise. (s_save): Likewise. (opexe_0): Likewise. (opexe_1): Likewise. (opexe_2): Likewise. (opexe_5): Likewise. (opexe_6): Likewise. (scheme_init_custom_alloc): Initialize the new fields. -- Every time a cell is allocated, the interpreter may run out of free cells and do a garbage collection. This is problematic because it might garbage collect objects that have been allocated, but are not yet made available to the interpreter. Previously, we would plug such newly allocated cells into the list of newly allocated objects rooted at car(sc->sink), but that requires allocating yet another cell increasing pressure on the memory management system. A faster alternative is to preallocate the cells needed for an operation and make sure the garbage collection is not run until all allocated objects are plugged in. This can be done with gc_disable and gc_enable. This optimization can be applied incrementally. This commit picks all low-hanging fruits. Signed-off-by: Justus Winter diff --git a/tests/gpgscm/scheme-private.h b/tests/gpgscm/scheme-private.h index 884889c..aa78894 100644 --- a/tests/gpgscm/scheme-private.h +++ b/tests/gpgscm/scheme-private.h @@ -121,6 +121,11 @@ pointer COMPILE_HOOK; /* *compile-hook* */ pointer free_cell; /* pointer to top of free cells */ long fcells; /* # of free cells */ +size_t inhibit_gc; /* nesting of gc_disable */ +size_t reserved_cells; /* # of reserved cells */ +#ifndef NDEBUG +int reserved_lineno; /* location of last reservation */ +#endif pointer inport; pointer outport; diff --git a/tests/gpgscm/scheme.c b/tests/gpgscm/scheme.c index 146b9e6..ce31f8d 100644 --- a/tests/gpgscm/scheme.c +++ b/tests/gpgscm/scheme.c @@ -653,13 +653,119 @@ static int alloc_cellseg(scheme *sc, int n) { return n; } + + +/* Controlling the garbage collector. + * + * Every time a cell is allocated, the interpreter may run out of free + * cells and do a garbage collection. This is problematic because it + * might garbage collect objects that have been allocated, but are not + * yet made available to the interpreter. + * + * Previously, we would plug such newly allocated cells into the list + * of newly allocated objects rooted at car(sc->sink), but that + * requires allocating yet another cell increasing pressure on the + * memory management system. + * + * A faster alternative is to preallocate the cells needed for an + * operation and make sure the garbage collection is not run until all + * allocated objects are plugged in. This can be done with gc_disable + * and gc_enable. + */ + +/* The garbage collector is enabled if the inhibit counter is + * zero. */ +#define GC_ENABLED 0 + +/* For now we provide a way to disable this optimization for + * benchmarking and because it produces slightly smaller code. */ +#ifndef USE_GC_LOCKING +# define USE_GC_LOCKING 1 +#endif + +/* To facilitate nested calls to gc_disable, functions that allocate + * more than one cell may define a macro, e.g. foo_allocates. This + * macro can be used to compute the amount of preallocation at the + * call site with the help of this macro. */ +#define gc_reservations(fn) fn ## _allocates + +#if USE_GC_LOCKING + +/* Report a shortage in reserved cells, and terminate the program. */ +static void +gc_reservation_failure(struct scheme *sc) +{ +#ifdef NDEBUG + fprintf(stderr, + "insufficient reservation\n") +#else + fprintf(stderr, + "insufficient reservation in line %d\n", + sc->reserved_lineno); +#endif + abort(); +} + +/* Disable the garbage collection and reserve the given number of + * cells. gc_disable may be nested, but the enclosing reservation + * must include the reservations of all nested calls. */ +static void +_gc_disable(struct scheme *sc, size_t reserve, int lineno) +{ + if (sc->inhibit_gc == 0) { + reserve_cells(sc, (reserve)); + sc->reserved_cells = (reserve); +#ifndef NDEBUG + (void) lineno; +#else + sc->reserved_lineno = lineno; +#endif + } else if (sc->reserved_cells < (reserve)) + gc_reservation_failure (sc); + sc->inhibit_gc += 1; +} +#define gc_disable(sc, reserve) \ + _gc_disable (sc, reserve, __LINE__) + +/* Enable the garbage collector. */ +#define gc_enable(sc) \ + do { \ + assert(sc->inhibit_gc); \ + sc->inhibit_gc -= 1; \ + } while (0) + +/* Test whether the garbage collector is enabled. */ +#define gc_enabled(sc) \ + (sc->inhibit_gc == GC_ENABLED) + +/* Consume a reserved cell. */ +#define gc_consume(sc) \ + do { \ + assert(! gc_enabled (sc)); \ + if (sc->reserved_cells == 0) \ + gc_reservation_failure (sc); \ + sc->reserved_cells -= 1; \ + } while (0) + +#else /* USE_GC_LOCKING */ + +#define gc_disable(sc, reserve) (void) 0 +#define gc_enable(sc) (void) 0 +#define gc_enabled(sc) 1 +#define gc_consume(sc) (void) 0 + +#endif /* USE_GC_LOCKING */ + static INLINE pointer get_cell_x(scheme *sc, pointer a, pointer b) { - if (sc->free_cell != sc->NIL) { + if (! gc_enabled (sc) || sc->free_cell != sc->NIL) { pointer x = sc->free_cell; + if (! gc_enabled (sc)) + gc_consume (sc); sc->free_cell = cdr(x); --sc->fcells; return (x); } + assert (gc_enabled (sc)); return _get_cell (sc, a, b); } @@ -672,6 +778,7 @@ static pointer _get_cell(scheme *sc, pointer a, pointer b) { return sc->sink; } + assert (gc_enabled (sc)); if (sc->free_cell == sc->NIL) { const int min_to_be_recovered = sc->last_cell_seg*8; gc(sc,a, b); @@ -826,7 +933,8 @@ static pointer get_cell(scheme *sc, pointer a, pointer b) typeflag(cell) = T_PAIR; car(cell) = a; cdr(cell) = b; - push_recent_alloc(sc, cell, sc->NIL); + if (gc_enabled (sc)) + push_recent_alloc(sc, cell, sc->NIL); return cell; } @@ -839,7 +947,8 @@ static pointer get_vector_object(scheme *sc, int len, pointer init) ivalue_unchecked(cells)=len; set_num_integer(cells); fill_vector(cells,init); - push_recent_alloc(sc, cells, sc->NIL); + if (gc_enabled (sc)) + push_recent_alloc(sc, cells, sc->NIL); return cells; } @@ -896,9 +1005,11 @@ static pointer oblist_initial_value(scheme *sc) /* returns the new symbol */ static pointer oblist_add_by_name(scheme *sc, const char *name) { +#define oblist_add_by_name_allocates 3 pointer x; int location; + gc_disable(sc, gc_reservations (oblist_add_by_name)); x = immutable_cons(sc, mk_string(sc, name), sc->NIL); typeflag(x) = T_SYMBOL; setimmutable(car(x)); @@ -906,6 +1017,7 @@ static pointer oblist_add_by_name(scheme *sc, const char *name) location = hash_fn(name, ivalue_unchecked(sc->oblist)); set_vector_elem(sc->oblist, location, immutable_cons(sc, x, vector_elem(sc->oblist, location))); + gc_enable(sc); return x; } @@ -1115,6 +1227,7 @@ INTERFACE static pointer set_vector_elem(pointer vec, int ielem, pointer a) { /* get new symbol */ INTERFACE pointer mk_symbol(scheme *sc, const char *name) { +#define mk_symbol_allocates oblist_add_by_name_allocates pointer x; /* first check oblist */ @@ -1345,6 +1458,8 @@ static void gc(scheme *sc, pointer a, pointer b) { pointer p; int i; + assert (gc_enabled (sc)); + if(sc->gc_verbose) { putstr(sc, "gc..."); } @@ -2296,14 +2411,19 @@ static void new_frame_in_env(scheme *sc, pointer old_env) new_frame = sc->NIL; } + gc_disable(sc, 1); sc->envir = immutable_cons(sc, new_frame, old_env); + gc_enable(sc); setenvironment(sc->envir); } static INLINE void new_slot_spec_in_env(scheme *sc, pointer env, pointer variable, pointer value) { - pointer slot = immutable_cons(sc, variable, value); +#define new_slot_spec_in_env_allocates 2 + pointer slot; + gc_disable(sc, gc_reservations (new_slot_spec_in_env)); + slot = immutable_cons(sc, variable, value); if (is_vector(car(env))) { int location = hash_fn(symname(variable), ivalue_unchecked(car(env))); @@ -2313,6 +2433,7 @@ static INLINE void new_slot_spec_in_env(scheme *sc, pointer env, } else { car(env) = immutable_cons(sc, slot, car(env)); } + gc_enable(sc); } static pointer find_slot_in_env(scheme *sc, pointer env, pointer hdl, int all) @@ -2385,6 +2506,7 @@ static pointer find_slot_in_env(scheme *sc, pointer env, pointer hdl, int all) static INLINE void new_slot_in_env(scheme *sc, pointer variable, pointer value) { +#define new_slot_in_env_allocates new_slot_spec_in_env_allocates new_slot_spec_in_env(sc, sc->envir, variable, value); } @@ -2488,7 +2610,13 @@ static pointer _Error_1(scheme *sc, const char *s, pointer a) { #define CASE(OP) case OP #endif /* USE_THREADED_CODE */ -#define s_return(sc,a) return _s_return(sc,a) +/* Return to the previous frame on the dump stack, setting the current + * value to A. */ +#define s_return(sc, a) return _s_return(sc, a, 0) + +/* Return to the previous frame on the dump stack, setting the current + * value to A, and re-enable the garbage collector. */ +#define s_return_enable_gc(sc, a) return _s_return(sc, a, 1) static INLINE void dump_stack_reset(scheme *sc) { @@ -2505,10 +2633,12 @@ static void dump_stack_free(scheme *sc) sc->dump = sc->NIL; } -static pointer _s_return(scheme *sc, pointer a) { +static pointer _s_return(scheme *sc, pointer a, int enable_gc) { pointer dump = sc->dump; pointer op; sc->value = (a); + if (enable_gc) + gc_enable(sc); if (dump == sc->NIL) return sc->NIL; free_cons(sc, dump, &op, &dump); @@ -2520,9 +2650,13 @@ static pointer _s_return(scheme *sc, pointer a) { } static void s_save(scheme *sc, enum scheme_opcodes op, pointer args, pointer code) { - sc->dump = cons(sc, sc->envir, cons(sc, (code), sc->dump)); - sc->dump = cons(sc, (args), sc->dump); - sc->dump = cons(sc, mk_integer(sc, (long)(op)), sc->dump); +#define s_save_allocates 5 + pointer dump; + gc_disable(sc, gc_reservations (s_save)); + dump = cons(sc, sc->envir, cons(sc, (code), sc->dump)); + dump = cons(sc, (args), dump); + sc->dump = cons(sc, mk_integer(sc, (long)(op)), dump); + gc_enable(sc); } static INLINE void dump_stack_mark(scheme *sc) @@ -2650,8 +2784,10 @@ static pointer opexe_0(scheme *sc, enum scheme_opcodes op) { CASE(OP_E0ARGS): /* eval arguments */ if (is_macro(sc->value)) { /* macro expansion */ + gc_disable(sc, 1 + gc_reservations (s_save)); s_save(sc,OP_DOMACRO, sc->NIL, sc->NIL); sc->args = cons(sc,sc->code, sc->NIL); + gc_enable(sc); sc->code = sc->value; s_thread_to(sc,OP_APPLY); } else { @@ -2660,7 +2796,9 @@ static pointer opexe_0(scheme *sc, enum scheme_opcodes op) { } CASE(OP_E1ARGS): /* eval arguments */ - sc->args = cons(sc, sc->value, sc->args); + gc_disable(sc, 1); + sc->args = cons(sc, sc->value, sc->args); + gc_enable(sc); if (is_pair(sc->code)) { /* continue */ s_save(sc,OP_E1ARGS, sc->args, cdr(sc->code)); sc->code = car(sc->code); @@ -2677,7 +2815,8 @@ static pointer opexe_0(scheme *sc, enum scheme_opcodes op) { CASE(OP_TRACING): { int tr=sc->tracing; sc->tracing=ivalue(car(sc->args)); - s_return(sc,mk_integer(sc,tr)); + gc_disable(sc, 1); + s_return_enable_gc(sc, mk_integer(sc, tr)); } #endif @@ -2749,19 +2888,23 @@ static pointer opexe_0(scheme *sc, enum scheme_opcodes op) { sc->value = sc->code; /* Fallthru */ } else { + gc_disable(sc, 1 + gc_reservations (s_save)); s_save(sc,OP_LAMBDA1,sc->args,sc->code); sc->args=cons(sc,sc->code,sc->NIL); + gc_enable(sc); sc->code=slot_value_in_env(f); s_thread_to(sc,OP_APPLY); } } CASE(OP_LAMBDA1): - s_return(sc,mk_closure(sc, sc->value, sc->envir)); + gc_disable(sc, 1); + s_return_enable_gc(sc, mk_closure(sc, sc->value, sc->envir)); #else CASE(OP_LAMBDA): /* lambda */ - s_return(sc,mk_closure(sc, sc->code, sc->envir)); + gc_disable(sc, 1); + s_return_enable_gc(sc, mk_closure(sc, sc->code, sc->envir)); #endif @@ -2775,7 +2918,8 @@ static pointer opexe_0(scheme *sc, enum scheme_opcodes op) { } else { y=cadr(sc->args); } - s_return(sc,mk_closure(sc, x, y)); + gc_disable(sc, 1); + s_return_enable_gc(sc, mk_closure(sc, x, y)); CASE(OP_QUOTE): /* quote */ s_return(sc,car(sc->code)); @@ -2786,7 +2930,9 @@ static pointer opexe_0(scheme *sc, enum scheme_opcodes op) { if (is_pair(car(sc->code))) { x = caar(sc->code); + gc_disable(sc, 2); sc->code = cons(sc, sc->LAMBDA, cons(sc, cdar(sc->code), cdr(sc->code))); + gc_enable(sc); } else { x = car(sc->code); sc->code = cadr(sc->code); @@ -2861,6 +3007,7 @@ static pointer opexe_0(scheme *sc, enum scheme_opcodes op) { s_thread_to(sc,OP_LET1); CASE(OP_LET1): /* let (calculate parameters) */ + gc_disable(sc, 1 + (is_pair(sc->code) ? gc_reservations (s_save) : 0)); sc->args = cons(sc, sc->value, sc->args); if (is_pair(sc->code)) { /* continue */ if (!is_pair(car(sc->code)) || !is_pair(cdar(sc->code))) { @@ -2868,10 +3015,12 @@ static pointer opexe_0(scheme *sc, enum scheme_opcodes op) { car(sc->code)); } s_save(sc,OP_LET1, sc->args, cdr(sc->code)); + gc_enable(sc); sc->code = cadar(sc->code); sc->args = sc->NIL; s_thread_to(sc,OP_EVAL); } else { /* end */ + gc_enable(sc); sc->args = reverse_in_place(sc, sc->NIL, sc->args); sc->code = car(sc->args); sc->args = cdr(sc->args); @@ -2890,10 +3039,14 @@ static pointer opexe_0(scheme *sc, enum scheme_opcodes op) { Error_1(sc, "Bad syntax of binding in let :", x); if (!is_list(sc, car(x))) Error_1(sc, "Bad syntax of binding in let :", car(x)); + gc_disable(sc, 1); sc->args = cons(sc, caar(x), sc->args); + gc_enable(sc); } + gc_disable(sc, 2 + gc_reservations (new_slot_in_env)); x = mk_closure(sc, cons(sc, reverse_in_place(sc, sc->NIL, sc->args), cddr(sc->code)), sc->envir); new_slot_in_env(sc, car(sc->code), x); + gc_enable(sc); sc->code = cddr(sc->code); sc->args = sc->NIL; } else { @@ -2951,7 +3104,9 @@ static pointer opexe_1(scheme *sc, enum scheme_opcodes op) { s_thread_to(sc,OP_LET1REC); CASE(OP_LET1REC): /* letrec (calculate parameters) */ + gc_disable(sc, 1); sc->args = cons(sc, sc->value, sc->args); + gc_enable(sc); if (is_pair(sc->code)) { /* continue */ if (!is_pair(car(sc->code)) || !is_pair(cdar(sc->code))) { Error_1(sc, "Bad syntax of binding spec in letrec :", @@ -2993,8 +3148,10 @@ static pointer opexe_1(scheme *sc, enum scheme_opcodes op) { if(!is_pair(cdr(sc->code))) { Error_0(sc,"syntax error in cond"); } + gc_disable(sc, 4); x=cons(sc, sc->QUOTE, cons(sc, sc->value, sc->NIL)); sc->code=cons(sc,cadr(sc->code),cons(sc,x,sc->NIL)); + gc_enable(sc); s_goto(sc,OP_EVAL); } s_goto(sc,OP_BEGIN); @@ -3009,9 +3166,10 @@ static pointer opexe_1(scheme *sc, enum scheme_opcodes op) { } CASE(OP_DELAY): /* delay */ + gc_disable(sc, 2); x = mk_closure(sc, cons(sc, sc->NIL, sc->code), sc->envir); typeflag(x)=T_PROMISE; - s_return(sc,x); + s_return_enable_gc(sc,x); CASE(OP_AND0): /* and */ if (sc->code == sc->NIL) { @@ -3058,14 +3216,17 @@ static pointer opexe_1(scheme *sc, enum scheme_opcodes op) { CASE(OP_C1STREAM): /* cons-stream */ sc->args = sc->value; /* save sc->value to register sc->args for gc */ + gc_disable(sc, 3); x = mk_closure(sc, cons(sc, sc->NIL, sc->code), sc->envir); typeflag(x)=T_PROMISE; - s_return(sc,cons(sc, sc->args, x)); + s_return_enable_gc(sc, cons(sc, sc->args, x)); CASE(OP_MACRO0): /* macro */ if (is_pair(car(sc->code))) { x = caar(sc->code); + gc_disable(sc, 2); sc->code = cons(sc, sc->LAMBDA, cons(sc, cdar(sc->code), cdr(sc->code))); + gc_enable(sc); } else { x = car(sc->code); sc->code = cadr(sc->code); @@ -3140,7 +3301,9 @@ static pointer opexe_1(scheme *sc, enum scheme_opcodes op) { CASE(OP_CONTINUATION): /* call-with-current-continuation */ sc->code = car(sc->args); + gc_disable(sc, 2); sc->args = cons(sc, mk_continuation(sc, sc->dump), sc->NIL); + gc_enable(sc); s_goto(sc,OP_APPLY); default: @@ -3270,14 +3433,16 @@ static pointer opexe_2(scheme *sc, enum scheme_opcodes op) { for (x = sc->args; x != sc->NIL; x = cdr(x)) { v=num_add(v,nvalue(car(x))); } - s_return(sc,mk_number(sc, v)); + gc_disable(sc, 1); + s_return_enable_gc(sc, mk_number(sc, v)); CASE(OP_MUL): /* * */ v=num_one; for (x = sc->args; x != sc->NIL; x = cdr(x)) { v=num_mul(v,nvalue(car(x))); } - s_return(sc,mk_number(sc, v)); + gc_disable(sc, 1); + s_return_enable_gc(sc, mk_number(sc, v)); CASE(OP_SUB): /* - */ if(cdr(sc->args)==sc->NIL) { @@ -3290,7 +3455,8 @@ static pointer opexe_2(scheme *sc, enum scheme_opcodes op) { for (; x != sc->NIL; x = cdr(x)) { v=num_sub(v,nvalue(car(x))); } - s_return(sc,mk_number(sc, v)); + gc_disable(sc, 1); + s_return_enable_gc(sc, mk_number(sc, v)); CASE(OP_DIV): /* / */ if(cdr(sc->args)==sc->NIL) { @@ -3307,7 +3473,8 @@ static pointer opexe_2(scheme *sc, enum scheme_opcodes op) { Error_0(sc,"/: division by zero"); } } - s_return(sc,mk_number(sc, v)); + gc_disable(sc, 1); + s_return_enable_gc(sc, mk_number(sc, v)); CASE(OP_INTDIV): /* quotient */ if(cdr(sc->args)==sc->NIL) { @@ -3324,7 +3491,8 @@ static pointer opexe_2(scheme *sc, enum scheme_opcodes op) { Error_0(sc,"quotient: division by zero"); } } - s_return(sc,mk_number(sc, v)); + gc_disable(sc, 1); + s_return_enable_gc(sc, mk_number(sc, v)); CASE(OP_REM): /* remainder */ v = nvalue(car(sc->args)); @@ -3333,7 +3501,8 @@ static pointer opexe_2(scheme *sc, enum scheme_opcodes op) { else { Error_0(sc,"remainder: division by zero"); } - s_return(sc,mk_number(sc, v)); + gc_disable(sc, 1); + s_return_enable_gc(sc, mk_number(sc, v)); CASE(OP_MOD): /* modulo */ v = nvalue(car(sc->args)); @@ -3342,7 +3511,8 @@ static pointer opexe_2(scheme *sc, enum scheme_opcodes op) { else { Error_0(sc,"modulo: division by zero"); } - s_return(sc,mk_number(sc, v)); + gc_disable(sc, 1); + s_return_enable_gc(sc, mk_number(sc, v)); CASE(OP_CAR): /* car */ s_return(sc,caar(sc->args)); @@ -3373,31 +3543,36 @@ static pointer opexe_2(scheme *sc, enum scheme_opcodes op) { CASE(OP_CHAR2INT): { /* char->integer */ char c; c=(char)ivalue(car(sc->args)); - s_return(sc,mk_integer(sc,(unsigned char)c)); + gc_disable(sc, 1); + s_return_enable_gc(sc, mk_integer(sc, (unsigned char) c)); } CASE(OP_INT2CHAR): { /* integer->char */ unsigned char c; c=(unsigned char)ivalue(car(sc->args)); - s_return(sc,mk_character(sc,(char)c)); + gc_disable(sc, 1); + s_return_enable_gc(sc, mk_character(sc, (char) c)); } CASE(OP_CHARUPCASE): { unsigned char c; c=(unsigned char)ivalue(car(sc->args)); c=toupper(c); - s_return(sc,mk_character(sc,(char)c)); + gc_disable(sc, 1); + s_return_enable_gc(sc, mk_character(sc, (char) c)); } CASE(OP_CHARDNCASE): { unsigned char c; c=(unsigned char)ivalue(car(sc->args)); c=tolower(c); - s_return(sc,mk_character(sc,(char)c)); + gc_disable(sc, 1); + s_return_enable_gc(sc, mk_character(sc, (char) c)); } CASE(OP_STR2SYM): /* string->symbol */ - s_return(sc,mk_symbol(sc,strvalue(car(sc->args)))); + gc_disable(sc, gc_reservations (mk_symbol)); + s_return_enable_gc(sc, mk_symbol(sc, strvalue(car(sc->args)))); CASE(OP_STR2ATOM): /* string->atom */ { char *s=strvalue(car(sc->args)); @@ -3435,9 +3610,10 @@ static pointer opexe_2(scheme *sc, enum scheme_opcodes op) { } CASE(OP_SYM2STR): /* symbol->string */ + gc_disable(sc, 1); x=mk_string(sc,symname(car(sc->args))); setimmutable(x); - s_return(sc,x); + s_return_enable_gc(sc, x); CASE(OP_ATOM2STR): /* atom->string */ { long pf = 0; @@ -3459,7 +3635,8 @@ static pointer opexe_2(scheme *sc, enum scheme_opcodes op) { char *p; int len; atom2str(sc,x,(int )pf,&p,&len); - s_return(sc,mk_counted_string(sc,p,len)); + gc_disable(sc, 1); + s_return_enable_gc(sc, mk_counted_string(sc, p, len)); } else { Error_1(sc, "atom->string: not an atom:", x); } @@ -3474,11 +3651,13 @@ static pointer opexe_2(scheme *sc, enum scheme_opcodes op) { if(cdr(sc->args)!=sc->NIL) { fill=charvalue(cadr(sc->args)); } - s_return(sc,mk_empty_string(sc,len,(char)fill)); + gc_disable(sc, 1); + s_return_enable_gc(sc, mk_empty_string(sc, len, (char) fill)); } CASE(OP_STRLEN): /* string-length */ - s_return(sc,mk_integer(sc,strlength(car(sc->args)))); + gc_disable(sc, 1); + s_return_enable_gc(sc, mk_integer(sc, strlength(car(sc->args)))); CASE(OP_STRREF): { /* string-ref */ char *str; @@ -3492,7 +3671,9 @@ static pointer opexe_2(scheme *sc, enum scheme_opcodes op) { Error_1(sc,"string-ref: out of bounds:",cadr(sc->args)); } - s_return(sc,mk_character(sc,((unsigned char*)str)[index])); + gc_disable(sc, 1); + s_return_enable_gc(sc, + mk_character(sc, ((unsigned char*) str)[index])); } CASE(OP_STRSET): { /* string-set! */ @@ -3526,13 +3707,14 @@ static pointer opexe_2(scheme *sc, enum scheme_opcodes op) { for (x = sc->args; x != sc->NIL; x = cdr(x)) { len += strlength(car(x)); } + gc_disable(sc, 1); newstr = mk_empty_string(sc, len, ' '); /* store the contents of the argument strings into the new string */ for (pos = strvalue(newstr), x = sc->args; x != sc->NIL; pos += strlength(car(x)), x = cdr(x)) { memcpy(pos, strvalue(car(x)), strlength(car(x))); } - s_return(sc, newstr); + s_return_enable_gc(sc, newstr); } CASE(OP_SUBSTR): { /* substring */ @@ -3559,11 +3741,12 @@ static pointer opexe_2(scheme *sc, enum scheme_opcodes op) { } len=index1-index0; + gc_disable(sc, 1); x=mk_empty_string(sc,len,' '); memcpy(strvalue(x),str+index0,len); strvalue(x)[len]=0; - s_return(sc,x); + s_return_enable_gc(sc, x); } CASE(OP_VECTOR): { /* vector */ @@ -3600,7 +3783,8 @@ static pointer opexe_2(scheme *sc, enum scheme_opcodes op) { } CASE(OP_VECLEN): /* vector-length */ - s_return(sc,mk_integer(sc,ivalue(car(sc->args)))); + gc_disable(sc, 1); + s_return_enable_gc(sc, mk_integer(sc, ivalue(car(sc->args)))); CASE(OP_VECREF): { /* vector-ref */ int index; @@ -4173,7 +4357,9 @@ static pointer opexe_5(scheme *sc, enum scheme_opcodes op) { break; CASE(OP_RDLIST): { + gc_disable(sc, 1); sc->args = cons(sc, sc->value, sc->args); + gc_enable(sc); sc->tok = token(sc); if (sc->tok == TOK_EOF) { s_return(sc,sc->EOF_OBJ); } @@ -4206,23 +4392,32 @@ static pointer opexe_5(scheme *sc, enum scheme_opcodes op) { } CASE(OP_RDQUOTE): - s_return(sc,cons(sc, sc->QUOTE, cons(sc, sc->value, sc->NIL))); + gc_disable(sc, 2); + s_return_enable_gc(sc, cons(sc, sc->QUOTE, + cons(sc, sc->value, sc->NIL))); CASE(OP_RDQQUOTE): - s_return(sc,cons(sc, sc->QQUOTE, cons(sc, sc->value, sc->NIL))); + gc_disable(sc, 2); + s_return_enable_gc(sc, cons(sc, sc->QQUOTE, + cons(sc, sc->value, sc->NIL))); CASE(OP_RDQQUOTEVEC): - s_return(sc,cons(sc, mk_symbol(sc,"apply"), + gc_disable(sc, 5 + 2 * gc_reservations (mk_symbol)); + s_return_enable_gc(sc,cons(sc, mk_symbol(sc,"apply"), cons(sc, mk_symbol(sc,"vector"), cons(sc,cons(sc, sc->QQUOTE, cons(sc,sc->value,sc->NIL)), sc->NIL)))); CASE(OP_RDUNQUOTE): - s_return(sc,cons(sc, sc->UNQUOTE, cons(sc, sc->value, sc->NIL))); + gc_disable(sc, 2); + s_return_enable_gc(sc, cons(sc, sc->UNQUOTE, + cons(sc, sc->value, sc->NIL))); CASE(OP_RDUQTSP): - s_return(sc,cons(sc, sc->UNQUOTESP, cons(sc, sc->value, sc->NIL))); + gc_disable(sc, 2); + s_return_enable_gc(sc, cons(sc, sc->UNQUOTESP, + cons(sc, sc->value, sc->NIL))); CASE(OP_RDVEC): /*sc->code=cons(sc,mk_proc(sc,OP_VECTOR),sc->value); @@ -4324,7 +4519,8 @@ static pointer opexe_6(scheme *sc, enum scheme_opcodes op) { if(v<0) { Error_1(sc,"length: not a list:",car(sc->args)); } - s_return(sc,mk_integer(sc, v)); + gc_disable(sc, 1); + s_return_enable_gc(sc, mk_integer(sc, v)); CASE(OP_ASSQ): /* assq */ /* a.k */ x = car(sc->args); @@ -4347,9 +4543,13 @@ static pointer opexe_6(scheme *sc, enum scheme_opcodes op) { if (sc->args == sc->NIL) { s_return(sc,sc->F); } else if (is_closure(sc->args)) { - s_return(sc,cons(sc, sc->LAMBDA, closure_code(sc->value))); + gc_disable(sc, 1); + s_return_enable_gc(sc, cons(sc, sc->LAMBDA, + closure_code(sc->value))); } else if (is_macro(sc->args)) { - s_return(sc,cons(sc, sc->LAMBDA, closure_code(sc->value))); + gc_disable(sc, 1); + s_return_enable_gc(sc, cons(sc, sc->LAMBDA, + closure_code(sc->value))); } else { s_return(sc,sc->F); } @@ -4705,6 +4905,9 @@ int scheme_init_custom_alloc(scheme *sc, func_alloc malloc, func_dealloc free) { sc->EOF_OBJ=&sc->_EOF_OBJ; sc->free_cell = &sc->_NIL; sc->fcells = 0; + sc->inhibit_gc = GC_ENABLED; + sc->reserved_cells = 0; + sc->reserved_lineno = 0; sc->no_memory=0; sc->inport=sc->NIL; sc->outport=sc->NIL; ----------------------------------------------------------------------- Summary of changes: tests/gpgscm/scheme-private.h | 5 + tests/gpgscm/scheme.c | 291 +++++++++++++++++++++++++++++++++++------- 2 files changed, 252 insertions(+), 44 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Mon Nov 14 16:31:52 2016 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Mon, 14 Nov 2016 16:31:52 +0100 Subject: [git] GPG-ERROR - branch, master, updated. libgpg-error-1.24-19-g80350f9 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Error codes used by GnuPG et al.". The branch, master has been updated via 80350f97e9e811b9e77b59b8fc4172043f072f42 (commit) from c26117b2eda43258d4e3e8fd3ed602b2eaaa51f4 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 80350f97e9e811b9e77b59b8fc4172043f072f42 Author: Werner Koch Date: Mon Nov 14 16:28:56 2016 +0100 Fix typo in two new error descriptions. diff --git a/src/err-codes.h.in b/src/err-codes.h.in index 833405f..082819e 100644 --- a/src/err-codes.h.in +++ b/src/err-codes.h.in @@ -326,8 +326,8 @@ 304 GPG_ERR_USER_ID_EXISTS User ID already exists 305 GPG_ERR_NAME_EXISTS Name already exists 306 GPG_ERR_DUP_NAME Duplicated name -307 GPG_ERR_TOO_YOUNG Objects is too young -308 GPG_ERR_TOO_OLD Objects is too old +307 GPG_ERR_TOO_YOUNG Object is too young +308 GPG_ERR_TOO_OLD Object is too old # This range is free for use. # diff --git a/src/gpg-error.h.in b/src/gpg-error.h.in index 86f3241..06c2f9c 100644 --- a/src/gpg-error.h.in +++ b/src/gpg-error.h.in @@ -20,7 +20,7 @@ */ #ifndef GPG_ERROR_H -#define GPG_ERROR_H 1 +#define GPG_ERROR_H 1 #include #include ----------------------------------------------------------------------- Summary of changes: src/err-codes.h.in | 4 ++-- src/gpg-error.h.in | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) hooks/post-receive -- Error codes used by GnuPG et al. http://git.gnupg.org From cvs at cvs.gnupg.org Mon Nov 14 17:30:55 2016 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Mon, 14 Nov 2016 17:30:55 +0100 Subject: [git] GPG-ERROR - branch, master, updated. libgpg-error-1.24-23-gea053ec Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Error codes used by GnuPG et al.". The branch, master has been updated via ea053ec3cbc5dd2eba160bcc873d80fb13e1f1e1 (commit) via 6d834f817fdb741ec64dcfbd2166ea044e4e0c3d (commit) via 9dcd3fd189f76ed5b3a52ca4f3bb773f527fc457 (commit) via 9cecc8ccded0759d94b08c9859e7ea843430dd97 (commit) from 80350f97e9e811b9e77b59b8fc4172043f072f42 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit ea053ec3cbc5dd2eba160bcc873d80fb13e1f1e1 Author: Werner Koch Date: Mon Nov 14 17:25:11 2016 +0100 Post release updates. -- diff --git a/NEWS b/NEWS index d00c410..ce2beb5 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ +Noteworthy changes in version 1.26 (unreleased) [C20/A20/R_] +----------------------------------------------- + + Noteworthy changes in version 1.25 (2016-11-14) [C20/A20/R0] ----------------------------------------------- diff --git a/configure.ac b/configure.ac index f9b1f1e..e3ca56e 100644 --- a/configure.ac +++ b/configure.ac @@ -27,7 +27,7 @@ min_automake_version="1.14" # another commit, and a push so that the git magic is able to work. # See below for the LT versions. m4_define([mym4_version_major], [1]) -m4_define([mym4_version_minor], [25]) +m4_define([mym4_version_minor], [26]) # Below is m4 magic to extract and compute the revision number, the # decimalized short revision number, a beta version string, and a flag commit 6d834f817fdb741ec64dcfbd2166ea044e4e0c3d Author: Werner Koch Date: Mon Nov 14 17:19:55 2016 +0100 Release 1.25 * configure.ac: Set LT version to C20/A20/R0. Signed-off-by: Werner Koch diff --git a/NEWS b/NEWS index 3b373c5..d00c410 100644 --- a/NEWS +++ b/NEWS @@ -1,8 +1,21 @@ -Noteworthy changes in version 1.25 (unreleased) [C19/A19/R_) +Noteworthy changes in version 1.25 (2016-11-14) [C20/A20/R0] ----------------------------------------------- + * New interface gpgrt_get_syscall_clamp to allow libaries to make use + of Libgpg-error's system call wrapper functions. + + * gpgrt_poll does now work under Windows. + + * Fixed bug in the locking code when used with the nPth threading + library. + + * Added support for {i686,x86_64}-apple-darwin. + + * Added new error codes. + * Interface changes relative to the 1.23 release: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + gpgrt_get_syscall_clamp NEW. GPG_ERR_ENGINE_TOO_OLD NEW. GPG_ERR_WINDOW_TOO_SMALL NEW. GPG_ERR_WINDOW_TOO_LARGE NEW. @@ -12,10 +25,9 @@ Noteworthy changes in version 1.25 (unreleased) [C19/A19/R_) GPG_ERR_DUP_NAME NEW. GPG_ERR_TOO_OLD NEW. GPG_ERR_TOO_YOUNG NEW. - gpgrt_get_syscall_clamp NEW. -Noteworthy changes in version 1.24 (2016-07-14) [C19/A19/R1) +Noteworthy changes in version 1.24 (2016-07-14) [C19/A19/R1] ----------------------------------------------- * Fixes a bug in es_fclose_snatch when used used after es_fseek. @@ -25,7 +37,7 @@ Noteworthy changes in version 1.24 (2016-07-14) [C19/A19/R1) * New configure option --disable-tests. -Noteworthy changes in version 1.23 (2016-06-15) [C19/A19/R0) +Noteworthy changes in version 1.23 (2016-06-15) [C19/A19/R0] ----------------------------------------------- * Fixes an assertion failure due to es_flush on read/write streams. @@ -40,7 +52,7 @@ Noteworthy changes in version 1.23 (2016-06-15) [C19/A19/R0) GPG_ERR_SUBKEYS_EXP_OR_REV NEW. -Noteworthy changes in version 1.22 (2016-04-25) [C18/A18/R0) +Noteworthy changes in version 1.22 (2016-04-25) [C18/A18/R0] ----------------------------------------------- * New functions and macros to to provide iconv(3) on Windows. diff --git a/README b/README index be7b7dc..fd6e1a8 100644 --- a/README +++ b/README @@ -1,9 +1,28 @@ -Libgpg-error -============ +What is Libgpg-error +==================== + +Libgpg-error is a library that defines common error values for all +GnuPG components. Among these are GPG, GPGSM, GPGME, GPG-Agent, +libgcrypt, Libksba, DirMngr, Pinentry, SmartCard Daemon and more. +Meanwhile Libgcrypt also sports functions commonly used by all GnuPG +components and which are believed to be generally useful. The main +components are + + - Structured error codes and utility functions. + + - Replacement functions for stdio stream (estream) to provide a + reliable set of printf features on all platforms. For convenience + macros are provided to make migration from stdio to estream easier + (ie. the prefix "es_") -This is a library that defines common error values for all GnuPG -components. Among these are GPG, GPGSM, GPGME, GPG-Agent, libgcrypt, -Libksba, DirMngr, Pinentry, SmartCard Daemon and more. + - Generic Mutex implementation for all platforms using an ABI + independent of the underlying implementation. + + - A lean gettext and iconv implementation for Windows. + +More components will be added over time. Most functions are prefixed +with "gpgrt" (GnuPG Run Time) instead of "gpg_err" to indicate the +long term plan to rename this library to gpgrt. Libgpg-error is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as @@ -22,7 +41,7 @@ affected by the GPL. Installation ------------- +============ Please read the file INSTALL! @@ -45,7 +64,7 @@ Here is a quick summary: How to Verify the Source ------------------------- +======================== In order to check that the version of libgpg-error which you are going to install is an original and unmodified copy of the original, you can @@ -54,7 +73,7 @@ do it in one of the following ways: a) If you already have a trusted version of GnuPG installed, you can simply check the supplied signature: - $ gpg --verify libgpg-error-x.y.tar.bz2.sig + $ gpg --verify libgpg-error-x.y.tar.bz2.sig libgpg-error-x.y.tar.bz2 This checks that the detached signature libgpg-error-x.y.tar.bz2.sig is indeed a signature of libgpg-error-x.y.tar.bz2. Make sure that @@ -79,7 +98,7 @@ b) If you don't have any a trusted version of GnuPG, you can attempt Hints ------ +===== To build for Windows you you may use the convenience command: @@ -97,7 +116,7 @@ version: Cross-Compiling ---------------- +=============== Libgpg-error needs to figure out some platform specific properties. These are used to build the platform specific gpg-error.h file. The @@ -123,7 +142,7 @@ extra aliasing to avoid having too much identical syscfg files. Known Problems --------------- +============== On Windows, WSA Error Codes can be provided as system error codes and will be transparently converted to the corresponding gpg error codes. @@ -140,9 +159,9 @@ There are two problems with this support: translations). * The translation to a gpg error code and back to a system error code - in some cases does not preserve information. For example, the error code - WSAEACCES translates to GPG_ERR_EACCES, which translates back to - EACCES. + in some cases does not preserve information. For example, the error + code WSAEACCES translates to GPG_ERR_EACCES, which translates back + to EACCES. Any WSA Error code has either the first problem or the second (but not both), depending on if there is a corresponding Windows error code. diff --git a/configure.ac b/configure.ac index 1caf655..f9b1f1e 100644 --- a/configure.ac +++ b/configure.ac @@ -51,9 +51,9 @@ AC_INIT([libgpg-error],[mym4_full_version],[https://bugs.gnupg.org]) # (Interfaces added: AGE++) # (Interfaces removed: AGE=0) # Note that added error codes don't constitute an interface change. -LIBGPG_ERROR_LT_CURRENT=19 -LIBGPG_ERROR_LT_AGE=19 -LIBGPG_ERROR_LT_REVISION=1 +LIBGPG_ERROR_LT_CURRENT=20 +LIBGPG_ERROR_LT_AGE=20 +LIBGPG_ERROR_LT_REVISION=0 ################################################ AC_SUBST(LIBGPG_ERROR_LT_CURRENT) commit 9dcd3fd189f76ed5b3a52ca4f3bb773f527fc457 Author: Werner Koch Date: Mon Nov 14 17:16:59 2016 +0100 po: Auto update. -- diff --git a/po/cs.po b/po/cs.po index 22324e1..4b58c21 100644 --- a/po/cs.po +++ b/po/cs.po @@ -939,6 +939,41 @@ msgid "Unknown IPC inquire" msgstr "Nezn??m?? dotaz IPC" #, fuzzy +#| msgid "No crypto engine" +msgid "Crypto engine too old" +msgstr "Chyb?? kryptografick?? jednotka" + +msgid "Screen or window too small" +msgstr "" + +msgid "Screen or window too large" +msgstr "" + +msgid "Required environment variable not set" +msgstr "" + +msgid "User ID already exists" +msgstr "" + +msgid "Name already exists" +msgstr "" + +#, fuzzy +#| msgid "Duplicated value" +msgid "Duplicated name" +msgstr "Zdvojen?? hodnota" + +#, fuzzy +#| msgid "Certificate too young" +msgid "Object is too young" +msgstr "Certifik??t je p????li?? mlad??" + +#, fuzzy +#| msgid "Provided object is too short" +msgid "Object is too old" +msgstr "Dodan?? objekt je p????li?? kr??tk??" + +#, fuzzy #| msgid "General IPC error" msgid "General LDAP error" msgstr "Obecn?? chyba IPC" diff --git a/po/da.po b/po/da.po index 9079e39..7fd9f11 100644 --- a/po/da.po +++ b/po/da.po @@ -935,6 +935,41 @@ msgid "Unknown IPC inquire" msgstr "Ukendt IPC-inquire" #, fuzzy +#| msgid "No crypto engine" +msgid "Crypto engine too old" +msgstr "Ingen cryptomotor" + +msgid "Screen or window too small" +msgstr "" + +msgid "Screen or window too large" +msgstr "" + +msgid "Required environment variable not set" +msgstr "" + +msgid "User ID already exists" +msgstr "" + +msgid "Name already exists" +msgstr "" + +#, fuzzy +#| msgid "Duplicated value" +msgid "Duplicated name" +msgstr "Duplikeret v??rdi" + +#, fuzzy +#| msgid "Certificate too young" +msgid "Object is too young" +msgstr "Certifikat for ungt" + +#, fuzzy +#| msgid "Provided object is too short" +msgid "Object is too old" +msgstr "Angivet objekt er for kort" + +#, fuzzy #| msgid "General IPC error" msgid "General LDAP error" msgstr "Generel IPC-fejl" diff --git a/po/eo.po b/po/eo.po index 7fb7c1b..a511ac9 100644 --- a/po/eo.po +++ b/po/eo.po @@ -993,6 +993,41 @@ msgid "Unknown IPC inquire" msgstr "Nekonata enketo de IPC" #, fuzzy +#| msgid "Invalid crypto engine" +msgid "Crypto engine too old" +msgstr "Malvalida ??ifra ma??ino" + +msgid "Screen or window too small" +msgstr "" + +msgid "Screen or window too large" +msgstr "" + +msgid "Required environment variable not set" +msgstr "" + +msgid "User ID already exists" +msgstr "" + +msgid "Name already exists" +msgstr "" + +#, fuzzy +#| msgid "Duplicated value" +msgid "Duplicated name" +msgstr "Duobligita valoro" + +#, fuzzy +#| msgid "Certificate too young" +msgid "Object is too young" +msgstr "Atestilo tro novas" + +#, fuzzy +#| msgid "Provided object is too short" +msgid "Object is too old" +msgstr "Provizita objekto tro mallongas" + +#, fuzzy #| msgid "General IPC error" msgid "General LDAP error" msgstr "??enerala eraro de IPC" diff --git a/po/fr.po b/po/fr.po index add5c90..a03a9e7 100644 --- a/po/fr.po +++ b/po/fr.po @@ -934,6 +934,41 @@ msgid "Unknown IPC inquire" msgstr "Requ??te IPC inconnue" #, fuzzy +#| msgid "No crypto engine" +msgid "Crypto engine too old" +msgstr "Aucun moteur de chiffrement" + +msgid "Screen or window too small" +msgstr "" + +msgid "Screen or window too large" +msgstr "" + +msgid "Required environment variable not set" +msgstr "" + +msgid "User ID already exists" +msgstr "" + +msgid "Name already exists" +msgstr "" + +#, fuzzy +#| msgid "Duplicated value" +msgid "Duplicated name" +msgstr "Valeur dupliqu??e" + +#, fuzzy +#| msgid "Certificate too young" +msgid "Object is too young" +msgstr "Certificat trop r??cent" + +#, fuzzy +#| msgid "Provided object is too short" +msgid "Object is too old" +msgstr "L'objet fourni est trop petit" + +#, fuzzy #| msgid "General IPC error" msgid "General LDAP error" msgstr "Erreur g??n??rale IPC" diff --git a/po/hu.po b/po/hu.po index 75ddfdb..b271089 100644 --- a/po/hu.po +++ b/po/hu.po @@ -991,6 +991,41 @@ msgid "Unknown IPC inquire" msgstr "Ismeretlen IPC ??rdekl??d??s" #, fuzzy +#| msgid "Invalid crypto engine" +msgid "Crypto engine too old" +msgstr "??rv??nytelen titkos??t??si motor" + +msgid "Screen or window too small" +msgstr "" + +msgid "Screen or window too large" +msgstr "" + +msgid "Required environment variable not set" +msgstr "" + +msgid "User ID already exists" +msgstr "" + +msgid "Name already exists" +msgstr "" + +#, fuzzy +#| msgid "Duplicated value" +msgid "Duplicated name" +msgstr "Kett??z??tt ??rt??k" + +#, fuzzy +#| msgid "Certificate too young" +msgid "Object is too young" +msgstr "T??l fiatal tan??s??tv??ny" + +#, fuzzy +#| msgid "Provided object is too short" +msgid "Object is too old" +msgstr "A megadott objektum t??l kicsi" + +#, fuzzy #| msgid "General IPC error" msgid "General LDAP error" msgstr "??ltal??nos IPC hiba" diff --git a/po/it.po b/po/it.po index 5b764f8..82d1782 100644 --- a/po/it.po +++ b/po/it.po @@ -930,6 +930,41 @@ msgid "Unknown IPC inquire" msgstr "Richiesta IPC sconosciuta" #, fuzzy +#| msgid "No crypto engine" +msgid "Crypto engine too old" +msgstr "Nessun motore di cifratura" + +msgid "Screen or window too small" +msgstr "" + +msgid "Screen or window too large" +msgstr "" + +msgid "Required environment variable not set" +msgstr "" + +msgid "User ID already exists" +msgstr "" + +msgid "Name already exists" +msgstr "" + +#, fuzzy +#| msgid "Duplicated value" +msgid "Duplicated name" +msgstr "Valore duplicato" + +#, fuzzy +#| msgid "Certificate too young" +msgid "Object is too young" +msgstr "Certificato troppo nuovo" + +#, fuzzy +#| msgid "Provided object is too short" +msgid "Object is too old" +msgstr "L'oggetto fornito ?? troppo piccolo" + +#, fuzzy #| msgid "General IPC error" msgid "General LDAP error" msgstr "Errore IPC generale" diff --git a/po/ja.po b/po/ja.po index 402a6ea..f1d44e4 100644 --- a/po/ja.po +++ b/po/ja.po @@ -920,6 +920,45 @@ msgstr "IPC??????????????????????????????" msgid "Unknown IPC inquire" msgstr "?????????IPC?????????????????????" +#, fuzzy +#| msgid "No crypto engine" +msgid "Crypto engine too old" +msgstr "????????????????????????????????????" + +msgid "Screen or window too small" +msgstr "" + +msgid "Screen or window too large" +msgstr "" + +msgid "Required environment variable not set" +msgstr "" + +#, fuzzy +#| msgid "Already exists (LDAP)" +msgid "User ID already exists" +msgstr "????????????????????? (LDAP)" + +#, fuzzy +#| msgid "Already exists (LDAP)" +msgid "Name already exists" +msgstr "????????????????????? (LDAP)" + +#, fuzzy +#| msgid "Duplicated value" +msgid "Duplicated name" +msgstr "?????????????????????" + +#, fuzzy +#| msgid "Certificate too young" +msgid "Object is too young" +msgstr "???????????????????????????" + +#, fuzzy +#| msgid "Provided object is too short" +msgid "Object is too old" +msgstr "??????????????????????????????????????????????????????" + msgid "General LDAP error" msgstr "??????LDAP???????????????" diff --git a/po/nl.po b/po/nl.po index 5a54707..e5734a1 100644 --- a/po/nl.po +++ b/po/nl.po @@ -931,6 +931,41 @@ msgid "Unknown IPC inquire" msgstr "Onbekende IPC-afvraging" #, fuzzy +#| msgid "No crypto engine" +msgid "Crypto engine too old" +msgstr "Geen crypto-engine" + +msgid "Screen or window too small" +msgstr "" + +msgid "Screen or window too large" +msgstr "" + +msgid "Required environment variable not set" +msgstr "" + +msgid "User ID already exists" +msgstr "" + +msgid "Name already exists" +msgstr "" + +#, fuzzy +#| msgid "Duplicated value" +msgid "Duplicated name" +msgstr "Gedupliceerde waarde" + +#, fuzzy +#| msgid "Certificate too young" +msgid "Object is too young" +msgstr "Certificaat te jong" + +#, fuzzy +#| msgid "Provided object is too short" +msgid "Object is too old" +msgstr "Geleverd object is te kort" + +#, fuzzy #| msgid "General IPC error" msgid "General LDAP error" msgstr "Algemene IPC-fout" diff --git a/po/pl.po b/po/pl.po index 8b0a7a2..dcb26d9 100644 --- a/po/pl.po +++ b/po/pl.po @@ -918,6 +918,45 @@ msgstr "B????d parametru IPC" msgid "Unknown IPC inquire" msgstr "Nieznane zapytanie IPC" +#, fuzzy +#| msgid "No crypto engine" +msgid "Crypto engine too old" +msgstr "Brak silnika kryptograficznego" + +msgid "Screen or window too small" +msgstr "" + +msgid "Screen or window too large" +msgstr "" + +msgid "Required environment variable not set" +msgstr "" + +#, fuzzy +#| msgid "Already exists (LDAP)" +msgid "User ID already exists" +msgstr "Ju?? istnieje (LDAP)" + +#, fuzzy +#| msgid "Already exists (LDAP)" +msgid "Name already exists" +msgstr "Ju?? istnieje (LDAP)" + +#, fuzzy +#| msgid "Duplicated value" +msgid "Duplicated name" +msgstr "Powt??rzona warto????" + +#, fuzzy +#| msgid "Certificate too young" +msgid "Object is too young" +msgstr "Certyfikat zbyt m??ody" + +#, fuzzy +#| msgid "Provided object is too short" +msgid "Object is too old" +msgstr "Dostarczony obiekt jest zbyt ma??y" + msgid "General LDAP error" msgstr "B????d og??lny LDAP" diff --git a/po/pt.po b/po/pt.po index 46776a1..691c64c 100644 --- a/po/pt.po +++ b/po/pt.po @@ -931,6 +931,41 @@ msgid "Unknown IPC inquire" msgstr "Inquiri????o IPC desconhecida" #, fuzzy +#| msgid "No crypto engine" +msgid "Crypto engine too old" +msgstr "Sem motor de encripta????o" + +msgid "Screen or window too small" +msgstr "" + +msgid "Screen or window too large" +msgstr "" + +msgid "Required environment variable not set" +msgstr "" + +msgid "User ID already exists" +msgstr "" + +msgid "Name already exists" +msgstr "" + +#, fuzzy +#| msgid "Duplicated value" +msgid "Duplicated name" +msgstr "Valor duplicado" + +#, fuzzy +#| msgid "Certificate too young" +msgid "Object is too young" +msgstr "Certificado demasiado novo" + +#, fuzzy +#| msgid "Provided object is too short" +msgid "Object is too old" +msgstr "O objecto fornecido ?? demasiado curto" + +#, fuzzy #| msgid "General IPC error" msgid "General LDAP error" msgstr "Erro gen??rico de IPC" diff --git a/po/ro.po b/po/ro.po index 4faca4f..2e5f404 100644 --- a/po/ro.po +++ b/po/ro.po @@ -1005,6 +1005,40 @@ msgid "Unknown IPC inquire" msgstr "Surs? necunoscut?" #, fuzzy +msgid "Crypto engine too old" +msgstr "Motor cifrare invalid" + +msgid "Screen or window too small" +msgstr "" + +msgid "Screen or window too large" +msgstr "" + +msgid "Required environment variable not set" +msgstr "" + +msgid "User ID already exists" +msgstr "" + +msgid "Name already exists" +msgstr "" + +#, fuzzy +#| msgid "Duplicated value" +msgid "Duplicated name" +msgstr "Valoare dubl?" + +#, fuzzy +#| msgid "Certificate too young" +msgid "Object is too young" +msgstr "Certificat prea recent" + +#, fuzzy +#| msgid "Provided object is too short" +msgid "Object is too old" +msgstr "Obiectul furnizat e prea scurt" + +#, fuzzy msgid "General LDAP error" msgstr "Eroare general?" diff --git a/po/ru.po b/po/ru.po index 3cc27f6..69cd250 100644 --- a/po/ru.po +++ b/po/ru.po @@ -924,6 +924,45 @@ msgstr "???????????? ?? ?????????????????? IPC" msgid "Unknown IPC inquire" msgstr "?????????????????????? ???????????? IPC" +#, fuzzy +#| msgid "No crypto engine" +msgid "Crypto engine too old" +msgstr "?????? ??????????????????????????????" + +msgid "Screen or window too small" +msgstr "" + +msgid "Screen or window too large" +msgstr "" + +msgid "Required environment variable not set" +msgstr "" + +#, fuzzy +#| msgid "Already exists (LDAP)" +msgid "User ID already exists" +msgstr "?????? ???????? (LDAP)" + +#, fuzzy +#| msgid "Already exists (LDAP)" +msgid "Name already exists" +msgstr "?????? ???????? (LDAP)" + +#, fuzzy +#| msgid "Duplicated value" +msgid "Duplicated name" +msgstr "???????????????? ????????????????????????????" + +#, fuzzy +#| msgid "Certificate too young" +msgid "Object is too young" +msgstr "???????????????????? ?????????????? ??????????" + +#, fuzzy +#| msgid "Provided object is too short" +msgid "Object is too old" +msgstr "?????????????????? ???????????? ?????????????? ??????" + msgid "General LDAP error" msgstr "?????????? ???????????? LDAP" diff --git a/po/sr.po b/po/sr.po index ffdee12..be7117d 100644 --- a/po/sr.po +++ b/po/sr.po @@ -990,6 +990,41 @@ msgid "Unknown IPC inquire" msgstr "?????????????????? ?????????????????????? ??????-??" #, fuzzy +#| msgid "Invalid crypto engine" +msgid "Crypto engine too old" +msgstr "???????????????????? ?????????? ??????????????????" + +msgid "Screen or window too small" +msgstr "" + +msgid "Screen or window too large" +msgstr "" + +msgid "Required environment variable not set" +msgstr "" + +msgid "User ID already exists" +msgstr "" + +msgid "Name already exists" +msgstr "" + +#, fuzzy +#| msgid "Duplicated value" +msgid "Duplicated name" +msgstr "???????????????????????? ????????????????" + +#, fuzzy +#| msgid "Certificate too young" +msgid "Object is too young" +msgstr "?????????????? ???? ?????????????? ????????" + +#, fuzzy +#| msgid "Provided object is too short" +msgid "Object is too old" +msgstr "???????????????????? ?????????????? ???? ??????????????????" + +#, fuzzy #| msgid "General IPC error" msgid "General LDAP error" msgstr "?????????? ???????????? ??????-??" diff --git a/po/sv.po b/po/sv.po index b01c70c..b4b6ea3 100644 --- a/po/sv.po +++ b/po/sv.po @@ -980,6 +980,40 @@ msgid "Unknown IPC inquire" msgstr "Ok??nd IPC-fr??ga" #, fuzzy +msgid "Crypto engine too old" +msgstr "Ogiltig krypteringsmotor" + +msgid "Screen or window too small" +msgstr "" + +msgid "Screen or window too large" +msgstr "" + +msgid "Required environment variable not set" +msgstr "" + +msgid "User ID already exists" +msgstr "" + +msgid "Name already exists" +msgstr "" + +#, fuzzy +#| msgid "Duplicated value" +msgid "Duplicated name" +msgstr "Dubblettv??rde" + +#, fuzzy +#| msgid "Certificate too young" +msgid "Object is too young" +msgstr "Certifikatet ??r f??r ungt" + +#, fuzzy +#| msgid "Provided object is too short" +msgid "Object is too old" +msgstr "Tillhandah??llet objekt ??r f??r kort" + +#, fuzzy #| msgid "General IPC error" msgid "General LDAP error" msgstr "Allm??nt IPC-fel" diff --git a/po/uk.po b/po/uk.po index c712b3a..cbab08a 100644 --- a/po/uk.po +++ b/po/uk.po @@ -935,6 +935,45 @@ msgstr "?????????????? ?? ?????????????????? IPC" msgid "Unknown IPC inquire" msgstr "?????????????????? ?????????? IPC" +#, fuzzy +#| msgid "No crypto engine" +msgid "Crypto engine too old" +msgstr "?????????? ?????????? ????????????????????" + +msgid "Screen or window too small" +msgstr "" + +msgid "Screen or window too large" +msgstr "" + +msgid "Required environment variable not set" +msgstr "" + +#, fuzzy +#| msgid "Already exists (LDAP)" +msgid "User ID already exists" +msgstr "?????? ?????????? (LDAP)" + +#, fuzzy +#| msgid "Already exists (LDAP)" +msgid "Name already exists" +msgstr "?????? ?????????? (LDAP)" + +#, fuzzy +#| msgid "Duplicated value" +msgid "Duplicated name" +msgstr "???????????????????? ????????????????" + +#, fuzzy +#| msgid "Certificate too young" +msgid "Object is too young" +msgstr "???????????????????? ?? ?????????? ??????????" + +#, fuzzy +#| msgid "Provided object is too short" +msgid "Object is too old" +msgstr "?????????????? ????????????? ?? ?????????? ????????????????" + msgid "General LDAP error" msgstr "???????????????? ?????????????? LDAP" diff --git a/po/vi.po b/po/vi.po index 1636d49..4ee1ec9 100644 --- a/po/vi.po +++ b/po/vi.po @@ -982,6 +982,40 @@ msgid "Unknown IPC inquire" msgstr "Y??u c???u IPC kh??ng r??" #, fuzzy +msgid "Crypto engine too old" +msgstr "C?? ch??? m???t m?? kh??ng h???p l???" + +msgid "Screen or window too small" +msgstr "" + +msgid "Screen or window too large" +msgstr "" + +msgid "Required environment variable not set" +msgstr "" + +msgid "User ID already exists" +msgstr "" + +msgid "Name already exists" +msgstr "" + +#, fuzzy +#| msgid "Duplicated value" +msgid "Duplicated name" +msgstr "Gi?? tr??? tr??ng" + +#, fuzzy +#| msgid "Certificate too young" +msgid "Object is too young" +msgstr "Ch???ng nh???n qu?? m???i" + +#, fuzzy +#| msgid "Provided object is too short" +msgid "Object is too old" +msgstr "???? cung c???p m???t ?????i t?????ng qu?? ng???n" + +#, fuzzy #| msgid "General IPC error" msgid "General LDAP error" msgstr "L???i IPC chung" diff --git a/po/zh_CN.po b/po/zh_CN.po index 2170957..680af4b 100644 --- a/po/zh_CN.po +++ b/po/zh_CN.po @@ -979,6 +979,40 @@ msgid "Unknown IPC inquire" msgstr "" #, fuzzy +msgid "Crypto engine too old" +msgstr "?????????????????????" + +msgid "Screen or window too small" +msgstr "" + +msgid "Screen or window too large" +msgstr "" + +msgid "Required environment variable not set" +msgstr "" + +msgid "User ID already exists" +msgstr "" + +msgid "Name already exists" +msgstr "" + +#, fuzzy +#| msgid "Duplicated value" +msgid "Duplicated name" +msgstr "?????????" + +#, fuzzy +#| msgid "Certificate too young" +msgid "Object is too young" +msgstr "????????????" + +#, fuzzy +#| msgid "Provided object is too short" +msgid "Object is too old" +msgstr "??????????????????" + +#, fuzzy #| msgid "General IPC error" msgid "General LDAP error" msgstr "??????IPC ??????" diff --git a/po/zh_TW.po b/po/zh_TW.po index 7997c72..ac6d7e3 100644 --- a/po/zh_TW.po +++ b/po/zh_TW.po @@ -933,6 +933,41 @@ msgid "Unknown IPC inquire" msgstr "????????? IPC ??????" #, fuzzy +#| msgid "No crypto engine" +msgid "Crypto engine too old" +msgstr "?????????????????????" + +msgid "Screen or window too small" +msgstr "" + +msgid "Screen or window too large" +msgstr "" + +msgid "Required environment variable not set" +msgstr "" + +msgid "User ID already exists" +msgstr "" + +msgid "Name already exists" +msgstr "" + +#, fuzzy +#| msgid "Duplicated value" +msgid "Duplicated name" +msgstr "????????????" + +#, fuzzy +#| msgid "Certificate too young" +msgid "Object is too young" +msgstr "???????????????" + +#, fuzzy +#| msgid "Provided object is too short" +msgid "Object is too old" +msgstr "?????????????????????" + +#, fuzzy #| msgid "General IPC error" msgid "General LDAP error" msgstr "???????????? IPC ??????" commit 9cecc8ccded0759d94b08c9859e7ea843430dd97 Author: Werner Koch Date: Mon Nov 14 17:13:06 2016 +0100 po: Update German translation diff --git a/po/de.po b/po/de.po index b7b0e23..2abbf88 100644 --- a/po/de.po +++ b/po/de.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: libgpg-error-1.19\n" "Report-Msgid-Bugs-To: translations at gnupg.org\n" -"PO-Revision-Date: 2016-04-25 10:33+0200\n" +"PO-Revision-Date: 2016-11-14 17:12+0100\n" "Last-Translator: Werner Koch \n" "Language-Team: none\n" "Language: de\n" @@ -924,6 +924,33 @@ msgstr "IPC Parameterfehler" msgid "Unknown IPC inquire" msgstr "Unbekanntes IPC \"Inquire\"" +msgid "Crypto engine too old" +msgstr "Die Krypto-Engine ist zu alt" + +msgid "Screen or window too small" +msgstr "Bildschirmfenster ist zu klein" + +msgid "Screen or window too large" +msgstr "Bildschirmfenster ist zu gro??" + +msgid "Required environment variable not set" +msgstr "Eine notwendige Umgebungsvariable ist nicht gesetzt" + +msgid "User ID already exists" +msgstr "Die User-ID existiert bereits" + +msgid "Name already exists" +msgstr "Der Name existiert bereits" + +msgid "Duplicated name" +msgstr "Doppelter Name" + +msgid "Object is too young" +msgstr "Objekt zu jung" + +msgid "Object is too old" +msgstr "Objekt zu alt" + msgid "General LDAP error" msgstr "Allgemeiner LDAP Fehler" ----------------------------------------------------------------------- Summary of changes: NEWS | 26 +++++++++++++++++++++----- README | 47 +++++++++++++++++++++++++++++++++-------------- configure.ac | 8 ++++---- po/cs.po | 35 +++++++++++++++++++++++++++++++++++ po/da.po | 35 +++++++++++++++++++++++++++++++++++ po/de.po | 29 ++++++++++++++++++++++++++++- po/eo.po | 35 +++++++++++++++++++++++++++++++++++ po/fr.po | 35 +++++++++++++++++++++++++++++++++++ po/hu.po | 35 +++++++++++++++++++++++++++++++++++ po/it.po | 35 +++++++++++++++++++++++++++++++++++ po/ja.po | 39 +++++++++++++++++++++++++++++++++++++++ po/nl.po | 35 +++++++++++++++++++++++++++++++++++ po/pl.po | 39 +++++++++++++++++++++++++++++++++++++++ po/pt.po | 35 +++++++++++++++++++++++++++++++++++ po/ro.po | 34 ++++++++++++++++++++++++++++++++++ po/ru.po | 39 +++++++++++++++++++++++++++++++++++++++ po/sr.po | 35 +++++++++++++++++++++++++++++++++++ po/sv.po | 34 ++++++++++++++++++++++++++++++++++ po/uk.po | 39 +++++++++++++++++++++++++++++++++++++++ po/vi.po | 34 ++++++++++++++++++++++++++++++++++ po/zh_CN.po | 34 ++++++++++++++++++++++++++++++++++ po/zh_TW.po | 35 +++++++++++++++++++++++++++++++++++ 22 files changed, 728 insertions(+), 24 deletions(-) hooks/post-receive -- Error codes used by GnuPG et al. http://git.gnupg.org From cvs at cvs.gnupg.org Mon Nov 14 17:33:09 2016 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Mon, 14 Nov 2016 17:33:09 +0100 Subject: [git] gnupg-doc - branch, master, updated. 8e42a932e834e7f32cc1b3e1cf4ef6c4f15ed7f0 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GnuPG website and other docs". The branch, master has been updated via 8e42a932e834e7f32cc1b3e1cf4ef6c4f15ed7f0 (commit) from 38594d8b830c4201f8b6fb79805153173520f233 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 8e42a932e834e7f32cc1b3e1cf4ef6c4f15ed7f0 Author: Werner Koch Date: Mon Nov 14 17:30:40 2016 +0100 swdb: Release libgpg-error 1.25 diff --git a/web/swdb.mac b/web/swdb.mac index fd123e2..e6fef67 100644 --- a/web/swdb.mac +++ b/web/swdb.mac @@ -110,11 +110,11 @@ # # LIBGPG-ERROR # -#+macro: libgpg_error_ver 1.24 -#+macro: libgpg_error_date 2016-07-14 -#+macro: libgpg_error_size 765k -#+macro: libgpg_error_sha1 c3e5bd0c3ddea647416b429cd8e2ec755bad9d9e -#+macro: libgpg_error_sha2 9268e1cc487de5e6e4460fca612a06e4f383072ac43ae90603e5e46783d3e540 +#+macro: libgpg_error_ver 1.25 +#+macro: libgpg_error_date 2016-11-14 +#+macro: libgpg_error_size 778k +#+macro: libgpg_error_sha1 8ab7494e40f80f4138edc9516981bf4afe7d9dbf +#+macro: libgpg_error_sha2 f628f75843433b38b05af248121beb7db5bd54bb2106f384edac39934261320c # ----------------------------------------------------------------------- Summary of changes: web/swdb.mac | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) hooks/post-receive -- The GnuPG website and other docs http://git.gnupg.org From cvs at cvs.gnupg.org Mon Nov 14 17:38:15 2016 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Mon, 14 Nov 2016 17:38:15 +0100 Subject: [git] GPGME - branch, master, updated. gpgme-1.7.1-37-gb91c383 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via b91c383386fe9eadd90afdb9bb1f8ec6c528173b (commit) from 16a30205064914eef578d84d07141b5d51d82838 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit b91c383386fe9eadd90afdb9bb1f8ec6c528173b Author: Andre Heinecke Date: Mon Nov 14 17:18:50 2016 +0100 w32: Fix build of w32-glib * src/Makefile.am (main_sources): Remove system_components_not_extra. (libgpgme_la_SOURCES): Add system_components_not_extra. (libgpgme_glib_la_SOURCES): Remove duplicated ath files. diff --git a/src/Makefile.am b/src/Makefile.am index dfe480c..71f2b3a 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -87,12 +87,12 @@ main_sources = \ gpgconf.c queryswdb.c \ sema.h priv-io.h $(system_components) sys-util.h dirinfo.c \ debug.c debug.h gpgme.c version.c error.c \ - ath.h ath.c $(system_components_not_extra) + ath.h ath.c -libgpgme_la_SOURCES = $(main_sources) +libgpgme_la_SOURCES = $(main_sources) $(system_components_not_extra) if BUILD_W32_GLIB -libgpgme_glib_la_SOURCES = $(main_sources) ath.h ath.c w32-glib-io.c +libgpgme_glib_la_SOURCES = $(main_sources) w32-glib-io.c endif # We use a global CFLAGS setting for all library ----------------------------------------------------------------------- Summary of changes: src/Makefile.am | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Mon Nov 14 17:56:20 2016 From: cvs at cvs.gnupg.org (by Justus Winter) Date: Mon, 14 Nov 2016 17:56:20 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.1.15-361-g2cd281c Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via 2cd281c4def1ea881b92b9aba18c1892f89c1870 (commit) from 83c184a66b73f312425b01008f0495610e5329a4 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 2cd281c4def1ea881b92b9aba18c1892f89c1870 Author: Justus Winter Date: Mon Nov 14 17:33:18 2016 +0100 g10: Fix memory leak. * g10/mainproc.c (check_sig_and_print): Free 'pk'. Fixes-commit: 37e3c897252babc203447be9d2f286a4507875ad Signed-off-by: Justus Winter diff --git a/g10/mainproc.c b/g10/mainproc.c index 0c979f8..c1819f0 100644 --- a/g10/mainproc.c +++ b/g10/mainproc.c @@ -2203,6 +2203,8 @@ check_sig_and_print (CTX c, kbnode_t node) } } + free_public_key (pk); + pk = NULL; release_kbnode( keyblock ); if (rc) g10_errors_seen = 1; ----------------------------------------------------------------------- Summary of changes: g10/mainproc.c | 2 ++ 1 file changed, 2 insertions(+) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Mon Nov 14 18:18:51 2016 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Mon, 14 Nov 2016 18:18:51 +0100 Subject: [git] GpgOL - branch, master, updated. gpgol-1.4.0-163-gba6e9a8 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG extension for MS Outlook". The branch, master has been updated via ba6e9a8c468fdde33a238099664762695b31c2ad (commit) from 1b822ad2b8142fb7020615875a64328c44362907 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit ba6e9a8c468fdde33a238099664762695b31c2ad Author: Andre Heinecke Date: Mon Nov 14 18:17:24 2016 +0100 Fix errors from 1b822ad2 * src/mail.cpp: Fix utf8 macro. (Mail::get_signature_status): Fix typo. * src/mailitem-events.cpp: Fix utf8 macro. -- One should never push without compiling. diff --git a/src/mail.cpp b/src/mail.cpp index fc79787..ee864e3 100644 --- a/src/mail.cpp +++ b/src/mail.cpp @@ -45,11 +45,9 @@ #include #include + #undef _ -# define _(a) utf8_gettext (a) -#else -# define _(a) a -#endif +#define _(a) utf8_gettext (a) using namespace GpgME; @@ -1460,12 +1458,12 @@ Mail::get_signature_status() if (keyFound) { message += isOpenPGP ? _("Click here for details about the key.") : - _("Click here for details about the key."): + _("Click here for details about the key."); } else { message += isOpenPGP ? _("Click here to search the key on the configured keyserver.") : - _("Click here to search the certificate on the configured X509 keyserver."): + _("Click here to search the certificate on the configured X509 keyserver."); } message += buf; xfree (buf); diff --git a/src/mailitem-events.cpp b/src/mailitem-events.cpp index a26eadd..29ff764 100644 --- a/src/mailitem-events.cpp +++ b/src/mailitem-events.cpp @@ -29,10 +29,7 @@ #include "mapihelp.h" #undef _ -# define _(a) utf8_gettext (a) -#else -# define _(a) a -#endif +#define _(a) utf8_gettext (a) const wchar_t *prop_blacklist[] = { L"Body", ----------------------------------------------------------------------- Summary of changes: src/mail.cpp | 10 ++++------ src/mailitem-events.cpp | 5 +---- 2 files changed, 5 insertions(+), 10 deletions(-) hooks/post-receive -- GnuPG extension for MS Outlook http://git.gnupg.org From cvs at cvs.gnupg.org Mon Nov 14 18:40:28 2016 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Mon, 14 Nov 2016 18:40:28 +0100 Subject: [git] GpgOL - branch, master, updated. gpgol-1.4.0-164-g96bb146 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG extension for MS Outlook". The branch, master has been updated via 96bb1461509a1cd7e86e93cee99b1d979fc11add (commit) from ba6e9a8c468fdde33a238099664762695b31c2ad (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 96bb1461509a1cd7e86e93cee99b1d979fc11add Author: Andre Heinecke Date: Mon Nov 14 18:38:48 2016 +0100 Look for libgpgmepp in the right libdir * src/Makefile.am (libgpgmepp.a): Use correct prefix. diff --git a/src/Makefile.am b/src/Makefile.am index 55a9a7e..a05f079 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -113,7 +113,7 @@ libassuan.a: ln -s $$($(LIBASSUAN_CONFIG) --prefix)/lib/libassuan.a . libgpgmepp.a: - ln -s $$($(LIBASSUAN_CONFIG) --prefix)/lib/libgpgmepp.a . + ln -s $$($(GPGME_CONFIG) --prefix)/lib/libgpgmepp.a . clean-local: rm -f libmapi32.a libgpg-error.a libgpgme.a libassuan.a libgpgmepp.a ----------------------------------------------------------------------- Summary of changes: src/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- GnuPG extension for MS Outlook http://git.gnupg.org From cvs at cvs.gnupg.org Mon Nov 14 19:39:15 2016 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Mon, 14 Nov 2016 19:39:15 +0100 Subject: [git] GPGME - branch, master, updated. gpgme-1.7.1-38-gf3790dd Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via f3790ddf56558fb0a08af95fdbae979cd6589aad (commit) from b91c383386fe9eadd90afdb9bb1f8ec6c528173b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit f3790ddf56558fb0a08af95fdbae979cd6589aad Author: Andre Heinecke Date: Mon Nov 14 19:37:34 2016 +0100 qt, cpp: Enable dll build for windows * lang/cpp/src/Makefile.am, lang/qt/src/Makefile.am: Add -no-undefined to LDFLAGS. diff --git a/lang/cpp/src/Makefile.am b/lang/cpp/src/Makefile.am index 608d2d9..8953473 100644 --- a/lang/cpp/src/Makefile.am +++ b/lang/cpp/src/Makefile.am @@ -66,7 +66,7 @@ AM_CPPFLAGS = -I$(top_builddir)/src @GPG_ERROR_CFLAGS@ @LIBASSUAN_CFLAGS@ \ -DBUILDING_GPGMEPP libgpgmepp_la_LIBADD = ../../../src/libgpgme.la @LIBASSUAN_LIBS@ -libgpgmepp_la_LDFLAGS = -version-info \ +libgpgmepp_la_LDFLAGS = -no-undefined -version-info \ @LIBGPGMEPP_LT_CURRENT@:@LIBGPGMEPP_LT_REVISION@:@LIBGPGMEPP_LT_AGE@ if HAVE_W32_SYSTEM diff --git a/lang/qt/src/Makefile.am b/lang/qt/src/Makefile.am index 8742bc8..ead5c7f 100644 --- a/lang/qt/src/Makefile.am +++ b/lang/qt/src/Makefile.am @@ -216,7 +216,7 @@ AM_CPPFLAGS = -I$(top_srcdir)/lang/cpp/src -I$(top_builddir)/src \ libqgpgme_la_LIBADD = ../../cpp/src/libgpgmepp.la ../../../src/libgpgme.la \ @LIBASSUAN_LIBS@ @GPGME_QT_LIBS@ -libqgpgme_la_LDFLAGS = -version-info \ +libqgpgme_la_LDFLAGS = -no-undefined -version-info \ @LIBQGPGME_LT_CURRENT@:@LIBQGPGME_LT_REVISION@:@LIBQGPGME_LT_AGE@ if HAVE_W32_SYSTEM ----------------------------------------------------------------------- Summary of changes: lang/cpp/src/Makefile.am | 2 +- lang/qt/src/Makefile.am | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Mon Nov 14 20:48:32 2016 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Mon, 14 Nov 2016 20:48:32 +0100 Subject: [git] GPGME - branch, master, updated. gpgme-1.7.1-40-g9451faa Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 9451faa2ee333904cff59f92ab62918e13ab4b87 (commit) via d09a84eaf1e4f8c6c2e462995fa15c1a5690a6ce (commit) from f3790ddf56558fb0a08af95fdbae979cd6589aad (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 9451faa2ee333904cff59f92ab62918e13ab4b87 Author: Andre Heinecke Date: Mon Nov 14 20:40:29 2016 +0100 qt: Add API to get the context for a Job * lang/qt/src/job.cpp, lang/qt/src/job.h (Job::context): New. * lang/qt/src/threadedjobmixin.cpp (ThreadedJobMixin::~ThreadedJobMixin): New. Unregister context. (ThreadedJobMixin::lateInitialization): Register context. * NEWS: Update for cpp and qt. -- The global map hack is necessary because the job class does not know about the context which is held in threadedjobmixin. Adding a virtual function in Job would be an ABI break which I'd like to avoid at this point. Although QGpgME's API will need a big ABI break to make it ABI maintainable. The virtual jobs -> implementation classes are nearly unmaintainable ABI wise. The context is exposed to provide more flexibility to users, e.g. to add a passphrase callback or to set the sender in a context. diff --git a/NEWS b/NEWS index 1cf401e..4bb0cfb 100644 --- a/NEWS +++ b/NEWS @@ -14,9 +14,12 @@ Noteworthy changes in version 1.7.2 (unreleased) gpgme_query_swdb_result_t NEW. qt: DN NEW. qt: DN::Attribute NEW. + qt: Job::context(Job*) NEW. cpp: EngineInfo::Version::Version(const char*) NEW. cpp: EngineInfo::Version::Version() NEW. cpp: SwdbResult NEW. + cpp: Context::setSender(const char*) NEW. + cpp: Context::getSender() NEW. Noteworthy changes in version 1.7.1 (2016-10-18) diff --git a/lang/qt/src/job.cpp b/lang/qt/src/job.cpp index 38dbc99..9ae3f31 100644 --- a/lang/qt/src/job.cpp +++ b/lang/qt/src/job.cpp @@ -62,6 +62,7 @@ #include "keyformailboxjob.h" #include "wkspublishjob.h" #include "tofupolicyjob.h" +#include "threadedjobmixin.h" #include #include @@ -78,7 +79,6 @@ QGpgME::Job::Job(QObject *parent) QGpgME::Job::~Job() { - } QString QGpgME::Job::auditLogAsHtml() const @@ -98,6 +98,14 @@ bool QGpgME::Job::isAuditLogSupported() const return auditLogError().code() != GPG_ERR_NOT_IMPLEMENTED; } +QMap QGpgME::g_context_map; + +/* static */ +GpgME::Context *QGpgME::Job::context(QGpgME::Job *job) +{ + return QGpgME::g_context_map.value (job, nullptr); +} + #define make_job_subclass_ext(x,y) \ QGpgME::x::x( QObject * parent ) : y( parent ) {} \ QGpgME::x::~x() {} diff --git a/lang/qt/src/job.h b/lang/qt/src/job.h index 5767729..a0c0285 100644 --- a/lang/qt/src/job.h +++ b/lang/qt/src/job.h @@ -38,6 +38,7 @@ #include #include +#include #ifdef BUILDING_QGPGME # include "error.h" @@ -79,6 +80,20 @@ public: virtual GpgME::Error auditLogError() const; bool isAuditLogSupported() const; + /** Get the underlying context to set some additional options for a job. + * + * This is intended to provide more flexibility on configuring jobs before + * they are started. + * The context is still owned by the thread, do not delete it. + * + * This is a static method that takes the job as argument. + * + * This function may not be called for running jobs. + * + * @returns the context used by the job job or null. + */ + static GpgME::Context *context(Job *job); + public Q_SLOTS: virtual void slotCancel() = 0; @@ -87,6 +102,7 @@ Q_SIGNALS: void done(); }; +extern QMap g_context_map; } #endif // __KLEO_JOB_H__ diff --git a/lang/qt/src/threadedjobmixin.h b/lang/qt/src/threadedjobmixin.h index d1b1043..aef2723 100644 --- a/lang/qt/src/threadedjobmixin.h +++ b/lang/qt/src/threadedjobmixin.h @@ -48,6 +48,7 @@ # include #endif +#include "job.h" #include @@ -147,7 +148,6 @@ protected: explicit ThreadedJobMixin(GpgME::Context *ctx) : T_base(0), m_ctx(ctx), m_thread(), m_auditLog(), m_auditLogError() { - } void lateInitialization() @@ -155,6 +155,12 @@ protected: assert(m_ctx); QObject::connect(&m_thread, SIGNAL(finished()), this, SLOT(slotFinished())); m_ctx->setProgressProvider(this); + QGpgME::g_context_map.insert(this, m_ctx.get()); + } + + ~ThreadedJobMixin() + { + QGpgME::g_context_map.remove(this); } template diff --git a/lang/qt/tests/t-tofuinfo.cpp b/lang/qt/tests/t-tofuinfo.cpp index 2c87e4a..f89e1c2 100644 --- a/lang/qt/tests/t-tofuinfo.cpp +++ b/lang/qt/tests/t-tofuinfo.cpp @@ -152,6 +152,10 @@ private Q_SLOTS: const QByteArray data1(testMsg1); QByteArray plaintext; + auto ctx = Job::context(job); + Q_ASSERT(ctx); + ctx->setSender("alfa at example.net"); + auto result = job->exec(data1, plaintext); delete job; commit d09a84eaf1e4f8c6c2e462995fa15c1a5690a6ce Author: Andre Heinecke Date: Mon Nov 14 16:13:27 2016 +0100 cpp: Add get / set Sender API * cpp/src/context.cpp, cpp/src/context.h (Context::setSender), (Context::getSender): Add simple wrappers. diff --git a/lang/cpp/src/context.cpp b/lang/cpp/src/context.cpp index 1121104..ada7bea 100644 --- a/lang/cpp/src/context.cpp +++ b/lang/cpp/src/context.cpp @@ -466,6 +466,16 @@ Error Context::setEngineHomeDirectory(const char *home_dir) return Error(gpgme_ctx_set_engine_info(d->ctx, gpgme_get_protocol(d->ctx), filename, home_dir)); } +Error Context::setSender (const char *sender) +{ + return Error(gpgme_set_sender(d->ctx, sender)); +} + +const char *Context::getSender () +{ + return gpgme_get_sender(d->ctx); +} + // // // Key Management diff --git a/lang/cpp/src/context.h b/lang/cpp/src/context.h index ab15a21..2c205b0 100644 --- a/lang/cpp/src/context.h +++ b/lang/cpp/src/context.h @@ -304,6 +304,10 @@ public: GpgME::Error startSigning(const Data &plainText, Data &signature, SignatureMode mode); SigningResult signingResult() const; + // wrapper for gpgme_set_sender + const char *getSender(); + GpgME::Error setSender(const char *sender); + // // Encryption // ----------------------------------------------------------------------- Summary of changes: NEWS | 3 +++ lang/cpp/src/context.cpp | 10 ++++++++++ lang/cpp/src/context.h | 4 ++++ lang/qt/src/job.cpp | 10 +++++++++- lang/qt/src/job.h | 16 ++++++++++++++++ lang/qt/src/threadedjobmixin.h | 8 +++++++- lang/qt/tests/t-tofuinfo.cpp | 4 ++++ 7 files changed, 53 insertions(+), 2 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Tue Nov 15 05:16:03 2016 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Tue, 15 Nov 2016 05:16:03 +0100 Subject: [git] Poldi - branch, master, updated. release-0.4.1-51-g553060d Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "PAM for the OpenPGP card". The branch, master has been updated via 553060d8bbaac1381d0501b4525f4b102ccd3324 (commit) via 6091c0af2537ff100dcbbd66029d2302a7d5c5c1 (commit) via 6904ae208e81e19639c85edfaa76a4fea0a4074f (commit) via 0afd57e088146f0e2e968809e95867f8caabce00 (commit) via 91aa9c96ab7d6a608c76a713b13b301e7ea5ff82 (commit) via eb1fc82c307c1a147a4fa2e240c3b3330875fede (commit) via af67cba1ed81ca642e85f684bbc897e54187ba2a (commit) via 836d56934709b8a8821b60eeda9c815448826320 (commit) via 64b07726e2d3e3a6140dcf49416ad30f83fecfc0 (commit) from 83891ae71db2ba6f7d0e48db746fb5caaeba2c4b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 553060d8bbaac1381d0501b4525f4b102ccd3324 Author: NIIBE Yutaka Date: Tue Nov 15 13:07:15 2016 +0900 Update po. -- Signed-off-by: NIIBE Yutaka diff --git a/po/POTFILES.in b/po/POTFILES.in index b631da8..45ad51c 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -1,38 +1,36 @@ # List of source files which contain translatable strings. -./src/pam/auth-method-localdb/usersdb.c ./src/pam/auth-method-localdb/auth-localdb.c +./src/pam/auth-method-localdb/key-lookup.c ./src/pam/auth-method-localdb/key-lookup.h +./src/pam/auth-method-localdb/usersdb.c ./src/pam/auth-method-localdb/usersdb.h -./src/pam/auth-method-localdb/key-lookup.c +./src/pam/auth-method-x509/auth-x509.c +./src/pam/auth-method-x509/dirmngr.c +./src/pam/auth-method-x509/dirmngr.h ./src/pam/auth-methods.h -./src/pam/auth-support/getpin-cb.h -./src/pam/auth-support/pam-util.h ./src/pam/auth-support/conv.c -./src/pam/auth-support/wait-for-card.h -./src/pam/auth-support/wait-for-card.c -./src/pam/auth-support/pam-util.c ./src/pam/auth-support/conv.h ./src/pam/auth-support/ctx.h ./src/pam/auth-support/getpin-cb.c -./src/pam/auth-method-x509/dirmngr.h -./src/pam/auth-method-x509/dirmngr.c -./src/pam/auth-method-x509/auth-x509.c +./src/pam/auth-support/getpin-cb.h +./src/pam/auth-support/wait-for-card.c +./src/pam/auth-support/wait-for-card.h ./src/pam/pam_poldi.c ./src/poldi.h ./src/scd/scd.c ./src/scd/scd.h -./src/util/simplelog.c ./src/util/convert.c -./src/util/support.c -./src/util/support.h -./src/util/membuf.c -./src/util/simpleparse.h +./src/util/defs.h.in ./src/util/filenames.c ./src/util/filenames.h +./src/util/membuf.c ./src/util/membuf.h -./src/util/util.h +./src/util/simplelog.c ./src/util/simplelog.h -./src/util/util-local.h ./src/util/simpleparse.c -./src/util/defs.h.in +./src/util/simpleparse.h +./src/util/support.c +./src/util/support.h +./src/util/util-local.h +./src/util/util.h diff --git a/po/de.po b/po/de.po index 932bd1e..026e0b5 100644 --- a/po/de.po +++ b/po/de.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: poldi 0.4-cvs\n" "Report-Msgid-Bugs-To: gnupg-devel at gnupg.org\n" -"POT-Creation-Date: 2015-12-18 04:31+0000\n" +"POT-Creation-Date: 2016-11-15 13:02+0900\n" "PO-Revision-Date: 2009-08-08 19:47+0200\n" "Last-Translator: Moritz Schulte \n" "Language-Team: LANGUAGE \n" @@ -16,337 +16,243 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -#: src/pam/auth-method-localdb/auth-localdb.c:109 +#: src/pam/auth-method-localdb/auth-localdb.c:108 msgid "Please enter username: " msgstr "Bitte Benutzername eingeben: " -#: src/pam/auth-method-localdb/auth-localdb.c:121 -#: src/pam/auth-method-localdb/auth-localdb.c:124 +#: src/pam/auth-method-localdb/auth-localdb.c:123 #, c-format msgid "Trying authentication as user `%s'..." msgstr "Versuche Authentifizierung als Benutzer '%s'..." -#: src/pam/auth-method-localdb/auth-localdb.c:133 -#: src/pam/auth-method-localdb/auth-localdb.c:136 +#: src/pam/auth-method-localdb/auth-localdb.c:135 #, c-format msgid "Serial number %s is not associated with user %s" msgstr "Seriennummer %s ist nicht assoziiert mit Benutzer %s" -#: src/pam/auth-method-localdb/auth-localdb.c:152 -#: src/pam/auth-method-x509/auth-x509.c:553 -#, c-format -msgid "failed to generate challenge: %s" -msgstr "Generierung der Challenge fehlgeschlagen: %s" - -#: src/pam/auth-method-localdb/auth-localdb.c:164 -#: src/pam/auth-method-x509/auth-x509.c:565 -#, c-format -msgid "failed to retrieve challenge signature from card: %s" -msgstr "konnte Signatur der Challenge nicht von der Karte empfangen: %s" +#: src/pam/auth-method-x509/auth-x509.c:102 +msgid "Specify local socket for dirmngr access" +msgstr "Spezifiziert den lokalen Socket fuer Dirmngr Zugriff" -#: src/pam/auth-method-localdb/auth-localdb.c:174 -msgid "failed to verify challenge" -msgstr "Verifizierung der Challenge fehlgeschlagen" +#: src/pam/auth-method-x509/auth-x509.c:104 +msgid "Specify X509 domain for this host" +msgstr "Spezifiziere die X509 Dom?ne f?r dieses System" -#: src/pam/auth-method-localdb/key-lookup.c:63 -#, c-format -msgid "failed to construct key file path for serial number `%s': %s\n" +#: src/pam/auth-support/getpin-cb.c:75 +msgid "PIN too short" msgstr "" -"konnte Pfad fuer die Schl?sseldatei f?r die Seriennummer '%s' nicht " -"konstruieren: %s\n" -#: src/pam/auth-method-localdb/key-lookup.c:75 -#, c-format -msgid "failed to retrieve key from key file `%s': %s\n" -msgstr "" -"Auslesen des Schl?ssels aus der Schl?sseldatei '%s' fehlgeschlagen: %s\n" +#: src/pam/auth-support/getpin-cb.c:228 src/pam/auth-support/getpin-cb.c:247 +msgid "Please enter the PIN:" +msgstr "Bitte PIN eingeben:" -#: src/pam/auth-method-localdb/key-lookup.c:84 +#: src/pam/pam_poldi.c:591 #, c-format -msgid "failed to convert key from `%s' into S-Expression: %s\n" -msgstr "" -"konnte Schl?ssel aus '%s' nicht in eine S-Expression konvertieren: %s\n" - -#: src/pam/auth-support/getpin-cb.c:74 src/pam/auth-support/getpin-cb.c:75 -msgid "PIN too short" -msgstr "" +msgid "Insert authentication card for user `%s'" +msgstr "Bitte Authentifikationskarte f?r Benutzer '%s' einlegen" -#: src/pam/auth-support/getpin-cb.c:83 -msgid "PIN too long for buffer!" -msgstr "PIN zu lang f?r Puffer" +#: src/pam/pam_poldi.c:598 +msgid "Insert authentication card" +msgstr "Bitte Authentifikationskarte einlegen" -#: src/pam/auth-support/getpin-cb.c:204 +#: src/util/simpleparse.c:149 #, c-format -msgid "getpin_cb called with flags set in info string `%s'\n" -msgstr "getpin-Callback mit nicht unterst?tzten Flags in '%s' aufgerufen\n" +msgid "Please report bugs to <%s>.\n" +msgstr "Bitte sende Fehlerberichte an <%s>.\n" -#: src/pam/auth-support/getpin-cb.c:214 +#: src/util/simpleparse.c:308 src/util/simpleparse.c:597 #, c-format -msgid "frob_info_msg failed for info msg of size %u\n" -msgstr "frob_info_msg fehlgeschlagen f?r eine Nachricht der L?nge %u\n" - -#: src/pam/auth-support/getpin-cb.c:228 src/pam/auth-support/getpin-cb.c:247 -msgid "Please enter the PIN:" -msgstr "Bitte PIN eingeben:" +msgid "unknown option '%s'" +msgstr "unbekannte Option '%s'" -#: src/pam/auth-method-x509/dirmngr.c:153 +#: src/util/simpleparse.c:321 src/util/simpleparse.c:335 +#: src/util/simpleparse.c:352 src/util/simpleparse.c:378 #, c-format -msgid "ignored inquiry from dirmngr: `%s'" -msgstr "ignorierte Anfrage von Dirmngr: '%s'" +msgid "parse-callback returned error '%s' for argument '%s'" +msgstr "parse-Callback hat Fehler '%s' f?r das Argument '%s' zur?ckgegeben" -#: src/pam/auth-method-x509/dirmngr.c:157 +#: src/util/simpleparse.c:365 src/util/simpleparse.c:619 #, c-format -msgid "failed to send back empty value to dirmngr: %s" -msgstr "zur?cksenden eines leeren Werts an Dirmngr fehlgeschlagen: %s" +msgid "missing required argument for '%s'" +msgstr "fehlendes notwendiges Argument f?r '%s'" -#: src/pam/auth-method-x509/dirmngr.c:162 +#: src/util/simpleparse.c:608 src/util/simpleparse.c:628 #, c-format -msgid "unsupported assuan inquiry `%s'" -msgstr "nicht unterst?tzte Assuan Anfrage '%s'" +msgid "too many arguments specified for option '%s'" +msgstr "zu viele Argumente f?r Options '%s' angegeben" -#: src/pam/auth-method-x509/dirmngr.c:258 -#, c-format -msgid "failed to create new ksba certificate object: %s" -msgstr "erzeugen eines neuen KSBA Zertifikatobjekts fehlgeschlagen: %s" +#~ msgid "failed to generate challenge: %s" +#~ msgstr "Generierung der Challenge fehlgeschlagen: %s" -#: src/pam/auth-method-x509/auth-x509.c:103 -msgid "Specify local socket for dirmngr access" -msgstr "Spezifiziert den lokalen Socket fuer Dirmngr Zugriff" +#~ msgid "failed to retrieve challenge signature from card: %s" +#~ msgstr "konnte Signatur der Challenge nicht von der Karte empfangen: %s" -#: src/pam/auth-method-x509/auth-x509.c:105 -msgid "Specify X509 domain for this host" -msgstr "Spezifiziere die X509 Dom?ne f?r dieses System" +#~ msgid "failed to verify challenge" +#~ msgstr "Verifizierung der Challenge fehlgeschlagen" -#: src/pam/auth-method-x509/auth-x509.c:124 -#: src/pam/auth-method-x509/auth-x509.c:136 -#, c-format -msgid "failed to duplicate %s (length: %i): %s" -msgstr "konnte %s (L?nge: %i) nicht duplizieren: %s" +#~ msgid "failed to construct key file path for serial number `%s': %s\n" +#~ msgstr "" +#~ "konnte Pfad fuer die Schl?sseldatei f?r die Seriennummer '%s' nicht " +#~ "konstruieren: %s\n" -#: src/pam/auth-method-x509/auth-x509.c:168 -msgid "libksba did not return a proper S-Exp" -msgstr "libksba gab keine g?ltige S-Expression zur?ck" +#~ msgid "failed to retrieve key from key file `%s': %s\n" +#~ msgstr "" +#~ "Auslesen des Schl?ssels aus der Schl?sseldatei '%s' fehlgeschlagen: %s\n" -#: src/pam/auth-method-x509/auth-x509.c:177 -#, c-format -msgid "failed to convert KSBA s-expression into s-expression object: %s" -msgstr "konnte KSBA S-Expression nicht in S-Expression Objekt konvertieren: %s" +#~ msgid "failed to convert key from `%s' into S-Expression: %s\n" +#~ msgstr "" +#~ "konnte Schl?ssel aus '%s' nicht in eine S-Expression konvertieren: %s\n" -#: src/pam/auth-method-x509/auth-x509.c:409 -msgid "failed to extract username from certificate" -msgstr "konnte Benutzername nicht aus dem Zertifikat extrahieren: %s" +#~ msgid "failed to duplicate %s (length: %i): %s" +#~ msgstr "konnte %s (L?nge: %i) nicht duplizieren: %s" -#: src/pam/auth-method-x509/auth-x509.c:443 -msgid "invalid certificate URL on card" -msgstr "ung?ltige Zertifikats URL auf der Karte" +#~ msgid "libksba did not return a proper S-Exp" +#~ msgstr "libksba gab keine g?ltige S-Expression zur?ck" -#: src/pam/auth-method-x509/auth-x509.c:490 -msgid "x509 authentication method not properly configured" -msgstr "X509 Authentifikationsmethode nicht richtig konfiguriert" +#~ msgid "failed to convert KSBA s-expression into s-expression object: %s" +#~ msgstr "" +#~ "konnte KSBA S-Expression nicht in S-Expression Objekt konvertieren: %s" -#: src/pam/auth-method-x509/auth-x509.c:504 -#, c-format -msgid "public key url is '%s'" -msgstr "URL des ?ffentlichen Schl?ssels ist '%s'" +#~ msgid "failed to extract username from certificate" +#~ msgstr "konnte Benutzername nicht aus dem Zertifikat extrahieren: %s" -#: src/pam/auth-method-x509/auth-x509.c:512 -#, c-format -msgid "failed to look up certificate `%s': %s" -msgstr "nachschlagen des Zertifikats '%s' gescheitert: %s" +#~ msgid "invalid certificate URL on card" +#~ msgstr "ung?ltige Zertifikats URL auf der Karte" -#: src/pam/auth-method-x509/auth-x509.c:578 -msgid "failed to verify challenge signature" -msgstr "Verifizierung der Signatur der Challenge fehlgeschlagen" +#~ msgid "x509 authentication method not properly configured" +#~ msgstr "X509 Authentifikationsmethode nicht richtig konfiguriert" -#: src/pam/auth-method-x509/auth-x509.c:598 -#, c-format -msgid "failure: %s" -msgstr "fehlgeschlagen: %s" +#~ msgid "failed to look up certificate `%s': %s" +#~ msgstr "nachschlagen des Zertifikats '%s' gescheitert: %s" -#: src/pam/auth-method-x509/auth-x509.c:600 -msgid "success" -msgstr "Erfolg" +#~ msgid "failed to verify challenge signature" +#~ msgstr "Verifizierung der Signatur der Challenge fehlgeschlagen" -#: src/pam/pam_poldi.c:142 src/pam/pam_poldi.c:155 src/pam/pam_poldi.c:169 -#: src/scd/scd.c:124 -#, c-format -msgid "failed to duplicate %s: %s" -msgstr "Konnte %s nicht duplizieren: %s" +#~ msgid "failure: %s" +#~ msgstr "fehlgeschlagen: %s" -#: src/pam/pam_poldi.c:184 -#, c-format -msgid "unknown authentication method '%s'" -msgstr "unbekannte Authentifikationsmethode '%s'" +#~ msgid "failed to send back empty value to dirmngr: %s" +#~ msgstr "zur?cksenden eines leeren Werts an Dirmngr fehlgeschlagen: %s" -#: src/pam/pam_poldi.c:312 -#, c-format -msgid "asprintf() failed in modify_environment_putenv(): %s" -msgstr "asprintf() in modify_environment_putenv() fehlgeschlagen: %s" +#~ msgid "unsupported assuan inquiry `%s'" +#~ msgstr "nicht unterst?tzte Assuan Anfrage '%s'" -#: src/pam/pam_poldi.c:321 -#, c-format -msgid "pam_putenv() failed in modify_environment_putenv(): %s" -msgstr "pam_putenv() in modify_environment_putenv() fehlgeschlagen: %s" +#~ msgid "failed to create new ksba certificate object: %s" +#~ msgstr "erzeugen eines neuen KSBA Zertifikatobjekts fehlgeschlagen: %s" -#: src/pam/pam_poldi.c:406 -#, c-format -msgid "failed to parse configuration file '%s': %s" -msgstr "Lesen der Konfigurationsdatei '%s' fehlgeschlagen: %s" +#~ msgid "PIN too long for buffer!" +#~ msgstr "PIN zu lang f?r Puffer" -#: src/pam/pam_poldi.c:419 -#, c-format -msgid "failed to parse PAM argument vector: %s" -msgstr "Auswertung des PAM Argumentvektors fehlgeschlagen: %s" +#~ msgid "getpin_cb called with flags set in info string `%s'\n" +#~ msgstr "getpin-Callback mit nicht unterst?tzten Flags in '%s' aufgerufen\n" -#: src/pam/pam_poldi.c:448 -msgid "no authentication method specified" -msgstr "Keine Authentifikationsmethode spezifiziert" +#~ msgid "frob_info_msg failed for info msg of size %u\n" +#~ msgstr "frob_info_msg fehlgeschlagen f?r eine Nachricht der L?nge %u\n" -#: src/pam/pam_poldi.c:462 -#, c-format -msgid "using authentication method `%s'" -msgstr "benutze Authentifikationsmethode '%s'" +#~ msgid "failed to duplicate %s: %s" +#~ msgstr "Konnte %s nicht duplizieren: %s" -#: src/pam/pam_poldi.c:474 -#, c-format -msgid "failed to initialize authentication method %i: %s" -msgstr "Initialisierung der Authentifikationsmethode %i fehlgeschlagen: %s" +#~ msgid "unknown authentication method '%s'" +#~ msgstr "unbekannte Authentifikationsmethode '%s'" -#: src/pam/pam_poldi.c:488 -#, c-format -msgid "" -"failed to initialize parsing of configuration file for authentication method " -"%s: %s" -msgstr "" -"konnte Auswertung der Konfigurationsdatei f?r die Authentifikationsmethode " -"%s nicht beginnen: %s" +#~ msgid "asprintf() failed in modify_environment_putenv(): %s" +#~ msgstr "asprintf() in modify_environment_putenv() fehlgeschlagen: %s" -#: src/pam/pam_poldi.c:509 -#, c-format -msgid "failed to parse configuration for authentication method %i: %s" -msgstr "" -"konnte Konfigurationsdatei f?r die Authentifikationsmethode %i nicht lesen: " -"%s" +#~ msgid "pam_putenv() failed in modify_environment_putenv(): %s" +#~ msgstr "pam_putenv() in modify_environment_putenv() fehlgeschlagen: %s" -#: src/pam/pam_poldi.c:528 -msgid "failed to retrieve PAM conversation structure" -msgstr "konnte PAM conversation-structure nicht empfangen" +#~ msgid "failed to parse configuration file '%s': %s" +#~ msgstr "Lesen der Konfigurationsdatei '%s' fehlgeschlagen: %s" -#: src/pam/pam_poldi.c:546 -#, c-format -msgid "failed to retrieve username from PAM: %s" -msgstr "konnte Benutzername nicht von PAM empfangen: %s" +#~ msgid "failed to parse PAM argument vector: %s" +#~ msgstr "Auswertung des PAM Argumentvektors fehlgeschlagen: %s" -#: src/pam/pam_poldi.c:570 -#, c-format -msgid "Waiting for card for user `%s'..." -msgstr "Warte auf Karte f?r Benutzer '%s'..." +#~ msgid "no authentication method specified" +#~ msgstr "Keine Authentifikationsmethode spezifiziert" -#: src/pam/pam_poldi.c:572 -#, c-format -msgid "Insert authentication card for user `%s'" -msgstr "Bitte Authentifikationskarte f?r Benutzer '%s' einlegen" +#~ msgid "using authentication method `%s'" +#~ msgstr "benutze Authentifikationsmethode '%s'" -#: src/pam/pam_poldi.c:577 -msgid "Waiting for card..." -msgstr "Warte auf Karte..." +#~ msgid "failed to initialize authentication method %i: %s" +#~ msgstr "Initialisierung der Authentifikationsmethode %i fehlgeschlagen: %s" -#: src/pam/pam_poldi.c:579 -msgid "Insert authentication card" -msgstr "Bitte Authentifikationskarte einlegen" +#~ msgid "" +#~ "failed to initialize parsing of configuration file for authentication " +#~ "method %s: %s" +#~ msgstr "" +#~ "konnte Auswertung der Konfigurationsdatei f?r die " +#~ "Authentifikationsmethode %s nicht beginnen: %s" -#: src/pam/pam_poldi.c:586 -#, c-format -msgid "failed to wait for card insertion: %s" -msgstr "Warten auf Karte fehlgeschlagen: %s" +#~ msgid "failed to parse configuration for authentication method %i: %s" +#~ msgstr "" +#~ "konnte Konfigurationsdatei f?r die Authentifikationsmethode %i nicht " +#~ "lesen: %s" -#: src/pam/pam_poldi.c:599 -#, c-format -msgid "connected to card; serial number is: %s" -msgstr "Verbunden zur Karte; Seriennummer ist: '%s'" +#~ msgid "failed to retrieve PAM conversation structure" +#~ msgstr "konnte PAM conversation-structure nicht empfangen" -#: src/pam/pam_poldi.c:637 -#, c-format -msgid "authentication failed: %s" -msgstr "Authentifikation fehlgeschlagen: %s" +#, fuzzy +#~ msgid "Can't retrieve username from PAM" +#~ msgstr "konnte Benutzername nicht von PAM empfangen: %s" -#: src/pam/pam_poldi.c:641 -msgid "authentication succeeded" -msgstr "Authentifikation erfolgreich" +#~ msgid "failed to wait for card insertion: %s" +#~ msgstr "Warten auf Karte fehlgeschlagen: %s" -#: src/scd/scd.c:133 -msgid "malformed GPG_AGENT_INFO environment variable" -msgstr "syntaktisch ung?ltige GPG_AGENT_INFO Umgebungsvariable" +#~ msgid "authentication failed: %s" +#~ msgstr "Authentifikation fehlgeschlagen: %s" -#: src/scd/scd.c:146 -#, c-format -msgid "agent protocol version %d is not supported" -msgstr "Agent-Protokoll Version %d ist nicht unterst?tzt" +#~ msgid "error flushing pending output: %s" +#~ msgstr "konnte wartende Ausgabe nicht schreiben: %s" -#: src/scd/scd.c:197 src/scd/scd.c:941 -#, c-format -msgid "warning: can't store getinfo data: %s" -msgstr "Warnung: konnte GETINFO Daten nicht speichern: %s" +#, fuzzy +#~ msgid "could not spawn scdaemon: %s" +#~ msgstr "Verbinden zu Scdaemon fehlgeschlagen: %s" -#: src/scd/scd.c:295 -#, c-format -msgid "connected to system scdaemon through socket '%s'" -msgstr "?ber den Socket '%s' zu System Scdaemon verbunden" +#~ msgid "warning: can't store getinfo data: %s" +#~ msgstr "Warnung: konnte GETINFO Daten nicht speichern: %s" -#: src/scd/scd.c:315 -#, c-format -msgid "got scdaemon socket name from gpg-agent, connected to socket '%s'" -msgstr "" -"Scdaemon Socket Namen ?ber GPG-Agent empfangen, verbunden mit Socket '%s'" +#~ msgid "ignored inquiry from dirmngr: `%s'" +#~ msgstr "ignorierte Anfrage von Dirmngr: '%s'" -#: src/scd/scd.c:336 -msgid "no running scdaemon - starting one" -msgstr "Kein aktiver Scdaemon - starte einen" +#~ msgid "public key url is '%s'" +#~ msgstr "URL des ?ffentlichen Schl?ssels ist '%s'" -#: src/scd/scd.c:342 -#, c-format -msgid "error flushing pending output: %s" -msgstr "konnte wartende Ausgabe nicht schreiben: %s" +#~ msgid "success" +#~ msgstr "Erfolg" -#: src/scd/scd.c:385 -#, c-format -msgid "spawned a new scdaemon (path: '%s')" -msgstr "neuer Scdaemon gestartet (Pfad: '%s')" +#~ msgid "Waiting for card for user `%s'..." +#~ msgstr "Warte auf Karte f?r Benutzer '%s'..." -#: src/scd/scd.c:392 -#, c-format -msgid "could not connect to any scdaemon: %s" -msgstr "Verbinden zu Scdaemon fehlgeschlagen: %s" +#~ msgid "Waiting for card..." +#~ msgstr "Warte auf Karte..." -#: src/scd/scd.c:415 -msgid "connection to scdaemon established" -msgstr "Verbindung zu Scdaemon hergestellt" +#~ msgid "connected to card; serial number is: %s" +#~ msgstr "Verbunden zur Karte; Seriennummer ist: '%s'" -#: src/util/simpleparse.c:149 -#, c-format -msgid "Please report bugs to <%s>.\n" -msgstr "Bitte sende Fehlerberichte an <%s>.\n" +#~ msgid "authentication succeeded" +#~ msgstr "Authentifikation erfolgreich" -#: src/util/simpleparse.c:308 src/util/simpleparse.c:597 -#, c-format -msgid "unknown option '%s'" -msgstr "unbekannte Option '%s'" +#~ msgid "malformed GPG_AGENT_INFO environment variable" +#~ msgstr "syntaktisch ung?ltige GPG_AGENT_INFO Umgebungsvariable" -#: src/util/simpleparse.c:321 src/util/simpleparse.c:335 -#: src/util/simpleparse.c:352 src/util/simpleparse.c:378 -#, c-format -msgid "parse-callback returned error '%s' for argument '%s'" -msgstr "parse-Callback hat Fehler '%s' f?r das Argument '%s' zur?ckgegeben" +#~ msgid "agent protocol version %d is not supported" +#~ msgstr "Agent-Protokoll Version %d ist nicht unterst?tzt" -#: src/util/simpleparse.c:365 src/util/simpleparse.c:619 -#, c-format -msgid "missing required argument for '%s'" -msgstr "fehlendes notwendiges Argument f?r '%s'" +#~ msgid "connected to system scdaemon through socket '%s'" +#~ msgstr "?ber den Socket '%s' zu System Scdaemon verbunden" -#: src/util/simpleparse.c:608 src/util/simpleparse.c:628 -#, c-format -msgid "too many arguments specified for option '%s'" -msgstr "zu viele Argumente f?r Options '%s' angegeben" +#~ msgid "got scdaemon socket name from gpg-agent, connected to socket '%s'" +#~ msgstr "" +#~ "Scdaemon Socket Namen ?ber GPG-Agent empfangen, verbunden mit Socket '%s'" + +#~ msgid "no running scdaemon - starting one" +#~ msgstr "Kein aktiver Scdaemon - starte einen" + +#~ msgid "spawned a new scdaemon (path: '%s')" +#~ msgstr "neuer Scdaemon gestartet (Pfad: '%s')" + +#~ msgid "connection to scdaemon established" +#~ msgstr "Verbindung zu Scdaemon hergestellt" #~ msgid "invalid PIN" #~ msgstr "ung?ltige PIN" diff --git a/po/poldi.pot b/po/poldi.pot index 241e5bc..3675c24 100644 --- a/po/poldi.pot +++ b/po/poldi.pot @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: poldi 0.4.2.git\n" "Report-Msgid-Bugs-To: gnupg-devel at gnupg.org\n" -"POT-Creation-Date: 2015-12-18 04:31+0000\n" +"POT-Creation-Date: 2016-11-15 13:02+0900\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,303 +17,45 @@ msgstr "" "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: src/pam/auth-method-localdb/auth-localdb.c:109 +#: src/pam/auth-method-localdb/auth-localdb.c:108 msgid "Please enter username: " msgstr "" -#: src/pam/auth-method-localdb/auth-localdb.c:121 -#: src/pam/auth-method-localdb/auth-localdb.c:124 +#: src/pam/auth-method-localdb/auth-localdb.c:123 #, c-format msgid "Trying authentication as user `%s'..." msgstr "" -#: src/pam/auth-method-localdb/auth-localdb.c:133 -#: src/pam/auth-method-localdb/auth-localdb.c:136 +#: src/pam/auth-method-localdb/auth-localdb.c:135 #, c-format msgid "Serial number %s is not associated with user %s" msgstr "" -#: src/pam/auth-method-localdb/auth-localdb.c:152 -#: src/pam/auth-method-x509/auth-x509.c:553 -#, c-format -msgid "failed to generate challenge: %s" -msgstr "" - -#: src/pam/auth-method-localdb/auth-localdb.c:164 -#: src/pam/auth-method-x509/auth-x509.c:565 -#, c-format -msgid "failed to retrieve challenge signature from card: %s" -msgstr "" - -#: src/pam/auth-method-localdb/auth-localdb.c:174 -msgid "failed to verify challenge" -msgstr "" - -#: src/pam/auth-method-localdb/key-lookup.c:63 -#, c-format -msgid "failed to construct key file path for serial number `%s': %s\n" -msgstr "" - -#: src/pam/auth-method-localdb/key-lookup.c:75 -#, c-format -msgid "failed to retrieve key from key file `%s': %s\n" +#: src/pam/auth-method-x509/auth-x509.c:102 +msgid "Specify local socket for dirmngr access" msgstr "" -#: src/pam/auth-method-localdb/key-lookup.c:84 -#, c-format -msgid "failed to convert key from `%s' into S-Expression: %s\n" +#: src/pam/auth-method-x509/auth-x509.c:104 +msgid "Specify X509 domain for this host" msgstr "" -#: src/pam/auth-support/getpin-cb.c:74 src/pam/auth-support/getpin-cb.c:75 +#: src/pam/auth-support/getpin-cb.c:75 msgid "PIN too short" msgstr "" -#: src/pam/auth-support/getpin-cb.c:83 -msgid "PIN too long for buffer!" -msgstr "" - -#: src/pam/auth-support/getpin-cb.c:204 -#, c-format -msgid "getpin_cb called with flags set in info string `%s'\n" -msgstr "" - -#: src/pam/auth-support/getpin-cb.c:214 -#, c-format -msgid "frob_info_msg failed for info msg of size %u\n" -msgstr "" - #: src/pam/auth-support/getpin-cb.c:228 src/pam/auth-support/getpin-cb.c:247 msgid "Please enter the PIN:" msgstr "" -#: src/pam/auth-method-x509/dirmngr.c:153 -#, c-format -msgid "ignored inquiry from dirmngr: `%s'" -msgstr "" - -#: src/pam/auth-method-x509/dirmngr.c:157 -#, c-format -msgid "failed to send back empty value to dirmngr: %s" -msgstr "" - -#: src/pam/auth-method-x509/dirmngr.c:162 -#, c-format -msgid "unsupported assuan inquiry `%s'" -msgstr "" - -#: src/pam/auth-method-x509/dirmngr.c:258 -#, c-format -msgid "failed to create new ksba certificate object: %s" -msgstr "" - -#: src/pam/auth-method-x509/auth-x509.c:103 -msgid "Specify local socket for dirmngr access" -msgstr "" - -#: src/pam/auth-method-x509/auth-x509.c:105 -msgid "Specify X509 domain for this host" -msgstr "" - -#: src/pam/auth-method-x509/auth-x509.c:124 -#: src/pam/auth-method-x509/auth-x509.c:136 -#, c-format -msgid "failed to duplicate %s (length: %i): %s" -msgstr "" - -#: src/pam/auth-method-x509/auth-x509.c:168 -msgid "libksba did not return a proper S-Exp" -msgstr "" - -#: src/pam/auth-method-x509/auth-x509.c:177 -#, c-format -msgid "failed to convert KSBA s-expression into s-expression object: %s" -msgstr "" - -#: src/pam/auth-method-x509/auth-x509.c:409 -msgid "failed to extract username from certificate" -msgstr "" - -#: src/pam/auth-method-x509/auth-x509.c:443 -msgid "invalid certificate URL on card" -msgstr "" - -#: src/pam/auth-method-x509/auth-x509.c:490 -msgid "x509 authentication method not properly configured" -msgstr "" - -#: src/pam/auth-method-x509/auth-x509.c:504 -#, c-format -msgid "public key url is '%s'" -msgstr "" - -#: src/pam/auth-method-x509/auth-x509.c:512 -#, c-format -msgid "failed to look up certificate `%s': %s" -msgstr "" - -#: src/pam/auth-method-x509/auth-x509.c:578 -msgid "failed to verify challenge signature" -msgstr "" - -#: src/pam/auth-method-x509/auth-x509.c:598 -#, c-format -msgid "failure: %s" -msgstr "" - -#: src/pam/auth-method-x509/auth-x509.c:600 -msgid "success" -msgstr "" - -#: src/pam/pam_poldi.c:142 src/pam/pam_poldi.c:155 src/pam/pam_poldi.c:169 -#: src/scd/scd.c:124 -#, c-format -msgid "failed to duplicate %s: %s" -msgstr "" - -#: src/pam/pam_poldi.c:184 -#, c-format -msgid "unknown authentication method '%s'" -msgstr "" - -#: src/pam/pam_poldi.c:312 -#, c-format -msgid "asprintf() failed in modify_environment_putenv(): %s" -msgstr "" - -#: src/pam/pam_poldi.c:321 -#, c-format -msgid "pam_putenv() failed in modify_environment_putenv(): %s" -msgstr "" - -#: src/pam/pam_poldi.c:406 -#, c-format -msgid "failed to parse configuration file '%s': %s" -msgstr "" - -#: src/pam/pam_poldi.c:419 -#, c-format -msgid "failed to parse PAM argument vector: %s" -msgstr "" - -#: src/pam/pam_poldi.c:448 -msgid "no authentication method specified" -msgstr "" - -#: src/pam/pam_poldi.c:462 -#, c-format -msgid "using authentication method `%s'" -msgstr "" - -#: src/pam/pam_poldi.c:474 -#, c-format -msgid "failed to initialize authentication method %i: %s" -msgstr "" - -#: src/pam/pam_poldi.c:488 -#, c-format -msgid "" -"failed to initialize parsing of configuration file for authentication method " -"%s: %s" -msgstr "" - -#: src/pam/pam_poldi.c:509 -#, c-format -msgid "failed to parse configuration for authentication method %i: %s" -msgstr "" - -#: src/pam/pam_poldi.c:528 -msgid "failed to retrieve PAM conversation structure" -msgstr "" - -#: src/pam/pam_poldi.c:546 -#, c-format -msgid "failed to retrieve username from PAM: %s" -msgstr "" - -#: src/pam/pam_poldi.c:570 -#, c-format -msgid "Waiting for card for user `%s'..." -msgstr "" - -#: src/pam/pam_poldi.c:572 +#: src/pam/pam_poldi.c:591 #, c-format msgid "Insert authentication card for user `%s'" msgstr "" -#: src/pam/pam_poldi.c:577 -msgid "Waiting for card..." -msgstr "" - -#: src/pam/pam_poldi.c:579 +#: src/pam/pam_poldi.c:598 msgid "Insert authentication card" msgstr "" -#: src/pam/pam_poldi.c:586 -#, c-format -msgid "failed to wait for card insertion: %s" -msgstr "" - -#: src/pam/pam_poldi.c:599 -#, c-format -msgid "connected to card; serial number is: %s" -msgstr "" - -#: src/pam/pam_poldi.c:637 -#, c-format -msgid "authentication failed: %s" -msgstr "" - -#: src/pam/pam_poldi.c:641 -msgid "authentication succeeded" -msgstr "" - -#: src/scd/scd.c:133 -msgid "malformed GPG_AGENT_INFO environment variable" -msgstr "" - -#: src/scd/scd.c:146 -#, c-format -msgid "agent protocol version %d is not supported" -msgstr "" - -#: src/scd/scd.c:197 src/scd/scd.c:941 -#, c-format -msgid "warning: can't store getinfo data: %s" -msgstr "" - -#: src/scd/scd.c:295 -#, c-format -msgid "connected to system scdaemon through socket '%s'" -msgstr "" - -#: src/scd/scd.c:315 -#, c-format -msgid "got scdaemon socket name from gpg-agent, connected to socket '%s'" -msgstr "" - -#: src/scd/scd.c:336 -msgid "no running scdaemon - starting one" -msgstr "" - -#: src/scd/scd.c:342 -#, c-format -msgid "error flushing pending output: %s" -msgstr "" - -#: src/scd/scd.c:385 -#, c-format -msgid "spawned a new scdaemon (path: '%s')" -msgstr "" - -#: src/scd/scd.c:392 -#, c-format -msgid "could not connect to any scdaemon: %s" -msgstr "" - -#: src/scd/scd.c:415 -msgid "connection to scdaemon established" -msgstr "" - #: src/util/simpleparse.c:149 #, c-format msgid "Please report bugs to <%s>.\n" commit 6091c0af2537ff100dcbbd66029d2302a7d5c5c1 Author: NIIBE Yutaka Date: Tue Nov 15 13:03:15 2016 +0900 Don't translate logged message. * src/pam/auth-method-localdb/auth-localdb.c, src/pam/auth-method-localdb/key-lookup.c, src/pam/auth-method-x509/auth-x509.c, src/pam/auth-method-x509/dirmngr.c, src/pam/auth-support/getpin-cb.c, src/pam/pam_poldi.c: Don't translate. -- Signed-off-by: NIIBE Yutaka diff --git a/src/pam/auth-method-localdb/auth-localdb.c b/src/pam/auth-method-localdb/auth-localdb.c index 3081737..d73808d 100644 --- a/src/pam/auth-method-localdb/auth-localdb.c +++ b/src/pam/auth-method-localdb/auth-localdb.c @@ -148,7 +148,7 @@ auth_method_localdb_auth_do (poldi_ctx_t ctx, if (err) { log_msg_error (ctx->loghandle, - _("failed to generate challenge: %s"), + "failed to generate challenge: %s", gpg_strerror (err)); goto out; } @@ -160,7 +160,7 @@ auth_method_localdb_auth_do (poldi_ctx_t ctx, if (err) { log_msg_error (ctx->loghandle, - _("failed to retrieve challenge signature from card: %s"), + "failed to retrieve challenge signature from card: %s", gpg_strerror (err)); goto out; } @@ -169,8 +169,7 @@ auth_method_localdb_auth_do (poldi_ctx_t ctx, err = challenge_verify (key, challenge, challenge_n, response, response_n); if (err) { - log_msg_error (ctx->loghandle, - _("failed to verify challenge")); + log_msg_error (ctx->loghandle, "failed to verify challenge"); goto out; } diff --git a/src/pam/auth-method-localdb/key-lookup.c b/src/pam/auth-method-localdb/key-lookup.c index c7a8840..20fce4a 100644 --- a/src/pam/auth-method-localdb/key-lookup.c +++ b/src/pam/auth-method-localdb/key-lookup.c @@ -60,8 +60,8 @@ key_lookup_by_serialno (poldi_ctx_t ctx, const char *serialno, gcry_sexp_t *key) if (err) { log_msg_error (ctx->loghandle, - _("failed to construct key file path " - "for serial number `%s': %s\n"), + "failed to construct key file path " + "for serial number `%s': %s\n", serialno, gpg_strerror (err)); goto out; } @@ -72,7 +72,7 @@ key_lookup_by_serialno (poldi_ctx_t ctx, const char *serialno, gcry_sexp_t *key) if (err) { log_msg_error (ctx->loghandle, - _("failed to retrieve key from key file `%s': %s\n"), + "failed to retrieve key from key file `%s': %s\n", key_path, gpg_strerror (err)); goto out; } @@ -81,8 +81,8 @@ key_lookup_by_serialno (poldi_ctx_t ctx, const char *serialno, gcry_sexp_t *key) if (err) { log_msg_error (ctx->loghandle, - _("failed to convert key " - "from `%s' into S-Expression: %s\n"), + "failed to convert key " + "from `%s' into S-Expression: %s\n", key_path, gpg_strerror (err)); goto out; } diff --git a/src/pam/auth-method-x509/auth-x509.c b/src/pam/auth-method-x509/auth-x509.c index 3d7c0f2..fafdc9e 100644 --- a/src/pam/auth-method-x509/auth-x509.c +++ b/src/pam/auth-method-x509/auth-x509.c @@ -120,7 +120,7 @@ auth_method_x509_parsecb (void *opaque, simpleparse_opt_spec_t spec, const char if (!x509_ctx->x509_domain) { log_msg_error (ctx->loghandle, - _("failed to duplicate %s (length: %i): %s"), + "failed to duplicate %s (length: %i): %s", "x509-domain option string", strlen (arg), strerror (errno)); err = gpg_error_from_syserror (); @@ -132,7 +132,7 @@ auth_method_x509_parsecb (void *opaque, simpleparse_opt_spec_t spec, const char if (!x509_ctx->dirmngr_socket) { log_msg_error (ctx->loghandle, - _("failed to duplicate %s (length: %i): %s"), + "failed to duplicate %s (length: %i): %s", "dirmngr-socket option string", strlen (arg), strerror (errno)); err = gpg_error_from_syserror (); @@ -164,7 +164,7 @@ extract_public_key_from_cert (poldi_ctx_t ctx, ksba_cert_t cert, gcry_sexp_t *pu if (!sexp_len) { log_msg_error (ctx->loghandle, - _("libksba did not return a proper S-Exp")); + "libksba did not return a proper S-Exp"); err = GPG_ERR_BUG; goto out; } @@ -173,7 +173,7 @@ extract_public_key_from_cert (poldi_ctx_t ctx, ksba_cert_t cert, gcry_sexp_t *pu if (err) { log_msg_error (ctx->loghandle, - _("failed to convert KSBA s-expression into s-expression object: %s"), + "failed to convert KSBA s-expression into s-expression object: %s", gpg_strerror (err)); goto out; } @@ -405,7 +405,7 @@ extract_username_from_cert (poldi_ctx_t ctx, ksba_cert_t cert, else { log_msg_error (ctx->loghandle, - _("failed to extract username from certificate")); + "failed to extract username from certificate"); err = gpg_error (GPG_ERR_UNSUPPORTED_CERT); } @@ -439,7 +439,7 @@ lookup_cert (poldi_ctx_t ctx, dirmngr_ctx_t dirmngr, const char *url, else { log_msg_error (ctx->loghandle, - _("invalid certificate URL on card")); + "invalid certificate URL on card"); err = GPG_ERR_INV_CARD; } if (err) @@ -486,7 +486,7 @@ auth_method_x509_auth_do (poldi_ctx_t ctx, x509_ctx_t cookie, { err = gpg_error (GPG_ERR_CONFIGURATION); log_msg_error (ctx->loghandle, - _("x509 authentication method not properly configured")); + "x509 authentication method not properly configured"); goto out; } @@ -508,7 +508,7 @@ auth_method_x509_auth_do (poldi_ctx_t ctx, x509_ctx_t cookie, if (err) { log_msg_error (ctx->loghandle, - _("failed to look up certificate `%s': %s"), + "failed to look up certificate `%s': %s", ctx->cardinfo.pubkey_url, gpg_strerror (err)); goto out; } @@ -548,8 +548,7 @@ auth_method_x509_auth_do (poldi_ctx_t ctx, x509_ctx_t cookie, err = challenge_generate (&challenge, &challenge_n); if (err) { - log_msg_error (ctx->loghandle, - _("failed to generate challenge: %s"), + log_msg_error (ctx->loghandle, "failed to generate challenge: %s", gpg_strerror (err)); goto out; } @@ -561,7 +560,7 @@ auth_method_x509_auth_do (poldi_ctx_t ctx, x509_ctx_t cookie, if (err) { log_msg_error (ctx->loghandle, - _("failed to retrieve challenge signature from card: %s"), + "failed to retrieve challenge signature from card: %s", gpg_strerror (err)); goto out; } @@ -573,8 +572,7 @@ auth_method_x509_auth_do (poldi_ctx_t ctx, x509_ctx_t cookie, response, response_n); if (err) { - log_msg_error (ctx->loghandle, - _("failed to verify challenge signature")); + log_msg_error (ctx->loghandle, "failed to verify challenge signature"); goto out; } @@ -594,7 +592,7 @@ auth_method_x509_auth_do (poldi_ctx_t ctx, x509_ctx_t cookie, /* Log result. */ if (err) - log_msg_error (ctx->loghandle, _("failure: %s"), gpg_strerror (err)); + log_msg_error (ctx->loghandle, "failure: %s", gpg_strerror (err)); else if (ctx->debug) log_msg_debug (ctx->loghandle, "success"); diff --git a/src/pam/auth-method-x509/dirmngr.c b/src/pam/auth-method-x509/dirmngr.c index a95bf71..7c5ad70 100644 --- a/src/pam/auth-method-x509/dirmngr.c +++ b/src/pam/auth-method-x509/dirmngr.c @@ -154,12 +154,12 @@ inq_cert (void *opaque, const char *line) err = assuan_send_data (parm->ctx->assuan, NULL, 0); if (err) log_msg_error (parm->ctx->log_handle, - _("failed to send back empty value to dirmngr: %s"), + "failed to send back empty value to dirmngr: %s", gpg_strerror (err)); } else { - log_msg_error (parm->ctx->log_handle, _("unsupported assuan inquiry `%s'"), line); + log_msg_error (parm->ctx->log_handle, "unsupported assuan inquiry `%s'", line); err = gpg_error (GPG_ERR_ASS_UNKNOWN_INQUIRE); /* Note that this error will let assuan_transact terminate immediately instead of return the error to the caller. It is @@ -255,7 +255,7 @@ lookup_cb (void *opaque, const void *buffer, size_t length) if (rc) { log_msg_error (parm->ctx->log_handle, - _("failed to create new ksba certificate object: %s"), + "failed to create new ksba certificate object: %s", gpg_strerror (rc)); /* FIXME: better error handling? -mo */ } diff --git a/src/pam/auth-support/getpin-cb.c b/src/pam/auth-support/getpin-cb.c index c5d7ba8..d06c50f 100644 --- a/src/pam/auth-support/getpin-cb.c +++ b/src/pam/auth-support/getpin-cb.c @@ -71,7 +71,7 @@ query_user (poldi_ctx_t ctx, const char *info, char *pin, size_t pin_size) if (strlen (buffer) < 6) /* FIXME? is it really minimum of 6 bytes? */ { - log_msg_error (ctx->loghandle, _("PIN too short")); + log_msg_error (ctx->loghandle, "PIN too short"); conv_tell (ctx->conv, "%s", _("PIN too short")); } else @@ -80,7 +80,7 @@ query_user (poldi_ctx_t ctx, const char *info, char *pin, size_t pin_size) if (strlen (buffer) >= pin_size) { - log_msg_error (ctx->loghandle, _("PIN too long for buffer!")); + log_msg_error (ctx->loghandle, "PIN too long for buffer!"); rc = gpg_error (GPG_ERR_INV_DATA); /* ? */ goto out; } @@ -201,7 +201,7 @@ getpin_cb (void *opaque, const char *info, char *buf, size_t maxbuf) /* Weird that we received flags - they are neither expected nor implemented here. */ log_msg_error (ctx->loghandle, - _("getpin_cb called with flags set in info string `%s'\n"), + "getpin_cb called with flags set in info string `%s'\n", info); err = gpg_error (GPG_ERR_INV_VALUE); /* FIXME? */ goto out; @@ -211,7 +211,7 @@ getpin_cb (void *opaque, const char *info, char *buf, size_t maxbuf) if (err) { log_msg_error (ctx->loghandle, - _("frob_info_msg failed for info msg of size %u\n"), + "frob_info_msg failed for info msg of size %u\n", (unsigned int) strlen (info)); goto out; } diff --git a/src/pam/pam_poldi.c b/src/pam/pam_poldi.c index 5992e5c..cb4cb3e 100644 --- a/src/pam/pam_poldi.c +++ b/src/pam/pam_poldi.c @@ -140,7 +140,7 @@ pam_poldi_options_cb (void *cookie, simpleparse_opt_spec_t spec, const char *arg { err = gpg_error_from_errno (errno); log_msg_error (ctx->loghandle, - _("failed to duplicate %s: %s"), + "failed to duplicate %s: %s", "logfile name", gpg_strerror (err)); } } @@ -153,7 +153,7 @@ pam_poldi_options_cb (void *cookie, simpleparse_opt_spec_t spec, const char *arg { err = gpg_error_from_errno (errno); log_msg_error (ctx->loghandle, - _("failed to duplicate %s: %s"), + "failed to duplicate %s: %s", "scdaemon program name", gpg_strerror (err)); } @@ -167,7 +167,7 @@ pam_poldi_options_cb (void *cookie, simpleparse_opt_spec_t spec, const char *arg { err = gpg_error_from_errno (errno); log_msg_error (ctx->loghandle, - _("failed to duplicate %s: %s"), + "failed to duplicate %s: %s", "scdaemon options name", gpg_strerror (err)); } @@ -182,7 +182,7 @@ pam_poldi_options_cb (void *cookie, simpleparse_opt_spec_t spec, const char *arg else { log_msg_error (ctx->loghandle, - _("unknown authentication method '%s'"), + "unknown authentication method '%s'", arg); err = GPG_ERR_INV_VALUE; } @@ -310,7 +310,7 @@ modify_environment_putenv (pam_handle_t *pam_handle, poldi_ctx_t ctx, if (ret < 0) { log_msg_error (ctx->loghandle, - _("asprintf() failed in modify_environment_putenv(): %s"), + "asprintf() failed in modify_environment_putenv(): %s", errno); return; } @@ -319,7 +319,7 @@ modify_environment_putenv (pam_handle_t *pam_handle, poldi_ctx_t ctx, if (ret != PAM_SUCCESS) { log_msg_error (ctx->loghandle, - _("pam_putenv() failed in modify_environment_putenv(): %s"), + "pam_putenv() failed in modify_environment_putenv(): %s", pam_strerror (pam_handle, ret)); } free (str); @@ -404,7 +404,7 @@ pam_sm_authenticate (pam_handle_t *pam_handle, if (err) { log_msg_error (ctx->loghandle, - _("failed to parse configuration file '%s': %s"), + "failed to parse configuration file '%s': %s", POLDI_CONF_FILE, gpg_strerror (err)); goto out; @@ -417,7 +417,7 @@ pam_sm_authenticate (pam_handle_t *pam_handle, if (err) { log_msg_error (ctx->loghandle, - _("failed to parse PAM argument vector: %s"), + "failed to parse PAM argument vector: %s", gpg_strerror (err)); goto out; } @@ -446,7 +446,7 @@ pam_sm_authenticate (pam_handle_t *pam_handle, if (ctx->auth_method < 0) { log_msg_error (ctx->loghandle, - _("no authentication method specified")); + "no authentication method specified"); err = GPG_ERR_CONFIGURATION; goto out; } @@ -460,7 +460,7 @@ pam_sm_authenticate (pam_handle_t *pam_handle, if (ctx->debug) { log_msg_debug (ctx->loghandle, - _("using authentication method `%s'"), + "using authentication method `%s'", auth_methods[ctx->auth_method].name); } @@ -472,7 +472,7 @@ pam_sm_authenticate (pam_handle_t *pam_handle, if (err) { log_msg_error (ctx->loghandle, - _("failed to initialize authentication method %i: %s"), + "failed to initialize authentication method %i: %s", -1, gpg_strerror (err)); goto out; } @@ -486,7 +486,7 @@ pam_sm_authenticate (pam_handle_t *pam_handle, if (err) { log_msg_error (ctx->loghandle, - _("failed to initialize parsing of configuration file for authentication method %s: %s"), + "failed to initialize parsing of configuration file for authentication method %s: %s", auth_methods[ctx->auth_method].name, gpg_strerror (err)); goto out_parsing; } @@ -507,7 +507,7 @@ pam_sm_authenticate (pam_handle_t *pam_handle, if (err) { log_msg_error (ctx->loghandle, - _("failed to parse configuration for authentication method %i: %s"), + "failed to parse configuration for authentication method %i: %s", auth_methods[ctx->auth_method].name, gpg_strerror (err)); goto out_parsing; } @@ -526,7 +526,7 @@ pam_sm_authenticate (pam_handle_t *pam_handle, if (ret != PAM_SUCCESS) { log_msg_error (ctx->loghandle, - _("failed to retrieve PAM conversation structure")); + "failed to retrieve PAM conversation structure"); err = GPG_ERR_INTERNAL; goto out; } @@ -544,8 +544,7 @@ pam_sm_authenticate (pam_handle_t *pam_handle, if (ret != PAM_SUCCESS) { /* It's not fatal, username can be in the card. */ - log_msg_error (ctx->loghandle, - _("Can't retrieve username from PAM")); + log_msg_error (ctx->loghandle, "Can't retrieve username from PAM"); } /*** Check if we use gpg-agent. ***/ @@ -602,8 +601,7 @@ pam_sm_authenticate (pam_handle_t *pam_handle, err = wait_for_card (ctx->scd, 0); if (err) { - log_msg_error (ctx->loghandle, - _("failed to wait for card insertion: %s"), + log_msg_error (ctx->loghandle, "failed to wait for card insertion: %s", gpg_strerror (err)); goto out; } @@ -660,7 +658,7 @@ pam_sm_authenticate (pam_handle_t *pam_handle, /* Log result. */ if (err) - log_msg_error (ctx->loghandle, _("authentication failed: %s"), gpg_strerror (err)); + log_msg_error (ctx->loghandle, "authentication failed: %s", gpg_strerror (err)); else { if (ctx->debug) diff --git a/src/scd/scd.c b/src/scd/scd.c index fe6613a..5d1b835 100644 --- a/src/scd/scd.c +++ b/src/scd/scd.c @@ -225,8 +225,7 @@ scd_connect (scd_context_t *scd_ctx, int use_agent, const char *scd_path, if (fflush (NULL)) { err = gpg_error_from_syserror (); - log_msg_error (loghandle, - _("error flushing pending output: %s"), + log_msg_error (loghandle, "error flushing pending output: %s", strerror (errno)); return err; } @@ -305,14 +304,12 @@ scd_connect (scd_context_t *scd_ctx, int use_agent, const char *scd_path, err = assuan_pipe_connect (&assuan_ctx, scd_path, argv, no_close_list); if (err) { - log_msg_error (loghandle, - _("could not spawn scdaemon: %s"), + log_msg_error (loghandle, "could not spawn scdaemon: %s", gpg_strerror (err)); } else { - log_msg_debug (loghandle, - "spawned a new scdaemon (path: '%s')", + log_msg_debug (loghandle, "spawned a new scdaemon (path: '%s')", scd_path); } } @@ -856,7 +853,7 @@ scd_getinfo (scd_context_t ctx, const char *what, char **result) if (!res) { log_msg_error (ctx->loghandle, - _("warning: can't store getinfo data: %s"), + "warning: can't store getinfo data: %s", strerror (errno)); rc = gpg_error_from_syserror (); } commit 6904ae208e81e19639c85edfaa76a4fea0a4074f Author: NIIBE Yutaka Date: Tue Nov 15 12:11:44 2016 +0900 Don't translate debug messages. * src/scd/scd.c (scd_connect): No use of translation. * src/pam/auth-method-x509/auth-x509.c (auth_method_x509_auth_do): Ditto. * src/pam/auth-method-localdb/auth-localdb.c (auth_method_localdb_auth_do): Ditto. * src/pam/auth-method-x509/dirmngr.c (inq_cert): Ditto. * src/pam/pam_poldi.c (pam_sm_authenticate): Ditto. -- Signed-off-by: NIIBE Yutaka diff --git a/src/pam/auth-method-localdb/auth-localdb.c b/src/pam/auth-method-localdb/auth-localdb.c index 07dfe64..3081737 100644 --- a/src/pam/auth-method-localdb/auth-localdb.c +++ b/src/pam/auth-method-localdb/auth-localdb.c @@ -117,7 +117,7 @@ auth_method_localdb_auth_do (poldi_ctx_t ctx, if (ctx->debug) log_msg_debug (ctx->loghandle, - _("Trying authentication as user `%s'..."), username); + "Trying authentication as user `%s'...", username); if (!ctx->quiet) conv_tell (ctx->conv, _("Trying authentication as user `%s'..."), username); @@ -129,7 +129,7 @@ auth_method_localdb_auth_do (poldi_ctx_t ctx, { if (ctx->debug) log_msg_debug (ctx->loghandle, - _("Serial number %s is not associated with user %s"), + "Serial number %s is not associated with user %s", ctx->cardinfo.serialno, username); conv_tell (ctx->conv, _("Serial number %s is not associated with user %s"), diff --git a/src/pam/auth-method-x509/auth-x509.c b/src/pam/auth-method-x509/auth-x509.c index d71d988..3d7c0f2 100644 --- a/src/pam/auth-method-x509/auth-x509.c +++ b/src/pam/auth-method-x509/auth-x509.c @@ -500,7 +500,7 @@ auth_method_x509_auth_do (poldi_ctx_t ctx, x509_ctx_t cookie, if (ctx->debug) log_msg_debug (ctx->loghandle, - _("public key url is '%s'"), ctx->cardinfo.pubkey_url); + "public key url is '%s'", ctx->cardinfo.pubkey_url); /*** Fetch certificate. ***/ @@ -596,7 +596,7 @@ auth_method_x509_auth_do (poldi_ctx_t ctx, x509_ctx_t cookie, if (err) log_msg_error (ctx->loghandle, _("failure: %s"), gpg_strerror (err)); else if (ctx->debug) - log_msg_debug (ctx->loghandle, _("success")); + log_msg_debug (ctx->loghandle, "success"); return !err; } diff --git a/src/pam/auth-method-x509/dirmngr.c b/src/pam/auth-method-x509/dirmngr.c index 79eedf5..a95bf71 100644 --- a/src/pam/auth-method-x509/dirmngr.c +++ b/src/pam/auth-method-x509/dirmngr.c @@ -150,7 +150,7 @@ inq_cert (void *opaque, const char *line) { /* We don't support this but dirmngr might ask for it. So simply ignore it by sending back an empty value. */ - log_msg_debug (parm->ctx->log_handle, _("ignored inquiry from dirmngr: `%s'"), line); + log_msg_debug (parm->ctx->log_handle, "ignored inquiry from dirmngr: `%s'", line); err = assuan_send_data (parm->ctx->assuan, NULL, 0); if (err) log_msg_error (parm->ctx->log_handle, diff --git a/src/pam/pam_poldi.c b/src/pam/pam_poldi.c index 6e01f10..5992e5c 100644 --- a/src/pam/pam_poldi.c +++ b/src/pam/pam_poldi.c @@ -587,14 +587,14 @@ pam_sm_authenticate (pam_handle_t *pam_handle, if (pam_username) { if (ctx->debug) - log_msg_debug (ctx->loghandle, _("Waiting for card for user `%s'..."), pam_username); + log_msg_debug (ctx->loghandle, "Waiting for card for user `%s'...", pam_username); if (!ctx->quiet) conv_tell (ctx->conv, _("Insert authentication card for user `%s'"), pam_username); } else { if (ctx->debug) - log_msg_debug (ctx->loghandle, _("Waiting for card...")); + log_msg_debug (ctx->loghandle, "Waiting for card..."); if (!ctx->quiet) conv_tell (ctx->conv, _("Insert authentication card")); } @@ -616,7 +616,7 @@ pam_sm_authenticate (pam_handle_t *pam_handle, if (ctx->debug) log_msg_debug (ctx->loghandle, - _("connected to card; serial number is: %s"), + "connected to card; serial number is: %s", ctx->cardinfo.serialno); /*** Authenticate. ***/ @@ -664,7 +664,7 @@ pam_sm_authenticate (pam_handle_t *pam_handle, else { if (ctx->debug) - log_msg_debug (ctx->loghandle, _("authentication succeeded")); + log_msg_debug (ctx->loghandle, "authentication succeeded"); if (ctx->modify_environment) modify_environment (pam_handle, ctx); } diff --git a/src/scd/scd.c b/src/scd/scd.c index 709497d..fe6613a 100644 --- a/src/scd/scd.c +++ b/src/scd/scd.c @@ -253,8 +253,8 @@ scd_connect (scd_context_t *scd_ctx, int use_agent, const char *scd_path, if (!err) log_msg_debug (loghandle, - _("got scdaemon socket name from gpg-agent, " - "connected to socket '%s'"), scd_socket_name); + "got scdaemon socket name from gpg-agent, " + "connected to socket '%s'", scd_socket_name); xfree (scd_socket_name); } @@ -312,7 +312,7 @@ scd_connect (scd_context_t *scd_ctx, int use_agent, const char *scd_path, else { log_msg_debug (loghandle, - _("spawned a new scdaemon (path: '%s')"), + "spawned a new scdaemon (path: '%s')", scd_path); } } commit 0afd57e088146f0e2e968809e95867f8caabce00 Author: NIIBE Yutaka Date: Tue Nov 15 12:06:32 2016 +0900 Use ERR instead of RC. * src/scd/scd.c (scd_connect): Clean up for ERR. -- "Return code" is not good when we have definition of error code properly. Signed-off-by: NIIBE Yutaka diff --git a/src/scd/scd.c b/src/scd/scd.c index f209940..709497d 100644 --- a/src/scd/scd.c +++ b/src/scd/scd.c @@ -177,7 +177,7 @@ agent_scd_getinfo_socket_name (assuan_context_t ctx, char **socket_name) } /* Retrieve SCDaemons socket name through a running gpg-agent. On - Success, *SOCKET_NAME contains a copy of the socket name. Returns + success, *SOCKET_NAME contains a copy of the socket name. Returns proper error code or zero on success. */ static gpg_error_t get_scd_socket_from_agent (char **socket_name) @@ -218,53 +218,51 @@ scd_connect (scd_context_t *scd_ctx, int use_agent, const char *scd_path, { assuan_context_t assuan_ctx; scd_context_t ctx; - int rc = 0; + gpg_error_t err; assuan_ctx = NULL; if (fflush (NULL)) { - rc = gpg_error_from_syserror (); + err = gpg_error_from_syserror (); log_msg_error (loghandle, _("error flushing pending output: %s"), strerror (errno)); - return rc; + return err; } ctx = xtrymalloc (sizeof (*ctx)); if (!ctx) - { - rc = gpg_error_from_syserror (); - return rc; - } + return gpg_error_from_syserror (); ctx->assuan_ctx = NULL; ctx->flags = 0; + /* Try using scdaemon under gpg-agent. */ if (use_agent) { - /* Retrieve a scdaemon socket name from gpg-agent. */ char *scd_socket_name = NULL; - rc = get_scd_socket_from_agent (&scd_socket_name); - if (!rc) - rc = assuan_socket_connect (&assuan_ctx, scd_socket_name, 0); + /* Note that if gpg-agent is there but no scdaemon yet, + * gpg-agent automatically invokes scdaemon by this query + * itself. + */ + err = get_scd_socket_from_agent (&scd_socket_name); + if (!err) + err = assuan_socket_connect (&assuan_ctx, scd_socket_name, 0); - if (!rc) + if (!err) log_msg_debug (loghandle, _("got scdaemon socket name from gpg-agent, " "connected to socket '%s'"), scd_socket_name); xfree (scd_socket_name); - - if (rc) - { - log_msg_error (loghandle, - _("could not connect to scdaemon: %s"), - gpg_strerror (rc)); - } } - if (!use_agent || rc) + + /* If scdaemon under gpg-agent is irrelevant or not available, + * let Poldi invoke scdaemon. + */ + if (!use_agent || err) { const char *pgmname; const char *argv[5]; @@ -304,12 +302,12 @@ scd_connect (scd_context_t *scd_ctx, int use_agent, const char *scd_path, no_close_list[i] = -1; /* connect to the scdaemon and perform initial handshaking */ - rc = assuan_pipe_connect (&assuan_ctx, scd_path, argv, no_close_list); - if (rc) + err = assuan_pipe_connect (&assuan_ctx, scd_path, argv, no_close_list); + if (err) { log_msg_error (loghandle, _("could not spawn scdaemon: %s"), - gpg_strerror (rc)); + gpg_strerror (err)); } else { @@ -319,7 +317,7 @@ scd_connect (scd_context_t *scd_ctx, int use_agent, const char *scd_path, } } - if (rc) + if (err) { assuan_disconnect (assuan_ctx); xfree (ctx); @@ -336,7 +334,7 @@ scd_connect (scd_context_t *scd_ctx, int use_agent, const char *scd_path, *scd_ctx = ctx; } - return rc; + return err; } /* Disconnect from SCDaemon; destroy the context SCD_CTX. */ commit 91aa9c96ab7d6a608c76a713b13b301e7ea5ff82 Author: Marc-Antoine Perennou Date: Fri Nov 11 15:51:23 2016 +0100 Fallback to invoking scdaemon. * src/scd/scd.c (scd_connect): When gpg-agent is not available in the case of pam_username == username_of_process_uid, try normal way to invoke scdaemon through pipe. -- Signed-off-by: Marc-Antoine Perennou diff --git a/src/scd/scd.c b/src/scd/scd.c index 5626187..f209940 100644 --- a/src/scd/scd.c +++ b/src/scd/scd.c @@ -264,7 +264,7 @@ scd_connect (scd_context_t *scd_ctx, int use_agent, const char *scd_path, gpg_strerror (rc)); } } - else + if (!use_agent || rc) { const char *pgmname; const char *argv[5]; commit eb1fc82c307c1a147a4fa2e240c3b3330875fede Author: NIIBE Yutaka Date: Tue Nov 15 11:41:49 2016 +0900 Invoke gpgconf by absolute path. * configure.ac (GNUPG_DEFAULT_GPGCONF): No parens. (GNUPG_DEFAULT_DIRMNGR): Remove unused var. * src/scd/scd.c (get_agent_socket_name): Use GNUPG_DEFAULT_GPGCONF. -- Signed-off-by: NIIBE Yutaka diff --git a/configure.ac b/configure.ac index 0aba308..626b9a0 100644 --- a/configure.ac +++ b/configure.ac @@ -69,13 +69,10 @@ AC_DEFINE_UNQUOTED(NEED_KSBA_VERSION, "$NEED_KSBA_VERSION", AH_BOTTOM([ /* Setup the hardwired names of modules. */ #ifndef GNUPG_DEFAULT_GPGCONF -#define GNUPG_DEFAULT_GPGCONF ( GNUPG_BINDIR "/gpgconf" ) +#define GNUPG_DEFAULT_GPGCONF GNUPG_BINDIR "/gpgconf" #endif #ifndef GNUPG_DEFAULT_SCD -#define GNUPG_DEFAULT_SCD ( GNUPG_LIBEXECDIR "/scdaemon" ) -#endif -#ifndef GNUPG_DEFAULT_DIRMNGR -#define GNUPG_DEFAULT_DIRMNGR ( GNUPG_BINDIR "/dirmngr" ) +#define GNUPG_DEFAULT_SCD GNUPG_LIBEXECDIR "/scdaemon" #endif ]) diff --git a/src/scd/scd.c b/src/scd/scd.c index 06a26d8..5626187 100644 --- a/src/scd/scd.c +++ b/src/scd/scd.c @@ -110,7 +110,8 @@ get_agent_socket_name (char **gpg_agent_sockname) if (!result) return gpg_error_from_syserror (); - input = popen ("gpgconf --list-dirs agent-socket", "r"); + /* It is good if we have popen with execv (no SHELL) */ + input = popen (GNUPG_DEFAULT_GPGCONF " --list-dirs agent-socket", "r"); if (input == NULL) { xfree (result); commit af67cba1ed81ca642e85f684bbc897e54187ba2a Author: NIIBE Yutaka Date: Tue Nov 15 09:49:28 2016 +0900 Restrict use of scdaemon under gpg-agent. * src/pam/pam_poldi.c (opt_ids, opt_specs): Remove use-agent option. (pam_poldi_options_cb): Remove use-agent handling. (pam_sm_authenticate): Determin use_agent by username. -- Signed-off-by: NIIBE Yutaka diff --git a/NEWS b/NEWS index d3d8c46..2e6d054 100644 --- a/NEWS +++ b/NEWS @@ -5,12 +5,13 @@ Changes since version 0.4.1: * poldi-ctrl is removed Please use gpg-connect-agent instead. -* New "use-agent" PAM option for backward compatibility +* For backward compatibility of sudo and screen unlock In GnuPG 2.1, the environment variable GPG_AGENT_INFO is gone. And now, Poldi's default is invoking scdaemon directly. Still, there - are use cases (like su/sudo) which expect connecting user's - gpg-agent. For this purpose, we now have "use-agent" option. Don't - enable this option for login authentication. + are use cases (like sudo and screen unlock) which expect connecting + user's gpg-agent. For this purpose, Poldi now distinguishes a case + where pam_username == username_of_process_uid. Only for such a case, + Poldi tries to find scdaemon under gpg-agent. * Poldi invokes scdaemon to connect it through pipe Older Poldi has a feature of connecting to scdaemon with help of diff --git a/src/pam/pam_poldi.c b/src/pam/pam_poldi.c index 9bf504e..6e01f10 100644 --- a/src/pam/pam_poldi.c +++ b/src/pam/pam_poldi.c @@ -24,6 +24,8 @@ #include #include #include +#include +#include #include #include @@ -84,7 +86,6 @@ enum opt_ids opt_scdaemon_options, opt_modify_environment, opt_quiet, - opt_use_agent, }; /* Full specifications for options. */ @@ -104,8 +105,6 @@ static simpleparse_opt_spec_t opt_specs[] = 0, SIMPLEPARSE_ARG_NONE, 0, "Set Poldi related variables in the PAM environment" }, { opt_quiet, "quiet", 0, SIMPLEPARSE_ARG_NONE, 0, "Be more quiet during PAM conversation with user" }, - { opt_use_agent, "use-agent", - 0, SIMPLEPARSE_ARG_NONE, 0, "Use gpg-agent for scdaemon" }, { 0 } }; @@ -204,10 +203,6 @@ pam_poldi_options_cb (void *cookie, simpleparse_opt_spec_t spec, const char *arg /* QUIET. */ ctx->quiet = 1; } - else if (!strcmp (spec.long_opt, "use-agent")) - { - ctx->use_agent = 1; - } return gpg_error (err); } @@ -369,6 +364,7 @@ pam_sm_authenticate (pam_handle_t *pam_handle, struct auth_method_parse_cookie method_parse_cookie = { NULL, NULL }; simpleparse_handle_t method_parse; struct getpin_cb_data getpin_cb_data; + int use_agent = 0; pam_username = NULL; scd_ctx = NULL; @@ -552,9 +548,29 @@ pam_sm_authenticate (pam_handle_t *pam_handle, _("Can't retrieve username from PAM")); } + /*** Check if we use gpg-agent. ***/ + { + struct passwd *pw; + pw = getpwuid (getuid ()); + + if (pw == NULL) + { + err = gpg_error_from_syserror (); + goto out; + } + + /* Supporting backward compatibility of old Poldi. + * + * For use cases of sudo and screen unlock where a user wants to + * use smartcard using the existing scdaemon under gpg-agent. + */ + if (pam_username && !strcmp (pw->pw_name, pam_username)) + use_agent = 1; + } + /*** Connect to Scdaemon. ***/ - err = scd_connect (&scd_ctx, ctx->use_agent, + err = scd_connect (&scd_ctx, use_agent, ctx->scdaemon_program, ctx->scdaemon_options, ctx->loghandle); if (err) commit 836d56934709b8a8821b60eeda9c815448826320 Author: NIIBE Yutaka Date: Tue Nov 15 08:28:21 2016 +0900 More clean up. * src/pam/pam_poldi.c (retrieve_username_from_pam): Remove. (send_username_to_pam): Remove. (pam_sm_authenticate): Call pam_get_item, pam_set_item directly. -- Signed-off-by: NIIBE Yutaka diff --git a/src/pam/pam_poldi.c b/src/pam/pam_poldi.c index 48dbb3c..9bf504e 100644 --- a/src/pam/pam_poldi.c +++ b/src/pam/pam_poldi.c @@ -347,44 +347,6 @@ modify_environment (pam_handle_t *pam_handle, poldi_ctx_t ctx) modify_environment_putenv (pam_handle, ctx, "PAM_POLDI_LANGUAGE", cardinfo->disp_lang); } - -/* Retrieve the username through the PAM handle contained in CTX and - store it in *USERNAME. Returns proper error code. */ -static gpg_error_t -retrieve_username_from_pam (pam_handle_t *handle, const char **username) -{ - const void *username_void; - gpg_error_t err; - int ret; - - ret = pam_get_item (handle, PAM_USER, &username_void); - if (ret == PAM_SUCCESS) - { - err = 0; - *username = username_void; - } - else - err = gpg_error (GPG_ERR_INTERNAL); - - return err; -} - -/* Make USERNAME available to the application through the PAM handle - contained in CTX. Returns proper error code. */ -static gpg_error_t -send_username_to_pam (pam_handle_t *handle, const char *username) -{ - gpg_error_t err; - int ret; - - ret = pam_set_item (handle, PAM_USER, username); - if (ret == PAM_SUCCESS) - err = 0; - else - err = gpg_error (GPG_ERR_INTERNAL); - - return err; -} /* @@ -582,12 +544,12 @@ pam_sm_authenticate (pam_handle_t *pam_handle, /*** Retrieve username from PAM. ***/ - err = retrieve_username_from_pam (ctx->pam_handle, &pam_username); - if (err) + ret = pam_get_item (ctx->pam_handle, PAM_USER, (const void **)&pam_username); + if (ret != PAM_SUCCESS) { + /* It's not fatal, username can be in the card. */ log_msg_error (ctx->loghandle, - _("failed to retrieve username from PAM: %s"), - gpg_strerror (err)); + _("Can't retrieve username from PAM")); } /*** Connect to Scdaemon. ***/ @@ -667,7 +629,13 @@ pam_sm_authenticate (pam_handle_t *pam_handle, { /* Send username received during authentication process back to PAM. */ - err = send_username_to_pam (ctx->pam_handle, username_authenticated); + ret = pam_set_item (ctx->pam_handle, PAM_USER, + username_authenticated); + if (ret == PAM_SUCCESS) + err = 0; + else + err = gpg_error (GPG_ERR_INTERNAL); + xfree (username_authenticated); } } commit 64b07726e2d3e3a6140dcf49416ad30f83fecfc0 Author: NIIBE Yutaka Date: Tue Nov 15 08:14:15 2016 +0900 Simplify things for PAM. * src/pam/auth-support/pam-util.h: Remove. * src/pam/auth-support/pam-util.c: Remove. Merge into... * src/pam/pam_poldi.c (retrieve_username_from_pam): ... here. (send_username_to_pam): Likewise. * src/pam/auth-method-localdb/auth-localdb.c: Clean up. * src/pam/auth-method-x509/auth-x509.c: Likewise. * src/pam/auth-support/Makefile.am: Remove pam-util.{c,h}. -- Signed-off-by: NIIBE Yutaka diff --git a/src/pam/auth-method-localdb/auth-localdb.c b/src/pam/auth-method-localdb/auth-localdb.c index 0c65817..07dfe64 100644 --- a/src/pam/auth-method-localdb/auth-localdb.c +++ b/src/pam/auth-method-localdb/auth-localdb.c @@ -35,7 +35,6 @@ #include "util/support.h" #include "auth-support/ctx.h" #include "auth-support/wait-for-card.h" -#include "auth-support/pam-util.h" #include "usersdb.h" #include "key-lookup.h" diff --git a/src/pam/auth-method-x509/auth-x509.c b/src/pam/auth-method-x509/auth-x509.c index 4b391db..d71d988 100644 --- a/src/pam/auth-method-x509/auth-x509.c +++ b/src/pam/auth-method-x509/auth-x509.c @@ -34,7 +34,6 @@ #include "util/support.h" #include "auth-support/ctx.h" #include "auth-support/getpin-cb.h" -#include "auth-support/pam-util.h" #include "auth-methods.h" #include "util/defs.h" #include "util/simplelog.h" diff --git a/src/pam/auth-support/Makefile.am b/src/pam/auth-support/Makefile.am index 9ab48a0..9a47d73 100644 --- a/src/pam/auth-support/Makefile.am +++ b/src/pam/auth-support/Makefile.am @@ -41,5 +41,4 @@ libpam_poldi_auth_support_a_SOURCES = \ ctx.h \ conv.c conv.h \ getpin-cb.c getpin-cb.h \ - pam-util.c pam-util.h \ wait-for-card.c wait-for-card.h diff --git a/src/pam/auth-support/pam-util.c b/src/pam/auth-support/pam-util.c deleted file mode 100644 index b133061..0000000 --- a/src/pam/auth-support/pam-util.c +++ /dev/null @@ -1,65 +0,0 @@ -/* pam-util.c - PAM util functions for Poldi. - * Copyright (C) 2007, 2008 g10 Code GmbH - * - * This file is part of Poldi. - * - * Poldi is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * Poldi 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see . - */ - -#include - -#include - -#define PAM_SM_AUTH -#include - - - -/* Retrieve the username through the PAM handle contained in CTX and - store it in *USERNAME. Returns proper error code. */ -gpg_error_t -retrieve_username_from_pam (pam_handle_t *handle, const char **username) -{ - const void *username_void; - gpg_error_t err; - int ret; - - ret = pam_get_item (handle, PAM_USER, &username_void); - if (ret == PAM_SUCCESS) - { - err = 0; - *username = username_void; - } - else - err = gpg_error (GPG_ERR_INTERNAL); - - return err; -} - -/* Make USERNAME available to the application through the PAM handle - contained in CTX. Returns proper error code. */ -gpg_error_t -send_username_to_pam (pam_handle_t *handle, const char *username) -{ - gpg_error_t err; - int ret; - - ret = pam_set_item (handle, PAM_USER, username); - if (ret == PAM_SUCCESS) - err = 0; - else - err = gpg_error (GPG_ERR_INTERNAL); - - return err; -} diff --git a/src/pam/auth-support/pam-util.h b/src/pam/auth-support/pam-util.h deleted file mode 100644 index 4a03f3d..0000000 --- a/src/pam/auth-support/pam-util.h +++ /dev/null @@ -1,36 +0,0 @@ -/* pam-util.c - PAM util functions for Poldi. - * Copyright (C) 2007, 2008 g10 Code GmbH - * - * This file is part of Poldi. - * - * Poldi is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * Poldi 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, see . - */ - -#ifndef PAM_UTIL_H -#define PAM_UTIL_H - -#include - -#define PAM_SM_AUTH -#include - -/* Retrieve the username through the PAM handle contained in CTX and - store it in *USERNAME. Returns proper error code. */ -gpg_error_t retrieve_username_from_pam (pam_handle_t *handle, const char **username); - -/* Make USERNAME available to the application through the PAM handle - contained in CTX. Returns proper error code. */ -gpg_error_t send_username_to_pam (pam_handle_t *handle, const char *username); - -#endif diff --git a/src/pam/pam_poldi.c b/src/pam/pam_poldi.c index a27a3e9..48dbb3c 100644 --- a/src/pam/pam_poldi.c +++ b/src/pam/pam_poldi.c @@ -37,7 +37,6 @@ #include "scd/scd.h" #include "auth-support/wait-for-card.h" -#include "auth-support/pam-util.h" #include "auth-support/conv.h" #include "auth-support/getpin-cb.h" #include "auth-methods.h" @@ -349,6 +348,43 @@ modify_environment (pam_handle_t *pam_handle, poldi_ctx_t ctx) "PAM_POLDI_LANGUAGE", cardinfo->disp_lang); } +/* Retrieve the username through the PAM handle contained in CTX and + store it in *USERNAME. Returns proper error code. */ +static gpg_error_t +retrieve_username_from_pam (pam_handle_t *handle, const char **username) +{ + const void *username_void; + gpg_error_t err; + int ret; + + ret = pam_get_item (handle, PAM_USER, &username_void); + if (ret == PAM_SUCCESS) + { + err = 0; + *username = username_void; + } + else + err = gpg_error (GPG_ERR_INTERNAL); + + return err; +} + +/* Make USERNAME available to the application through the PAM handle + contained in CTX. Returns proper error code. */ +static gpg_error_t +send_username_to_pam (pam_handle_t *handle, const char *username) +{ + gpg_error_t err; + int ret; + + ret = pam_set_item (handle, PAM_USER, username); + if (ret == PAM_SUCCESS) + err = 0; + else + err = gpg_error (GPG_ERR_INTERNAL); + + return err; +} /* ----------------------------------------------------------------------- Summary of changes: NEWS | 9 +- configure.ac | 7 +- po/POTFILES.in | 34 ++- po/de.po | 414 +++++++++++------------------ po/poldi.pot | 280 +------------------ src/pam/auth-method-localdb/auth-localdb.c | 12 +- src/pam/auth-method-localdb/key-lookup.c | 10 +- src/pam/auth-method-x509/auth-x509.c | 31 +-- src/pam/auth-method-x509/dirmngr.c | 8 +- src/pam/auth-support/Makefile.am | 1 - src/pam/auth-support/getpin-cb.c | 8 +- src/pam/auth-support/pam-util.c | 65 ----- src/pam/auth-support/pam-util.h | 36 --- src/pam/pam_poldi.c | 92 ++++--- src/scd/scd.c | 68 +++-- 15 files changed, 313 insertions(+), 762 deletions(-) delete mode 100644 src/pam/auth-support/pam-util.c delete mode 100644 src/pam/auth-support/pam-util.h hooks/post-receive -- PAM for the OpenPGP card http://git.gnupg.org From cvs at cvs.gnupg.org Tue Nov 15 09:30:43 2016 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Tue, 15 Nov 2016 09:30:43 +0100 Subject: [git] GpgOL - branch, master, updated. gpgol-1.4.0-165-g9560e55 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG extension for MS Outlook". The branch, master has been updated via 9560e555e86fa9b5b59829bc9bd5b7f6ff6308e1 (commit) from 96bb1461509a1cd7e86e93cee99b1d979fc11add (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 9560e555e86fa9b5b59829bc9bd5b7f6ff6308e1 Author: Andre Heinecke Date: Tue Nov 15 09:26:38 2016 +0100 Remove buggy debug output warning * src/main.c (read_options): Don't show messagebox about debug output. -- Let's assume that users that have enabled debug output know that. This message also was only shown if log_file was set (even if set to an empty string) and debug output was off. diff --git a/src/main.c b/src/main.c index bec5f9f..c0e64e2 100644 --- a/src/main.c +++ b/src/main.c @@ -458,12 +458,6 @@ read_options (void) _("Note: Using compatibility flags: %s"), val); MessageBox (NULL, tmpbuf, _("GpgOL"), MB_ICONWARNING|MB_OK); } - if (get_log_file () && !opt.enable_debug) - { - snprintf (tmpbuf, sizeof tmpbuf, - _("Note: Writing debug logs to\n\n\"%s\""), get_log_file ()); - MessageBox (NULL, tmpbuf, _("GpgOL"), MB_ICONWARNING|MB_OK); - } } xfree (val); val = NULL; ----------------------------------------------------------------------- Summary of changes: src/main.c | 6 ------ 1 file changed, 6 deletions(-) hooks/post-receive -- GnuPG extension for MS Outlook http://git.gnupg.org From cvs at cvs.gnupg.org Tue Nov 15 10:38:33 2016 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Tue, 15 Nov 2016 10:38:33 +0100 Subject: [git] GPGME - branch, master, updated. gpgme-1.7.1-43-g7659d42 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 7659d42468b604db2936b021425683f407eba4a7 (commit) via 3234b1bf1d6939772677d64f6c1e1820ec98e3cd (commit) via cad1210fb8a7402cb29e607f8f9680005314120d (commit) from 9451faa2ee333904cff59f92ab62918e13ab4b87 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 7659d42468b604db2936b021425683f407eba4a7 Author: Werner Koch Date: Tue Nov 15 10:29:48 2016 +0100 core: Implement context flag "override-session-key". * src/gpgme.c (gpgme_set_ctx_flag): Add flags "export-session-key" and "override-session-key". (gpgme_get_ctx_flag): Ditto. (gpgme_set_export_session_keys): Remove. (gpgme_get_export_session_keys): Remove. * src/gpgme.def, src/libgpgme.vers: Remove them. * src/context.h (struct gpgme_context): Add field override_session_key. * src/decrypt-verify.c (decrypt_verify_start): Pass override_session_key value to the engine. * src/decrypt.c (decrypt_start): Ditto. * src/engine.c (_gpgme_engine_op_decrypt): Ditto. (_gpgme_engine_op_decrypt_verify): Ditto. * src/engine-backend.h (struct engine_ops): Extend DECRYPT and DECRYPT_VERIFY_START with override_session_key. * src/engine-uiserver.c (_uiserver_decrypt): Add stub arg override_session_key. (uiserver_decrypt): Ditto. (uiserver_decrypt_verify): Ditto. * src/engine-gpgsm.c (gpgsm_decrypt): Ditto. * src/engine-gpg.c (gpg_decrypt): Add arg override_session_key and set corresponding gpg option. * tests/run-decrypt.c (print_result): Print the session key if available. (main): Add options --export-session-key and --override-session-key. -- To keep the number of context manipulation functions at bay, this patches removes the just added gpgme_set_export_session_keys and gpgme_get_export_session_keys by flags for the generic context function. The patch also implements the --override-session-key feature. GnuPG-bug-id: 2754 Signed-off-by: Werner Koch diff --git a/doc/gpgme.texi b/doc/gpgme.texi index e47979c..eb06c20 100644 --- a/doc/gpgme.texi +++ b/doc/gpgme.texi @@ -191,7 +191,6 @@ Context Attributes * Text Mode:: Choosing canonical text mode. * Offline Mode:: Choosing offline mode. * Included Certificates:: Including a number of certificates. -* Exporting Session Keys:: Requesting session keys upon decryption. * Key Listing Mode:: Selecting key listing mode. * Passphrase Callback:: Getting the passphrase from the user. * Progress Meter Callback:: Being informed about the progress. @@ -2314,10 +2313,12 @@ The function @code{gpgme_release} destroys the context with the handle The detailed result of an operation is returned in operation-specific structures such as @code{gpgme_decrypt_result_t}. The corresponding retrieval functions such as @code{gpgme_op_decrypt_result} provide -static access to the results after an operation completes. The -following interfaces make it possible to detach a result structure -from its associated context and give it a lifetime beyond that of the -current operation or context. +static access to the results after an operation completes. Those +structures shall be considered read-only and an application must not +allocated such a strucure on its own. The following interfaces make +it possible to detach a result structure from its associated context +and give it a lifetime beyond that of the current operation or +context. @deftypefun void gpgme_result_ref (@w{void *@var{result}}) The function @code{gpgme_result_ref} acquires an additional reference @@ -2352,7 +2353,6 @@ started. In fact, these references are accessed through the * Offline Mode:: Choosing offline mode. * Pinentry Mode:: Choosing the pinentry mode. * Included Certificates:: Including a number of certificates. -* Exporting Session Keys:: Requesting session keys upon decryption. * Key Listing Mode:: Selecting key listing mode. * Passphrase Callback:: Getting the passphrase from the user. * Progress Meter Callback:: Being informed about the progress. @@ -2643,29 +2643,6 @@ certificates to include into an S/MIME signed message. @end deftypefun - at node Exporting Session Keys - at subsection Exporting Session Keys - at cindex context, exporting session keys - at cindex Exporting Session Keys - at cindex exporting session keys - - at deftypefun void gpgme_set_export_session_keys (@w{gpgme_ctx_t @var{ctx}}, @w{int @var{yes}}) -The function @code{gpgme_set_export_session_keys} specifies whether -the context should try to export the symmetric session key when -decrypting data. By default, session keys are not exported. - -Session keys are not exported if @var{yes} is zero, and -enabled otherwise. - at end deftypefun - - at deftypefun int gpgme_get_export_session_keys (@w{gpgme_ctx_t @var{ctx}}) -The function @code{gpgme_get_export_session_keys} returns @code{1} if -the context will try to export the symmetric session key when -decrypting, and @code{0} if not, or if @var{ctx} is not a valid -pointer. - at end deftypefun - - @node Key Listing Mode @subsection Key Listing Mode @cindex key listing mode @@ -2923,6 +2900,18 @@ format. For example the non breaking space characters ("~") will not be removed from the @code{description} field of the @code{gpgme_tofu_info_t} object. + at item "export-session-key" +Using a @var{value} of "1" specifies that the context should try to +export the symmetric session key when decrypting data. By default, or +when using an empty string or "0" for @var{value}, session keys are +not exported. + + at item "override-session-key" +The string given in @var{value} is passed to the GnuPG engine to override +the session key for decryption. The format of that session key is +specific to GnuPG and can be retrieved during a decrypt operation when +the context flag "export-session-key" is enabled. + @end table This function returns @code{0} on success. @@ -4798,8 +4787,10 @@ secret key for this recipient is not available, and 0 otherwise. This is a pointer to a structure used to store the result of a @code{gpgme_op_decrypt} operation. After successfully decrypting data, you can retrieve the pointer to the result with - at code{gpgme_op_decrypt_result}. The structure contains the following -members: + at code{gpgme_op_decrypt_result}. As with all result structures, it +this structure shall be considered read-only and an application must +not allocated such a strucure on its own. The structure contains the +following members: @table @code @item char *unsupported_algorithm @@ -4817,17 +4808,12 @@ This is the filename of the original plaintext message file if it is known, otherwise this is a null pointer. @item char *session_key -A textual representation (null-terminated string) of the session key +A textual representation (nul-terminated string) of the session key used in symmetric encryption of the message, if the context has been -set to export session keys (see @code{gpgme_get_export_session_keys} -and @code{gpgme_set_export_session_keys}), and a session key was -available for the most recent decryption operation. Otherwise, this -is a null pointer. - -You should never access this member of a - at code{gpgme_op_decrypt_result_t} without first ensuring that - at code{gpgme_get_export_session_keys} returns non-zero for the -reporting context. +set to export session keys (see @code{gpgme_set_ctx_flag, +"export-session-key"}), and a session key was available for the most +recent decryption operation. Otherwise, this is a null pointer. + @end table @end deftp diff --git a/src/context.h b/src/context.h index 94935c8..d915b99 100644 --- a/src/context.h +++ b/src/context.h @@ -135,6 +135,9 @@ struct gpgme_context /* The sender's addr-spec or NULL. */ char *sender; + /* The gpg specific override session key or NULL. */ + char *override_session_key; + /* The locale for the pinentry. */ char *lc_ctype; char *lc_messages; diff --git a/src/decrypt-verify.c b/src/decrypt-verify.c index 00d256a..e0aa8ea 100644 --- a/src/decrypt-verify.c +++ b/src/decrypt-verify.c @@ -77,7 +77,9 @@ decrypt_verify_start (gpgme_ctx_t ctx, int synchronous, _gpgme_engine_set_status_handler (ctx->engine, decrypt_verify_status_handler, ctx); - return _gpgme_engine_op_decrypt_verify (ctx->engine, cipher, plain, ctx->export_session_keys); + return _gpgme_engine_op_decrypt_verify (ctx->engine, cipher, plain, + ctx->export_session_keys, + ctx->override_session_key); } diff --git a/src/decrypt.c b/src/decrypt.c index 49c735c..43717c0 100644 --- a/src/decrypt.c +++ b/src/decrypt.c @@ -360,7 +360,7 @@ _gpgme_op_decrypt_init_result (gpgme_ctx_t ctx) static gpgme_error_t decrypt_start (gpgme_ctx_t ctx, int synchronous, - gpgme_data_t cipher, gpgme_data_t plain) + gpgme_data_t cipher, gpgme_data_t plain) { gpgme_error_t err; @@ -390,7 +390,9 @@ decrypt_start (gpgme_ctx_t ctx, int synchronous, _gpgme_engine_set_status_handler (ctx->engine, decrypt_status_handler, ctx); - return _gpgme_engine_op_decrypt (ctx->engine, cipher, plain, ctx->export_session_keys); + return _gpgme_engine_op_decrypt (ctx->engine, cipher, plain, + ctx->export_session_keys, + ctx->override_session_key); } diff --git a/src/engine-backend.h b/src/engine-backend.h index 144b156..cfc624d 100644 --- a/src/engine-backend.h +++ b/src/engine-backend.h @@ -62,9 +62,11 @@ struct engine_ops gpgme_error_t (*set_locale) (void *engine, int category, const char *value); gpgme_error_t (*set_protocol) (void *engine, gpgme_protocol_t protocol); gpgme_error_t (*decrypt) (void *engine, gpgme_data_t ciph, - gpgme_data_t plain, int export_session_key); + gpgme_data_t plain, int export_session_key, + const char *override_session_key); gpgme_error_t (*decrypt_verify) (void *engine, gpgme_data_t ciph, - gpgme_data_t plain, int export_session_key); + gpgme_data_t plain, int export_session_key, + const char *override_session_key); gpgme_error_t (*delete) (void *engine, gpgme_key_t key, int allow_secret); gpgme_error_t (*edit) (void *engine, int type, gpgme_key_t key, gpgme_data_t out, gpgme_ctx_t ctx /* FIXME */); diff --git a/src/engine-gpg.c b/src/engine-gpg.c index 0e43c24..21ed5bc 100644 --- a/src/engine-gpg.c +++ b/src/engine-gpg.c @@ -1550,7 +1550,8 @@ add_input_size_hint (engine_gpg_t gpg, gpgme_data_t data) static gpgme_error_t -gpg_decrypt (void *engine, gpgme_data_t ciph, gpgme_data_t plain, int export_session_key) +gpg_decrypt (void *engine, gpgme_data_t ciph, gpgme_data_t plain, + int export_session_key, const char *override_session_key) { engine_gpg_t gpg = engine; gpgme_error_t err; @@ -1560,6 +1561,13 @@ gpg_decrypt (void *engine, gpgme_data_t ciph, gpgme_data_t plain, int export_ses if (!err && export_session_key) err = add_arg (gpg, "--show-session-key"); + if (!err && override_session_key && *override_session_key) + { + err = add_arg (gpg, "--override-session-key"); + if (!err) + err = add_arg (gpg, override_session_key); + } + /* Tell the gpg object about the data. */ if (!err) err = add_arg (gpg, "--output"); diff --git a/src/engine-gpgsm.c b/src/engine-gpgsm.c index 2ff353b..d1be049 100644 --- a/src/engine-gpgsm.c +++ b/src/engine-gpgsm.c @@ -1120,13 +1120,16 @@ gpgsm_reset (void *engine) static gpgme_error_t -gpgsm_decrypt (void *engine, gpgme_data_t ciph, gpgme_data_t plain, int export_session_key) +gpgsm_decrypt (void *engine, gpgme_data_t ciph, gpgme_data_t plain, + int export_session_key, const char *override_session_key) { engine_gpgsm_t gpgsm = engine; gpgme_error_t err; + /* gpgsm is not capable of exporting session keys right now, so we * will ignore this if requested. */ (void)export_session_key; + (void)override_session_key; if (!gpgsm) return gpg_error (GPG_ERR_INV_VALUE); diff --git a/src/engine-uiserver.c b/src/engine-uiserver.c index 26f0d18..ee7b1d2 100644 --- a/src/engine-uiserver.c +++ b/src/engine-uiserver.c @@ -961,13 +961,16 @@ uiserver_reset (void *engine) static gpgme_error_t _uiserver_decrypt (void *engine, int verify, gpgme_data_t ciph, gpgme_data_t plain, - int export_session_key) + int export_session_key, const char *override_session_key) { engine_uiserver_t uiserver = engine; gpgme_error_t err; const char *protocol; char *cmd; + (void)override_session_key; /* Fixme: We need to see now to add this + * to the UI server protocol */ + if (!uiserver) return gpg_error (GPG_ERR_INV_VALUE); if (uiserver->protocol == GPGME_PROTOCOL_DEFAULT) @@ -1008,16 +1011,21 @@ _uiserver_decrypt (void *engine, int verify, static gpgme_error_t -uiserver_decrypt (void *engine, gpgme_data_t ciph, gpgme_data_t plain, int export_session_key) +uiserver_decrypt (void *engine, gpgme_data_t ciph, gpgme_data_t plain, + int export_session_key, const char *override_session_key) { - return _uiserver_decrypt (engine, 0, ciph, plain, export_session_key); + return _uiserver_decrypt (engine, 0, ciph, plain, + export_session_key, override_session_key); } static gpgme_error_t -uiserver_decrypt_verify (void *engine, gpgme_data_t ciph, gpgme_data_t plain, int export_session_key) +uiserver_decrypt_verify (void *engine, gpgme_data_t ciph, gpgme_data_t plain, + int export_session_key, + const char *override_session_key) { - return _uiserver_decrypt (engine, 1, ciph, plain, export_session_key); + return _uiserver_decrypt (engine, 1, ciph, plain, + export_session_key, override_session_key); } diff --git a/src/engine.c b/src/engine.c index b43f683..d542b25 100644 --- a/src/engine.c +++ b/src/engine.c @@ -653,7 +653,8 @@ _gpgme_engine_set_protocol (engine_t engine, gpgme_protocol_t protocol) gpgme_error_t _gpgme_engine_op_decrypt (engine_t engine, gpgme_data_t ciph, - gpgme_data_t plain, int export_session_key) + gpgme_data_t plain, int export_session_key, + const char *override_session_key) { if (!engine) return gpg_error (GPG_ERR_INV_VALUE); @@ -661,13 +662,15 @@ _gpgme_engine_op_decrypt (engine_t engine, gpgme_data_t ciph, if (!engine->ops->decrypt) return gpg_error (GPG_ERR_NOT_IMPLEMENTED); - return (*engine->ops->decrypt) (engine->engine, ciph, plain, export_session_key); + return (*engine->ops->decrypt) (engine->engine, ciph, plain, + export_session_key, override_session_key); } gpgme_error_t _gpgme_engine_op_decrypt_verify (engine_t engine, gpgme_data_t ciph, - gpgme_data_t plain, int export_session_key) + gpgme_data_t plain, int export_session_key, + const char *override_session_key) { if (!engine) return gpg_error (GPG_ERR_INV_VALUE); @@ -675,7 +678,9 @@ _gpgme_engine_op_decrypt_verify (engine_t engine, gpgme_data_t ciph, if (!engine->ops->decrypt_verify) return gpg_error (GPG_ERR_NOT_IMPLEMENTED); - return (*engine->ops->decrypt_verify) (engine->engine, ciph, plain, export_session_key); + return (*engine->ops->decrypt_verify) (engine->engine, ciph, plain, + export_session_key, + override_session_key); } diff --git a/src/engine.h b/src/engine.h index 512ac19..29d2f25 100644 --- a/src/engine.h +++ b/src/engine.h @@ -84,11 +84,14 @@ _gpgme_engine_set_colon_line_handler (engine_t engine, void *fnc_value); gpgme_error_t _gpgme_engine_op_decrypt (engine_t engine, gpgme_data_t ciph, gpgme_data_t plain, - int export_session_key); + int export_session_key, + const char *override_session_key); gpgme_error_t _gpgme_engine_op_decrypt_verify (engine_t engine, gpgme_data_t ciph, gpgme_data_t plain, - int export_session_key); + int export_session_key, + const char *override_session_key + ); gpgme_error_t _gpgme_engine_op_delete (engine_t engine, gpgme_key_t key, int allow_secret); gpgme_error_t _gpgme_engine_op_edit (engine_t engine, int type, diff --git a/src/gpgme.c b/src/gpgme.c index 32abc28..1a10fd9 100644 --- a/src/gpgme.c +++ b/src/gpgme.c @@ -247,6 +247,7 @@ gpgme_release (gpgme_ctx_t ctx) free (ctx->signers); free (ctx->lc_ctype); free (ctx->lc_messages); + free (ctx->override_session_key); _gpgme_engine_info_release (ctx->engine_info); ctx->engine_info = NULL; DESTROY_LOCK (ctx->lock); @@ -515,6 +516,17 @@ gpgme_set_ctx_flag (gpgme_ctx_t ctx, const char *name, const char *value) { ctx->raw_description = abool; } + else if (!strcmp (name, "export-session-key")) + { + ctx->export_session_keys = abool; + } + else if (!strcmp (name, "override-session-key")) + { + free (ctx->override_session_key); + ctx->override_session_key = strdup (value); + if (!ctx->override_session_key) + err = gpg_error_from_syserror (); + } else err = gpg_error (GPG_ERR_UNKNOWN_NAME); @@ -526,7 +538,7 @@ gpgme_set_ctx_flag (gpgme_ctx_t ctx, const char *name, const char *value) * of valid names. If the NAME is unknown NULL is returned. For a * boolean flag an empty string is returned for False and the string * "1" for True; thus either atoi or a simple string test can be - * used. */ + * used. */ const char * gpgme_get_ctx_flag (gpgme_ctx_t ctx, const char *name) { @@ -540,35 +552,19 @@ gpgme_get_ctx_flag (gpgme_ctx_t ctx, const char *name) { return ctx->raw_description? "1":""; } + else if (!strcmp (name, "export-session-key")) + { + return ctx->export_session_keys? "1":""; + } + else if (!strcmp (name, "override-session-key")) + { + return ctx->override_session_key? ctx->override_session_key : ""; + } else return NULL; } -/* Enable or disable the exporting session keys upon decryption. */ -void -gpgme_set_export_session_keys (gpgme_ctx_t ctx, int export_session_keys) -{ - TRACE2 (DEBUG_CTX, "gpgme_set_export_session_keys", ctx, "export_session_keys=%i (%s)", - export_session_keys, export_session_keys ? "yes" : "no"); - - if (!ctx) - return; - - ctx->export_session_keys = !!export_session_keys; -} - - -/* Return whether this context will export session keys upon decryption. */ -int -gpgme_get_export_session_keys (gpgme_ctx_t ctx) -{ - TRACE2 (DEBUG_CTX, "gpgme_get_export_session_keys", ctx, "ctx->export_session_keys=%i (%s)", - ctx->export_session_keys, ctx->export_session_keys ? "yes" : "no"); - return ctx->export_session_keys; -} - - /* Enable or disable the use of the special textmode. Textmode is for example used for the RFC2015 signatures; note that the updated RFC 3156 mandates that the MUA does some preparations so that textmode diff --git a/src/gpgme.def b/src/gpgme.def index cd0d084..0d3ce74 100644 --- a/src/gpgme.def +++ b/src/gpgme.def @@ -252,8 +252,6 @@ EXPORTS gpgme_op_query_swdb @189 gpgme_op_query_swdb_result @190 - gpgme_set_export_session_keys @191 - gpgme_get_export_session_keys @192 - gpgme_get_ctx_flag @193 + gpgme_get_ctx_flag @191 ; END diff --git a/src/gpgme.h.in b/src/gpgme.h.in index 43e07b0..7cfe8f6 100644 --- a/src/gpgme.h.in +++ b/src/gpgme.h.in @@ -1040,13 +1040,6 @@ void gpgme_set_offline (gpgme_ctx_t ctx, int yes); /* Return non-zero if offline mode is set in CTX. */ int gpgme_get_offline (gpgme_ctx_t ctx); -/* If YES is non-zero, try to return session keys during decryption, - do not otherwise. */ -void gpgme_set_export_session_keys (gpgme_ctx_t ctx, int yes); - -/* Return non-zero if export_session_keys is set in CTX. */ -int gpgme_get_export_session_keys (gpgme_ctx_t ctx); - /* Use whatever the default of the backend crypto engine is. */ #define GPGME_INCLUDE_CERTS_DEFAULT -256 diff --git a/src/libgpgme.vers b/src/libgpgme.vers index 362909a..a55cd10 100644 --- a/src/libgpgme.vers +++ b/src/libgpgme.vers @@ -126,9 +126,6 @@ GPGME_1.1 { gpgme_op_query_swdb; gpgme_op_query_swdb_result; - - gpgme_set_export_session_keys; - gpgme_get_export_session_keys; }; diff --git a/tests/run-decrypt.c b/tests/run-decrypt.c index 6d38aee..65624d0 100644 --- a/tests/run-decrypt.c +++ b/tests/run-decrypt.c @@ -51,9 +51,13 @@ print_result (gpgme_decrypt_result_t result) { gpgme_recipient_t recp; int count = 0; + printf ("Original file name: %s\n", nonnull(result->file_name)); printf ("Wrong key usage: %i\n", result->wrong_key_usage); - printf ("Unsupported algorithm: %s\n ", nonnull(result->unsupported_algorithm)); + printf ("Unsupported algorithm: %s\n", + nonnull(result->unsupported_algorithm)); + if (result->session_key) + printf ("Session key: %s\n", result->session_key); for (recp = result->recipients; recp->next; recp = recp->next) { @@ -74,6 +78,8 @@ show_usage (int ex) " --status print status lines from the backend\n" " --openpgp use the OpenPGP protocol (default)\n" " --cms use the CMS protocol\n" + " --export-session-key show the session key\n" + " --override-session-key STRING use STRING as session key\n" , stderr); exit (ex); } @@ -91,6 +97,8 @@ main (int argc, char **argv) gpgme_data_t out = NULL; gpgme_decrypt_result_t result; int print_status = 0; + int export_session_key = 0; + const char *override_session_key = NULL; if (argc) { argc--; argv++; } @@ -125,6 +133,19 @@ main (int argc, char **argv) protocol = GPGME_PROTOCOL_CMS; argc--; argv++; } + else if (!strcmp (*argv, "--export-session-key")) + { + export_session_key = 1; + argc--; argv++; + } + else if (!strcmp (*argv, "--override-session-key")) + { + argc--; argv++; + if (!argc) + show_usage (1); + override_session_key = *argv; + argc--; argv++; + } else if (!strncmp (*argv, "--", 2)) show_usage (1); @@ -152,6 +173,10 @@ main (int argc, char **argv) gpgme_set_status_cb (ctx, status_cb, NULL); gpgme_set_ctx_flag (ctx, "full-status", "1"); } + if (export_session_key) + gpgme_set_ctx_flag (ctx, "export-session-key", "1"); + if (override_session_key) + gpgme_set_ctx_flag (ctx, "override-session-key", override_session_key); err = gpgme_data_new_from_stream (&in, fp_in); if (err) commit 3234b1bf1d6939772677d64f6c1e1820ec98e3cd Author: Werner Koch Date: Tue Nov 15 09:24:17 2016 +0100 core: Add public function gpgme_get_ctx_flag. * src/gpgme.h.in (gpgme_get_ctx_flag): New. * src/gpgme.c (gpgme_set_ctx_flag): Move down the file and add a trace statement. (gpgme_get_ctx_flag): New. * src/gpgme.def, src/libgpgme.vers: Add new interface. Signed-off-by: Werner Koch diff --git a/NEWS b/NEWS index 4bb0cfb..c194d8f 100644 --- a/NEWS +++ b/NEWS @@ -12,6 +12,7 @@ Noteworthy changes in version 1.7.2 (unreleased) gpgme_op_query_swdb NEW. gpgme_op_query_swdb_result NEW. gpgme_query_swdb_result_t NEW. + gpgme_get_ctx_flag NEW. qt: DN NEW. qt: DN::Attribute NEW. qt: Job::context(Job*) NEW. diff --git a/doc/gpgme.texi b/doc/gpgme.texi index 7eabab4..e47979c 100644 --- a/doc/gpgme.texi +++ b/doc/gpgme.texi @@ -2929,6 +2929,19 @@ This function returns @code{0} on success. @end deftypefun + at deftypefun {const char *} gpgme_get_ctx_flag @ + (@w{gpgme_ctx_t @var{ctx}}, @ + @w{const char *@var{name}}) + +The value of flags settable by @code{gpgme_set_ctx_flag} can be +retrieved by this function. If @var{name} is unknown the function +returns @code{NULL}. For boolean flags an empty string is returned +for False and the string "1" is returned for True; either atoi(3) or a +test for an empty string can be used to get the boolean value. + + at end deftypefun + + @node Locale @subsection Locale @cindex locale, default diff --git a/src/gpgme.c b/src/gpgme.c index 7b14b5e..32abc28 100644 --- a/src/gpgme.c +++ b/src/gpgme.c @@ -85,39 +85,6 @@ gpgme_set_global_flag (const char *name, const char *value) } -/* Set the flag NAME for CTX to VALUE. The supported flags are: - * - * - full-status :: With a value of "1" the status callback set by - * gpgme_set_status_cb returns all status lines - * except for PROGRESS lines. With the default of - * "0" the status callback is only called in certain - * situations. - */ -gpgme_error_t -gpgme_set_ctx_flag (gpgme_ctx_t ctx, const char *name, const char *value) -{ - int abool; - - if (!ctx || !name || !value) - return gpg_error (GPG_ERR_INV_VALUE); - - abool = *value? !!atoi (value) : 0; - - if (!strcmp (name, "full-status")) - { - ctx->full_status = abool; - } - else if (!strcmp (name, "raw-description")) - { - ctx->raw_description = abool; - } - else - return gpg_error (GPG_ERR_UNKNOWN_NAME); - - return 0; -} - - /* Create a new context as an environment for GPGME crypto operations. */ @@ -518,6 +485,66 @@ gpgme_get_armor (gpgme_ctx_t ctx) } +/* Set the flag NAME for CTX to VALUE. The supported flags are: + * + * - full-status :: With a value of "1" the status callback set by + * gpgme_set_status_cb returns all status lines + * except for PROGRESS lines. With the default of + * "0" the status callback is only called in certain + * situations. + */ +gpgme_error_t +gpgme_set_ctx_flag (gpgme_ctx_t ctx, const char *name, const char *value) +{ + gpgme_error_t err = 0; + int abool; + + TRACE2 (DEBUG_CTX, "gpgme_set_ctx_flag", ctx, + "name='%s' value='%s'", + name? name:"(null)", value?value:"(null)"); + + abool = (value && *value)? !!atoi (value) : 0; + + if (!ctx || !name || !value) + err = gpg_error (GPG_ERR_INV_VALUE); + else if (!strcmp (name, "full-status")) + { + ctx->full_status = abool; + } + else if (!strcmp (name, "raw-description")) + { + ctx->raw_description = abool; + } + else + err = gpg_error (GPG_ERR_UNKNOWN_NAME); + + return err; +} + + +/* Get the context flag named NAME. See gpgme_set_ctx_flag for a list + * of valid names. If the NAME is unknown NULL is returned. For a + * boolean flag an empty string is returned for False and the string + * "1" for True; thus either atoi or a simple string test can be + * used. */ +const char * +gpgme_get_ctx_flag (gpgme_ctx_t ctx, const char *name) +{ + if (!ctx || !name) + return NULL; + else if (!strcmp (name, "full-status")) + { + return ctx->full_status? "1":""; + } + else if (!strcmp (name, "raw-description")) + { + return ctx->raw_description? "1":""; + } + else + return NULL; +} + + /* Enable or disable the exporting session keys upon decryption. */ void gpgme_set_export_session_keys (gpgme_ctx_t ctx, int export_session_keys) diff --git a/src/gpgme.def b/src/gpgme.def index 35f4341..cd0d084 100644 --- a/src/gpgme.def +++ b/src/gpgme.def @@ -254,5 +254,6 @@ EXPORTS gpgme_set_export_session_keys @191 gpgme_get_export_session_keys @192 + gpgme_get_ctx_flag @193 ; END diff --git a/src/gpgme.h.in b/src/gpgme.h.in index 2a0e16e..43e07b0 100644 --- a/src/gpgme.h.in +++ b/src/gpgme.h.in @@ -999,6 +999,9 @@ void gpgme_release (gpgme_ctx_t ctx); gpgme_error_t gpgme_set_ctx_flag (gpgme_ctx_t ctx, const char *name, const char *value); +/* Get the value of the flag NAME from CTX. */ +const char *gpgme_get_ctx_flag (gpgme_ctx_t ctx, const char *name); + /* Set the protocol to be used by CTX to PROTO. */ gpgme_error_t gpgme_set_protocol (gpgme_ctx_t ctx, gpgme_protocol_t proto); diff --git a/src/libgpgme.vers b/src/libgpgme.vers index 9a3ecb2..362909a 100644 --- a/src/libgpgme.vers +++ b/src/libgpgme.vers @@ -101,6 +101,7 @@ GPGME_1.1 { gpgme_pubkey_algo_string; gpgme_set_ctx_flag; + gpgme_get_ctx_flag; gpgme_data_set_flag; gpgme_op_createkey_start; diff --git a/tests/run-tofu.c b/tests/run-tofu.c index ff55789..9e3b117 100644 --- a/tests/run-tofu.c +++ b/tests/run-tofu.c @@ -99,6 +99,7 @@ main (int argc, char **argv) const char *fpr; const char *policystr = NULL; gpgme_tofu_policy_t policy; + const char *s; if (argc) { argc--; argv++; } @@ -145,10 +146,31 @@ main (int argc, char **argv) fail_if_err (err); gpgme_set_protocol (ctx, protocol); gpgme_set_armor (ctx, 1); + + + s = gpgme_get_ctx_flag (ctx, "no_such-flag"); + if (s) + { + fprintf (stderr, PGM ": gpgme_get_ctx_flag failed " + "(bad name not detected)\n"); + exit (1); + } + s = gpgme_get_ctx_flag (ctx, "full-status"); + if (!s || *s) + { + fprintf (stderr, PGM ": gpgme_get_ctx_flag failed (wrong false)\n"); + exit (1); + } if (print_status) { gpgme_set_status_cb (ctx, status_cb, NULL); gpgme_set_ctx_flag (ctx, "full-status", "1"); + s = gpgme_get_ctx_flag (ctx, "full-status"); + if (!s || strcmp (s, "1")) + { + fprintf (stderr, PGM ": gpgme_get_ctx_flag fauled (wrong true)\n"); + exit (1); + } } err = gpgme_get_key (ctx, fpr, &thekey, 0); commit cad1210fb8a7402cb29e607f8f9680005314120d Author: Daniel Kahn Gillmor Date: Fri Nov 11 16:49:28 2016 +0900 core: Enable extraction of session keys. * src/gpgme.c (gpgme_set_export_session_keys): New function. (gpgme_get_export_session_keys): New function. * src/gpgme.h.in (struct _gpgme_op_decrypt_result): Add session_key member. (gpgme_{set,get}_export_session_keys): Declare new functions. * src/libgpgme.vers, src/gpgme.def: Export new functions in shared object. * src/engine.h: (_gpgme_engine_op_decrypt) Add export_session_key parameter. (_gpgme_engine_op_decrypt_verify): Add export_session_key parameter. * src/engine-backend.h: (struct engine_ops): Change function pointer declarations to match. * src/context.h (struct gpgme_context): Add export_session_keys member. * src/decrypt.c (release_op_data): Free result.session_key. (_gpgme_decrypt_status_handler): Store a copy of the exported session key. (decrypt_start): Pass export_session_keys from the context. * src/decrypt-verify.c (decrypt_verify_start): Pass export_session_keys from context. * src/engine.c (_gpgme_engine_op_decrypt): Pass through export_session_key flag. (_gpgme_engine_op_decrypt_verify): Pass through export_session_key flag. * src/engine-gpg.c (gpg_decrypt): If export_session_key is set, add --export-session-key to argument list. * src/engine-gpgsm.c (gpgsm_decrypt): Ignore export_session_key for now, since gpgsm offers no such mechanism. * src/engine-uiserver.c (_uiserver_decrypt): If export_session_key is set, add --export-session-key flag to cmd. * doc/gpgme.texi: Document new functions and session_key member of decrypt_result_t. * doc/uiserver.texi: Add --export-session-key flag to DECRYPT command. -- gpg(1) documents session key export as useful for key escrow, and is rightly dubious of that use case. However, session key export is also useful in other use cases. Two examples from MUA development (where this functionality would be specifically useful to me right now): * If the MUA stores a local copy of the session key upon decrypting the message, it can re-decrypt the message without expensive asymmetric operations. When rendering a thread with dozens of encrypted messages, this can represent a significant speedup. * A user may have expired encryption-capable secret key material, along with many messages encrypted to that material. If she stores the session keys for those messages she wants to keep, she can destroy her secret key material and make any messages she has deleted completely unrecoverable, even to an attacker who gets her remaining secret keys in the future. This patchset makes a two specific implementation decisions that could have gone in different ways. I welcome feedback on preferred outcomes. 0) session key representation: we currently represent the session key as an opaque textual string, rather than trying to provide any sort of in-memory structure. While it wouldn't be hard to parse the data produced by gpg's --export-session-key, I chose to use the opaque string rather than lock in a particular data format. 1) API/ABI: i've added a member to gpgme_op_decrypt_result_t. This has the potential to cause an out-of-bound memory access if someone uses code compiled against the newer verision, but linked at runtime against an older version. I've attempted to limit that risk by documenting that users must verify gpgme_get_export_session_keys() before accessing this new struct member -- this means that code expecting this capability will require the symbol at link-time, and will refuse to link against older versions. Another approach to solving this problem would be to avoid modifying gpgme_op_decrypt_result_t, and to introduce instead a new function gpgme_op_session_key(), which could be called in the same places as gpgme_op_decrypt_result(). Depending on the representation of the session key, this might introduce new memory-management burdens on the user of the library, and the session key is certainly part of a decryption result, so it seemed simpler to go with what i have here. If anyone has strong preferences that these choices should be solved in a different way, i'm happy to hear them. Additionally, I note that i'm also still pretty unclear about how the "UI Server" fits into this whole ecosystem. In particular, I don't know whether it's kosher to just add an --export-session-key flag to the DECRYPT operation without actually having implemented it anywhere, but i don't see where i would actually implement it either :/ If this patch (or some variant) is adopted, i will supply another patch that permits offering a session key during decryption (e.g. "gpg --override-session-key"), but I wanted to get these implementation choices ironed out first. Gnupg-Bug-Id: 2754 Signed-off-by: Daniel Kahn Gillmor On the concern of adding a new field to a structure: It may not be clearly documented but we don't expect that a user ever allocates such a structure - those result structure may only be created bu gpgme and are read-only for the user. Adding a new member constitutes a compatible ABI change and thus an older SO may not be used by code compiled with a header for the newer API. Unless someone tinkers with the build system, this should never happen. We have added new fields to result structure may times and I can't remember any problems. - wk diff --git a/doc/gpgme.texi b/doc/gpgme.texi index 801a53f..7eabab4 100644 --- a/doc/gpgme.texi +++ b/doc/gpgme.texi @@ -191,6 +191,7 @@ Context Attributes * Text Mode:: Choosing canonical text mode. * Offline Mode:: Choosing offline mode. * Included Certificates:: Including a number of certificates. +* Exporting Session Keys:: Requesting session keys upon decryption. * Key Listing Mode:: Selecting key listing mode. * Passphrase Callback:: Getting the passphrase from the user. * Progress Meter Callback:: Being informed about the progress. @@ -2351,6 +2352,7 @@ started. In fact, these references are accessed through the * Offline Mode:: Choosing offline mode. * Pinentry Mode:: Choosing the pinentry mode. * Included Certificates:: Including a number of certificates. +* Exporting Session Keys:: Requesting session keys upon decryption. * Key Listing Mode:: Selecting key listing mode. * Passphrase Callback:: Getting the passphrase from the user. * Progress Meter Callback:: Being informed about the progress. @@ -2641,6 +2643,29 @@ certificates to include into an S/MIME signed message. @end deftypefun + at node Exporting Session Keys + at subsection Exporting Session Keys + at cindex context, exporting session keys + at cindex Exporting Session Keys + at cindex exporting session keys + + at deftypefun void gpgme_set_export_session_keys (@w{gpgme_ctx_t @var{ctx}}, @w{int @var{yes}}) +The function @code{gpgme_set_export_session_keys} specifies whether +the context should try to export the symmetric session key when +decrypting data. By default, session keys are not exported. + +Session keys are not exported if @var{yes} is zero, and +enabled otherwise. + at end deftypefun + + at deftypefun int gpgme_get_export_session_keys (@w{gpgme_ctx_t @var{ctx}}) +The function @code{gpgme_get_export_session_keys} returns @code{1} if +the context will try to export the symmetric session key when +decrypting, and @code{0} if not, or if @var{ctx} is not a valid +pointer. + at end deftypefun + + @node Key Listing Mode @subsection Key Listing Mode @cindex key listing mode @@ -4777,6 +4802,19 @@ This is a linked list of recipients to which this message was encrypted. @item char *file_name This is the filename of the original plaintext message file if it is known, otherwise this is a null pointer. + + at item char *session_key +A textual representation (null-terminated string) of the session key +used in symmetric encryption of the message, if the context has been +set to export session keys (see @code{gpgme_get_export_session_keys} +and @code{gpgme_set_export_session_keys}), and a session key was +available for the most recent decryption operation. Otherwise, this +is a null pointer. + +You should never access this member of a + at code{gpgme_op_decrypt_result_t} without first ensuring that + at code{gpgme_get_export_session_keys} returns non-zero for the +reporting context. @end table @end deftp diff --git a/doc/uiserver.texi b/doc/uiserver.texi index aae3b60..f10db01 100644 --- a/doc/uiserver.texi +++ b/doc/uiserver.texi @@ -260,12 +260,14 @@ encoded. For details on the file descriptor, see the description of @noindent The decryption is started with the command: - at deffn Command DECRYPT - at w{}-protocol=@var{name} [- at w{}-no-verify] + at deffn Command DECRYPT - at w{}-protocol=@var{name} [- at w{}-no-verify] [- at w{}-export-session-key] @var{name} is the encryption protocol used for the message. For a description of the allowed protocols see the @code{ENCRYPT} command. -This argument is mandatory. If the option @option{--no-verify} is given, -the server should not try to verify a signature, in case the input data -is an OpenPGP combined message. +This argument is mandatory. If the option @option{--no-verify} is +given, the server should not try to verify a signature, in case the +input data is an OpenPGP combined message. If the option + at option{--export-session-key} is given and the underlying engine knows +how to export the session key, it will appear on a status line @end deffn diff --git a/src/context.h b/src/context.h index 00e2e77..94935c8 100644 --- a/src/context.h +++ b/src/context.h @@ -111,6 +111,9 @@ struct gpgme_context * unmodified string, as received form gpg, will be returned. */ unsigned int raw_description : 1; + /* True if session keys should be exported upon decryption. */ + unsigned int export_session_keys : 1; + /* Flags for keylist mode. */ gpgme_keylist_mode_t keylist_mode; diff --git a/src/decrypt-verify.c b/src/decrypt-verify.c index a334f86..00d256a 100644 --- a/src/decrypt-verify.c +++ b/src/decrypt-verify.c @@ -77,7 +77,7 @@ decrypt_verify_start (gpgme_ctx_t ctx, int synchronous, _gpgme_engine_set_status_handler (ctx->engine, decrypt_verify_status_handler, ctx); - return _gpgme_engine_op_decrypt_verify (ctx->engine, cipher, plain); + return _gpgme_engine_op_decrypt_verify (ctx->engine, cipher, plain, ctx->export_session_keys); } diff --git a/src/decrypt.c b/src/decrypt.c index 51e4292..49c735c 100644 --- a/src/decrypt.c +++ b/src/decrypt.c @@ -63,6 +63,9 @@ release_op_data (void *hook) if (opd->result.file_name) free (opd->result.file_name); + if (opd->result.session_key) + free (opd->result.session_key); + while (recipient) { gpgme_recipient_t next = recipient->next; @@ -277,6 +280,12 @@ _gpgme_decrypt_status_handler (void *priv, gpgme_status_code_t code, opd->last_recipient_p = &(*opd->last_recipient_p)->next; break; + case GPGME_STATUS_SESSION_KEY: + if (opd->result.session_key) + free (opd->result.session_key); + opd->result.session_key = strdup(args); + break; + case GPGME_STATUS_NO_SECKEY: { gpgme_recipient_t rec = opd->result.recipients; @@ -381,7 +390,7 @@ decrypt_start (gpgme_ctx_t ctx, int synchronous, _gpgme_engine_set_status_handler (ctx->engine, decrypt_status_handler, ctx); - return _gpgme_engine_op_decrypt (ctx->engine, cipher, plain); + return _gpgme_engine_op_decrypt (ctx->engine, cipher, plain, ctx->export_session_keys); } diff --git a/src/engine-backend.h b/src/engine-backend.h index a8b1ac6..144b156 100644 --- a/src/engine-backend.h +++ b/src/engine-backend.h @@ -62,9 +62,9 @@ struct engine_ops gpgme_error_t (*set_locale) (void *engine, int category, const char *value); gpgme_error_t (*set_protocol) (void *engine, gpgme_protocol_t protocol); gpgme_error_t (*decrypt) (void *engine, gpgme_data_t ciph, - gpgme_data_t plain); + gpgme_data_t plain, int export_session_key); gpgme_error_t (*decrypt_verify) (void *engine, gpgme_data_t ciph, - gpgme_data_t plain); + gpgme_data_t plain, int export_session_key); gpgme_error_t (*delete) (void *engine, gpgme_key_t key, int allow_secret); gpgme_error_t (*edit) (void *engine, int type, gpgme_key_t key, gpgme_data_t out, gpgme_ctx_t ctx /* FIXME */); diff --git a/src/engine-gpg.c b/src/engine-gpg.c index 7725a00..0e43c24 100644 --- a/src/engine-gpg.c +++ b/src/engine-gpg.c @@ -1550,13 +1550,16 @@ add_input_size_hint (engine_gpg_t gpg, gpgme_data_t data) static gpgme_error_t -gpg_decrypt (void *engine, gpgme_data_t ciph, gpgme_data_t plain) +gpg_decrypt (void *engine, gpgme_data_t ciph, gpgme_data_t plain, int export_session_key) { engine_gpg_t gpg = engine; gpgme_error_t err; err = add_arg (gpg, "--decrypt"); + if (!err && export_session_key) + err = add_arg (gpg, "--show-session-key"); + /* Tell the gpg object about the data. */ if (!err) err = add_arg (gpg, "--output"); diff --git a/src/engine-gpgsm.c b/src/engine-gpgsm.c index a815cf0..2ff353b 100644 --- a/src/engine-gpgsm.c +++ b/src/engine-gpgsm.c @@ -1120,10 +1120,13 @@ gpgsm_reset (void *engine) static gpgme_error_t -gpgsm_decrypt (void *engine, gpgme_data_t ciph, gpgme_data_t plain) +gpgsm_decrypt (void *engine, gpgme_data_t ciph, gpgme_data_t plain, int export_session_key) { engine_gpgsm_t gpgsm = engine; gpgme_error_t err; + /* gpgsm is not capable of exporting session keys right now, so we + * will ignore this if requested. */ + (void)export_session_key; if (!gpgsm) return gpg_error (GPG_ERR_INV_VALUE); diff --git a/src/engine-uiserver.c b/src/engine-uiserver.c index 47b7dc3..26f0d18 100644 --- a/src/engine-uiserver.c +++ b/src/engine-uiserver.c @@ -960,7 +960,8 @@ uiserver_reset (void *engine) static gpgme_error_t _uiserver_decrypt (void *engine, int verify, - gpgme_data_t ciph, gpgme_data_t plain) + gpgme_data_t ciph, gpgme_data_t plain, + int export_session_key) { engine_uiserver_t uiserver = engine; gpgme_error_t err; @@ -978,8 +979,9 @@ _uiserver_decrypt (void *engine, int verify, else return gpgme_error (GPG_ERR_UNSUPPORTED_PROTOCOL); - if (asprintf (&cmd, "DECRYPT%s%s", protocol, - verify ? "" : " --no-verify") < 0) + if (asprintf (&cmd, "DECRYPT%s%s%s", protocol, + verify ? "" : " --no-verify", + export_session_key ? " --export-session-key" : "") < 0) return gpg_error_from_syserror (); uiserver->input_cb.data = ciph; @@ -1006,16 +1008,16 @@ _uiserver_decrypt (void *engine, int verify, static gpgme_error_t -uiserver_decrypt (void *engine, gpgme_data_t ciph, gpgme_data_t plain) +uiserver_decrypt (void *engine, gpgme_data_t ciph, gpgme_data_t plain, int export_session_key) { - return _uiserver_decrypt (engine, 0, ciph, plain); + return _uiserver_decrypt (engine, 0, ciph, plain, export_session_key); } static gpgme_error_t -uiserver_decrypt_verify (void *engine, gpgme_data_t ciph, gpgme_data_t plain) +uiserver_decrypt_verify (void *engine, gpgme_data_t ciph, gpgme_data_t plain, int export_session_key) { - return _uiserver_decrypt (engine, 1, ciph, plain); + return _uiserver_decrypt (engine, 1, ciph, plain, export_session_key); } diff --git a/src/engine.c b/src/engine.c index 4e513b6..b43f683 100644 --- a/src/engine.c +++ b/src/engine.c @@ -653,7 +653,7 @@ _gpgme_engine_set_protocol (engine_t engine, gpgme_protocol_t protocol) gpgme_error_t _gpgme_engine_op_decrypt (engine_t engine, gpgme_data_t ciph, - gpgme_data_t plain) + gpgme_data_t plain, int export_session_key) { if (!engine) return gpg_error (GPG_ERR_INV_VALUE); @@ -661,13 +661,13 @@ _gpgme_engine_op_decrypt (engine_t engine, gpgme_data_t ciph, if (!engine->ops->decrypt) return gpg_error (GPG_ERR_NOT_IMPLEMENTED); - return (*engine->ops->decrypt) (engine->engine, ciph, plain); + return (*engine->ops->decrypt) (engine->engine, ciph, plain, export_session_key); } gpgme_error_t _gpgme_engine_op_decrypt_verify (engine_t engine, gpgme_data_t ciph, - gpgme_data_t plain) + gpgme_data_t plain, int export_session_key) { if (!engine) return gpg_error (GPG_ERR_INV_VALUE); @@ -675,7 +675,7 @@ _gpgme_engine_op_decrypt_verify (engine_t engine, gpgme_data_t ciph, if (!engine->ops->decrypt_verify) return gpg_error (GPG_ERR_NOT_IMPLEMENTED); - return (*engine->ops->decrypt_verify) (engine->engine, ciph, plain); + return (*engine->ops->decrypt_verify) (engine->engine, ciph, plain, export_session_key); } diff --git a/src/engine.h b/src/engine.h index 15b0b5d..512ac19 100644 --- a/src/engine.h +++ b/src/engine.h @@ -83,10 +83,12 @@ _gpgme_engine_set_colon_line_handler (engine_t engine, engine_colon_line_handler_t fnc, void *fnc_value); gpgme_error_t _gpgme_engine_op_decrypt (engine_t engine, gpgme_data_t ciph, - gpgme_data_t plain); + gpgme_data_t plain, + int export_session_key); gpgme_error_t _gpgme_engine_op_decrypt_verify (engine_t engine, gpgme_data_t ciph, - gpgme_data_t plain); + gpgme_data_t plain, + int export_session_key); gpgme_error_t _gpgme_engine_op_delete (engine_t engine, gpgme_key_t key, int allow_secret); gpgme_error_t _gpgme_engine_op_edit (engine_t engine, int type, diff --git a/src/gpgme.c b/src/gpgme.c index 443cb76..7b14b5e 100644 --- a/src/gpgme.c +++ b/src/gpgme.c @@ -518,6 +518,30 @@ gpgme_get_armor (gpgme_ctx_t ctx) } +/* Enable or disable the exporting session keys upon decryption. */ +void +gpgme_set_export_session_keys (gpgme_ctx_t ctx, int export_session_keys) +{ + TRACE2 (DEBUG_CTX, "gpgme_set_export_session_keys", ctx, "export_session_keys=%i (%s)", + export_session_keys, export_session_keys ? "yes" : "no"); + + if (!ctx) + return; + + ctx->export_session_keys = !!export_session_keys; +} + + +/* Return whether this context will export session keys upon decryption. */ +int +gpgme_get_export_session_keys (gpgme_ctx_t ctx) +{ + TRACE2 (DEBUG_CTX, "gpgme_get_export_session_keys", ctx, "ctx->export_session_keys=%i (%s)", + ctx->export_session_keys, ctx->export_session_keys ? "yes" : "no"); + return ctx->export_session_keys; +} + + /* Enable or disable the use of the special textmode. Textmode is for example used for the RFC2015 signatures; note that the updated RFC 3156 mandates that the MUA does some preparations so that textmode diff --git a/src/gpgme.def b/src/gpgme.def index 2f6837d..35f4341 100644 --- a/src/gpgme.def +++ b/src/gpgme.def @@ -252,5 +252,7 @@ EXPORTS gpgme_op_query_swdb @189 gpgme_op_query_swdb_result @190 + gpgme_set_export_session_keys @191 + gpgme_get_export_session_keys @192 ; END diff --git a/src/gpgme.h.in b/src/gpgme.h.in index 4f470a0..2a0e16e 100644 --- a/src/gpgme.h.in +++ b/src/gpgme.h.in @@ -1037,6 +1037,13 @@ void gpgme_set_offline (gpgme_ctx_t ctx, int yes); /* Return non-zero if offline mode is set in CTX. */ int gpgme_get_offline (gpgme_ctx_t ctx); +/* If YES is non-zero, try to return session keys during decryption, + do not otherwise. */ +void gpgme_set_export_session_keys (gpgme_ctx_t ctx, int yes); + +/* Return non-zero if export_session_keys is set in CTX. */ +int gpgme_get_export_session_keys (gpgme_ctx_t ctx); + /* Use whatever the default of the backend crypto engine is. */ #define GPGME_INCLUDE_CERTS_DEFAULT -256 @@ -1527,6 +1534,10 @@ struct _gpgme_op_decrypt_result /* The original file name of the plaintext message, if available. */ char *file_name; + + /* A textual representation of the session key used to decrypt the + * message, if available */ + char *session_key; }; typedef struct _gpgme_op_decrypt_result *gpgme_decrypt_result_t; diff --git a/src/libgpgme.vers b/src/libgpgme.vers index 5457daa..9a3ecb2 100644 --- a/src/libgpgme.vers +++ b/src/libgpgme.vers @@ -125,6 +125,9 @@ GPGME_1.1 { gpgme_op_query_swdb; gpgme_op_query_swdb_result; + + gpgme_set_export_session_keys; + gpgme_get_export_session_keys; }; ----------------------------------------------------------------------- Summary of changes: NEWS | 1 + doc/gpgme.texi | 49 +++++++++++++++++++--- doc/uiserver.texi | 10 +++-- src/context.h | 6 +++ src/decrypt-verify.c | 4 +- src/decrypt.c | 15 ++++++- src/engine-backend.h | 6 ++- src/engine-gpg.c | 13 +++++- src/engine-gpgsm.c | 8 +++- src/engine-uiserver.c | 24 +++++++---- src/engine.c | 13 ++++-- src/engine.h | 9 +++- src/gpgme.c | 113 +++++++++++++++++++++++++++++++++++--------------- src/gpgme.def | 1 + src/gpgme.h.in | 7 ++++ src/libgpgme.vers | 1 + tests/run-decrypt.c | 27 +++++++++++- tests/run-tofu.c | 22 ++++++++++ 18 files changed, 265 insertions(+), 64 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Tue Nov 15 10:49:06 2016 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Tue, 15 Nov 2016 10:49:06 +0100 Subject: [git] GpgOL - branch, master, updated. gpgol-1.4.0-166-gb405ba1 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG extension for MS Outlook". The branch, master has been updated via b405ba1bddc587ea634182330d6f0d834a0bf75e (commit) from 9560e555e86fa9b5b59829bc9bd5b7f6ff6308e1 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit b405ba1bddc587ea634182330d6f0d834a0bf75e Author: Andre Heinecke Date: Tue Nov 15 10:48:16 2016 +0100 Fix check for gpgme-w32spawn * src/main.cpp (get_gpgme_w32_inst_dir): Fix name of gpgme-w32spawn.exe diff --git a/src/main.c b/src/main.c index c0e64e2..d862b57 100644 --- a/src/main.c +++ b/src/main.c @@ -148,7 +148,7 @@ get_gpgme_w32_inst_dir (void) { char *gpg4win_dir = get_gpg4win_dir (); char *tmp; - gpgrt_asprintf (&tmp, "%s\\bin\\gpgme-w32-spawn.exe", gpg4win_dir); + gpgrt_asprintf (&tmp, "%s\\bin\\gpgme-w32spawn.exe", gpg4win_dir); if (!access(tmp, R_OK)) { @@ -158,15 +158,14 @@ get_gpgme_w32_inst_dir (void) return tmp; } xfree (tmp); - gpgrt_asprintf (&tmp, "%s\\gpgme-w32-spawn.exe", gpg4win_dir); + gpgrt_asprintf (&tmp, "%s\\gpgme-w32spawn.exe", gpg4win_dir); if (!access(tmp, R_OK)) { xfree (tmp); return gpg4win_dir; } - log_error("%s:%s: Failed to find gpgme-w32-spawn.exe!", - SRCNAME, __func__); + OutputDebugString("Failed to find gpgme-w32spawn.exe!"); return NULL; } ----------------------------------------------------------------------- Summary of changes: src/main.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) hooks/post-receive -- GnuPG extension for MS Outlook http://git.gnupg.org From cvs at cvs.gnupg.org Tue Nov 15 11:25:01 2016 From: cvs at cvs.gnupg.org (by Justus Winter) Date: Tue, 15 Nov 2016 11:25:01 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.1.15-363-g64a58e2 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via 64a58e23c38db8658423bbe26fcd650330e24a88 (commit) via 93cc322ac06d3045a24aece90091f7f80f3dacb8 (commit) from 2cd281c4def1ea881b92b9aba18c1892f89c1870 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 64a58e23c38db8658423bbe26fcd650330e24a88 Author: Justus Winter Date: Tue Nov 15 11:03:30 2016 +0100 gpgscm: Mark cells requiring finalization. * tests/gpgscm/scheme.c (T_FINALIZE): New macro. (mk_port): Use the new macro. (mk_foreign_object): Likewise. (mk_counted_string): Likewise. (mk_empty_string): Likewise. (gc): Only call 'finalize_cell' for cells with the new flag. -- This speeds up the sweep phase of the garbage collector considerably because most cells do not require finalization. Signed-off-by: Justus Winter diff --git a/tests/gpgscm/scheme.c b/tests/gpgscm/scheme.c index 3ed1a00..1db6456 100644 --- a/tests/gpgscm/scheme.c +++ b/tests/gpgscm/scheme.c @@ -165,6 +165,7 @@ type_to_string (enum scheme_types typ) #define ADJ 32 #define TYPE_BITS 5 #define T_MASKTYPE 31 /* 0000000000011111 */ +#define T_FINALIZE 2048 /* 0000100000000000 */ #define T_SYNTAX 4096 /* 0001000000000000 */ #define T_IMMUTABLE 8192 /* 0010000000000000 */ #define T_ATOM 16384 /* 0100000000000000 */ /* only for gc */ @@ -1095,7 +1096,7 @@ static pointer oblist_all_symbols(scheme *sc) static pointer mk_port(scheme *sc, port *p) { pointer x = get_cell(sc, sc->NIL, sc->NIL); - typeflag(x) = T_PORT|T_ATOM; + typeflag(x) = T_PORT|T_ATOM|T_FINALIZE; x->_object._port=p; return (x); } @@ -1111,7 +1112,7 @@ pointer mk_foreign_func(scheme *sc, foreign_func f) { pointer mk_foreign_object(scheme *sc, const foreign_object_vtable *vtable, void *data) { pointer x = get_cell(sc, sc->NIL, sc->NIL); - typeflag(x) = (T_FOREIGN_OBJECT | T_ATOM); + typeflag(x) = (T_FOREIGN_OBJECT | T_ATOM | T_FINALIZE); x->_object._foreign_object._vtable=vtable; x->_object._foreign_object._data = data; return (x); @@ -1179,7 +1180,7 @@ INTERFACE pointer mk_string(scheme *sc, const char *str) { INTERFACE pointer mk_counted_string(scheme *sc, const char *str, int len) { pointer x = get_cell(sc, sc->NIL, sc->NIL); - typeflag(x) = (T_STRING | T_ATOM); + typeflag(x) = (T_STRING | T_ATOM | T_FINALIZE); strvalue(x) = store_string(sc,len,str,0); strlength(x) = len; return (x); @@ -1187,7 +1188,7 @@ INTERFACE pointer mk_counted_string(scheme *sc, const char *str, int len) { INTERFACE pointer mk_empty_string(scheme *sc, int len, char fill) { pointer x = get_cell(sc, sc->NIL, sc->NIL); - typeflag(x) = (T_STRING | T_ATOM); + typeflag(x) = (T_STRING | T_ATOM | T_FINALIZE); strvalue(x) = store_string(sc,len,0,fill); strlength(x) = len; return (x); @@ -1504,7 +1505,7 @@ static void gc(scheme *sc, pointer a, pointer b) { clrmark(p); } else { /* reclaim cell */ - if (typeflag(p) != 0) { + if (typeflag(p) & T_FINALIZE) { finalize_cell(sc, p); typeflag(p) = 0; car(p) = sc->NIL; commit 93cc322ac06d3045a24aece90091f7f80f3dacb8 Author: Justus Winter Date: Tue Nov 15 11:07:57 2016 +0100 gpgscm: Recover more cells. * tests/gpgscm/scheme.c (_s_return): Recover the cell holding the opcode. Fixes-commit: e0cbd3389e2dd6ec19ee3a4c7bad81fa0f1907f5 Signed-off-by: Justus Winter diff --git a/tests/gpgscm/scheme.c b/tests/gpgscm/scheme.c index ce31f8d..3ed1a00 100644 --- a/tests/gpgscm/scheme.c +++ b/tests/gpgscm/scheme.c @@ -2643,6 +2643,7 @@ static pointer _s_return(scheme *sc, pointer a, int enable_gc) { return sc->NIL; free_cons(sc, dump, &op, &dump); sc->op = ivalue(op); + free_cell(sc, op); free_cons(sc, dump, &sc->args, &dump); free_cons(sc, dump, &sc->envir, &dump); free_cons(sc, dump, &sc->code, &sc->dump); ----------------------------------------------------------------------- Summary of changes: tests/gpgscm/scheme.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Tue Nov 15 11:30:16 2016 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Tue, 15 Nov 2016 11:30:16 +0100 Subject: [git] GpgOL - branch, master, updated. gpgol-1.4.0-167-g9218ee7 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG extension for MS Outlook". The branch, master has been updated via 9218ee793a5b0d26244ba064ae66080db8f83cdd (commit) from b405ba1bddc587ea634182330d6f0d834a0bf75e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 9218ee793a5b0d26244ba064ae66080db8f83cdd Author: Andre Heinecke Date: Tue Nov 15 11:28:57 2016 +0100 Ignore UnRead property change notification * src/mailitem-events.cpp: Ignore UnRead -- UnRead is handled, we just ignore the notification. diff --git a/src/mailitem-events.cpp b/src/mailitem-events.cpp index 29ff764..2eba0b8 100644 --- a/src/mailitem-events.cpp +++ b/src/mailitem-events.cpp @@ -38,6 +38,7 @@ const wchar_t *prop_blacklist[] = { L"CC", /* Ditto */ L"BCC", /* Ditto */ L"Categories", + L"UnRead", NULL }; typedef enum ----------------------------------------------------------------------- Summary of changes: src/mailitem-events.cpp | 1 + 1 file changed, 1 insertion(+) hooks/post-receive -- GnuPG extension for MS Outlook http://git.gnupg.org From cvs at cvs.gnupg.org Tue Nov 15 11:49:45 2016 From: cvs at cvs.gnupg.org (by Justus Winter) Date: Tue, 15 Nov 2016 11:49:45 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.1.15-364-g809d67e Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via 809d67e74014cb563efd965744fd11f87bbae743 (commit) from 64a58e23c38db8658423bbe26fcd650330e24a88 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 809d67e74014cb563efd965744fd11f87bbae743 Author: Justus Winter Date: Tue Nov 15 11:46:40 2016 +0100 g10: Fix memory leak. * g10/keyedit.c (menu_adduid): Deallocate 'sig'. Signed-off-by: Justus Winter diff --git a/g10/keyedit.c b/g10/keyedit.c index ffc0da7..4fba224 100644 --- a/g10/keyedit.c +++ b/g10/keyedit.c @@ -4350,6 +4350,7 @@ menu_adduid (ctrl_t ctrl, kbnode_t pub_keyblock, pkt = xmalloc_clear (sizeof *pkt); pkt->pkttype = PKT_SIGNATURE; pkt->pkt.signature = copy_signature (NULL, sig); + free_seckey_enc (sig); if (pub_where) insert_kbnode (node, new_kbnode (pkt), 0); else ----------------------------------------------------------------------- Summary of changes: g10/keyedit.c | 1 + 1 file changed, 1 insertion(+) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Tue Nov 15 12:04:01 2016 From: cvs at cvs.gnupg.org (by Daniel Kahn Gillmor) Date: Tue, 15 Nov 2016 12:04:01 +0100 Subject: [git] GPGME - branch, master, updated. gpgme-1.7.1-44-gff3b72e Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via ff3b72e2a3b5bf0e6037ee495f8ba6b28727a872 (commit) from 7659d42468b604db2936b021425683f407eba4a7 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit ff3b72e2a3b5bf0e6037ee495f8ba6b28727a872 Author: Daniel Kahn Gillmor Date: Tue Nov 15 19:53:35 2016 +0900 doc: Fix typos. -- diff --git a/doc/gpgme.texi b/doc/gpgme.texi index eb06c20..fd396e0 100644 --- a/doc/gpgme.texi +++ b/doc/gpgme.texi @@ -2315,7 +2315,7 @@ structures such as @code{gpgme_decrypt_result_t}. The corresponding retrieval functions such as @code{gpgme_op_decrypt_result} provide static access to the results after an operation completes. Those structures shall be considered read-only and an application must not -allocated such a strucure on its own. The following interfaces make +allocate such a structure on its own. The following interfaces make it possible to detach a result structure from its associated context and give it a lifetime beyond that of the current operation or context. ----------------------------------------------------------------------- Summary of changes: doc/gpgme.texi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Tue Nov 15 13:06:53 2016 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Tue, 15 Nov 2016 13:06:53 +0100 Subject: [git] GpgOL - branch, master, updated. gpgol-1.4.0-168-ge4ed7ec Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG extension for MS Outlook". The branch, master has been updated via e4ed7ecb3f153450599b53fcc42906839a57717b (commit) from 9218ee793a5b0d26244ba064ae66080db8f83cdd (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit e4ed7ecb3f153450599b53fcc42906839a57717b Author: Andre Heinecke Date: Tue Nov 15 13:06:06 2016 +0100 Install forms for formpath forms * forms/Makefile.am (cfg): Add new forms. diff --git a/forms/Makefile.am b/forms/Makefile.am index e51c006..d5d4fd1 100644 --- a/forms/Makefile.am +++ b/forms/Makefile.am @@ -13,7 +13,8 @@ icons = encr-l.ico encr-s.ico sign-l.ico sign-s.ico -cfg = gpgol.cfg gpgol-ms.cfg gpgol-cs.cfg +cfg = gpgol.cfg gpgol-ms.cfg gpgol-cs.cfg \ + gpgol-form-signed.cfg gpgol-form-encrypted.cfg dist_pkgdata_DATA = $(icons) $(cfg) ----------------------------------------------------------------------- Summary of changes: forms/Makefile.am | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) hooks/post-receive -- GnuPG extension for MS Outlook http://git.gnupg.org From cvs at cvs.gnupg.org Tue Nov 15 13:09:18 2016 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Tue, 15 Nov 2016 13:09:18 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.1.15-365-gf86b1a1 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via f86b1a15ad4bb7bcc1e9f7d209aabcb23641f7df (commit) from 809d67e74014cb563efd965744fd11f87bbae743 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit f86b1a15ad4bb7bcc1e9f7d209aabcb23641f7df Author: Werner Koch Date: Tue Nov 15 13:03:29 2016 +0100 gpg: New option --compliance. * g10/gpg.c (oCompliance): New. (opts): Add "--compliance". (parse_tofu_policy): Use a generic description string for "help". (parse_compliance_option): New. (main): Add option oCompliance. Factor out code for compliance setting to ... (set_compliance_option): new. Signed-off-by: Werner Koch diff --git a/doc/gpg.texi b/doc/gpg.texi index 6cc35e0..aff3aeb 100644 --- a/doc/gpg.texi +++ b/doc/gpg.texi @@ -2618,6 +2618,12 @@ this does is disable @option{--throw-keyids} and set @option{--escape-from-lines}. All algorithms are allowed except for the SHA224, SHA384, and SHA512 digests. + at item --compliance @var{string} + at opindex compliance +This option can be used instead of one of the options above. Valid +values for @var{string} are the above option names (without the double +dash) and possibly others as shown when using "help" for @var{value}. + @end table diff --git a/g10/gpg.c b/g10/gpg.c index 4e26672..b5fe490 100644 --- a/g10/gpg.c +++ b/g10/gpg.c @@ -224,6 +224,7 @@ enum cmd_and_opt_values oMarginalsNeeded, oMaxCertDepth, oLoadExtension, + oCompliance, oGnuPG, oRFC2440, oRFC4880, @@ -613,6 +614,7 @@ static ARGPARSE_OPTS opts[] = { ARGPARSE_s_s (oLoadExtension, "load-extension", "@"), /* Dummy. */ + ARGPARSE_s_s (oCompliance, "compliance", "@"), ARGPARSE_s_n (oGnuPG, "gnupg", "@"), ARGPARSE_s_n (oGnuPG, "no-pgp2", "@"), ARGPARSE_s_n (oGnuPG, "no-pgp6", "@"), @@ -2010,7 +2012,7 @@ parse_tofu_policy (const char *policystr) if (!ascii_strcasecmp (policystr, "help")) { - log_info (_("available TOFU policies:\n")); + log_info (_("valid values for option '%s':\n"), "--tofu-policy"); for (i=0; i < DIM (list); i++) log_info (" %s\n", list[i].keyword); g10_exit (1); @@ -2027,6 +2029,105 @@ parse_tofu_policy (const char *policystr) g10_exit (1); } + +/* Parse the value of --compliance. */ +static int +parse_compliance_option (const char *string) +{ + struct { const char *keyword; enum cmd_and_opt_values option; } list[] = { + { "gnupg", oGnuPG }, + { "openpgp", oOpenPGP }, + { "rfc4880bis", oRFC4880bis }, + { "rfc4880", oRFC4880 }, + { "rfc2440", oRFC2440 }, + { "pgp6", oPGP6 }, + { "pgp7", oPGP7 }, + { "pgp8", oPGP8 } + }; + int i; + + if (!ascii_strcasecmp (string, "help")) + { + log_info (_("valid values for option '%s':\n"), "--compliance"); + for (i=0; i < DIM (list); i++) + log_info (" %s\n", list[i].keyword); + g10_exit (1); + } + + for (i=0; i < DIM (list); i++) + if (!ascii_strcasecmp (string, list[i].keyword)) + return list[i].option; + + log_error (_("invalid value for option '%s'\n"), "--compliance"); + if (!opt.quiet) + log_info (_("(use \"help\" to list choices)\n")); + g10_exit (1); +} + + + +/* Helper to set compliance related options. This is a separte + * function so that it can also be used by the --compliance option + * parser. */ +static void +set_compliance_option (enum cmd_and_opt_values option) +{ + switch (option) + { + case oRFC4880bis: + opt.flags.rfc4880bis = 1; + /* fall through. */ + case oOpenPGP: + case oRFC4880: + /* This is effectively the same as RFC2440, but with + "--enable-dsa2 --no-rfc2440-text --escape-from-lines + --require-cross-certification". */ + opt.compliance = CO_RFC4880; + opt.flags.dsa2 = 1; + opt.flags.require_cross_cert = 1; + opt.rfc2440_text = 0; + opt.allow_non_selfsigned_uid = 1; + opt.allow_freeform_uid = 1; + opt.escape_from = 1; + opt.not_dash_escaped = 0; + opt.def_cipher_algo = 0; + opt.def_digest_algo = 0; + opt.cert_digest_algo = 0; + opt.compress_algo = -1; + opt.s2k_mode = 3; /* iterated+salted */ + opt.s2k_digest_algo = DIGEST_ALGO_SHA1; + opt.s2k_cipher_algo = CIPHER_ALGO_3DES; + break; + case oRFC2440: + opt.compliance = CO_RFC2440; + opt.flags.dsa2 = 0; + opt.rfc2440_text = 1; + opt.allow_non_selfsigned_uid = 1; + opt.allow_freeform_uid = 1; + opt.escape_from = 0; + opt.not_dash_escaped = 0; + opt.def_cipher_algo = 0; + opt.def_digest_algo = 0; + opt.cert_digest_algo = 0; + opt.compress_algo = -1; + opt.s2k_mode = 3; /* iterated+salted */ + opt.s2k_digest_algo = DIGEST_ALGO_SHA1; + opt.s2k_cipher_algo = CIPHER_ALGO_3DES; + break; + case oPGP6: opt.compliance = CO_PGP6; break; + case oPGP7: opt.compliance = CO_PGP7; break; + case oPGP8: opt.compliance = CO_PGP8; break; + case oGnuPG: opt.compliance = CO_GNUPG; break; + default: + BUG (); + } +} + + + + + + /* This function called to initialized a new control object. It is assumed that this object has been zeroed out before calling this function. */ @@ -2702,52 +2803,24 @@ main (int argc, char **argv) /* Dummy so that gpg 1.4 conf files can work. Should eventually be removed. */ break; + + case oCompliance: + set_compliance_option (parse_compliance_option (pargs.r.ret_str)); + break; + case oOpenPGP: + case oRFC2440: + case oRFC4880: case oRFC4880bis: - opt.flags.rfc4880bis = 1; - /* fall through. */ - case oOpenPGP: - case oRFC4880: - /* This is effectively the same as RFC2440, but with - "--enable-dsa2 --no-rfc2440-text --escape-from-lines - --require-cross-certification". */ - opt.compliance = CO_RFC4880; - opt.flags.dsa2 = 1; - opt.flags.require_cross_cert = 1; - opt.rfc2440_text = 0; - opt.allow_non_selfsigned_uid = 1; - opt.allow_freeform_uid = 1; - opt.escape_from = 1; - opt.not_dash_escaped = 0; - opt.def_cipher_algo = 0; - opt.def_digest_algo = 0; - opt.cert_digest_algo = 0; - opt.compress_algo = -1; - opt.s2k_mode = 3; /* iterated+salted */ - opt.s2k_digest_algo = DIGEST_ALGO_SHA1; - opt.s2k_cipher_algo = CIPHER_ALGO_3DES; - break; - case oRFC2440: - opt.compliance = CO_RFC2440; - opt.flags.dsa2 = 0; - opt.rfc2440_text = 1; - opt.allow_non_selfsigned_uid = 1; - opt.allow_freeform_uid = 1; - opt.escape_from = 0; - opt.not_dash_escaped = 0; - opt.def_cipher_algo = 0; - opt.def_digest_algo = 0; - opt.cert_digest_algo = 0; - opt.compress_algo = -1; - opt.s2k_mode = 3; /* iterated+salted */ - opt.s2k_digest_algo = DIGEST_ALGO_SHA1; - opt.s2k_cipher_algo = CIPHER_ALGO_3DES; - break; - case oPGP6: opt.compliance = CO_PGP6; break; - case oPGP7: opt.compliance = CO_PGP7; break; - case oPGP8: opt.compliance = CO_PGP8; break; - case oGnuPG: opt.compliance = CO_GNUPG; break; - case oRFC2440Text: opt.rfc2440_text=1; break; - case oNoRFC2440Text: opt.rfc2440_text=0; break; + case oPGP6: + case oPGP7: + case oPGP8: + case oGnuPG: + set_compliance_option (pargs.r_opt); + break; + + case oRFC2440Text: opt.rfc2440_text=1; break; + case oNoRFC2440Text: opt.rfc2440_text=0; break; + case oSetFilename: if(utf8_strings) opt.set_filename = pargs.r.ret_str; ----------------------------------------------------------------------- Summary of changes: doc/gpg.texi | 6 +++ g10/gpg.c | 165 ++++++++++++++++++++++++++++++++++++++++++----------------- 2 files changed, 125 insertions(+), 46 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Tue Nov 15 13:12:06 2016 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Tue, 15 Nov 2016 13:12:06 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.1.15-366-g1f7639e Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via 1f7639ebbe58af1b581b0be7809da9ee55482992 (commit) from f86b1a15ad4bb7bcc1e9f7d209aabcb23641f7df (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 1f7639ebbe58af1b581b0be7809da9ee55482992 Author: NIIBE Yutaka Date: Tue Nov 15 21:10:51 2016 +0900 g10: Fix memory leak. * g10/keyedit.c (menu_adduid): Don't copy 'sig'. -- Fixes-commit: 809d67e74014cb563efd965744fd11f87bbae743 Signed-off-by: NIIBE Yutaka diff --git a/g10/keyedit.c b/g10/keyedit.c index 4fba224..171afb7 100644 --- a/g10/keyedit.c +++ b/g10/keyedit.c @@ -4349,8 +4349,7 @@ menu_adduid (ctrl_t ctrl, kbnode_t pub_keyblock, add_kbnode (pub_keyblock, node); pkt = xmalloc_clear (sizeof *pkt); pkt->pkttype = PKT_SIGNATURE; - pkt->pkt.signature = copy_signature (NULL, sig); - free_seckey_enc (sig); + pkt->pkt.signature = sig; if (pub_where) insert_kbnode (node, new_kbnode (pkt), 0); else ----------------------------------------------------------------------- Summary of changes: g10/keyedit.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Tue Nov 15 13:16:05 2016 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Tue, 15 Nov 2016 13:16:05 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.1.15-367-g26c7c1d Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via 26c7c1d72c5f2acb3edb58d610c09a635c87bdbf (commit) from 1f7639ebbe58af1b581b0be7809da9ee55482992 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 26c7c1d72c5f2acb3edb58d610c09a635c87bdbf Author: Werner Koch Date: Tue Nov 15 13:13:14 2016 +0100 sm: New stub option --compliance. * sm/gpgsm.c (oCompliance): New. (opts): Add "--compliance". (main): Implement as stub. Signed-off-by: Werner Koch diff --git a/sm/gpgsm.c b/sm/gpgsm.c index d012465..c4fd1c2 100644 --- a/sm/gpgsm.c +++ b/sm/gpgsm.c @@ -133,6 +133,8 @@ enum cmd_and_opt_values { oNoArmor, oP12Charset, + oCompliance, + oDisableCRLChecks, oEnableCRLChecks, oDisableTrustedCertCRLCheck, @@ -361,6 +363,7 @@ static ARGPARSE_OPTS opts[] = { " --fingerprint [names] show fingerprints\n" )), /* Hidden options. */ + ARGPARSE_s_s (oCompliance, "compliance", "@"), ARGPARSE_s_n (oNoVerbose, "no-verbose", "@"), ARGPARSE_s_n (oEnableSpecialFilenames, "enable-special-filenames", "@"), ARGPARSE_s_n (oNoSecmemWarn, "no-secmem-warning", "@"), @@ -1445,6 +1448,10 @@ main ( int argc, char **argv) case oNoAutostart: opt.autostart = 0; break; + case oCompliance: + /* Dummy option for now. */ + break; + default: pargs.err = configfp? ARGPARSE_PRINT_WARNING:ARGPARSE_PRINT_ERROR; break; ----------------------------------------------------------------------- Summary of changes: sm/gpgsm.c | 7 +++++++ 1 file changed, 7 insertions(+) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Tue Nov 15 14:35:36 2016 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Tue, 15 Nov 2016 14:35:36 +0100 Subject: [git] GPGME - branch, master, updated. gpgme-1.7.1-46-gb2c07bd Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via b2c07bd47bd608afa5cc819b60a7b5bb8c9dd96a (commit) via 45abe6d142e314ba7099ad80b6365af171b06fec (commit) from ff3b72e2a3b5bf0e6037ee495f8ba6b28727a872 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit b2c07bd47bd608afa5cc819b60a7b5bb8c9dd96a Author: Andre Heinecke Date: Tue Nov 15 14:33:31 2016 +0100 qt, cpp: Add cmake config files for w32 * lang/cpp/src/GpgmeppConfig-w32.cmake.in.in lang/qt/src/QGpgmeConfig-w32.cmake.in.in: New. * lang/cpp/src/GpgmeppConfig.cmake.in.in, lang/qt/src/QGpgmeConfig.cmake.in.in: Remove libsuffix handling. * lang/cpp/src/Makefile.am, lang/qt/src/Makefile.am: Create / install w32 config files. * configure.ac: Configure them. -- To work with DLL's cmake needs to know about the implib and the final DLL. So the config files look different enough that it's better to use alternative files. diff --git a/configure.ac b/configure.ac index 4afad85..fe71c71 100644 --- a/configure.ac +++ b/configure.ac @@ -59,6 +59,9 @@ LIBGPGME_LT_CURRENT=27 LIBGPGME_LT_AGE=16 LIBGPGME_LT_REVISION=0 +# If there is an ABI break in gpgmepp or qgpgme also bump the +# version in IMPORTED_LOCATION in the GpgmeppConfig-w32.cmake.in.in + LIBGPGMEPP_LT_CURRENT=8 LIBGPGMEPP_LT_AGE=2 LIBGPGMEPP_LT_REVISION=0 @@ -873,10 +876,12 @@ AC_CONFIG_FILES(Makefile src/Makefile src/gpgme.h) AC_CONFIG_FILES(src/gpgme-config, chmod +x src/gpgme-config) AC_CONFIG_FILES(lang/cpp/Makefile lang/cpp/src/Makefile) +AC_CONFIG_FILES(lang/cpp/src/GpgmeppConfig-w32.cmake.in) AC_CONFIG_FILES(lang/cpp/src/GpgmeppConfig.cmake.in) AC_CONFIG_FILES(lang/cpp/src/GpgmeppConfigVersion.cmake) AC_CONFIG_FILES(lang/cpp/src/gpgmepp_version.h) AC_CONFIG_FILES(lang/qt/Makefile lang/qt/src/Makefile) +AC_CONFIG_FILES(lang/qt/src/QGpgmeConfig-w32.cmake.in) AC_CONFIG_FILES(lang/qt/src/QGpgmeConfig.cmake.in) AC_CONFIG_FILES(lang/qt/src/QGpgmeConfigVersion.cmake) AC_CONFIG_FILES(lang/qt/tests/Makefile) diff --git a/lang/cpp/src/GpgmeppConfig.cmake.in.in b/lang/cpp/src/GpgmeppConfig-w32.cmake.in.in similarity index 90% copy from lang/cpp/src/GpgmeppConfig.cmake.in.in copy to lang/cpp/src/GpgmeppConfig-w32.cmake.in.in index 73f5eaa..1282676 100644 --- a/lang/cpp/src/GpgmeppConfig.cmake.in.in +++ b/lang/cpp/src/GpgmeppConfig-w32.cmake.in.in @@ -62,10 +62,14 @@ unset(_expectedTargets) add_library(Gpgmepp SHARED IMPORTED) set_target_properties(Gpgmepp PROPERTIES + IMPORTED_IMPLIB "@resolved_libdir@/libgpgmepp.dll.a" INTERFACE_INCLUDE_DIRECTORIES "@resolved_includedir@/gpgme++;@resolved_includedir@" - INTERFACE_LINK_LIBRARIES "pthread;@resolved_libdir@/libgpgme at libsuffix@;@LIBASSUAN_LIBS@" - IMPORTED_LOCATION "@resolved_libdir@/libgpgmepp at libsuffix@" + INTERFACE_LINK_LIBRARIES "pthread;@resolved_libdir@/libgpgme.dll.a;@LIBASSUAN_LIBS@" + IMPORTED_LOCATION "@resolved_bindir@/libgpgmepp-6.dll" ) +list(APPEND _IMPORT_CHECK_TARGETS Gpgmepp ) +list(APPEND _IMPORT_CHECK_FILES_FOR_Gpgmepp "@resolved_libdir@/libgpgmepp.dll.a" "@resolved_bindir@/libgpgmepp-6.dll" ) + if(CMAKE_VERSION VERSION_LESS 2.8.12) message(FATAL_ERROR "This file relies on consumers using CMake 2.8.12 or greater.") diff --git a/lang/cpp/src/GpgmeppConfig.cmake.in.in b/lang/cpp/src/GpgmeppConfig.cmake.in.in index 73f5eaa..928d19f 100644 --- a/lang/cpp/src/GpgmeppConfig.cmake.in.in +++ b/lang/cpp/src/GpgmeppConfig.cmake.in.in @@ -64,7 +64,7 @@ add_library(Gpgmepp SHARED IMPORTED) set_target_properties(Gpgmepp PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "@resolved_includedir@/gpgme++;@resolved_includedir@" INTERFACE_LINK_LIBRARIES "pthread;@resolved_libdir@/libgpgme at libsuffix@;@LIBASSUAN_LIBS@" - IMPORTED_LOCATION "@resolved_libdir@/libgpgmepp at libsuffix@" + IMPORTED_LOCATION "@resolved_libdir@/libgpgmepp.so" ) if(CMAKE_VERSION VERSION_LESS 2.8.12) diff --git a/lang/cpp/src/Makefile.am b/lang/cpp/src/Makefile.am index 8953473..92ed784 100644 --- a/lang/cpp/src/Makefile.am +++ b/lang/cpp/src/Makefile.am @@ -19,7 +19,7 @@ # 02111-1307, USA EXTRA_DIST = GpgmeppConfig.cmake.in.in GpgmeppConfigVersion.cmake.in \ - gpgmepp_version.h.in + gpgmepp_version.h.in GpgmeppConfig-w32.cmake.in.in lib_LTLIBRARIES = libgpgmepp.la @@ -70,16 +70,15 @@ libgpgmepp_la_LDFLAGS = -no-undefined -version-info \ @LIBGPGMEPP_LT_CURRENT@:@LIBGPGMEPP_LT_REVISION@:@LIBGPGMEPP_LT_AGE@ if HAVE_W32_SYSTEM -libsuffix=.dll.a +GpgmeppConfig.cmake: GpgmeppConfig-w32.cmake.in + sed -e 's|[@]resolved_bindir@|$(bindir)|g' < "$<" | \ + sed -e 's|[@]resolved_libdir@|$(libdir)|g' | \ + sed -e 's|[@]resolved_includedir@|$(includedir)|g' > $@ else -libsuffix=.so -endif - GpgmeppConfig.cmake: GpgmeppConfig.cmake.in sed -e 's|[@]resolved_libdir@|$(libdir)|g' < "$<" | \ - sed -e 's|[@]libsuffix@|$(libsuffix)|g' | \ sed -e 's|[@]resolved_includedir@|$(includedir)|g' > $@ - +endif install-cmake-files: GpgmeppConfig.cmake GpgmeppConfigVersion.cmake -$(INSTALL) -d $(DESTDIR)$(libdir)/cmake/Gpgmepp $(INSTALL) -m 644 GpgmeppConfig.cmake \ diff --git a/lang/qt/src/Makefile.am b/lang/qt/src/Makefile.am index ead5c7f..87e2ec2 100644 --- a/lang/qt/src/Makefile.am +++ b/lang/qt/src/Makefile.am @@ -19,7 +19,8 @@ # 02111-1307, USA lib_LTLIBRARIES = libqgpgme.la EXTRA_DIST = QGpgmeConfig.cmake.in.in QGpgmeConfigVersion.cmake.in \ - gpgme_backend_debug.h qgpgme_version.h.in + gpgme_backend_debug.h qgpgme_version.h.in \ + QGpgmeConfig.cmake.in.in qgpgme_sources = \ dataprovider.cpp job.cpp multideletejob.cpp qgpgmeadduseridjob.cpp \ @@ -220,15 +221,15 @@ libqgpgme_la_LDFLAGS = -no-undefined -version-info \ @LIBQGPGME_LT_CURRENT@:@LIBQGPGME_LT_REVISION@:@LIBQGPGME_LT_AGE@ if HAVE_W32_SYSTEM -libsuffix=.dll.a +QGpgmeConfig.cmake: QGpgmeConfig-w32.cmake.in + sed -e 's|[@]resolved_bindir@|$(bindir)|g' < "$<" | \ + sed -e 's|[@]resolved_libdir@|$(libdir)|g' | \ + sed -e 's|[@]resolved_includedir@|$(includedir)|g' > $@ else -libsuffix=.so -endif - QGpgmeConfig.cmake: QGpgmeConfig.cmake.in sed -e 's|[@]resolved_libdir@|$(libdir)|g' < "$<" | \ - sed -e 's|[@]libsuffix@|$(libsuffix)|g' | \ sed -e 's|[@]resolved_includedir@|$(includedir)|g' > $@ +endif $(camelcase_headers): Makefile.am echo -n "#include \"qgpgme/" > "$@" diff --git a/lang/qt/src/QGpgmeConfig.cmake.in.in b/lang/qt/src/QGpgmeConfig-w32.cmake.in.in similarity index 92% copy from lang/qt/src/QGpgmeConfig.cmake.in.in copy to lang/qt/src/QGpgmeConfig-w32.cmake.in.in index a17a19f..b897805 100644 --- a/lang/qt/src/QGpgmeConfig.cmake.in.in +++ b/lang/qt/src/QGpgmeConfig-w32.cmake.in.in @@ -62,11 +62,15 @@ unset(_expectedTargets) add_library(QGpgme SHARED IMPORTED) set_target_properties(QGpgme PROPERTIES + IMPORTED_IMPLIB_RELEASE "@resolved_libdir@/libqgpgme.dll.a" INTERFACE_INCLUDE_DIRECTORIES "@resolved_includedir@/qgpgme;@resolved_includedir@" INTERFACE_LINK_LIBRARIES "Gpgmepp;Qt5::Core" - IMPORTED_LOCATION "@resolved_libdir@/libqgpgme at libsuffix@" + IMPORTED_LOCATION "@resolved_libdir@/libqgpgme-7.dll" ) +list(APPEND _IMPORT_CHECK_TARGETS QGgpme ) +list(APPEND _IMPORT_CHECK_FILES_FOR_Qgpgme "@resolved_libdir@/libqgpgme.dll.a" "@resolved_bindir@/libqgpgme-7.dll" ) + if(CMAKE_VERSION VERSION_LESS 2.8.12) message(FATAL_ERROR "This file relies on consumers using CMake 2.8.12 or greater.") endif() diff --git a/lang/qt/src/QGpgmeConfig.cmake.in.in b/lang/qt/src/QGpgmeConfig.cmake.in.in index a17a19f..88ed242 100644 --- a/lang/qt/src/QGpgmeConfig.cmake.in.in +++ b/lang/qt/src/QGpgmeConfig.cmake.in.in @@ -64,7 +64,7 @@ add_library(QGpgme SHARED IMPORTED) set_target_properties(QGpgme PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "@resolved_includedir@/qgpgme;@resolved_includedir@" INTERFACE_LINK_LIBRARIES "Gpgmepp;Qt5::Core" - IMPORTED_LOCATION "@resolved_libdir@/libqgpgme at libsuffix@" + IMPORTED_LOCATION "@resolved_libdir@/libqgpgme.so" ) if(CMAKE_VERSION VERSION_LESS 2.8.12) commit 45abe6d142e314ba7099ad80b6365af171b06fec Author: Andre Heinecke Date: Tue Nov 15 12:30:56 2016 +0100 qt: Use new style connect in th..mixin * lang/qt/src/threadedjobmixin.h (ThreadedJobMixin::lateInitialization): Use new style connect. diff --git a/lang/qt/src/threadedjobmixin.h b/lang/qt/src/threadedjobmixin.h index aef2723..32b23db 100644 --- a/lang/qt/src/threadedjobmixin.h +++ b/lang/qt/src/threadedjobmixin.h @@ -153,7 +153,8 @@ protected: void lateInitialization() { assert(m_ctx); - QObject::connect(&m_thread, SIGNAL(finished()), this, SLOT(slotFinished())); + QObject::connect(&m_thread, &QThread::finished, this, + &mixin_type::slotFinished); m_ctx->setProgressProvider(this); QGpgME::g_context_map.insert(this, m_ctx.get()); } ----------------------------------------------------------------------- Summary of changes: configure.ac | 5 +++++ ...meppConfig.cmake.in.in => GpgmeppConfig-w32.cmake.in.in} | 8 ++++++-- lang/cpp/src/GpgmeppConfig.cmake.in.in | 2 +- lang/cpp/src/Makefile.am | 13 ++++++------- lang/qt/src/Makefile.am | 13 +++++++------ ...GpgmeConfig.cmake.in.in => QGpgmeConfig-w32.cmake.in.in} | 6 +++++- lang/qt/src/QGpgmeConfig.cmake.in.in | 2 +- lang/qt/src/threadedjobmixin.h | 3 ++- 8 files changed, 33 insertions(+), 19 deletions(-) copy lang/cpp/src/{GpgmeppConfig.cmake.in.in => GpgmeppConfig-w32.cmake.in.in} (90%) copy lang/qt/src/{QGpgmeConfig.cmake.in.in => QGpgmeConfig-w32.cmake.in.in} (92%) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Tue Nov 15 15:18:36 2016 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Tue, 15 Nov 2016 15:18:36 +0100 Subject: [git] GpgOL - branch, master, updated. gpgol-1.4.0-172-g8ffd2b6 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG extension for MS Outlook". The branch, master has been updated via 8ffd2b6369cde93b75bad8adf8dcd89911862546 (commit) via 4cb8d9a2cb25981c60840b9e1d449bc6a575ace4 (commit) via 9fafa5c667742310cf65f0edd4b1d0ae881bb7a9 (commit) via 65d223f4960a560632ce04c4563589181171a496 (commit) from e4ed7ecb3f153450599b53fcc42906839a57717b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 8ffd2b6369cde93b75bad8adf8dcd89911862546 Author: Andre Heinecke Date: Tue Nov 15 15:16:59 2016 +0100 Use undecoded body if charset unkown or not found * src/mlang-charset.cpp (ansi_charset_to_utf8): Handle no charset. diff --git a/src/mlang-charset.cpp b/src/mlang-charset.cpp index 0e60492..016fb61 100644 --- a/src/mlang-charset.cpp +++ b/src/mlang-charset.cpp @@ -43,6 +43,13 @@ char *ansi_charset_to_utf8 (const char *charset, const char *input, wchar_t *buf; char *ret; + if (!charset || !strlen (charset)) + { + log_debug ("%s:%s: No charset returning plain.", + SRCNAME, __func__); + return strdup (input); + } + CoCreateInstance(CLSID_CMultiLanguage, NULL, CLSCTX_INPROC_SERVER, IID_IMultiLanguage, (void**)&multilang); @@ -73,7 +80,7 @@ char *ansi_charset_to_utf8 (const char *charset, const char *input, log_error ("%s:%s: Failed to find charset for: %s", SRCNAME, __func__, charset); gpgol_release (multilang); - return NULL; + return strdup(input); } enc = (mime_info.uiInternetEncoding == 0) ? mime_info.uiCodePage : mime_info.uiInternetEncoding; commit 4cb8d9a2cb25981c60840b9e1d449bc6a575ace4 Author: Andre Heinecke Date: Tue Nov 15 15:16:18 2016 +0100 Add some more error messages to finalize_message * src/mimemaker.cpp (finalize_message): Add some more errors. diff --git a/src/mimemaker.cpp b/src/mimemaker.cpp index 51c555b..a9e9aa6 100644 --- a/src/mimemaker.cpp +++ b/src/mimemaker.cpp @@ -1120,7 +1120,11 @@ finalize_message (LPMESSAGE message, mapi_attach_item_t *att_table, /* Set a special property so that we are later able to identify messages signed or encrypted by us. */ if (mapi_set_sig_status (message, "@")) - return -1; + { + log_error ("%s:%s: error setting sigstatus", + SRCNAME, __func__); + return -1; + } /* We also need to set the message class into our custom property. This override is at least required for encrypted @@ -1131,18 +1135,32 @@ finalize_message (LPMESSAGE message, mapi_attach_item_t *att_table, "IPM.Note.GpgOL.OpaqueEncrypted" : "IPM.Note.GpgOL.MultipartEncrypted") : "IPM.Note.GpgOL.MultipartSigned"))) - return -1; + { + log_error ("%s:%s: error setting gpgol msgclass", + SRCNAME, __func__); + return -1; + } /* Now delete all parts of the MAPI message except for the one attachment we just created. */ if (delete_all_attachments (message, att_table)) - return -1; + { + log_error ("%s:%s: error deleting attachments", + SRCNAME, __func__); + return -1; + } /* Remove the draft info so that we don't leak the information on whether the message has been signed etc. */ mapi_set_gpgol_draft_info (message, NULL); - return mapi_save_changes (message, KEEP_OPEN_READWRITE|FORCE_SAVE); + if (mapi_save_changes (message, KEEP_OPEN_READWRITE|FORCE_SAVE)) + { + log_error ("%s:%s: error saving changes.", + SRCNAME, __func__); + return -1; + } + return 0; } commit 9fafa5c667742310cf65f0edd4b1d0ae881bb7a9 Author: Andre Heinecke Date: Tue Nov 15 15:15:14 2016 +0100 Fix use after free in mimemaker * src/mimemaker.cpp (create_mapi_attachment), (finalize_message): Do not use GpgOLStr for assignments. diff --git a/src/mimemaker.cpp b/src/mimemaker.cpp index edb9980..51c555b 100644 --- a/src/mimemaker.cpp +++ b/src/mimemaker.cpp @@ -186,8 +186,9 @@ create_mapi_attachment (LPMESSAGE message, sink_t sink) /* We better insert a short filename. */ prop.ulPropTag = PR_ATTACH_FILENAME_A; - prop.Value.lpszA = GpgOLStr (MIMEATTACHFILENAME); + prop.Value.lpszA = strdup (MIMEATTACHFILENAME); hr = HrSetOneProp ((LPMAPIPROP)att, &prop); + xfree (prop.Value.lpszA); if (hr) { log_error ("%s:%s: can't set attach filename: hr=%#lx\n", @@ -1100,13 +1101,15 @@ finalize_message (LPMESSAGE message, mapi_attach_item_t *att_table, prop.ulPropTag = PR_MESSAGE_CLASS_A; if (encrypt) { - prop.Value.lpszA = GpgOLStr ("IPM.Note.InfoPathForm.GpgOL.SMIME.MultipartSigned"); + prop.Value.lpszA = strdup ("IPM.Note.InfoPathForm.GpgOL.SMIME.MultipartSigned"); } else { - prop.Value.lpszA = GpgOLStr ("IPM.Note.InfoPathForm.GpgOLS.SMIME.MultipartSigned"); + prop.Value.lpszA = strdup ("IPM.Note.InfoPathForm.GpgOLS.SMIME.MultipartSigned"); } + hr = message->SetProps(1, &prop, NULL); + xfree(prop.Value.lpszA); if (hr) { log_error ("%s:%s: error setting the message class: hr=%#lx\n", commit 65d223f4960a560632ce04c4563589181171a496 Author: Andre Heinecke Date: Tue Nov 15 15:12:54 2016 +0100 Fix use after free & double free * src/mail.cpp (Mail::get_signature_status): Do not append / free buf as it is no longer set in the above block. diff --git a/src/mail.cpp b/src/mail.cpp index ee864e3..8c5c478 100644 --- a/src/mail.cpp +++ b/src/mail.cpp @@ -1465,8 +1465,6 @@ Mail::get_signature_status() message += isOpenPGP ? _("Click here to search the key on the configured keyserver.") : _("Click here to search the certificate on the configured X509 keyserver."); } - message += buf; - xfree (buf); return message; } ----------------------------------------------------------------------- Summary of changes: src/mail.cpp | 2 -- src/mimemaker.cpp | 35 ++++++++++++++++++++++++++++------- src/mlang-charset.cpp | 9 ++++++++- 3 files changed, 36 insertions(+), 10 deletions(-) hooks/post-receive -- GnuPG extension for MS Outlook http://git.gnupg.org From cvs at cvs.gnupg.org Tue Nov 15 15:40:28 2016 From: cvs at cvs.gnupg.org (by Justus Winter) Date: Tue, 15 Nov 2016 15:40:28 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.1.15-371-g12834e8 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via 12834e84aca9d74800245f0f2f2e6b5123e76173 (commit) via d20107f6da094edd782947abb357abae5129a12c (commit) via 1d03cc77e1706f7da653153ad4b58c61e4fd2573 (commit) via bd60742925414e0ef2a497df827c1913ea211a44 (commit) from 26c7c1d72c5f2acb3edb58d610c09a635c87bdbf (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 12834e84aca9d74800245f0f2f2e6b5123e76173 Author: Justus Winter Date: Tue Nov 15 15:33:09 2016 +0100 g10: Optimize key iteration. * g10/getkey.c (get_best_pubkey_byname): Use the node returned by 'getkey_next' instead of doing another lookup. Signed-off-by: Justus Winter diff --git a/g10/getkey.c b/g10/getkey.c index 7bc5c88..5792302 100644 --- a/g10/getkey.c +++ b/g10/getkey.c @@ -1593,9 +1593,9 @@ get_best_pubkey_byname (ctrl_t ctrl, GETKEY_CTX *retctx, PKT_public_key *pk, { /* Rank results and return only the most relevant key. */ struct pubkey_cmp_cookie best = { 0 }, new; - while (getkey_next (ctx, &new.key, NULL) == 0) + KBNODE new_keyblock; + while (getkey_next (ctx, &new.key, &new_keyblock) == 0) { - KBNODE new_keyblock = get_pubkeyblock (pk_keyid (&new.key)); int diff = pubkey_cmp (ctrl, name, &best, &new, new_keyblock); release_kbnode (new_keyblock); if (diff < 0) commit d20107f6da094edd782947abb357abae5129a12c Author: Justus Winter Date: Tue Nov 15 15:11:39 2016 +0100 g10: Fix memory leak. * g10/getkey.c (finish_lookup): Clarify that we do not return a reference. (lookup): Clarify the relation between RET_KEYBLOCK and RET_FOUND_KEY. Check arguments. Actually release the node if it is not returned. Signed-off-by: Justus Winter diff --git a/g10/getkey.c b/g10/getkey.c index 6232363..7bc5c88 100644 --- a/g10/getkey.c +++ b/g10/getkey.c @@ -3341,6 +3341,9 @@ merge_selfsigs (KBNODE keyblock) * in CTX. If so, return the node of an appropriate key or subkey. * Otherwise, return NULL if there was no appropriate key. * + * Note that we do not return a reference, i.e. the result must not be + * freed using 'release_kbnode'. + * * In case the primary key is not required, select a suitable subkey. * We need the primary key if PUBKEY_USAGE_CERT is set in REQ_USAGE or * we are in PGP6 or PGP7 mode and PUBKEY_USAGE_SIG is set in @@ -3660,7 +3663,12 @@ print_status_key_considered (kbnode_t keyblock, unsigned int flags) all of the self-signed data into the keys, subkeys and user id packets (see the merge_selfsigs for details). - On success the key's keyblock is stored at *RET_KEYBLOCK. */ + On success the key's keyblock is stored at *RET_KEYBLOCK, and the + specific subkey is stored at *RET_FOUND_KEY. Note that we do not + return a reference in *RET_FOUND_KEY, i.e. the result must not be + freed using 'release_kbnode', and it is only valid until + *RET_KEYBLOCK is deallocated. Therefore, if RET_FOUND_KEY is not + NULL, then RET_KEYBLOCK must not be NULL. */ static int lookup (getkey_ctx_t ctx, kbnode_t *ret_keyblock, kbnode_t *ret_found_key, int want_secret) @@ -3671,6 +3679,7 @@ lookup (getkey_ctx_t ctx, kbnode_t *ret_keyblock, kbnode_t *ret_found_key, KBNODE found_key = NULL; unsigned int infoflags; + log_assert (ret_found_key == NULL || ret_keyblock != NULL); if (ret_keyblock) *ret_keyblock = NULL; @@ -3732,8 +3741,10 @@ lookup (getkey_ctx_t ctx, kbnode_t *ret_keyblock, kbnode_t *ret_found_key, if (!rc) { if (ret_keyblock) - *ret_keyblock = keyblock; /* Return the keyblock. */ - keyblock = NULL; + { + *ret_keyblock = keyblock; /* Return the keyblock. */ + keyblock = NULL; + } } else if (gpg_err_code (rc) == GPG_ERR_NOT_FOUND && no_suitable_key) rc = want_secret? GPG_ERR_UNUSABLE_SECKEY : GPG_ERR_UNUSABLE_PUBKEY; commit 1d03cc77e1706f7da653153ad4b58c61e4fd2573 Author: Justus Winter Date: Tue Nov 15 15:08:54 2016 +0100 g10: Fix iteration over getkey results. * g10/getkey.c (getkey_next): Fix invocation of 'lookup'. If we want to use RET_FOUND_KEY, RET_KEYBLOCK must be valid. Fixes-commit: 8ea72a776a88f3c851e812d258355be80caa1bc1 Signed-off-by: Justus Winter diff --git a/g10/getkey.c b/g10/getkey.c index bf197b2..6232363 100644 --- a/g10/getkey.c +++ b/g10/getkey.c @@ -2167,6 +2167,7 @@ gpg_error_t getkey_next (getkey_ctx_t ctx, PKT_public_key *pk, kbnode_t *ret_keyblock) { int rc; /* Fixme: Make sure this is proper gpg_error */ + KBNODE keyblock = NULL; KBNODE found_key = NULL; /* We need to disable the caching so that for an exact key search we @@ -2175,11 +2176,18 @@ getkey_next (getkey_ctx_t ctx, PKT_public_key *pk, kbnode_t *ret_keyblock) used without respecting the current file pointer! */ keydb_disable_caching (ctx->kr_handle); + /* FOUND_KEY is only valid as long as RET_KEYBLOCK is. If the + * caller wants PK, but not RET_KEYBLOCK, we need hand in our own + * keyblock. */ + if (pk && ret_keyblock == NULL) + ret_keyblock = &keyblock; + rc = lookup (ctx, ret_keyblock, &found_key, ctx->want_secret); if (!rc && pk) { log_assert (found_key); pk_from_block (pk, NULL, found_key); + release_kbnode (keyblock); } return rc; commit bd60742925414e0ef2a497df827c1913ea211a44 Author: Justus Winter Date: Tue Nov 15 15:06:28 2016 +0100 g10: Fix use-after-free. * g10/getkey.c (pubkey_cmp): Make a copy of the user id. (get_best_pubkey_byname): Free the user ids. Signed-off-by: Justus Winter diff --git a/g10/getkey.c b/g10/getkey.c index 59625e7..bf197b2 100644 --- a/g10/getkey.c +++ b/g10/getkey.c @@ -1541,7 +1541,7 @@ pubkey_cmp (ctrl_t ctrl, const char *name, struct pubkey_cmp_cookie *old, if (! match) continue; - new->uid = uid; + new->uid = scopy_user_id (uid); new->validity = get_validity (ctrl, &new->key, uid, NULL, 0) & TRUST_MASK; new->valid = 1; @@ -1602,21 +1602,29 @@ get_best_pubkey_byname (ctrl_t ctrl, GETKEY_CTX *retctx, PKT_public_key *pk, { /* New key is better. */ release_public_key_parts (&best.key); + if (best.uid) + free_user_id (best.uid); best = new; } else if (diff > 0) { /* Old key is better. */ release_public_key_parts (&new.key); + if (new.uid) + free_user_id (new.uid); } else { /* A tie. Keep the old key. */ release_public_key_parts (&new.key); + if (new.uid) + free_user_id (new.uid); } } getkey_end (ctx); ctx = NULL; + if (best.uid) + free_user_id (best.uid); if (best.valid) { ----------------------------------------------------------------------- Summary of changes: g10/getkey.c | 39 +++++++++++++++++++++++++++++++++------ 1 file changed, 33 insertions(+), 6 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Tue Nov 15 16:31:43 2016 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Tue, 15 Nov 2016 16:31:43 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.1.15-373-g4bd12b5 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via 4bd12b571e661c7f208cf8a96c32bbacfc8b2598 (commit) via 8ea3b4c4102dc67ed83d4419b7171e422fc01047 (commit) from 12834e84aca9d74800245f0f2f2e6b5123e76173 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 4bd12b571e661c7f208cf8a96c32bbacfc8b2598 Author: Werner Koch Date: Tue Nov 15 16:29:08 2016 +0100 doc: Add comment to make clear that KBNODE is deprecated. -- kbnode_t has replaced KBNODE for new code years ago, but that should be documented. No bulk changes please to keep git blame easy to read. Signed-off-by: Werner Koch diff --git a/g10/gpg.h b/g10/gpg.h index 8bc4c08..3bf023b 100644 --- a/g10/gpg.h +++ b/g10/gpg.h @@ -60,7 +60,7 @@ struct dirmngr_local_s; typedef struct dirmngr_local_s *dirmngr_local_t; /* Object used to describe a keyblok node. */ -typedef struct kbnode_struct *KBNODE; +typedef struct kbnode_struct *KBNODE; /* Deprecated use kbnode_t. */ typedef struct kbnode_struct *kbnode_t; /* TOFU database meta object. */ commit 8ea3b4c4102dc67ed83d4419b7171e422fc01047 Author: Werner Koch Date: Tue Nov 15 16:23:41 2016 +0100 gpg: Use usual free semantics for packet structure free functions. * g10/free-packet.c (free_attributes): Turn function into a nop for a NULL arg. (free_user_id): Ditto. (free_compressed): Ditto. (free_encrypted): Ditto. (free_plaintext): Ditto. (release_public_key_parts): Avoid extra check for NULL. * g10/getkey.c (get_best_pubkey_byname): Ditto. -- This change avoid surprises because it is common that function named like free and taking a pointer also have similar semantics. Signed-off-by: Werner Koch diff --git a/g10/free-packet.c b/g10/free-packet.c index 2ca1d3b..6038d26 100644 --- a/g10/free-packet.c +++ b/g10/free-packet.c @@ -114,11 +114,8 @@ release_public_key_parts (PKT_public_key *pk) xfree (pk->prefs); pk->prefs = NULL; } - if (pk->user_id) - { - free_user_id (pk->user_id); - pk->user_id = NULL; - } + free_user_id (pk->user_id); + pk->user_id = NULL; if (pk->revkey) { xfree(pk->revkey); @@ -293,6 +290,9 @@ free_comment( PKT_comment *rem ) void free_attributes(PKT_user_id *uid) { + if (!uid) + return; + xfree(uid->attribs); xfree(uid->attrib_data); @@ -304,70 +304,94 @@ free_attributes(PKT_user_id *uid) void free_user_id (PKT_user_id *uid) { - log_assert (uid->ref > 0); - if (--uid->ref) - return; - - free_attributes(uid); - xfree (uid->prefs); - xfree (uid->namehash); - xfree (uid->mbox); - xfree (uid); + if (!uid) + return; + + log_assert (uid->ref > 0); + if (--uid->ref) + return; + + free_attributes(uid); + xfree (uid->prefs); + xfree (uid->namehash); + xfree (uid->mbox); + xfree (uid); } void free_compressed( PKT_compressed *zd ) { - if( zd->buf ) { /* have to skip some bytes */ - /* don't have any information about the length, so - * we assume this is the last packet */ - while( iobuf_read( zd->buf, NULL, 1<<30 ) != -1 ) - ; + if (!zd) + return; + + if (zd->buf) + { + /* We need to skip some bytes. Because don't have any + * information about the length, so we assume this is the last + * packet */ + while (iobuf_read( zd->buf, NULL, 1<<30 ) != -1) + ; } - xfree(zd); + xfree(zd); } void free_encrypted( PKT_encrypted *ed ) { - if( ed->buf ) { /* have to skip some bytes */ - if( ed->is_partial ) { - while( iobuf_read( ed->buf, NULL, 1<<30 ) != -1 ) - ; + if (!ed) + return; + + if (ed->buf) + { + /* We need to skip some bytes. */ + if (ed->is_partial) + { + while (iobuf_read( ed->buf, NULL, 1<<30 ) != -1) + ; } - else { - while( ed->len ) { /* skip the packet */ - int n = iobuf_read( ed->buf, NULL, ed->len ); - if( n == -1 ) - ed->len = 0; - else - ed->len -= n; - } + else + { + while (ed->len) + { + /* Skip the packet. */ + int n = iobuf_read( ed->buf, NULL, ed->len ); + if (n == -1) + ed->len = 0; + else + ed->len -= n; + } } } - xfree(ed); + xfree (ed); } void free_plaintext( PKT_plaintext *pt ) { - if( pt->buf ) { /* have to skip some bytes */ - if( pt->is_partial ) { - while( iobuf_read( pt->buf, NULL, 1<<30 ) != -1 ) - ; - } - else { - while( pt->len ) { /* skip the packet */ - int n = iobuf_read( pt->buf, NULL, pt->len ); - if( n == -1 ) - pt->len = 0; - else - pt->len -= n; - } + if (!pt) + return; + + if (pt->buf) + { /* We need to skip some bytes. */ + if (pt->is_partial) + { + while (iobuf_read( pt->buf, NULL, 1<<30 ) != -1) + ; + } + else + { + while( pt->len ) + { /* Skip the packet. */ + int n = iobuf_read( pt->buf, NULL, pt->len ); + if (n == -1) + pt->len = 0; + else + pt->len -= n; + } } } - xfree(pt); + xfree (pt); } /**************** diff --git a/g10/getkey.c b/g10/getkey.c index 5792302..f0e33c5 100644 --- a/g10/getkey.c +++ b/g10/getkey.c @@ -1602,29 +1602,25 @@ get_best_pubkey_byname (ctrl_t ctrl, GETKEY_CTX *retctx, PKT_public_key *pk, { /* New key is better. */ release_public_key_parts (&best.key); - if (best.uid) - free_user_id (best.uid); + free_user_id (best.uid); best = new; } else if (diff > 0) { /* Old key is better. */ release_public_key_parts (&new.key); - if (new.uid) - free_user_id (new.uid); + free_user_id (new.uid); } else { /* A tie. Keep the old key. */ release_public_key_parts (&new.key); - if (new.uid) - free_user_id (new.uid); + free_user_id (new.uid); } } getkey_end (ctx); ctx = NULL; - if (best.uid) - free_user_id (best.uid); + free_user_id (best.uid); if (best.valid) { @@ -3604,8 +3600,7 @@ finish_lookup (kbnode_t keyblock, unsigned int req_usage, int want_exact, if (latest_key) { pk = latest_key->pkt->pkt.public_key; - if (pk->user_id) - free_user_id (pk->user_id); + free_user_id (pk->user_id); pk->user_id = scopy_user_id (foundu); } ----------------------------------------------------------------------- Summary of changes: g10/free-packet.c | 118 ++++++++++++++++++++++++++++++++---------------------- g10/getkey.c | 15 +++---- g10/gpg.h | 2 +- 3 files changed, 77 insertions(+), 58 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Tue Nov 15 17:52:43 2016 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Tue, 15 Nov 2016 17:52:43 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.1.15-374-gb47603a Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via b47603a0ac24902c5bb000f8ef27cfb99aceeb81 (commit) from 4bd12b571e661c7f208cf8a96c32bbacfc8b2598 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit b47603a0ac24902c5bb000f8ef27cfb99aceeb81 Author: Werner Koch Date: Tue Nov 15 17:50:03 2016 +0100 gpg: Add new compliance mode "de-vs". * g10/options.h (CO_DE_VS): New. (GNUPG): Also allow CO_DE_VS. * g10/gpg.c (oDE_VS): New. (parse_compliance_option): Add "de-vs". (set_compliance_option): Set "de-vs". * g10/misc.c (compliance_option_string): Return a description string. (compliance_failure): Ditto. * g10/keygen.c (ask_algo): Take care of CO_DE_VS. (get_keysize_range): Ditto. (ask_curve): Add new field to CURVES and trun flags into bit flags. Allow only Brainpool curves in CO_DE_VS mode. -- As of now this compliance mode only restricts the set of algorithms and curves which can be created. Signed-off-by: Werner Koch diff --git a/g10/gpg.c b/g10/gpg.c index b5fe490..495356c 100644 --- a/g10/gpg.c +++ b/g10/gpg.c @@ -233,6 +233,7 @@ enum cmd_and_opt_values oPGP6, oPGP7, oPGP8, + oDE_VS, oRFC2440Text, oNoRFC2440Text, oCipherAlgo, @@ -2042,7 +2043,8 @@ parse_compliance_option (const char *string) { "rfc2440", oRFC2440 }, { "pgp6", oPGP6 }, { "pgp7", oPGP7 }, - { "pgp8", oPGP8 } + { "pgp8", oPGP8 }, + { "de-vs", oDE_VS } }; int i; @@ -2118,6 +2120,13 @@ set_compliance_option (enum cmd_and_opt_values option) case oPGP7: opt.compliance = CO_PGP7; break; case oPGP8: opt.compliance = CO_PGP8; break; case oGnuPG: opt.compliance = CO_GNUPG; break; + + case oDE_VS: + set_compliance_option (oOpenPGP); + opt.compliance = CO_DE_VS; + /* Fixme: Change other options. */ + break; + default: BUG (); } diff --git a/g10/keygen.c b/g10/keygen.c index b424c98..d249556 100644 --- a/g10/keygen.c +++ b/g10/keygen.c @@ -1885,24 +1885,27 @@ ask_algo (ctrl_t ctrl, int addmode, int *r_subkey_algo, unsigned int *r_usage, tty_printf (_(" (%d) RSA and RSA (default)\n"), 1 ); #endif - if (!addmode) + if (!addmode && opt.compliance != CO_DE_VS) tty_printf (_(" (%d) DSA and Elgamal\n"), 2 ); - tty_printf (_(" (%d) DSA (sign only)\n"), 3 ); + if (opt.compliance != CO_DE_VS) + tty_printf (_(" (%d) DSA (sign only)\n"), 3 ); #if GPG_USE_RSA tty_printf (_(" (%d) RSA (sign only)\n"), 4 ); #endif if (addmode) { - tty_printf (_(" (%d) Elgamal (encrypt only)\n"), 5 ); + if (opt.compliance != CO_DE_VS) + tty_printf (_(" (%d) Elgamal (encrypt only)\n"), 5 ); #if GPG_USE_RSA tty_printf (_(" (%d) RSA (encrypt only)\n"), 6 ); #endif } if (opt.expert) { - tty_printf (_(" (%d) DSA (set your own capabilities)\n"), 7 ); + if (opt.compliance != CO_DE_VS) + tty_printf (_(" (%d) DSA (set your own capabilities)\n"), 7 ); #if GPG_USE_RSA tty_printf (_(" (%d) RSA (set your own capabilities)\n"), 8 ); #endif @@ -1930,7 +1933,13 @@ ask_algo (ctrl_t ctrl, int addmode, int *r_subkey_algo, unsigned int *r_usage, answer = cpr_get ("keygen.algo", _("Your selection? ")); cpr_kill_prompt (); algo = *answer? atoi (answer) : 1; - if ((algo == 1 || !strcmp (answer, "rsa+rsa")) && !addmode) + + if (opt.compliance == CO_DE_VS + && (algo == 2 || algo == 3 || algo == 5 || algo == 7)) + { + tty_printf (_("Invalid selection.\n")); + } + else if ((algo == 1 || !strcmp (answer, "rsa+rsa")) && !addmode) { algo = PUBKEY_ALGO_RSA; *r_subkey_algo = PUBKEY_ALGO_RSA; @@ -2051,7 +2060,7 @@ static void get_keysize_range (int algo, unsigned int *min, unsigned int *def, unsigned int *max) { - *min = 1024; + *min = opt.compliance == CO_DE_VS ? 2048: 1024; *def = DEFAULT_STD_KEYSIZE; *max = 4096; @@ -2197,26 +2206,27 @@ ask_curve (int *algo, int *subkey_algo) numbers in the menu regardless on how Gpg was configured. */ struct { const char *name; - int available; /* Available in Libycrypt (runtime checked) */ - int expert_only; const char* eddsa_curve; /* Corresponding EdDSA curve. */ const char *pretty_name; - int supported; /* Supported by gpg. */ + unsigned int supported : 1; /* Supported by gpg. */ + unsigned int de_vs : 1; /* Allowed in CO_DE_VS. */ + unsigned int expert_only : 1; /* Only with --expert */ + unsigned int available : 1; /* Available in Libycrypt (runtime checked) */ } curves[] = { #if GPG_USE_ECDSA || GPG_USE_ECDH # define MY_USE_ECDSADH 1 #else # define MY_USE_ECDSADH 0 #endif - { "Curve25519", 0, 0, "Ed25519", "Curve 25519", GPG_USE_EDDSA }, - { "Curve448", 0, 1, "Ed448", "Curve 448", 0/*reserved*/ }, - { "NIST P-256", 0, 1, NULL, NULL, MY_USE_ECDSADH }, - { "NIST P-384", 0, 0, NULL, NULL, MY_USE_ECDSADH }, - { "NIST P-521", 0, 1, NULL, NULL, MY_USE_ECDSADH }, - { "brainpoolP256r1", 0, 1, NULL, "Brainpool P-256", MY_USE_ECDSADH }, - { "brainpoolP384r1", 0, 1, NULL, "Brainpool P-384", MY_USE_ECDSADH }, - { "brainpoolP512r1", 0, 1, NULL, "Brainpool P-512", MY_USE_ECDSADH }, - { "secp256k1", 0, 1, NULL, NULL, MY_USE_ECDSADH }, + { "Curve25519", "Ed25519", "Curve 25519", !!GPG_USE_EDDSA, 0, 0, 0 }, + { "Curve448", "Ed448", "Curve 448", 0/*reserved*/ , 0, 1, 0 }, + { "NIST P-256", NULL, NULL, MY_USE_ECDSADH, 0, 1, 0 }, + { "NIST P-384", NULL, NULL, MY_USE_ECDSADH, 0, 0, 0 }, + { "NIST P-521", NULL, NULL, MY_USE_ECDSADH, 0, 1, 0 }, + { "brainpoolP256r1", NULL, "Brainpool P-256", MY_USE_ECDSADH, 1, 1, 0 }, + { "brainpoolP384r1", NULL, "Brainpool P-384", MY_USE_ECDSADH, 1, 1, 0 }, + { "brainpoolP512r1", NULL, "Brainpool P-512", MY_USE_ECDSADH, 1, 1, 0 }, + { "secp256k1", NULL, NULL, MY_USE_ECDSADH, 0, 1, 0 }, }; #undef MY_USE_ECDSADH int idx; @@ -2234,7 +2244,13 @@ ask_curve (int *algo, int *subkey_algo) curves[idx].available = 0; if (!curves[idx].supported) continue; - if (!opt.expert && curves[idx].expert_only) + + if (opt.compliance==CO_DE_VS) + { + if (!curves[idx].de_vs) + continue; /* Not allowed. */ + } + else if (!opt.expert && curves[idx].expert_only) continue; /* We need to switch from the ECDH name of the curve to the diff --git a/g10/misc.c b/g10/misc.c index 4f9ece3..4b9ad99 100644 --- a/g10/misc.c +++ b/g10/misc.c @@ -1252,6 +1252,7 @@ compliance_option_string(void) case CO_PGP6: return "--pgp6"; case CO_PGP7: return "--pgp7"; case CO_PGP8: return "--pgp8"; + case CO_DE_VS: return "--compliance=de-vs"; } return ver; @@ -1287,6 +1288,10 @@ compliance_failure(void) case CO_PGP8: ver="PGP 8.x"; break; + + case CO_DE_VS: + ver="DE-VS applications"; + break; } log_info(_("this message may not be usable by %s\n"),ver); diff --git a/g10/options.h b/g10/options.h index 19b855a..8ed2cdb 100644 --- a/g10/options.h +++ b/g10/options.h @@ -140,7 +140,7 @@ struct enum { CO_GNUPG, CO_RFC4880, CO_RFC2440, - CO_PGP6, CO_PGP7, CO_PGP8 + CO_PGP6, CO_PGP7, CO_PGP8, CO_DE_VS } compliance; enum { @@ -327,7 +327,7 @@ EXTERN_UNLESS_MAIN_MODULE int memory_stat_debug_mode; /* Compatibility flags. */ -#define GNUPG (opt.compliance==CO_GNUPG) +#define GNUPG (opt.compliance==CO_GNUPG || opt.compliance==CO_DE_VS) #define RFC2440 (opt.compliance==CO_RFC2440) #define RFC4880 (opt.compliance==CO_RFC4880) #define PGP6 (opt.compliance==CO_PGP6) ----------------------------------------------------------------------- Summary of changes: g10/gpg.c | 11 ++++++++++- g10/keygen.c | 54 +++++++++++++++++++++++++++++++++++------------------- g10/misc.c | 5 +++++ g10/options.h | 4 ++-- 4 files changed, 52 insertions(+), 22 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Tue Nov 15 20:22:12 2016 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Tue, 15 Nov 2016 20:22:12 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.1.15-375-g500e594 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via 500e594c2da530e69a63fc1a40d173458682fa0e (commit) from b47603a0ac24902c5bb000f8ef27cfb99aceeb81 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 500e594c2da530e69a63fc1a40d173458682fa0e Author: Werner Koch Date: Tue Nov 15 20:11:40 2016 +0100 gpgv: New option --enable-special-filenames. * g10/gpgv.c (oEnableSpecialFilenames): New. (opts): Add option --enable-special-filenames. (main): Implement that option. -- This is the same option we have in gpg. It allows to use commands like gpgv --enable-special-filenames -- '-&3' - diff --git a/doc/gpgv.texi b/doc/gpgv.texi index 9a74c27..0608a3f 100644 --- a/doc/gpgv.texi +++ b/doc/gpgv.texi @@ -128,6 +128,12 @@ supplied multiple times if multiple algorithms should be considered weak. MD5 is always considered weak, and does not need to be listed explicitly. + at item --enable-special-filenames + at opindex enable-special-filenames +This option enables a mode in which filenames of the form + at file{-&n}, where n is a non-negative decimal number, +refer to the file descriptor n and not to a file with that name. + @end table @mansect return value diff --git a/g10/gpgv.c b/g10/gpgv.c index d25b6be..d9f2898 100644 --- a/g10/gpgv.c +++ b/g10/gpgv.c @@ -63,6 +63,7 @@ enum cmd_and_opt_values { oLoggerFD, oHomedir, oWeakDigest, + oEnableSpecialFilenames, aTest }; @@ -83,6 +84,7 @@ static ARGPARSE_OPTS opts[] = { ARGPARSE_s_s (oHomedir, "homedir", "@"), ARGPARSE_s_s (oWeakDigest, "weak-digest", N_("|ALGO|reject signatures made with ALGO")), + ARGPARSE_s_n (oEnableSpecialFilenames, "enable-special-filenames", "@"), ARGPARSE_end () }; @@ -201,6 +203,9 @@ main( int argc, char **argv ) additional_weak_digest(pargs.r.ret_str); break; case oIgnoreTimeConflict: opt.ignore_time_conflict = 1; break; + case oEnableSpecialFilenames: + iobuf_enable_special_filenames (1); + break; default : pargs.err = ARGPARSE_PRINT_ERROR; break; } } ----------------------------------------------------------------------- Summary of changes: doc/gpgv.texi | 6 ++++++ g10/gpgv.c | 5 +++++ 2 files changed, 11 insertions(+) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Wed Nov 16 09:05:41 2016 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Wed, 16 Nov 2016 09:05:41 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.1.15-376-g43bfaf2 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via 43bfaf2c5417ede621c0a07721952ea549a7a139 (commit) from 500e594c2da530e69a63fc1a40d173458682fa0e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 43bfaf2c5417ede621c0a07721952ea549a7a139 Author: Werner Koch Date: Wed Nov 16 09:02:53 2016 +0100 gpg: New option --override-session-key-fd. * g10/gpg.c (oOverrideSessionKeyFD): New. (opts): Add option --override-session-key-fd. (main): Handle that option. (read_sessionkey_from_fd): New. -- The override-session-key feature was designed to mitigate the effect of the British RIP act by allowing to keep the private key private and hand out only a session key. For that use case the leaking of the session key would not be a problem. However there are other use cases, for example fast re-decryption after an initial decryption, which would benefit from concealing the session key from other users. Signed-off-by: Werner Koch diff --git a/doc/gpg.texi b/doc/gpg.texi index aff3aeb..c69e512 100644 --- a/doc/gpg.texi +++ b/doc/gpg.texi @@ -3118,13 +3118,17 @@ inappropriate plaintext so they can take action against the offending user. @item --override-session-key @code{string} + at itemx --override-session-key-fd @code{fd} @opindex override-session-key -Don't use the public key but the session key @code{string}. The format -of this string is the same as the one printed by - at option{--show-session-key}. This option is normally not used but comes -handy in case someone forces you to reveal the content of an encrypted -message; using this option you can do this without handing out the -secret key. +Don't use the public key but the session key @code{string} respective +the session key taken from the first line read from file descriptor + at code{fd}. The format of this string is the same as the one printed +by @option{--show-session-key}. This option is normally not used but +comes handy in case someone forces you to reveal the content of an +encrypted message; using this option you can do this without handing +out the secret key. Note that using @option{--override-session-key} +may reveal the session key to all local users via the global process +table. @item --ask-sig-expire @itemx --no-ask-sig-expire diff --git a/g10/gpg.c b/g10/gpg.c index 495356c..c54facb 100644 --- a/g10/gpg.c +++ b/g10/gpg.c @@ -343,6 +343,7 @@ enum cmd_and_opt_values oIgnoreMDCError, oShowSessionKey, oOverrideSessionKey, + oOverrideSessionKeyFD, oNoRandomSeedFile, oAutoKeyRetrieve, oNoAutoKeyRetrieve, @@ -776,6 +777,7 @@ static ARGPARSE_OPTS opts[] = { ARGPARSE_s_n (oIgnoreMDCError, "ignore-mdc-error", "@"), ARGPARSE_s_n (oShowSessionKey, "show-session-key", "@"), ARGPARSE_s_s (oOverrideSessionKey, "override-session-key", "@"), + ARGPARSE_s_i (oOverrideSessionKeyFD, "override-session-key-fd", "@"), ARGPARSE_s_n (oNoRandomSeedFile, "no-random-seed-file", "@"), ARGPARSE_s_n (oAutoKeyRetrieve, "auto-key-retrieve", "@"), ARGPARSE_s_n (oNoAutoKeyRetrieve, "no-auto-key-retrieve", "@"), @@ -919,6 +921,7 @@ static void add_notation_data( const char *string, int which ); static void add_policy_url( const char *string, int which ); static void add_keyserver_url( const char *string, int which ); static void emergency_cleanup (void); +static void read_sessionkey_from_fd (int fd); static char * @@ -2262,6 +2265,7 @@ main (int argc, char **argv) int eyes_only=0; int multifile=0; int pwfd = -1; + int ovrseskeyfd = -1; int fpr_maybe_cmd = 0; /* --fingerprint maybe a command. */ int any_explicit_recipient = 0; int require_secmem = 0; @@ -3289,6 +3293,9 @@ main (int argc, char **argv) case oOverrideSessionKey: opt.override_session_key = pargs.r.ret_str; break; + case oOverrideSessionKeyFD: + ovrseskeyfd = translate_sys2libc_fd_int (pargs.r.ret_int, 0); + break; case oMergeOnly: deprecated_warning(configname,configlineno,"--merge-only", "--import-options ","merge-only"); @@ -3856,8 +3863,11 @@ main (int argc, char **argv) g10_exit(0); - if( pwfd != -1 ) /* Read the passphrase now. */ - read_passphrase_from_fd( pwfd ); + if (pwfd != -1) /* Read the passphrase now. */ + read_passphrase_from_fd (pwfd); + + if (ovrseskeyfd != -1 ) /* Read the sessionkey now. */ + read_sessionkey_from_fd (ovrseskeyfd); fname = argc? *argv : NULL; @@ -5212,3 +5222,34 @@ add_keyserver_url( const char *string, int which ) if(critical) sl->flags |= 1; } + + +static void +read_sessionkey_from_fd (int fd) +{ + int i, len; + char *line; + + for (line = NULL, i = len = 100; ; i++ ) + { + if (i >= len-1 ) + { + char *tmp = line; + len += 100; + line = xmalloc_secure (len); + if (tmp) + { + memcpy (line, tmp, i); + xfree (tmp); + } + else + i=0; + } + if (read (fd, line + i, 1) != 1 || line[i] == '\n') + break; + } + line[i] = 0; + log_debug ("seskey: %s\n", line); + gpgrt_annotate_leaked_object (line); + opt.override_session_key = line; +} ----------------------------------------------------------------------- Summary of changes: doc/gpg.texi | 16 ++++++++++------ g10/gpg.c | 45 +++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 53 insertions(+), 8 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Wed Nov 16 10:07:53 2016 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Wed, 16 Nov 2016 10:07:53 +0100 Subject: [git] GpgOL - branch, master, updated. gpgol-1.4.0-173-g7424fd0 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG extension for MS Outlook". The branch, master has been updated via 7424fd0fcad08ce4de7492c28d5d1bec1060661d (commit) from 8ffd2b6369cde93b75bad8adf8dcd89911862546 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 7424fd0fcad08ce4de7492c28d5d1bec1060661d Author: Andre Heinecke Date: Wed Nov 16 10:00:15 2016 +0100 Add some NEWS -- diff --git a/NEWS b/NEWS index 8975aef..6dcec59 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,40 @@ Noteworthy changes for version 2.0.0 (unreleased) ================================================= + * Decryption / verification is done in a second thread so outlook + stays responsive while decrypting. + + * Opening a mail in a reader window no longer causes Outlook to + resync the mail. + + * Inline editors (Reply and Forward in the messagelist) are now + supported. + + * The HTML preferences from Outlook are now respected when viewing + an encrypted multipart/alternative mail. + + * Two crashes that sometimes occured when sending mail have been + fixed. + + * The "Do you want to save the changes" Messageboxes from outlook + no longer show up. + + * Signature details are now shown in the Mail ribbon when reading + messages. + + * Signature and encryption status is now shown in Outlook through + categorisation. No more popups when reading encrypted mails. + + * There is now an Option to use inline-pgp when encrypting mails + without attachments. + + * When opening a mail in a reader window closing it no longer causes + the mail in the Messagelist not to be displayed anymore. + + * Decryption no longer requires an UI-Server (GPA or Kleopatra). + + * Various bugfixes. + Noteworthy changes for version 1.4.0 (2016-03-30) ================================================= ----------------------------------------------------------------------- Summary of changes: NEWS | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) hooks/post-receive -- GnuPG extension for MS Outlook http://git.gnupg.org From cvs at cvs.gnupg.org Wed Nov 16 10:20:27 2016 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Wed, 16 Nov 2016 10:20:27 +0100 Subject: [git] GPGME - branch, master, updated. gpgme-1.7.1-48-g9fc92a1 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 9fc92a15bd0a30437a39d0eb28b6f40edc22e6e8 (commit) via 573064742145aa5f9bf04baa88af918c0c4d5e12 (commit) from b2c07bd47bd608afa5cc819b60a7b5bb8c9dd96a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 9fc92a15bd0a30437a39d0eb28b6f40edc22e6e8 Author: Werner Koch Date: Wed Nov 16 10:12:19 2016 +0100 core: Do not leak the override session key to ps(1). * src/engine-gpg.c (struct engine_gpg): New field override_session_key. (gpg_release): Free that field. (gpg_decrypt): With gnupg 2.1.16 use --override-session-key-fd. * tests/run-decrypt.c (main): Fix setting over the override key. -- Note that this works only with gnupg 2.1.16 and later. Signed-off-by: Werner Koch diff --git a/doc/gpgme.texi b/doc/gpgme.texi index 4f899a9..32e0861 100644 --- a/doc/gpgme.texi +++ b/doc/gpgme.texi @@ -2910,7 +2910,9 @@ not exported. The string given in @var{value} is passed to the GnuPG engine to override the session key for decryption. The format of that session key is specific to GnuPG and can be retrieved during a decrypt operation when -the context flag "export-session-key" is enabled. +the context flag "export-session-key" is enabled. Please be aware that +using this feature with GnuPG < 2.1.16 will leak the session key on +many platforms via ps(1). @end table diff --git a/src/engine-gpg.c b/src/engine-gpg.c index 21ed5bc..7afeb5c 100644 --- a/src/engine-gpg.c +++ b/src/engine-gpg.c @@ -139,6 +139,9 @@ struct engine_gpg struct gpgme_io_cbs io_cbs; gpgme_pinentry_mode_t pinentry_mode; + + /* NULL or the data object fed to --override_session_key-fd. */ + gpgme_data_t override_session_key; }; typedef struct engine_gpg *engine_gpg_t; @@ -441,6 +444,8 @@ gpg_release (void *engine) if (gpg->cmd.keyword) free (gpg->cmd.keyword); + gpgme_data_release (gpg->override_session_key); + free (gpg); } @@ -1563,9 +1568,30 @@ gpg_decrypt (void *engine, gpgme_data_t ciph, gpgme_data_t plain, if (!err && override_session_key && *override_session_key) { - err = add_arg (gpg, "--override-session-key"); - if (!err) - err = add_arg (gpg, override_session_key); + if (have_gpg_version (gpg, "2.1.16")) + { + gpgme_data_release (gpg->override_session_key); + TRACE2 (DEBUG_ENGINE, "override", gpg, "seskey='%s' len=%zu\n", + override_session_key, + strlen (override_session_key)); + + err = gpgme_data_new_from_mem (&gpg->override_session_key, + override_session_key, + strlen (override_session_key), 1); + if (!err) + { + err = add_arg (gpg, "--override-session-key-fd"); + if (!err) + err = add_data (gpg, gpg->override_session_key, -2, 0); + } + } + else + { + /* Using that option may leak the session key via ps(1). */ + err = add_arg (gpg, "--override-session-key"); + if (!err) + err = add_arg (gpg, override_session_key); + } } /* Tell the gpg object about the data. */ diff --git a/tests/run-decrypt.c b/tests/run-decrypt.c index 07a8747..d8ff00f 100644 --- a/tests/run-decrypt.c +++ b/tests/run-decrypt.c @@ -185,7 +185,8 @@ main (int argc, char **argv) } if (override_session_key) { - err = gpgme_set_ctx_flag (ctx, "overrride-session-key", "1"); + err = gpgme_set_ctx_flag (ctx, "override-session-key", + override_session_key); if (err) { fprintf (stderr, PGM ": error overriding session key: %s\n", commit 573064742145aa5f9bf04baa88af918c0c4d5e12 Author: Daniel Kahn Gillmor Date: Wed Nov 16 14:10:22 2016 +0900 doc,tests: Require use of ctx_flag before use of session_key. * doc/gpgme.texi: Document requirements of verifying that it is OK to use session_key. * tests/run-decrypt.c: Ensure that we fail if we're unable to access the session key, so that we do not violate the guidance above. Signed-off-by: Daniel Kahn Gillmor Changed the description - at code{gpgme_set_ctx_flag (ctx, "export-session-key")} returns - at code{GPG_ERR_NO_ERROR} or @code{gpgme_get_ctx_flag (ctx, -"export-session-key")} returns @code{"1"}. + at code{gpgme_set_ctx_flag (ctx, "export-session-key")} returns success +or @code{gpgme_get_ctx_flag (ctx, "export-session-key")} returns true +(non-empty string). to get gpgme_get_ctx_flag for boolean values in sync with its own description. Note that I don't agree with the above suggestion but it does not really harm to have it in the man page. Signed-off-by: Werner Koch diff --git a/doc/gpgme.texi b/doc/gpgme.texi index fd396e0..4f899a9 100644 --- a/doc/gpgme.texi +++ b/doc/gpgme.texi @@ -4814,6 +4814,11 @@ set to export session keys (see @code{gpgme_set_ctx_flag, "export-session-key"}), and a session key was available for the most recent decryption operation. Otherwise, this is a null pointer. +You must not try to access this member of the struct unless + at code{gpgme_set_ctx_flag (ctx, "export-session-key")} returns success +or @code{gpgme_get_ctx_flag (ctx, "export-session-key")} returns true +(non-empty string). + @end table @end deftp diff --git a/tests/run-decrypt.c b/tests/run-decrypt.c index 65624d0..07a8747 100644 --- a/tests/run-decrypt.c +++ b/tests/run-decrypt.c @@ -174,9 +174,25 @@ main (int argc, char **argv) gpgme_set_ctx_flag (ctx, "full-status", "1"); } if (export_session_key) - gpgme_set_ctx_flag (ctx, "export-session-key", "1"); + { + err = gpgme_set_ctx_flag (ctx, "export-session-key", "1"); + if (err) + { + fprintf (stderr, PGM ": error requesting exported session key: %s\n", + gpgme_strerror (err)); + exit (1); + } + } if (override_session_key) - gpgme_set_ctx_flag (ctx, "override-session-key", override_session_key); + { + err = gpgme_set_ctx_flag (ctx, "overrride-session-key", "1"); + if (err) + { + fprintf (stderr, PGM ": error overriding session key: %s\n", + gpgme_strerror (err)); + exit (1); + } + } err = gpgme_data_new_from_stream (&in, fp_in); if (err) @@ -201,10 +217,11 @@ main (int argc, char **argv) fprintf (stderr, PGM ": decrypt failed: %s\n", gpgme_strerror (err)); exit (1); } - if (result) { - print_result (result); - print_data (out); - } + if (result) + { + print_result (result); + print_data (out); + } gpgme_data_release (out); gpgme_data_release (in); ----------------------------------------------------------------------- Summary of changes: doc/gpgme.texi | 9 ++++++++- src/engine-gpg.c | 32 +++++++++++++++++++++++++++++--- tests/run-decrypt.c | 30 ++++++++++++++++++++++++------ 3 files changed, 61 insertions(+), 10 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Wed Nov 16 12:58:00 2016 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Wed, 16 Nov 2016 12:58:00 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.1.15-377-gc564790 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via c564790df723beef031d83802bd7830737bd330a (commit) from 43bfaf2c5417ede621c0a07721952ea549a7a139 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit c564790df723beef031d83802bd7830737bd330a Author: Werner Koch Date: Wed Nov 16 12:48:27 2016 +0100 wks: Always build gpg-wks-client. * tools/Makefile.am (gpg_wks_client): Remove macro. (libexec_PROGRAMS): Add gpg-wks-client. Signed-off-by: Werner Koch diff --git a/tools/Makefile.am b/tools/Makefile.am index 75750f7..94b53f2 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -47,18 +47,15 @@ endif if BUILD_WKS_TOOLS gpg_wks_server = gpg-wks-server - gpg_wks_client = gpg-wks-client else gpg_wks_server = - gpg_wks_client = endif -libexec_PROGRAMS = +libexec_PROGRAMS = gpg-wks-client bin_PROGRAMS = gpgconf gpg-connect-agent ${symcryptrun} if !HAVE_W32_SYSTEM bin_PROGRAMS += watchgnupg gpgparsemail ${gpg_wks_server} -libexec_PROGRAMS += ${gpg_wks_client} endif if !DISABLE_REGEX ----------------------------------------------------------------------- Summary of changes: tools/Makefile.am | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Wed Nov 16 14:06:13 2016 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Wed, 16 Nov 2016 14:06:13 +0100 Subject: [git] GPGME - branch, master, updated. gpgme-1.7.1-51-gaf79327 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via af79327021b5b3a5c4accd5d4e9f0124199bfdcc (commit) via f06220b691e9711afdabaa19886244ae7724eed5 (commit) via 7f5f26fd66e60e60de875c70b1f93f60c0438780 (commit) from 9fc92a15bd0a30437a39d0eb28b6f40edc22e6e8 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit af79327021b5b3a5c4accd5d4e9f0124199bfdcc Author: Werner Koch Date: Wed Nov 16 14:03:40 2016 +0100 Post release updates. -- diff --git a/NEWS b/NEWS index bbafdeb..39b41f6 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ +Noteworthy changes in version 1.8.1 (unreleased) +------------------------------------------------ + + Noteworthy changes in version 1.8.0 (2016-11-16) ------------------------------------------------ diff --git a/configure.ac b/configure.ac index 0a67b48..4495093 100644 --- a/configure.ac +++ b/configure.ac @@ -29,7 +29,7 @@ min_automake_version="1.14" # for the LT versions. m4_define(mym4_version_major, [1]) m4_define(mym4_version_minor, [8]) -m4_define(mym4_version_micro, [0]) +m4_define(mym4_version_micro, [1]) # Below is m4 magic to extract and compute the revision number, the # decimalized short revision number, a beta version string, and a flag commit f06220b691e9711afdabaa19886244ae7724eed5 Author: Werner Koch Date: Wed Nov 16 13:29:02 2016 +0100 Release 1.8.0 * configure.ac: Set version to 1.8.0. Set LT version C28/A17/RO. Set CPP LT version to C9/A3/R0. Set Qt LT version to C8/A1/R0. -- Signed-off-by: Werner Koch diff --git a/NEWS b/NEWS index c194d8f..bbafdeb 100644 --- a/NEWS +++ b/NEWS @@ -1,10 +1,23 @@ -Noteworthy changes in version 1.7.2 (unreleased) +Noteworthy changes in version 1.8.0 (2016-11-16) ------------------------------------------------ * The module of the Python bindings has been renamed to 'gpg'. + * New interface to query current software versions. + + * New feature to use gpg's --{show,override}session-key options. + + * New interface to set the sender of a mail. + * qt: Added Distinguished Name parser from libkleo + * The --homedir option is now used with recent gpgconf versions. + + * On 64 bit Windows systems gpgconf is now properly located. + + * The internal locking functions have been replaced by libgpg-error + locking functions. + * Interface changes relative to the 1.7.1 release: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ gpgme_set_sender NEW. @@ -13,6 +26,7 @@ Noteworthy changes in version 1.7.2 (unreleased) gpgme_op_query_swdb_result NEW. gpgme_query_swdb_result_t NEW. gpgme_get_ctx_flag NEW. + gpgme_decrypt_result_t EXTENDED: New field session_key. qt: DN NEW. qt: DN::Attribute NEW. qt: Job::context(Job*) NEW. @@ -22,6 +36,8 @@ Noteworthy changes in version 1.7.2 (unreleased) cpp: Context::setSender(const char*) NEW. cpp: Context::getSender() NEW. + [c=C28/A17/R0 cpp=C9/A3/R0 qt=C8/A1/R0] + Noteworthy changes in version 1.7.1 (2016-10-18) ------------------------------------------------ diff --git a/README b/README index 90f2e39..b7483b2 100644 --- a/README +++ b/README @@ -64,7 +64,7 @@ following ways: a) If you have a trusted Version of GnuPG installed, you can simply check the supplied signature: - $ gpg --verify gpgme-x.y.z.tar.gz.sig + $ gpg --verify gpgme-x.y.z.tar.gz.sig gpgme-x.y.z.tar.gz This checks that the detached signature gpgme-x.y.z.tar.gz.sig is indeed a a signature of gpgme-x.y.z.tar.gz. The key used to create diff --git a/configure.ac b/configure.ac index 4d2f8d6..0a67b48 100644 --- a/configure.ac +++ b/configure.ac @@ -28,8 +28,8 @@ min_automake_version="1.14" # commit and push so that the git magic is able to work. See below # for the LT versions. m4_define(mym4_version_major, [1]) -m4_define(mym4_version_minor, [7]) -m4_define(mym4_version_micro, [2]) +m4_define(mym4_version_minor, [8]) +m4_define(mym4_version_micro, [0]) # Below is m4 magic to extract and compute the revision number, the # decimalized short revision number, a beta version string, and a flag @@ -55,19 +55,19 @@ AC_INIT([gpgme],[mym4_full_version],[http://bugs.gnupg.org]) # (Interfaces added: AGE++) # (Interfaces removed/changed: AGE=0) # -LIBGPGME_LT_CURRENT=27 -LIBGPGME_LT_AGE=16 +LIBGPGME_LT_CURRENT=28 +LIBGPGME_LT_AGE=17 LIBGPGME_LT_REVISION=0 # If there is an ABI break in gpgmepp or qgpgme also bump the # version in IMPORTED_LOCATION in the GpgmeppConfig-w32.cmake.in.in -LIBGPGMEPP_LT_CURRENT=8 -LIBGPGMEPP_LT_AGE=2 +LIBGPGMEPP_LT_CURRENT=9 +LIBGPGMEPP_LT_AGE=3 LIBGPGMEPP_LT_REVISION=0 -LIBQGPGME_LT_CURRENT=7 -LIBQGPGME_LT_AGE=0 +LIBQGPGME_LT_CURRENT=8 +LIBQGPGME_LT_AGE=1 LIBQGPGME_LT_REVISION=0 # If the API is changed in an incompatible way: increment the next counter. commit 7f5f26fd66e60e60de875c70b1f93f60c0438780 Author: Werner Koch Date: Wed Nov 16 13:27:00 2016 +0100 doc: Replace http: by https: in core source files. -- Signed-off-by: Werner Koch diff --git a/Makefile.am b/Makefile.am index 72b8ee9..e47ace5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -15,7 +15,7 @@ # 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 . +# License along with this program; if not, see . ## Process this file with automake to produce Makefile.in diff --git a/autogen.sh b/autogen.sh index 24da40c..91f35a6 100755 --- a/autogen.sh +++ b/autogen.sh @@ -347,7 +347,7 @@ if [ -d .git ]; then [ -z "${SILENT}" ] && cat <. +# along with this program; if not, see . # (Process this file with autoconf to produce a configure script.) AC_PREREQ(2.59) diff --git a/doc/gpl.texi b/doc/gpl.texi index d13e9e4..931a93d 100644 --- a/doc/gpl.texi +++ b/doc/gpl.texi @@ -6,7 +6,7 @@ @c This file is intended to be included in another file. @display -Copyright @copyright{} 2007 Free Software Foundation, Inc. @url{http://fsf.org/} +Copyright @copyright{} 2007 Free Software Foundation, Inc. @url{https://fsf.org/} Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. @@ -696,7 +696,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with this program. If not, see @url{http://www.gnu.org/licenses/}. +along with this program. If not, see @url{https://www.gnu.org/licenses/}. @end example @noindent @@ -722,11 +722,11 @@ use an ``about box''. You should also get your employer (if you work as a programmer) or school, if any, to sign a ``copyright disclaimer'' for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see - at url{http://www.gnu.org/licenses/}. + at url{https://www.gnu.org/licenses/}. The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But -first, please read @url{http://www.gnu.org/philosophy/why-not-lgpl.html}. +first, please read @url{https://www.gnu.org/philosophy/why-not-lgpl.html}. diff --git a/doc/texinfo.tex b/doc/texinfo.tex index d2b264d..2c274a2 100644 --- a/doc/texinfo.tex +++ b/doc/texinfo.tex @@ -20,7 +20,7 @@ % General Public License for more details. % % You should have received a copy of the GNU General Public License -% along with this program. If not, see . +% along with this program. If not, see . % % As a special exception, when this file is read by TeX when processing % a Texinfo source document, you may use the result without @@ -28,7 +28,7 @@ % % Please try the latest version of texinfo.tex before submitting bug % reports; you can get the latest version from: -% http://www.gnu.org/software/texinfo/ (the Texinfo home page), or +% https://www.gnu.org/software/texinfo/ (the Texinfo home page), or % ftp://tug.org/tex/texinfo.tex % (and all CTAN mirrors, see http://www.ctan.org). % The texinfo.tex in any given distribution could well be out @@ -54,7 +54,7 @@ % extent. You can get the existing language-specific files from the % full Texinfo distribution. % -% The GNU Texinfo home page is http://www.gnu.org/software/texinfo. +% The GNU Texinfo home page is https://www.gnu.org/software/texinfo. \message{Loading texinfo [version \texinfoversion]:} @@ -354,7 +354,7 @@ % We don't want .vr (or whatever) entries like this: % \entry{{\tt \indexbackslash }acronym}{32}{\code {\acronym}} % "\acronym" won't work when it's read back in; - % it needs to be + % it needs to be % {\code {{\tt \backslashcurfont }acronym} \shipout\vbox{% % Do this early so pdf references go to the beginning of the page. @@ -705,7 +705,7 @@ \def\?{?\spacefactor=\endofsentencespacefactor\space} % @frenchspacing on|off says whether to put extra space after punctuation. -% +% \def\onword{on} \def\offword{off} % @@ -1260,7 +1260,7 @@ where each line of input produces a line of output.} % that's what we do). % double active backslashes. -% +% {\catcode`\@=0 \catcode`\\=\active @gdef at activebackslashdouble{% @catcode`@\=@active @@ -1272,11 +1272,11 @@ where each line of input produces a line of output.} % us) handles it with this amazing macro to replace tokens, with minor % changes for Texinfo. It is included here under the GPL by permission % from the author, Heiko Oberdiek. -% +% % #1 is the tokens to replace. % #2 is the replacement. % #3 is the control sequence with the string. -% +% \def\HyPsdSubst#1#2#3{% \def\HyPsdReplace##1#1##2\END{% ##1% @@ -1542,7 +1542,7 @@ output) for that.)} % tried to figure out what each command should do in the context % of @url. for now, just make @/ a no-op, that's the only one % people have actually reported a problem with. - % + % \normalturnoffactive \def\@{@}% \let\/=\empty @@ -1941,7 +1941,7 @@ end % Definitions for a main text size of 11pt. This is the default in % Texinfo. -% +% \def\definetextfontsizexi{% % Text fonts (11.2pt, magstep1). \def\textnominalsize{11pt} @@ -2074,7 +2074,7 @@ end % section, chapter, etc., sizes following suit. This is for the GNU % Press printing of the Emacs 22 manual. Maybe other manuals in the % future. Used with @smallbook, which sets the leading to 12pt. -% +% \def\definetextfontsizex{% % Text fonts (10pt). \def\textnominalsize{10pt} @@ -2165,7 +2165,7 @@ end \setfont\secsf\sfbshape{12}{1000}{OT1} \let\secbf\secrm \setfont\secsc\scbshape{10}{\magstep1}{OT1} -\font\seci=cmmi12 +\font\seci=cmmi12 \font\secsy=cmsy10 scaled \magstep1 \def\sececsize{1200} @@ -2209,7 +2209,7 @@ end % We provide the user-level command % @fonttextsize 10 % (or 11) to redefine the text font size. pt is assumed. -% +% \def\xword{10} \def\xiword{11} % @@ -2219,7 +2219,7 @@ end % % Set \globaldefs so that documents can use this inside @tex, since % makeinfo 4.8 does not support it, but we need it nonetheless. - % + % \begingroup \globaldefs=1 \ifx\textsizearg\xword \definetextfontsizex \else \ifx\textsizearg\xiword \definetextfontsizexi @@ -2505,7 +2505,7 @@ end % each of the four underscores in __typeof__. This is undesirable in % some manuals, especially if they don't have long identifiers in % general. @allowcodebreaks provides a way to control this. -% +% \newif\ifallowcodebreaks \allowcodebreakstrue \def\keywordtrue{true} @@ -2636,7 +2636,7 @@ end % @acronym for "FBI", "NATO", and the like. % We print this one point size smaller, since it's intended for % all-uppercase. -% +% \def\acronym#1{\doacronym #1,,\finish} \def\doacronym#1,#2,#3\finish{% {\selectfonts\lsize #1}% @@ -2648,7 +2648,7 @@ end % @abbr for "Comput. J." and the like. % No font change, but don't do end-of-sentence spacing. -% +% \def\abbr#1{\doabbr #1,,\finish} \def\doabbr#1,#2,#3\finish{% {\plainfrenchspacing #1}% @@ -2667,43 +2667,43 @@ end % Theiling, which support regular, slanted, bold and bold slanted (and % "outlined" (blackboard board, sort of) versions, which we don't need). % It is available from http://www.ctan.org/tex-archive/fonts/eurosym. -% +% % Although only regular is the truly official Euro symbol, we ignore % that. The Euro is designed to be slightly taller than the regular % font height. -% +% % feymr - regular % feymo - slanted % feybr - bold % feybo - bold slanted -% +% % There is no good (free) typewriter version, to my knowledge. % A feymr10 euro is ~7.3pt wide, while a normal cmtt10 char is ~5.25pt wide. % Hmm. -% +% % Also doesn't work in math. Do we need to do math with euro symbols? % Hope not. -% -% +% +% \def\euro{{\eurofont e}} \def\eurofont{% % We set the font at each command, rather than predefining it in % \textfonts and the other font-switching commands, so that % installations which never need the symbol don't have to have the % font installed. - % + % % There is only one designed size (nominal 10pt), so we always scale % that to the current nominal size. - % + % % By the way, simply using "at 1em" works for cmr10 and the like, but % does not work for cmbx10 and other extended/shrunken fonts. - % + % \def\eurosize{\csname\curfontsize nominalsize\endcsname}% % - \ifx\curfontstyle\bfstylename + \ifx\curfontstyle\bfstylename % bold: \font\thiseurofont = \ifusingit{feybo10}{feybr10} at \eurosize - \else + \else % regular: \font\thiseurofont = \ifusingit{feymo10}{feymr10} at \eurosize \fi @@ -2756,7 +2756,7 @@ end % Laurent Siebenmann reports \Orb undefined with: % Textures 1.7.7 (preloaded format=plain 93.10.14) (68K) 16 APR 2004 02:38 % so we'll define it if necessary. -% +% \ifx\Orb\undefined \def\Orb{\mathhexbox20D} \fi @@ -3105,7 +3105,7 @@ end % cause the example and the item to crash together. So we use this % bizarre value of 10001 as a signal to \aboveenvbreak to insert % \parskip glue after all. Section titles are handled this way also. - % + % \penalty 10001 \endgroup \itemxneedsnegativevskipfalse @@ -3901,7 +3901,7 @@ end % processing continues to some further point. On the other hand, it % seems \endinput does not hurt in the printed index arg, since that % is still getting written without apparent harm. - % + % % Sample source (mac-idx3.tex, reported by Graham Percival to % help-texinfo, 22may06): % @macro funindex {WORD} @@ -3909,12 +3909,12 @@ end % @end macro % ... % @funindex commtest - % + % % The above is not enough to reproduce the bug, but it gives the flavor. - % + % % Sample whatsit resulting: % . at write3{\entry{xyz}{@folio }{@code {xyz at endinput }}} - % + % % So: \let\endinput = \empty % @@ -4170,11 +4170,11 @@ end % makeinfo does not expand macros in the argument to @deffn, which ends up % writing an index entry, and texindex isn't prepared for an index sort entry % that starts with \. - % + % % Since macro invocations are followed by braces, we can just redefine them % to take a single TeX argument. The case of a macro invocation that % goes to end-of-line is not handled. - % + % \macrolist } @@ -4302,7 +4302,7 @@ end % to re-insert the same penalty (values >10000 are used for various % signals); since we just inserted a non-discardable item, any % following glue (such as a \parskip) would be a breakpoint. For example: - % + % % @deffn deffn-whatever % @vindex index-whatever % Description. @@ -5368,11 +5368,11 @@ end % glue accumulate. (Not a breakpoint because it's preceded by a % discardable item.) \vskip-\parskip - % + % % This is purely so the last item on the list is a known \penalty > % 10000. This is so \startdefun can avoid allowing breakpoints after % section headings. Otherwise, it would insert a valid breakpoint between: - % + % % @section sec-whatever % @deffn def-whatever \penalty 10001 @@ -5430,7 +5430,7 @@ end % These characters do not print properly in the Computer Modern roman % fonts, so we must take special care. This is more or less redundant % with the Texinfo input format setup at the end of this file. -% +% \def\activecatcodes{% \catcode`\"=\active \catcode`\$=\active @@ -5480,7 +5480,7 @@ end % redefined for the two-volume lispref. We always output on % \jobname.toc even if this is redefined. -% +% \def\tocreadfilename{\jobname.toc} % Normal (long) toc. @@ -6035,8 +6035,8 @@ end % from cmtt (char 0x0d). The undirected quote is ugly, so don't make it % the default, but it works for pasting with more pdf viewers (at least % evince), the lilypond developers report. xpdf does work with the -% regular 0x27. -% +% regular 0x27. +% \def\codequoteright{% \expandafter\ifx\csname SETtxicodequoteundirected\endcsname\relax \expandafter\ifx\csname SETcodequoteundirected\endcsname\relax @@ -6048,7 +6048,7 @@ end % and a similar option for the left quote char vs. a grave accent. % Modern fonts display ASCII 0x60 as a grave accent, so some people like % the code environments to do likewise. -% +% \def\codequoteleft{% \expandafter\ifx\csname SETtxicodequotebacktick\endcsname\relax \expandafter\ifx\csname SETcodequotebacktick\endcsname\relax @@ -6579,7 +6579,7 @@ end % This does \let #1 = #2, with \csnames; that is, % \let \csname#1\endcsname = \csname#2\endcsname % (except of course we have to play expansion games). -% +% \def\cslet#1#2{% \expandafter\let \csname#1\expandafter\endcsname @@ -7737,7 +7737,7 @@ end % % If they passed de_DE, and txi-de_DE.tex doesn't exist, % try txi-de.tex. -% +% \def\documentlanguagetrywithoutunderscore#1_#2\finish{% \openin 1 txi-#1.tex \ifeof 1 @@ -7793,7 +7793,7 @@ should work if nowhere else does.} \setnonasciicharscatcode\active \lattwochardefs % - \else \ifx \declaredencoding \latone + \else \ifx \declaredencoding \latone \setnonasciicharscatcode\active \latonechardefs % @@ -7805,7 +7805,7 @@ should work if nowhere else does.} \setnonasciicharscatcode\active \utfeightchardefs % - \else + \else \message{Unknown document encoding #1, ignoring.}% % \fi % utfeight @@ -7817,7 +7817,7 @@ should work if nowhere else does.} % A message to be logged when using a character that isn't available % the default font encoding (OT1). -% +% \def\missingcharmsg#1{\message{Character missing in OT1 encoding: #1.}} % Take account of \c (plain) vs. \, (Texinfo) difference. @@ -7830,21 +7830,21 @@ should work if nowhere else does.} % % Latin1 (ISO-8859-1) character definitions. \def\latonechardefs{% - \gdef^^a0{~} + \gdef^^a0{~} \gdef^^a1{\exclamdown} - \gdef^^a2{\missingcharmsg{CENT SIGN}} + \gdef^^a2{\missingcharmsg{CENT SIGN}} \gdef^^a3{{\pounds}} \gdef^^a4{\missingcharmsg{CURRENCY SIGN}} \gdef^^a5{\missingcharmsg{YEN SIGN}} - \gdef^^a6{\missingcharmsg{BROKEN BAR}} + \gdef^^a6{\missingcharmsg{BROKEN BAR}} \gdef^^a7{\S} - \gdef^^a8{\"{}} - \gdef^^a9{\copyright} + \gdef^^a8{\"{}} + \gdef^^a9{\copyright} \gdef^^aa{\ordf} - \gdef^^ab{\missingcharmsg{LEFT-POINTING DOUBLE ANGLE QUOTATION MARK}} + \gdef^^ab{\missingcharmsg{LEFT-POINTING DOUBLE ANGLE QUOTATION MARK}} \gdef^^ac{$\lnot$} - \gdef^^ad{\-} - \gdef^^ae{\registeredsymbol} + \gdef^^ad{\-} + \gdef^^ae{\registeredsymbol} \gdef^^af{\={}} % \gdef^^b0{\textdegree} @@ -7871,7 +7871,7 @@ should work if nowhere else does.} \gdef^^c2{\^A} \gdef^^c3{\~A} \gdef^^c4{\"A} - \gdef^^c5{\ringaccent A} + \gdef^^c5{\ringaccent A} \gdef^^c6{\AE} \gdef^^c7{\cedilla C} \gdef^^c8{\`E} @@ -8012,7 +8012,7 @@ should work if nowhere else does.} \gdef^^d6{\"O} \gdef^^d7{$\times$} \gdef^^d8{\v R} - \gdef^^d9{\ringaccent U} + \gdef^^d9{\ringaccent U} \gdef^^da{\'U} \gdef^^db{\H U} \gdef^^dc{\"U} @@ -8056,11 +8056,11 @@ should work if nowhere else does.} } % UTF-8 character definitions. -% +% % This code to support UTF-8 is based on LaTeX's utf8.def, with some % changes for Texinfo conventions. It is included here under the GPL by % permission from Frank Mittelbach and the LaTeX team. -% +% \newcount\countUTFx \newcount\countUTFy \newcount\countUTFz @@ -8900,7 +8900,7 @@ should work if nowhere else does.} % Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of % the literal character `\'. -% +% @def at normalturnoffactive{% @let\=@normalbackslash @let"=@normaldoublequote diff --git a/gpgme.spec.in b/gpgme.spec.in index a5c6996..ddc0de3 100644 --- a/gpgme.spec.in +++ b/gpgme.spec.in @@ -3,7 +3,7 @@ Summary: GPGME - GnuPG Made Easy Name: gpgme Version: @pkg_version@ Release: 1 -URL: http://www.gnupg.org/gpgme.html +URL: https://gnupg.org/gpgme.html Source: ftp://ftp.gnupg.org/gcrypt/alpha/gpgme/%{name}-%{version}.tar.gz Group: Development/Libraries Copyright: GPL diff --git a/m4/glib-2.0.m4 b/m4/glib-2.0.m4 index d6413ff..a22e6e6 100644 --- a/m4/glib-2.0.m4 +++ b/m4/glib-2.0.m4 @@ -2,11 +2,11 @@ # Owen Taylor 1997-2001 dnl AM_PATH_GLIB_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]]) -dnl Test for GLIB, and define GLIB_CFLAGS and GLIB_LIBS, if gmodule, gobject or +dnl Test for GLIB, and define GLIB_CFLAGS and GLIB_LIBS, if gmodule, gobject or dnl gthread is specified in MODULES, pass to pkg-config dnl AC_DEFUN([AM_PATH_GLIB_2_0], -[dnl +[dnl dnl Get the cflags and libraries from pkg-config dnl AC_ARG_ENABLE(glibtest, [ --disable-glibtest do not try to compile and run a test GLIB program], @@ -16,16 +16,16 @@ AC_ARG_ENABLE(glibtest, [ --disable-glibtest do not try to compile and run for module in . $4 do case "$module" in - gmodule) + gmodule) pkg_config_args="$pkg_config_args gmodule-2.0" ;; - gmodule-no-export) + gmodule-no-export) pkg_config_args="$pkg_config_args gmodule-no-export-2.0" ;; - gobject) + gobject) pkg_config_args="$pkg_config_args gobject-2.0" ;; - gthread) + gthread) pkg_config_args="$pkg_config_args gthread-2.0" ;; esac @@ -92,7 +92,7 @@ dnl #include #include -int +int main () { int major, minor, micro; @@ -111,7 +111,7 @@ main () (glib_minor_version != $glib_config_minor_version) || (glib_micro_version != $glib_config_micro_version)) { - printf("\n*** 'pkg-config --modversion glib-2.0' returned %d.%d.%d, but GLIB (%d.%d.%d)\n", + printf("\n*** 'pkg-config --modversion glib-2.0' returned %d.%d.%d, but GLIB (%d.%d.%d)\n", $glib_config_major_version, $glib_config_minor_version, $glib_config_micro_version, glib_major_version, glib_minor_version, glib_micro_version); printf ("*** was found! If pkg-config was correct, then it is best\n"); @@ -121,7 +121,7 @@ main () printf("*** required on your system.\n"); printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n"); printf("*** to point to the correct configuration files\n"); - } + } else if ((glib_major_version != GLIB_MAJOR_VERSION) || (glib_minor_version != GLIB_MINOR_VERSION) || (glib_micro_version != GLIB_MICRO_VERSION)) @@ -165,12 +165,12 @@ main () fi if test "x$no_glib" = x ; then AC_MSG_RESULT(yes (version $glib_config_major_version.$glib_config_minor_version.$glib_config_micro_version)) - ifelse([$2], , :, [$2]) + ifelse([$2], , :, [$2]) else AC_MSG_RESULT(no) if test "$PKG_CONFIG" = "no" ; then echo "*** A new enough version of pkg-config was not found." - echo "*** See http://www.freedesktop.org/software/pkgconfig/" + echo "*** See https://www.freedesktop.org/software/pkgconfig/" else if test -f conf.glibtest ; then : diff --git a/m4/libtool.m4 b/m4/libtool.m4 index ff871a0..0d340c7 100644 --- a/m4/libtool.m4 +++ b/m4/libtool.m4 @@ -34,7 +34,7 @@ m4_define([_LT_COPYING], [dnl # # You should have received a copy of the GNU General Public License # along with GNU Libtool; see the file COPYING. If not, a copy -# can be downloaded from http://www.gnu.org/licenses/gpl.html, or +# can be downloaded from https://www.gnu.org/licenses/gpl.html, or # obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ]) diff --git a/m4/pkg.m4 b/m4/pkg.m4 index c29b6c0..5865daf 100644 --- a/m4/pkg.m4 +++ b/m4/pkg.m4 @@ -1,5 +1,5 @@ # pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- -# +# # Copyright ? 2004 Scott James Remnant . # # This program is free software; you can redistribute it and/or modify @@ -39,7 +39,7 @@ if test -n "$PKG_CONFIG"; then AC_MSG_RESULT([no]) PKG_CONFIG="" fi - + fi[]dnl ])# PKG_PROG_PKG_CONFIG @@ -120,7 +120,7 @@ if test $pkg_failed = yes; then _PKG_SHORT_ERRORS_SUPPORTED if test $_pkg_short_errors_supported = yes; then $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --errors-to-stdout --print-errors "$2"` - else + else $1[]_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "$2"` fi # Put the nasty error message in config.log where it belongs @@ -146,7 +146,7 @@ path to pkg-config. _PKG_TEXT -To get pkg-config, see .])], +To get pkg-config, see .])], [$4]) else $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS diff --git a/src/Makefile.am b/src/Makefile.am index 71f2b3a..ce6f1d4 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -14,7 +14,7 @@ # 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 . +# License along with this program; if not, see . ## Process this file with automake to produce Makefile.in diff --git a/src/argparse.c b/src/argparse.c index 003334f..758173f 100644 --- a/src/argparse.c +++ b/src/argparse.c @@ -26,7 +26,7 @@ * * You should have received a copies of the GNU General Public License * and the GNU Lesser General Public License along with this program; - * if not, see . + * if not, see . */ /* This file may be used as part of GnuPG or standalone. A GnuPG @@ -1518,7 +1518,7 @@ ARGPARSE_STR2(ARGPARSE_GPL_VERSION) "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" "GNU General Public License for more details.\n\n" "You should have received a copy of the GNU General Public License\n" -"along with this software. If not, see .\n"; +"along with this software. If not, see .\n"; break; case 40: /* short and long usage */ case 41: p = ""; break; diff --git a/src/argparse.h b/src/argparse.h index 10b838f..81e881d 100644 --- a/src/argparse.h +++ b/src/argparse.h @@ -25,7 +25,7 @@ * * You should have received a copies of the GNU General Public License * and the GNU Lesser General Public License along with this program; - * if not, see . + * if not, see . */ #ifndef GNUPG_COMMON_ARGPARSE_H diff --git a/src/b64dec.c b/src/b64dec.c index 9a7efca..c824786 100644 --- a/src/b64dec.c +++ b/src/b64dec.c @@ -15,7 +15,7 @@ * 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 . + * along with this program; if not, see . */ #include diff --git a/src/context.h b/src/context.h index d915b99..1a8698c 100644 --- a/src/context.h +++ b/src/context.h @@ -15,7 +15,7 @@ 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 . + License along with this program; if not, see . */ #ifndef CONTEXT_H diff --git a/src/data-identify.c b/src/data-identify.c index 615a4f3..857d06c 100644 --- a/src/data-identify.c +++ b/src/data-identify.c @@ -14,7 +14,7 @@ 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 . + License along with this program; if not, see . */ #if HAVE_CONFIG_H diff --git a/src/dirinfo.c b/src/dirinfo.c index b24a8a0..a0cbc03 100644 --- a/src/dirinfo.c +++ b/src/dirinfo.c @@ -14,7 +14,7 @@ * 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 . + * License along with this program; if not, see . */ #if HAVE_CONFIG_H diff --git a/src/engine-assuan.c b/src/engine-assuan.c index 4c7fe28..3e3b89f 100644 --- a/src/engine-assuan.c +++ b/src/engine-assuan.c @@ -14,7 +14,7 @@ * 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 . + * License along with this program; if not, see . */ /* diff --git a/src/engine-backend.h b/src/engine-backend.h index cfc624d..a8457af 100644 --- a/src/engine-backend.h +++ b/src/engine-backend.h @@ -14,7 +14,7 @@ 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 . + License along with this program; if not, see . */ #ifndef ENGINE_BACKEND_H diff --git a/src/engine-gpg.c b/src/engine-gpg.c index 7afeb5c..3ddaa07 100644 --- a/src/engine-gpg.c +++ b/src/engine-gpg.c @@ -16,7 +16,7 @@ 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 . + License along with this program; if not, see . */ #if HAVE_CONFIG_H diff --git a/src/engine-gpgconf.c b/src/engine-gpgconf.c index 25c798e..2ea8673 100644 --- a/src/engine-gpgconf.c +++ b/src/engine-gpgconf.c @@ -16,7 +16,7 @@ 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 . + License along with this program; if not, see . */ #if HAVE_CONFIG_H diff --git a/src/engine-spawn.c b/src/engine-spawn.c index d2c7dd6..1cd4421 100644 --- a/src/engine-spawn.c +++ b/src/engine-spawn.c @@ -14,7 +14,7 @@ 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 . + License along with this program; if not, see . */ #if HAVE_CONFIG_H diff --git a/src/engine.c b/src/engine.c index d542b25..75d9ff7 100644 --- a/src/engine.c +++ b/src/engine.c @@ -15,7 +15,7 @@ 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 . + License along with this program; if not, see . */ #ifdef HAVE_CONFIG_H diff --git a/src/export.c b/src/export.c index 41a9eba..cd94050 100644 --- a/src/export.c +++ b/src/export.c @@ -15,7 +15,7 @@ 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 . + License along with this program; if not, see . */ #if HAVE_CONFIG_H diff --git a/src/genkey.c b/src/genkey.c index 9dcf0be..ea3f1ea 100644 --- a/src/genkey.c +++ b/src/genkey.c @@ -15,7 +15,7 @@ * 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 . + * License along with this program; if not, see . */ #if HAVE_CONFIG_H diff --git a/src/getauditlog.c b/src/getauditlog.c index e2ba25e..dbaf260 100644 --- a/src/getauditlog.c +++ b/src/getauditlog.c @@ -15,7 +15,7 @@ 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 . + License along with this program; if not, see . */ #if HAVE_CONFIG_H diff --git a/src/gpgme-tool.c b/src/gpgme-tool.c index fb158f1..3e2dc78 100644 --- a/src/gpgme-tool.c +++ b/src/gpgme-tool.c @@ -15,7 +15,7 @@ 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 . + License along with this program; if not, see . */ #if HAVE_CONFIG_H diff --git a/src/gpgme-w32spawn.c b/src/gpgme-w32spawn.c index b510ba3..003b9b0 100644 --- a/src/gpgme-w32spawn.c +++ b/src/gpgme-w32spawn.c @@ -14,7 +14,7 @@ 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 . + License along with this program; if not, see . */ diff --git a/src/gpgme.c b/src/gpgme.c index 1a10fd9..cf767c7 100644 --- a/src/gpgme.c +++ b/src/gpgme.c @@ -16,7 +16,7 @@ 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 . + License along with this program; if not, see . */ #if HAVE_CONFIG_H diff --git a/src/keylist.c b/src/keylist.c index 6e22e16..2ce0846 100644 --- a/src/keylist.c +++ b/src/keylist.c @@ -16,7 +16,7 @@ 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 . + License along with this program; if not, see . */ #if HAVE_CONFIG_H diff --git a/src/keysign.c b/src/keysign.c index 7d08c11..c2fcabb 100644 --- a/src/keysign.c +++ b/src/keysign.c @@ -14,7 +14,7 @@ * 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 . + * License along with this program; if not, see . */ #if HAVE_CONFIG_H diff --git a/src/mbox-util.c b/src/mbox-util.c index 81e929b..0dafc2a 100644 --- a/src/mbox-util.c +++ b/src/mbox-util.c @@ -15,7 +15,7 @@ * 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 . + * along with this program; if not, see . */ /* NB: This code has been taken from GnuPG. Please keep it in sync diff --git a/src/mbox-util.h b/src/mbox-util.h index c5747b6..8be1343 100644 --- a/src/mbox-util.h +++ b/src/mbox-util.h @@ -14,7 +14,7 @@ * 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 . + * along with this program; if not, see . */ #ifndef GNUPG_COMMON_MBOX_UTIL_H #define GNUPG_COMMON_MBOX_UTIL_H diff --git a/src/op-support.c b/src/op-support.c index 9f10cd3..d9217ec 100644 --- a/src/op-support.c +++ b/src/op-support.c @@ -14,7 +14,7 @@ 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 . + License along with this program; if not, see . */ #if HAVE_CONFIG_H diff --git a/src/opassuan.c b/src/opassuan.c index e58240c..2bbaacd 100644 --- a/src/opassuan.c +++ b/src/opassuan.c @@ -14,7 +14,7 @@ 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 . + License along with this program; if not, see . */ #if HAVE_CONFIG_H diff --git a/src/parsetlv.c b/src/parsetlv.c index 70c9518..b311a73 100644 --- a/src/parsetlv.c +++ b/src/parsetlv.c @@ -12,7 +12,7 @@ * 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 . + * along with this program; if not, see . */ #ifdef HAVE_CONFIG_H diff --git a/src/parsetlv.h b/src/parsetlv.h index 153073c..bea03d4 100644 --- a/src/parsetlv.h +++ b/src/parsetlv.h @@ -12,7 +12,7 @@ * 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 . + * along with this program; if not, see . */ #ifndef PARSETLV_H diff --git a/src/passwd.c b/src/passwd.c index c34f357..5bd67a5 100644 --- a/src/passwd.c +++ b/src/passwd.c @@ -14,7 +14,7 @@ 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 . + License along with this program; if not, see . */ #if HAVE_CONFIG_H diff --git a/src/posix-io.c b/src/posix-io.c index c903072..5296f5f 100644 --- a/src/posix-io.c +++ b/src/posix-io.c @@ -15,7 +15,7 @@ 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 . + License along with this program; if not, see . */ #ifdef HAVE_CONFIG_H diff --git a/src/queryswdb.c b/src/queryswdb.c index ce50b1e..698a419 100644 --- a/src/queryswdb.c +++ b/src/queryswdb.c @@ -14,7 +14,7 @@ * 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 . + * License along with this program; if not, see . */ #if HAVE_CONFIG_H diff --git a/src/sys-util.h b/src/sys-util.h index 541c557..094399c 100644 --- a/src/sys-util.h +++ b/src/sys-util.h @@ -14,7 +14,7 @@ * 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 . + * License along with this program; if not, see . */ #ifndef SYS_UTIL_H diff --git a/src/tofupolicy.c b/src/tofupolicy.c index 799779e..460e3ba 100644 --- a/src/tofupolicy.c +++ b/src/tofupolicy.c @@ -14,7 +14,7 @@ * 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 . + * License along with this program; if not, see . */ #if HAVE_CONFIG_H diff --git a/src/ttyname_r.c b/src/ttyname_r.c index eed28bd..7aed79e 100644 --- a/src/ttyname_r.c +++ b/src/ttyname_r.c @@ -14,7 +14,7 @@ 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 . + License along with this program; if not, see . */ #if HAVE_CONFIG_H diff --git a/src/w32-ce.c b/src/w32-ce.c index e42f053..e326bfe 100644 --- a/src/w32-ce.c +++ b/src/w32-ce.c @@ -15,7 +15,7 @@ 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 . + License along with this program; if not, see . */ #ifdef HAVE_CONFIG_H diff --git a/src/w32-util.c b/src/w32-util.c index 0dc1288..ad36c9a 100644 --- a/src/w32-util.c +++ b/src/w32-util.c @@ -16,7 +16,7 @@ * 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 . + * License along with this program; if not, see . **/ #ifdef HAVE_CONFIG_H diff --git a/tests/Makefile.am b/tests/Makefile.am index e8c7c56..30c35f0 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -15,7 +15,7 @@ # 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 . +# License along with this program; if not, see . ## Process this file with automake to produce Makefile.in diff --git a/tests/gpg/t-decrypt-verify.c b/tests/gpg/t-decrypt-verify.c index b774cfd..653d74e 100644 --- a/tests/gpg/t-decrypt-verify.c +++ b/tests/gpg/t-decrypt-verify.c @@ -15,7 +15,7 @@ * 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 . + * License along with this program; if not, see . */ /* We need to include config.h so that we know whether we are building diff --git a/tests/gpgsm/cms-decrypt.c b/tests/gpgsm/cms-decrypt.c index 580832d..794f013 100644 --- a/tests/gpgsm/cms-decrypt.c +++ b/tests/gpgsm/cms-decrypt.c @@ -14,7 +14,7 @@ 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 . + License along with this program; if not, see . */ /* We need to include config.h so that we know whether we are building diff --git a/tests/gpgsm/cms-keylist.c b/tests/gpgsm/cms-keylist.c index 7ed3a4e..ffe17e2 100644 --- a/tests/gpgsm/cms-keylist.c +++ b/tests/gpgsm/cms-keylist.c @@ -14,7 +14,7 @@ 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 . + License along with this program; if not, see . */ /* We need to include config.h so that we know whether we are building diff --git a/tests/opassuan/t-command.c b/tests/opassuan/t-command.c index 9c791ee..fd0ea71 100644 --- a/tests/opassuan/t-command.c +++ b/tests/opassuan/t-command.c @@ -14,7 +14,7 @@ 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 . + License along with this program; if not, see . */ #ifdef HAVE_CONFIG_H diff --git a/tests/run-decrypt.c b/tests/run-decrypt.c index d8ff00f..8bcca0e 100644 --- a/tests/run-decrypt.c +++ b/tests/run-decrypt.c @@ -15,7 +15,7 @@ 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 . + License along with this program; if not, see . */ /* We need to include config.h so that we know whether we are building diff --git a/tests/run-encrypt.c b/tests/run-encrypt.c index b94b028..fd86836 100644 --- a/tests/run-encrypt.c +++ b/tests/run-encrypt.c @@ -14,7 +14,7 @@ * 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 . + * License along with this program; if not, see . */ /* We need to include config.h so that we know whether we are building diff --git a/tests/run-export.c b/tests/run-export.c index b133f13..0bb5468 100644 --- a/tests/run-export.c +++ b/tests/run-export.c @@ -14,7 +14,7 @@ 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 . + License along with this program; if not, see . */ /* We need to include config.h so that we know whether we are building diff --git a/tests/run-genkey.c b/tests/run-genkey.c index 20e7db5..c5abc42 100644 --- a/tests/run-genkey.c +++ b/tests/run-genkey.c @@ -14,7 +14,7 @@ * 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 . + * License along with this program; if not, see . */ /* We need to include config.h so that we know whether we are building diff --git a/tests/run-identify.c b/tests/run-identify.c index d5ce55f..01e9671 100644 --- a/tests/run-identify.c +++ b/tests/run-identify.c @@ -14,7 +14,7 @@ * 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 . + * License along with this program; if not, see . */ /* We need to include config.h so that we know whether we are building diff --git a/tests/run-import.c b/tests/run-import.c index 9225f61..081c0fa 100644 --- a/tests/run-import.c +++ b/tests/run-import.c @@ -14,7 +14,7 @@ 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 . + License along with this program; if not, see . */ /* We need to include config.h so that we know whether we are building diff --git a/tests/run-keylist.c b/tests/run-keylist.c index 647a9ed..93fbeb5 100644 --- a/tests/run-keylist.c +++ b/tests/run-keylist.c @@ -14,7 +14,7 @@ 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 . + License along with this program; if not, see . */ /* We need to include config.h so that we know whether we are building diff --git a/tests/run-keysign.c b/tests/run-keysign.c index f5a13e4..5f6cfce 100644 --- a/tests/run-keysign.c +++ b/tests/run-keysign.c @@ -14,7 +14,7 @@ * 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 . + * License along with this program; if not, see . */ /* We need to include config.h so that we know whether we are building diff --git a/tests/run-sign.c b/tests/run-sign.c index f790cb6..9f2e175 100644 --- a/tests/run-sign.c +++ b/tests/run-sign.c @@ -14,7 +14,7 @@ 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 . + License along with this program; if not, see . */ /* We need to include config.h so that we know whether we are building diff --git a/tests/run-support.h b/tests/run-support.h index e4a4f70..841b223 100644 --- a/tests/run-support.h +++ b/tests/run-support.h @@ -15,7 +15,7 @@ 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 . + License along with this program; if not, see . */ #include diff --git a/tests/run-swdb.c b/tests/run-swdb.c index 91ed22f..a373254 100644 --- a/tests/run-swdb.c +++ b/tests/run-swdb.c @@ -14,7 +14,7 @@ * 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 . + * License along with this program; if not, see . */ /* We need to include config.h so that we know whether we are building diff --git a/tests/run-tofu.c b/tests/run-tofu.c index 9e3b117..1f11c2d 100644 --- a/tests/run-tofu.c +++ b/tests/run-tofu.c @@ -14,7 +14,7 @@ * 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 . + * License along with this program; if not, see . */ /* We need to include config.h so that we know whether we are building diff --git a/tests/run-verify.c b/tests/run-verify.c index 22242c0..3abc572 100644 --- a/tests/run-verify.c +++ b/tests/run-verify.c @@ -14,7 +14,7 @@ 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 . + License along with this program; if not, see . */ /* We need to include config.h so that we know whether we are building ----------------------------------------------------------------------- Summary of changes: Makefile.am | 2 +- NEWS | 22 +++++++- README | 2 +- autogen.sh | 2 +- configure.ac | 18 +++---- doc/gpl.texi | 8 +-- doc/texinfo.tex | 124 +++++++++++++++++++++---------------------- gpgme.spec.in | 2 +- m4/glib-2.0.m4 | 22 ++++---- m4/libtool.m4 | 2 +- m4/pkg.m4 | 8 +-- src/Makefile.am | 2 +- src/argparse.c | 4 +- src/argparse.h | 2 +- src/b64dec.c | 2 +- src/context.h | 2 +- src/data-identify.c | 2 +- src/dirinfo.c | 2 +- src/engine-assuan.c | 2 +- src/engine-backend.h | 2 +- src/engine-gpg.c | 2 +- src/engine-gpgconf.c | 2 +- src/engine-spawn.c | 2 +- src/engine.c | 2 +- src/export.c | 2 +- src/genkey.c | 2 +- src/getauditlog.c | 2 +- src/gpgme-tool.c | 2 +- src/gpgme-w32spawn.c | 2 +- src/gpgme.c | 2 +- src/keylist.c | 2 +- src/keysign.c | 2 +- src/mbox-util.c | 2 +- src/mbox-util.h | 2 +- src/op-support.c | 2 +- src/opassuan.c | 2 +- src/parsetlv.c | 2 +- src/parsetlv.h | 2 +- src/passwd.c | 2 +- src/posix-io.c | 2 +- src/queryswdb.c | 2 +- src/sys-util.h | 2 +- src/tofupolicy.c | 2 +- src/ttyname_r.c | 2 +- src/w32-ce.c | 2 +- src/w32-util.c | 2 +- tests/Makefile.am | 2 +- tests/gpg/t-decrypt-verify.c | 2 +- tests/gpgsm/cms-decrypt.c | 2 +- tests/gpgsm/cms-keylist.c | 2 +- tests/opassuan/t-command.c | 2 +- tests/run-decrypt.c | 2 +- tests/run-encrypt.c | 2 +- tests/run-export.c | 2 +- tests/run-genkey.c | 2 +- tests/run-identify.c | 2 +- tests/run-import.c | 2 +- tests/run-keylist.c | 2 +- tests/run-keysign.c | 2 +- tests/run-sign.c | 2 +- tests/run-support.h | 2 +- tests/run-swdb.c | 2 +- tests/run-tofu.c | 2 +- tests/run-verify.c | 2 +- 64 files changed, 170 insertions(+), 150 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Wed Nov 16 21:05:39 2016 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Wed, 16 Nov 2016 21:05:39 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.1.15-378-gc4506a3 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via c4506a3f15bba5d257cb4c6738800c5e00ecc9a2 (commit) from c564790df723beef031d83802bd7830737bd330a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit c4506a3f15bba5d257cb4c6738800c5e00ecc9a2 Author: Werner Koch Date: Wed Nov 16 17:43:59 2016 +0100 common: Rename keybox_file_rename to gnupg_rename_file. * kbx/keybox-util.c (keybox_file_rename): Rename to ... * common/sysutils.c (gnupg_rename_file): this. Change all callers. Signed-off-by: Werner Koch diff --git a/common/sysutils.c b/common/sysutils.c index a0addd1..c7df872 100644 --- a/common/sysutils.c +++ b/common/sysutils.c @@ -618,6 +618,76 @@ gnupg_remove (const char *fname) } +/* Wrapper for rename(2) to handle Windows peculiarities. If + * BLOCK_SIGNALS is not NULL and points to a variable set to true, all + * signals will be blocked by calling gnupg_block_all_signals; the + * caller needs to call gnupg_unblock_all_signals if that variable is + * still set to true on return. */ +gpg_error_t +gnupg_rename_file (const char *oldname, const char *newname, int *block_signals) +{ + gpg_error_t err = 0; + + if (block_signals && *block_signals) + gnupg_block_all_signals (); + +#ifdef HAVE_DOSISH_SYSTEM + { + int wtime = 0; + + gnupg_remove (newname); + again: + if (rename (oldname, newname)) + { + if (GetLastError () == ERROR_SHARING_VIOLATION) + { + /* Another process has the file open. We do not use a + * lock for read but instead we wait until the other + * process has closed the file. This may take long but + * that would also be the case with a dotlock approach for + * read and write. Note that we don't need this on Unix + * due to the inode concept. + * + * So let's wait until the rename has worked. The retry + * intervals are 50, 100, 200, 400, 800, 50ms, ... */ + if (!wtime || wtime >= 800) + wtime = 50; + else + wtime *= 2; + + if (wtime >= 800) + log_info (_("waiting for file '%s' to become accessible ...\n"), + oldname); + + Sleep (wtime); + goto again; + } + err = my_error_from_syserror (); + } + } +#else /* Unix */ + { +#ifdef __riscos__ + gnupg_remove (newname); +#endif + if (rename (oldname, newname) ) + err = my_error_from_syserror (); + } +#endif /* Unix */ + + if (block_signals && *block_signals && err) + { + gnupg_unblock_all_signals (); + *block_signals = 0; + } + + if (err) + log_error (_("renaming '%s' to '%s' failed: %s\n"), + oldname, newname, gpg_strerror (err)); + return err; +} + + #ifndef HAVE_W32_SYSTEM static mode_t modestr_to_mode (const char *modestr) diff --git a/common/sysutils.h b/common/sysutils.h index 0847da7..fef6ba1 100644 --- a/common/sysutils.h +++ b/common/sysutils.h @@ -61,6 +61,8 @@ FILE *gnupg_tmpfile (void); void gnupg_reopen_std (const char *pgmname); void gnupg_allow_set_foregound_window (pid_t pid); int gnupg_remove (const char *fname); +gpg_error_t gnupg_rename_file (const char *oldname, const char *newname, + int *block_signals); int gnupg_mkdir (const char *name, const char *modestr); int gnupg_chmod (const char *name, const char *modestr); char *gnupg_mkdtemp (char *template); diff --git a/g10/keyring.c b/g10/keyring.c index 091151b..f1281e9 100644 --- a/g10/keyring.c +++ b/g10/keyring.c @@ -1351,12 +1351,12 @@ rename_tmp_file (const char *bakfname, const char *tmpfname, const char *fname) /* First make a backup file. */ block = 1; - rc = keybox_file_rename (fname, bakfname, &block); + rc = gnupg_rename_file (fname, bakfname, &block); if (rc) goto fail; /* then rename the file */ - rc = keybox_file_rename (tmpfname, fname, NULL); + rc = gnupg_rename_file (tmpfname, fname, NULL); if (block) { gnupg_unblock_all_signals (); diff --git a/kbx/keybox-update.c b/kbx/keybox-update.c index dcf8b2e..31171de 100644 --- a/kbx/keybox-update.c +++ b/kbx/keybox-update.c @@ -122,13 +122,13 @@ rename_tmp_file (const char *bakfname, const char *tmpfname, if (!secret) { block = 1; - rc = keybox_file_rename (fname, bakfname, &block); + rc = gnupg_rename_file (fname, bakfname, &block); if (rc) goto leave; } /* Then rename the file. */ - rc = keybox_file_rename (tmpfname, fname, NULL); + rc = gnupg_rename_file (tmpfname, fname, NULL); if (block) { gnupg_unblock_all_signals (); diff --git a/kbx/keybox-util.c b/kbx/keybox-util.c index aacd0a4..486753c 100644 --- a/kbx/keybox-util.c +++ b/kbx/keybox-util.c @@ -147,73 +147,9 @@ keybox_tmp_names (const char *filename, int for_keyring, return 0; } - -/* Wrapper for rename(2) to handle Windows peculiarities. If - * BLOCK_SIGNALS is not NULL and points to a variable set to true, all - * signals will be blocked by calling gnupg_block_all_signals; the - * caller needs to call gnupg_unblock_all_signals if that variable is - * still set to true on return. */ gpg_error_t keybox_file_rename (const char *oldname, const char *newname, int *block_signals) { - gpg_error_t err = 0; - - if (block_signals && *block_signals) - gnupg_block_all_signals (); - -#ifdef HAVE_DOSISH_SYSTEM - { - int wtime = 0; - - gnupg_remove (newname); - again: - if (rename (oldname, newname)) - { - if (GetLastError () == ERROR_SHARING_VIOLATION) - { - /* Another process has the file open. We do not use a - * lock for read but instead we wait until the other - * process has closed the file. This may take long but - * that would also be the case with a dotlock approach for - * read and write. Note that we don't need this on Unix - * due to the inode concept. - * - * So let's wait until the rename has worked. The retry - * intervals are 50, 100, 200, 400, 800, 50ms, ... */ - if (!wtime || wtime >= 800) - wtime = 50; - else - wtime *= 2; - - if (wtime >= 800) - log_info ("waiting for file '%s' to become accessible ...\n", - oldname); - - Sleep (wtime); - goto again; - } - err = gpg_error_from_syserror (); - } - } -#else /* Unix */ - { -#ifdef __riscos__ - gnupg_remove (newname); -#endif - if (rename (oldname, newname) ) - err = gpg_error_from_syserror (); - } -#endif /* Unix */ - - if (block_signals && *block_signals && err) - { - gnupg_unblock_all_signals (); - *block_signals = 0; - } - - if (err) - log_error ("renaming '%s' to '%s' failed: %s\n", - oldname, newname, gpg_strerror (err)); - return err; + return gnupg_rename_file (oldname, newname, block_signals); } diff --git a/kbx/keybox.h b/kbx/keybox.h index a248bf0..5c2824a 100644 --- a/kbx/keybox.h +++ b/kbx/keybox.h @@ -134,8 +134,6 @@ void keybox_set_malloc_hooks ( void *(*new_alloc_func)(size_t n), gpg_error_t keybox_tmp_names (const char *filename, int for_keyring, char **r_bakname, char **r_tmpname); -gpg_error_t keybox_file_rename (const char *oldname, const char *newname, - int *block_signals); #ifdef __cplusplus ----------------------------------------------------------------------- Summary of changes: common/sysutils.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++++ common/sysutils.h | 2 ++ g10/keyring.c | 4 +-- kbx/keybox-update.c | 4 +-- kbx/keybox-util.c | 66 +------------------------------------------------- kbx/keybox.h | 2 -- 6 files changed, 77 insertions(+), 71 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Wed Nov 16 21:25:27 2016 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Wed, 16 Nov 2016 21:25:27 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.1.15-380-g52c10a2 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via 52c10a280af6ce06eb1732ff35b095f2b8d24b9f (commit) via 4839e6d002a8ad1f7d3260792c3c9641e258f342 (commit) from c4506a3f15bba5d257cb4c6738800c5e00ecc9a2 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 52c10a280af6ce06eb1732ff35b095f2b8d24b9f Author: Werner Koch Date: Wed Nov 16 21:22:39 2016 +0100 dirmngr: Add command to only load the swdb. * dirmngr/loadswdb.c: New. * dirmngr/Makefile.am (dirmngr_SOURCES): Add that file. * dirmngr/server.c: Remove includes cpparray.h and exectool.h. (cmd_loadswdb): New. (parse_version_number,parse_version_string): Remove. (my_mktmpdir, cmp_version): Remove. (fetch_into_tmpdir): Remove. (struct verify_swdb_parm_s): Remove. (verify_swdb_status_cb): Remove. (cmd_versioncheck): Remove. (register_commands): Register LOADSWDB. Remove VERSIONCHECK. -- This change is required to to the new design where gpgconf does the version check w/o network access and only dirmngr is responsible for getting the swdb. In the next installment the loading will be triggered as needed. Signed-off-by: Werner Koch diff --git a/dirmngr/Makefile.am b/dirmngr/Makefile.am index bd70c8c..2a18a50 100644 --- a/dirmngr/Makefile.am +++ b/dirmngr/Makefile.am @@ -56,6 +56,7 @@ noinst_HEADERS = dirmngr.h crlcache.h crlfetch.h misc.h dirmngr_SOURCES = dirmngr.c dirmngr.h server.c crlcache.c crlfetch.c \ certcache.c certcache.h \ + loadswdb.c \ cdb.h cdblib.c misc.c dirmngr-err.h \ ocsp.c ocsp.h validate.c validate.h \ dns-stuff.c dns-stuff.h \ diff --git a/dirmngr/dirmngr.h b/dirmngr/dirmngr.h index 107059d..42b3b2b 100644 --- a/dirmngr/dirmngr.h +++ b/dirmngr/dirmngr.h @@ -206,5 +206,8 @@ gpg_error_t dirmngr_status_help (ctrl_t ctrl, const char *text); gpg_error_t dirmngr_tick (ctrl_t ctrl); +/*-- loadswdb.c --*/ +gpg_error_t dirmngr_load_swdb (ctrl_t ctrl, int force); + #endif /*DIRMNGR_H*/ diff --git a/dirmngr/loadswdb.c b/dirmngr/loadswdb.c new file mode 100644 index 0000000..57a7e04 --- /dev/null +++ b/dirmngr/loadswdb.c @@ -0,0 +1,358 @@ +/* loadswdb.c - Load the swdb file from versions.gnupg.org + * Copyright (C) 2016 g10 Code GmbH + * + * This file is part of GnuPG. + * + * GnuPG is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * GnuPG 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 General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see . + */ + +#include + +#include +#include +#include + +#include "dirmngr.h" +#include "../common/ccparray.h" +#include "../common/exectool.h" +#include "misc.h" +#include "ks-engine.h" + + +/* Get the time from the current swdb file and store it at R_TIME. If + * the file does not exist 0 is stored at R_TIME. The function + * returns 0 on sucess or an error code. */ +static gpg_error_t +time_of_saved_swdb (const char *fname, time_t *r_time) +{ + gpg_error_t err; + estream_t fp = NULL; + char *line = NULL; + size_t length_of_line = 0; + size_t maxlen; + ssize_t len; + char *fields[2]; + time_t t = (time_t)(-1); + + *r_time = 0; + + fp = es_fopen (fname, "r"); + err = fp? 0 : gpg_error_from_syserror (); + if (err) + { + if (gpg_err_code (err) == GPG_ERR_ENOENT) + err = 0; /* No file - assume time is the year of Unix. */ + goto leave; + } + + /* Note that the parser uses the first occurance of a matching + * values and ignores possible duplicated values. */ + maxlen = 2048; /* Set limit. */ + while ((len = es_read_line (fp, &line, &length_of_line, &maxlen)) > 0) + { + if (!maxlen) + { + err = gpg_error (GPG_ERR_LINE_TOO_LONG); + goto leave; + } + /* Strip newline and carriage return, if present. */ + while (len > 0 && (line[len - 1] == '\n' || line[len - 1] == '\r')) + line[--len] = '\0'; + + if (split_fields (line, fields, DIM (fields)) < DIM(fields)) + continue; /* Skip empty lines and names w/o a value. */ + if (*fields[0] == '#') + continue; /* Skip comments. */ + + /* Record the meta data. */ + if (!strcmp (fields[0], ".filedate")) + { + gnupg_isotime_t isot; + if (string2isotime (isot, fields[1]) + && (t = isotime2epoch (isot)) != (time_t)(-1)) + break; /* Got the time - stop reading. */ + } + } + if (len < 0 || es_ferror (fp)) + { + err = gpg_error_from_syserror (); + goto leave; + } + if (t == (time_t)(-1)) + { + err = gpg_error (GPG_ERR_INV_TIME); + goto leave; + } + + *r_time = t; + + leave: + if (err) + log_error (_("error reading '%s': %s\n"), fname, gpg_strerror (err)); + xfree (line); + es_fclose (fp); + return err; +} + + + +/* Read a file from URL and return it as an estream memory buffer at + * R_FP. */ +static gpg_error_t +fetch_file (ctrl_t ctrl, const char *url, estream_t *r_fp) +{ + gpg_error_t err; + estream_t fp = NULL; + estream_t httpfp = NULL; + size_t nread, nwritten; + char buffer[1024]; + + if ((err = ks_http_fetch (ctrl, url, &httpfp))) + goto leave; + + /* We now read the data from the web server into a memory buffer. + * To avoid excessive memory use in case of a ill behaving server we + * put a 64 k size limit on the buffer. As of today the actual size + * of the swdb.lst file is 3k. */ + fp = es_fopenmem (64*1024, "rw"); + if (!fp) + { + err = gpg_error_from_syserror (); + log_error ("error allocating memory buffer: %s\n", gpg_strerror (err)); + goto leave; + } + + for (;;) + { + if (es_read (httpfp, buffer, sizeof buffer, &nread)) + { + err = gpg_error_from_syserror (); + log_error ("error reading '%s': %s\n", + es_fname_get (httpfp), gpg_strerror (err)); + goto leave; + } + + if (!nread) + break; /* Ready. */ + if (es_write (fp, buffer, nread, &nwritten)) + { + err = gpg_error_from_syserror (); + log_error ("error writing '%s': %s\n", + es_fname_get (fp), gpg_strerror (err)); + goto leave; + } + else if (nread != nwritten) + { + err = gpg_error (GPG_ERR_EIO); + log_error ("error writing '%s': %s\n", + es_fname_get (fp), "short write"); + goto leave; + } + } + + es_rewind (fp); + *r_fp = fp; + fp = NULL; + + leave: + es_fclose (httpfp); + es_fclose (fp); + return err; +} + + +/* Communication object for verify_status_cb. */ +struct verify_status_parm_s +{ + time_t sigtime; + int anyvalid; +}; + +static void +verify_status_cb (void *opaque, const char *keyword, char *args) +{ + struct verify_status_parm_s *parm = opaque; + + /* We care only about the first valid signature. */ + if (!strcmp (keyword, "VALIDSIG") && !parm->anyvalid) + { + char *fields[3]; + + parm->anyvalid = 1; + if (split_fields (args, fields, DIM (fields)) >= 3) + parm->sigtime = parse_timestamp (fields[2], NULL); + } +} + + + +/* Load the swdb file into the current home directory. Do this onlky + * when needed unless FORCE is set which will always get a new + * copy. */ +gpg_error_t +dirmngr_load_swdb (ctrl_t ctrl, int force) +{ + gpg_error_t err; + char *fname = NULL; /* The swdb.lst file. */ + char *tmp_fname = NULL; /* The temporary swdb.lst file. */ + char *keyfile_fname = NULL; + estream_t swdb = NULL; + estream_t swdb_sig = NULL; + ccparray_t ccp; + const char **argv = NULL; + struct verify_status_parm_s verify_status_parm = { (time_t)(-1), 0 }; + estream_t outfp = NULL; + time_t now = gnupg_get_time (); + gnupg_isotime_t isotime; + + + fname = make_filename_try (gnupg_homedir (), "swdb.lst", NULL); + if (!fname) + { + err = gpg_error_from_syserror (); + goto leave; + } + + /* Check whether there is a need to get an update. */ + if (!force) + { + time_t filetime; + + err = time_of_saved_swdb (fname, &filetime); + if (err) + goto leave; + if (filetime >= now) + goto leave; /* Current or newer. */ + if (now - filetime < 3*86400) + goto leave; /* Not older than 3 days. */ + } + + /* Create the filename of the file with the keys. */ + keyfile_fname = make_filename_try (gnupg_datadir (), "distsigkey.gpg", NULL); + if (!keyfile_fname) + goto leave; + + /* Fetch the swdb from the web. */ + err = fetch_file (ctrl, "https://versions.gnupg.org/swdb.lst", &swdb); + if (err) + goto leave; + err = fetch_file (ctrl, "https://versions.gnupg.org/swdb.lst.sig", &swdb_sig); + if (err) + goto leave; + + /* Run gpgv. */ + ccparray_init (&ccp, 0); + ccparray_put (&ccp, "--enable-special-filenames"); + ccparray_put (&ccp, "--status-fd=2"); + ccparray_put (&ccp, "--keyring"); + ccparray_put (&ccp, keyfile_fname); + ccparray_put (&ccp, "--"); + ccparray_put (&ccp, "-&@INEXTRA@"); + ccparray_put (&ccp, "-"); + ccparray_put (&ccp, NULL); + argv = ccparray_get (&ccp, NULL); + if (!argv) + { + err = gpg_error_from_syserror (); + goto leave; + } + + err = gnupg_exec_tool_stream (gnupg_module_name (GNUPG_MODULE_NAME_GPGV), + argv, swdb, swdb_sig, NULL, + verify_status_cb, &verify_status_parm); + if (!err && verify_status_parm.sigtime == (time_t)(-1)) + err = gpg_error (verify_status_parm.anyvalid? GPG_ERR_BAD_SIGNATURE + /**/ : GPG_ERR_INV_TIME ); + if (err) + goto leave; + + /* Create a file name for a temporary file in the home directory. + * We will later rename that file to the real name. */ + { + char *tmpstr; + +#ifdef HAVE_W32_SYSTEM + tmpstr = es_bsprintf ("tmp-%u-swdb", (unsigned int)getpid ()); +#else + tmpstr = es_bsprintf (".#%u.swdb", (unsigned int)getpid ()); +#endif + if (!tmpstr) + { + err = gpg_error_from_syserror (); + goto leave; + } + tmp_fname = make_filename_try (gnupg_homedir (), tmpstr, NULL); + xfree (tmpstr); + if (!tmp_fname) + { + err = gpg_error_from_syserror (); + goto leave; + } + } + + outfp = es_fopen (tmp_fname, "w"); + if (!outfp) + { + err = gpg_error_from_syserror (); + log_error (_("error creating '%s': %s\n"), tmp_fname, gpg_strerror (err)); + goto leave; + } + + epoch2isotime (isotime, verify_status_parm.sigtime); + es_fprintf (outfp, ".filedate %s\n", isotime); + epoch2isotime (isotime, now); + es_fprintf (outfp, ".verified %s\n", isotime); + + if (es_fseek (swdb, 0, SEEK_SET)) + { + err = gpg_error_from_syserror (); + goto leave; + } + + err = copy_stream (swdb, outfp); + if (err) + { + /* Well, it might also be a reading error, but that is pretty + * unlikely for a memory stream. */ + log_error (_("error writing '%s': %s\n"), tmp_fname, gpg_strerror (err)); + goto leave; + } + + if (es_fclose (outfp)) + { + err = gpg_error_from_syserror (); + log_error (_("error writing '%s': %s\n"), tmp_fname, gpg_strerror (err)); + goto leave; + } + outfp = NULL; + + err = gnupg_rename_file (tmp_fname, fname, NULL); + if (err) + goto leave; + xfree (tmp_fname); + tmp_fname = NULL; + + + leave: + es_fclose (outfp); + if (tmp_fname) + gnupg_remove (tmp_fname); /* This is a temporary file. */ + xfree (argv); + es_fclose (swdb_sig); + es_fclose (swdb); + xfree (keyfile_fname); + xfree (tmp_fname); + xfree (fname); + return err; +} diff --git a/dirmngr/server.c b/dirmngr/server.c index 2122d54..5c78d64 100644 --- a/dirmngr/server.c +++ b/dirmngr/server.c @@ -54,8 +54,6 @@ #include "mbox-util.h" #include "zb32.h" #include "server-help.h" -#include "ccparray.h" -#include "../common/exectool.h" /* To avoid DoS attacks we limit the size of a certificate to something reasonable. The DoS was actually only an issue back when @@ -2239,6 +2237,22 @@ cmd_ks_put (assuan_context_t ctx, char *line) } + +static const char hlp_loadswdb[] = + "LOADSWDB [--force]\n" + "\n" + "Load and verify the swdb.lst from the Net."; +static gpg_error_t +cmd_loadswdb (assuan_context_t ctx, char *line) +{ + ctrl_t ctrl = assuan_get_pointer (ctx); + gpg_error_t err; + + err = dirmngr_load_swdb (ctrl, has_option (line, "--force")); + + return leave_cmd (ctx, err); +} + static const char hlp_getinfo[] = @@ -2343,388 +2357,6 @@ cmd_reloaddirmngr (assuan_context_t ctx, char *line) -/* This function parses the first portion of the version number S and - * stores it in *NUMBER. On success, this function returns a pointer - * into S starting with the first character, which is not part of the - * initial number portion; on failure, NULL is returned. */ -static const char* -parse_version_number (const char *s, int *number) -{ - int val = 0; - - if (*s == '0' && digitp (&s[1])) - return NULL; /* Leading zeros are not allowed. */ - for (; digitp (s); s++) - { - val *= 10; - val += *s - '0'; - } - *number = val; - return val < 0 ? NULL : s; -} - - -/* This function breaks up the complete string-representation of the - * version number S, which is of the following struture: .[.]. The major, - * minor and micro number components will be stored in *MAJOR, *MINOR - * and *MICRO. If MICRO is not given 0 is used instead. - * - * On success, the last component, the patch level, will be returned; - * on failure, NULL will be returned. */ -static const char * -parse_version_string (const char *s, int *major, int *minor, int *micro) -{ - s = parse_version_number (s, major); - if (!s || *s != '.') - return NULL; - s++; - s = parse_version_number (s, minor); - if (!s) - return NULL; - if (*s == '.') - { - s++; - s = parse_version_number (s, micro); - if (!s) - return NULL; - } - else - micro = 0; - return s; /* Patchlevel. */ -} - - -/* Create temporary directory with mode 0700. Returns a dynamically - * allocated string with the filename of the directory. */ -static char * -my_mktmpdir (void) -{ - char *name, *p; - - p = getenv ("TMPDIR"); - if (!p || !*p) - p = "/tmp"; - if (p[strlen (p) - 1] == '/') - name = strconcat (p, "gpg-XXXXXX", NULL); - else - name = strconcat (p, "/", "gpg-XXXXXX", NULL); - if (!name || !gnupg_mkdtemp (name)) - { - int saveerr = errno; - log_error (_("can't create temporary directory '%s': %s\n"), - name, strerror (saveerr)); - gpg_err_set_errno (saveerr); - return NULL; - } - - return name; -} - - -/* Sets result to -1 if version a is less than b, 0 if the versions are equal - * and 1 otherwise. Patch levels are compared as strings. */ -static gpg_error_t -cmp_version (const char *a, const char *b, int *result) -{ - int a_major, b_major; - int a_minor, b_minor; - int a_micro, b_micro; - const char *a_patch, *b_patch; - - if (!a || !b || !result) - return gpg_error (GPG_ERR_EINVAL); - - a_patch = parse_version_string (a, &a_major, &a_minor, &a_micro); - b_patch = parse_version_string (b, &b_major, &b_minor, &b_micro); - - if (!a_patch || !b_patch) - return gpg_error (GPG_ERR_EINVAL); - - if (a_major == b_major) - { - if (a_minor == b_minor) - { - if (a_micro == b_micro) - *result = strcmp (a_patch, b_patch); - else - *result = a_micro - b_minor; - } - else - *result = a_minor - b_minor; - } - else - *result = a_major - b_major; - - return 0; -} - - -static gpg_error_t -fetch_into_tmpdir (ctrl_t ctrl, const char *url, estream_t *strm_out, - char **path) -{ - gpg_error_t err; - char *filename = NULL; - char *dirname = NULL; - estream_t file = NULL; - estream_t strm = NULL; - size_t len, nwritten; - char buf[1024]; - - if (!strm_out || !path || !url) - { - err = gpg_error (GPG_ERR_INV_ARG); - goto leave; - } - - dirname = my_mktmpdir (); - if (!dirname) - { - err = gpg_error_from_syserror (); - goto leave; - } - - filename = strconcat (dirname, DIRSEP_S, "file", NULL); - if (!filename) - { - err = gpg_error_from_syserror (); - goto leave; - } - - file = es_fopen (filename, "w+"); - if (!file) - { - err = gpg_error_from_syserror (); - goto leave; - } - - if ((err = ks_http_fetch (ctrl, url, &strm))) - goto leave; - - for (;;) - { - if (es_read (strm, buf, sizeof buf, &len)) - { - err = gpg_error_from_syserror (); - log_error ("error reading '%s': %s\n", - es_fname_get (strm), gpg_strerror (err)); - goto leave; - } - - if (!len) - break; - if (es_write (file, buf, len, &nwritten)) - { - err = gpg_error_from_syserror (); - log_error ("error writing '%s': %s\n", filename, gpg_strerror (err)); - goto leave; - } - else if (len != nwritten) - { - err = gpg_error (GPG_ERR_EIO); - log_error ("error writing '%s': %s\n", filename, "short write"); - goto leave; - } - } - - es_rewind (file); - *strm_out = file; - file = NULL; - - if (path) - { - *path = dirname; - dirname = NULL; - } - - leave: - es_fclose (file); - es_fclose (strm); - xfree (dirname); - xfree (filename); - return err; -} - - -struct verify_swdb_parm_s -{ - time_t sigtime; - int anyvalid; -}; - -static void -verify_swdb_status_cb (void *opaque, const char *keyword, char *args) -{ - struct verify_swdb_parm_s *parm = opaque; - - /* We care only about the first valid signature. */ - if (!strcmp (keyword, "VALIDSIG") && !parm->anyvalid) - { - char *fields[3]; - - parm->anyvalid = 1; - if (split_fields (args, fields, DIM (fields)) >= 3) - parm->sigtime = parse_timestamp (fields[2], NULL); - } -} - - -static const char hlp_versioncheck[] = - "VERSIONCHECK " - "\n" - "Checks the internet to find whenever a new program version is available." - "\n" - " program name i.e. \"gnupg\"\n" - " current version of the program i.e. \"2.0.2\""; -static gpg_error_t -cmd_versioncheck (assuan_context_t ctx, char *line) -{ - gpg_error_t err; - - char *name; - char *version; - size_t name_len; - char *cmd_fields[2]; - - ctrl_t ctrl; - estream_t swdb = NULL; - estream_t swdb_sig = NULL; - char* swdb_dir = NULL; - char* swdb_sig_dir = NULL; - char* buf = NULL; - size_t len = 0; - ccparray_t ccp; - const char **argv = NULL; - char keyring_name[128]; - char swdb_name[128]; - char swdb_sig_name[128]; - - struct verify_swdb_parm_s verify_swdb_parm = { (time_t)(-1), 0 }; - - - swdb_name[0] = 0; - swdb_sig_name[0] = 0; - ctrl = assuan_get_pointer (ctx); - - if (split_fields (line, cmd_fields, 2) != 2) - { - err = set_error (GPG_ERR_ASS_PARAMETER, - "No program name and/or version given"); - goto out; - } - - name = cmd_fields[0]; - name_len = strlen (name); - version = cmd_fields[1]; - - if ((err = fetch_into_tmpdir (ctrl, "https://versions.gnupg.org/swdb.lst", - &swdb, &swdb_dir))) - goto out; - - snprintf (swdb_name, sizeof swdb_name, "%s%s%s", swdb_dir, DIRSEP_S, "file"); - - if ((err = fetch_into_tmpdir (ctrl, "https://versions.gnupg.org/swdb.lst.sig", - &swdb_sig, &swdb_sig_dir))) - goto out; - - snprintf (keyring_name, sizeof keyring_name, "%s%s%s", gnupg_datadir (), - DIRSEP_S, "distsigkey.gpg"); - snprintf (swdb_sig_name, sizeof swdb_sig_name, "%s%s%s", swdb_sig_dir, - DIRSEP_S, "file"); - - ccparray_init (&ccp, 0); - ccparray_put (&ccp, "--status-fd=2"); - ccparray_put (&ccp, "--keyring"); - ccparray_put (&ccp, keyring_name); - ccparray_put (&ccp, "--"); - ccparray_put (&ccp, swdb_sig_name); - ccparray_put (&ccp, "-"); - ccparray_put (&ccp, NULL); - argv = ccparray_get (&ccp, NULL); - if (!argv) - { - err = gpg_error_from_syserror (); - goto out; - } - - if ((err = gnupg_exec_tool_stream (gnupg_module_name (GNUPG_MODULE_NAME_GPGV), - argv, swdb, NULL, NULL, - verify_swdb_status_cb, &verify_swdb_parm))) - goto out; - if (verify_swdb_parm.sigtime == (time_t)(-1)) - { - if (verify_swdb_parm.anyvalid) - err = gpg_error (GPG_ERR_BAD_SIGNATURE); - else - err = gpg_error (GPG_ERR_INV_TIME); - goto out; - } - - { - gnupg_isotime_t tbuf; - - epoch2isotime (tbuf, verify_swdb_parm.sigtime); - log_debug ("swdb created: %s\n", tbuf); - } - - es_fseek (swdb, 0, SEEK_SET); - - while (es_getline (&buf, &len, swdb) > 0) - { - if (len > name_len + 5 && - strncmp (buf, name, name_len) == 0 && - strncmp (buf + name_len, "_ver ", 5) == 0) - { - const char* this_ver_start = buf + name_len + 5; - char* this_ver_end = strchr (this_ver_start, '\n'); - int cmp; - - if (this_ver_end) - *this_ver_end = 0; - - err = assuan_write_status (ctx, "LINE", buf); - - err = cmp_version (this_ver_start, version, &cmp); - if (err > 0) - goto out; - - if (cmp < 0) - err = assuan_send_data (ctx, "ROLLBACK", strlen ("ROLLBACK")); - else if (cmp == 0) - err = assuan_send_data (ctx, "CURRENT", strlen ("CURRENT")); - else - err = assuan_send_data (ctx, "UPDATE", strlen ("UPDATE")); - - goto out; - } - } - - err = assuan_send_data (ctx, "NOT_FOUND", strlen ("NOT_FOUND")); - - out: - es_fclose (swdb); - es_fclose (swdb_sig); - xfree (buf); - - if (strlen (swdb_name) > 0) - remove (swdb_name); - if (swdb_dir) - rmdir (swdb_dir); - xfree (swdb_dir); - - if (strlen (swdb_sig_name) > 0) - remove (swdb_sig_name); - if (swdb_sig_dir) - rmdir (swdb_sig_dir); - xfree (swdb_sig_dir); - xfree (argv); - - return leave_cmd (ctx, err); -} - - - /* Tell the assuan library about our commands. */ static int register_commands (assuan_context_t ctx) @@ -2751,9 +2383,9 @@ register_commands (assuan_context_t ctx) { "KS_FETCH", cmd_ks_fetch, hlp_ks_fetch }, { "KS_PUT", cmd_ks_put, hlp_ks_put }, { "GETINFO", cmd_getinfo, hlp_getinfo }, + { "LOADSWDB", cmd_loadswdb, hlp_loadswdb }, { "KILLDIRMNGR",cmd_killdirmngr,hlp_killdirmngr }, { "RELOADDIRMNGR",cmd_reloaddirmngr,hlp_reloaddirmngr }, - { "VERSIONCHECK",cmd_versioncheck,hlp_versioncheck }, { NULL, NULL } }; int i, j, rc; commit 4839e6d002a8ad1f7d3260792c3c9641e258f342 Author: Werner Koch Date: Wed Nov 16 21:17:47 2016 +0100 scd,dirmngr: Keep the standard fds when daemonizing. * dirmngr/dirmngr.c (main): Before calling setsid do not close the standard fds but connect them to /dev/null. * scd/scdaemon.c (main): Ditto. Noet that the old test for a log stream was even reverted. -- Note that this was fixed for gpg-agent 10 years ago on 2006-11-09. Signed-off-by: Werner Koch diff --git a/dirmngr/dirmngr.c b/dirmngr/dirmngr.c index 254c543..db5079c 100644 --- a/dirmngr/dirmngr.c +++ b/dirmngr/dirmngr.c @@ -1209,8 +1209,18 @@ main (int argc, char **argv) for (i=0; i <= 2; i++) { if (!log_test_fd (i) && i != fd ) - close (i); + { + if ( !close (i) + && open ("/dev/null", i? O_WRONLY : O_RDONLY) == -1) + { + log_error ("failed to open '%s': %s\n", + "/dev/null", strerror (errno)); + cleanup (); + dirmngr_exit (1); + } + } } + if (setsid() == -1) { log_error ("setsid() failed: %s\n", strerror(errno) ); diff --git a/scd/scdaemon.c b/scd/scdaemon.c index acc5b47..064cae9 100644 --- a/scd/scdaemon.c +++ b/scd/scdaemon.c @@ -871,9 +871,19 @@ main (int argc, char **argv ) /* Close stdin, stdout and stderr unless it is the log stream. */ for (i=0; i <= 2; i++) { - if ( log_test_fd (i) && i != fd) - close (i); + if (!log_test_fd (i) && i != fd ) + { + if ( !close (i) + && open ("/dev/null", i? O_WRONLY : O_RDONLY) == -1) + { + log_error ("failed to open '%s': %s\n", + "/dev/null", strerror (errno)); + cleanup (); + exit (1); + } + } } + if (setsid() == -1) { log_error ("setsid() failed: %s\n", strerror(errno) ); ----------------------------------------------------------------------- Summary of changes: dirmngr/Makefile.am | 1 + dirmngr/dirmngr.c | 12 +- dirmngr/dirmngr.h | 3 + dirmngr/loadswdb.c | 358 ++++++++++++++++++++++++++++++++++++++++++++++ dirmngr/server.c | 402 +++------------------------------------------------- scd/scdaemon.c | 14 +- 6 files changed, 402 insertions(+), 388 deletions(-) create mode 100644 dirmngr/loadswdb.c hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Thu Nov 17 04:50:50 2016 From: cvs at cvs.gnupg.org (by Dmitry Eremin-Solenikov) Date: Thu, 17 Nov 2016 04:50:50 +0100 Subject: [git] GCRYPT - branch, master, updated. libgcrypt-1.7.3-13-g5ca63c9 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU crypto library". The branch, master has been updated via 5ca63c92825453fdb369a97bbc19cb95b49b4296 (commit) from b829dfe9f0eeff08c956ba3f3a6b559b9d2199dd (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 5ca63c92825453fdb369a97bbc19cb95b49b4296 Author: Dmitry Eremin-Solenikov Date: Wed Nov 16 23:36:01 2016 +0300 cipher/gost28147: Fix CryptoPro-B S-BOX. * cipher/gost-s-box.c: CryptoPro_B s-box missed one line, resulting in incorrect encryption/decryption using that s-box. Add missing data. Signed-off-by: Dmitry Eremin-Solenikov diff --git a/cipher/gost-s-box.c b/cipher/gost-s-box.c index 0094f65..7bf6041 100644 --- a/cipher/gost-s-box.c +++ b/cipher/gost-s-box.c @@ -132,6 +132,7 @@ struct gost_sbox 0xA, 0x3, 0x8, 0xC, 0x0, 0x7, 0xD, 0x9, 0xC, 0xF, 0xF, 0xF, 0xD, 0xF, 0x0, 0x6, + 0xD, 0xB, 0x3, 0x4, 0x6, 0xA, 0x6, 0xF, 0x6, 0x8, 0x6, 0xE, 0x8, 0x0, 0xF, 0xD, 0x7, 0x6, 0x1, 0x9, 0xE, 0x9, 0x8, 0x5, 0xF, 0xE, 0x4, 0x8, 0x3, 0x5, 0xE, 0xC, ----------------------------------------------------------------------- Summary of changes: cipher/gost-s-box.c | 1 + 1 file changed, 1 insertion(+) hooks/post-receive -- The GNU crypto library http://git.gnupg.org From cvs at cvs.gnupg.org Thu Nov 17 04:51:16 2016 From: cvs at cvs.gnupg.org (by Dmitry Eremin-Solenikov) Date: Thu, 17 Nov 2016 04:51:16 +0100 Subject: [git] GCRYPT - branch, LIBGCRYPT-1-7-BRANCH, updated. libgcrypt-1.7.3-12-g15718db Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU crypto library". The branch, LIBGCRYPT-1-7-BRANCH has been updated via 15718db54b2888a704b020cb1032954b443c6686 (commit) from bf6d5b10cb4173826f47ac080506b68bb001acb2 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 15718db54b2888a704b020cb1032954b443c6686 Author: Dmitry Eremin-Solenikov Date: Wed Nov 16 23:36:01 2016 +0300 cipher/gost28147: Fix CryptoPro-B S-BOX. * cipher/gost-s-box.c: CryptoPro_B s-box missed one line, resulting in incorrect encryption/decryption using that s-box. Add missing data. -- Backport of master commit: 5ca63c92825453fdb369a97bbc19cb95b49b4296 Signed-off-by: Dmitry Eremin-Solenikov diff --git a/cipher/gost-s-box.c b/cipher/gost-s-box.c index 0094f65..7bf6041 100644 --- a/cipher/gost-s-box.c +++ b/cipher/gost-s-box.c @@ -132,6 +132,7 @@ struct gost_sbox 0xA, 0x3, 0x8, 0xC, 0x0, 0x7, 0xD, 0x9, 0xC, 0xF, 0xF, 0xF, 0xD, 0xF, 0x0, 0x6, + 0xD, 0xB, 0x3, 0x4, 0x6, 0xA, 0x6, 0xF, 0x6, 0x8, 0x6, 0xE, 0x8, 0x0, 0xF, 0xD, 0x7, 0x6, 0x1, 0x9, 0xE, 0x9, 0x8, 0x5, 0xF, 0xE, 0x4, 0x8, 0x3, 0x5, 0xE, 0xC, ----------------------------------------------------------------------- Summary of changes: cipher/gost-s-box.c | 1 + 1 file changed, 1 insertion(+) hooks/post-receive -- The GNU crypto library http://git.gnupg.org From cvs at cvs.gnupg.org Thu Nov 17 06:29:33 2016 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Thu, 17 Nov 2016 06:29:33 +0100 Subject: [git] GPG-ERROR - branch, master, updated. libgpg-error-1.25-2-geeef6b8 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Error codes used by GnuPG et al.". The branch, master has been updated via eeef6b8724b43e105ae2beef022fc957eb228bcf (commit) from ea053ec3cbc5dd2eba160bcc873d80fb13e1f1e1 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit eeef6b8724b43e105ae2beef022fc957eb228bcf Author: NIIBE Yutaka Date: Thu Nov 17 14:23:07 2016 +0900 Fix EXEEXT for lock obj creation. * src/Makefile.am (lock-obj-pub.native.h): Add EXEEXT for the executable gen-posix-lock-obj. -- This change is from packaging work for Cygwin. Reported-by: Michael Haubenwallner Signed-off-by: NIIBE Yutaka diff --git a/src/Makefile.am b/src/Makefile.am index 0c18252..e5e907d 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -291,7 +291,7 @@ else pre_mkheader_cmds = : parts_of_gpg_error_h += ./lock-obj-pub.native.h -./lock-obj-pub.native.h: Makefile gen-posix-lock-obj posix-lock-obj.h +./lock-obj-pub.native.h: Makefile gen-posix-lock-obj$(EXEEXT) posix-lock-obj.h ./gen-posix-lock-obj >$@ endif ----------------------------------------------------------------------- Summary of changes: src/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- Error codes used by GnuPG et al. http://git.gnupg.org From cvs at cvs.gnupg.org Thu Nov 17 09:22:31 2016 From: cvs at cvs.gnupg.org (by Heiko Becker) Date: Thu, 17 Nov 2016 09:22:31 +0100 Subject: [git] GPGME - branch, master, updated. gpgme-1.8.0-2-g572c1aa Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 572c1aac107125ce62230251713349348373db5a (commit) from af79327021b5b3a5c4accd5d4e9f0124199bfdcc (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 572c1aac107125ce62230251713349348373db5a Author: Heiko Becker Date: Wed Nov 16 23:09:45 2016 +0100 Remove a forgotten instance of @libsuffix@ * lang/cpp/src/GpgmeppConfig.cmake.in.in: Remove a forgotten instance of @libsuffix at . -- b2c07bd47bd608afa5cc819b60a7b5bb8c9dd96a removed @libsuffix@ from cmake config files, but missed one instance. Signed-off-by: Heiko Becker diff --git a/lang/cpp/src/GpgmeppConfig.cmake.in.in b/lang/cpp/src/GpgmeppConfig.cmake.in.in index 928d19f..cbe9713 100644 --- a/lang/cpp/src/GpgmeppConfig.cmake.in.in +++ b/lang/cpp/src/GpgmeppConfig.cmake.in.in @@ -63,7 +63,7 @@ add_library(Gpgmepp SHARED IMPORTED) set_target_properties(Gpgmepp PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "@resolved_includedir@/gpgme++;@resolved_includedir@" - INTERFACE_LINK_LIBRARIES "pthread;@resolved_libdir@/libgpgme at libsuffix@;@LIBASSUAN_LIBS@" + INTERFACE_LINK_LIBRARIES "pthread;@resolved_libdir@/libgpgme.so;@LIBASSUAN_LIBS@" IMPORTED_LOCATION "@resolved_libdir@/libgpgmepp.so" ) ----------------------------------------------------------------------- Summary of changes: lang/cpp/src/GpgmeppConfig.cmake.in.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Thu Nov 17 10:17:08 2016 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Thu, 17 Nov 2016 10:17:08 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.1.15-383-gbd91f92 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via bd91f92ace09263e3a91177f2a1644379baeb08a (commit) via c45ca316a54665915ae08399484db271566db7c0 (commit) via d8da5bc50b856db3445435780311c9f8e52a5144 (commit) from 52c10a280af6ce06eb1732ff35b095f2b8d24b9f (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit bd91f92ace09263e3a91177f2a1644379baeb08a Author: Werner Koch Date: Thu Nov 17 10:14:14 2016 +0100 dirmngr: Auto-sownload the swdb.lst * dirmngr/dirmngr.h (struct opt): Add field allow_version_check. * dirmngr/dirmngr.c (oAllowVersionCheck): New. (opts): Add --allow-version-check. (network_activity_seen): New variable. (parse_rereadable_options): Set opt.allow_version_check. (main) : Do not anymore set the no change flag for Windows. Add allow-version-check. (netactivity_action): Set network_activity_seen. (housekeeping_thread): Call dirmngr_load_swdb. * tools/gpgconf-comp.c (gc_options_dirmngr): Add allow-version-check. Make "use-tor" available at Basic level. Signed-off-by: Werner Koch diff --git a/dirmngr/dirmngr.c b/dirmngr/dirmngr.c index db5079c..9d4fb14 100644 --- a/dirmngr/dirmngr.c +++ b/dirmngr/dirmngr.c @@ -131,6 +131,7 @@ enum cmd_and_opt_values { oFakedSystemTime, oForce, oAllowOCSP, + oAllowVersionCheck, oSocketName, oLDAPWrapperProgram, oHTTPWrapperProgram, @@ -176,6 +177,8 @@ static ARGPARSE_OPTS opts[] = { ARGPARSE_s_n (oBatch, "batch", N_("run without asking a user")), ARGPARSE_s_n (oForce, "force", N_("force loading of outdated CRLs")), ARGPARSE_s_n (oAllowOCSP, "allow-ocsp", N_("allow sending OCSP requests")), + ARGPARSE_s_n (oAllowVersionCheck, "allow-version-check", + N_("allow online software version check")), ARGPARSE_s_n (oDisableHTTP, "disable-http", N_("inhibit the use of HTTP")), ARGPARSE_s_n (oDisableLDAP, "disable-ldap", N_("inhibit the use of LDAP")), ARGPARSE_s_n (oIgnoreHTTPDP,"ignore-http-dp", @@ -289,6 +292,10 @@ static int disable_check_own_socket; /* Counter for the active connections. */ static int active_connections; +/* This flag is set by any network access and used by the housekeeping + * thread to run background network tasks. */ +static int network_activity_seen; + /* The timer tick used for housekeeping stuff. For Windows we use a longer period as the SetWaitableTimer seems to signal earlier than the 2 seconds. All values are in seconds. */ @@ -526,6 +533,7 @@ parse_rereadable_options (ARGPARSE_ARGS *pargs, int reread) opt.ignore_ldap_dp = 0; opt.ignore_ocsp_service_url = 0; opt.allow_ocsp = 0; + opt.allow_version_check = 0; opt.ocsp_responder = NULL; opt.ocsp_max_clock_skew = 10 * 60; /* 10 minutes. */ opt.ocsp_max_period = 90 * 86400; /* 90 days. */ @@ -588,6 +596,7 @@ parse_rereadable_options (ARGPARSE_ARGS *pargs, int reread) case oIgnoreOCSPSvcUrl: opt.ignore_ocsp_service_url = 1; break; case oAllowOCSP: opt.allow_ocsp = 1; break; + case oAllowVersionCheck: opt.allow_version_check = 1; break; case oOCSPResponder: opt.ocsp_responder = pargs->r.ret_str; break; case oOCSPSigner: opt.ocsp_signer = parse_ocsp_signer (pargs->r.ret_str); @@ -1329,15 +1338,6 @@ main (int argc, char **argv) char *filename; char *filename_esc; -#ifdef HAVE_W32_SYSTEM - /* On Windows systems, dirmngr always runs as system daemon, and - the per-user configuration is never used. So we short-cut - everything to use the global system configuration of dirmngr - above, and here we set the no change flag to make these - read-only. */ - flags |= GC_OPT_FLAG_NO_CHANGE; -#endif - /* First the configuration file. This is not an option, but it is vital information for GPG Conf. */ if (!opt.config_filename) @@ -1375,6 +1375,7 @@ main (int argc, char **argv) es_printf ("max-replies:%lu:%u\n", flags | GC_OPT_FLAG_DEFAULT, DEFAULT_MAX_REPLIES); es_printf ("allow-ocsp:%lu:\n", flags | GC_OPT_FLAG_NONE); + es_printf ("allow-version-check:%lu:\n", flags | GC_OPT_FLAG_NONE); es_printf ("ocsp-responder:%lu:\n", flags | GC_OPT_FLAG_NONE); es_printf ("ocsp-signer:%lu:\n", flags | GC_OPT_FLAG_NONE); @@ -1723,7 +1724,7 @@ dirmngr_sighup_action (void) static void netactivity_action (void) { - log_debug ("network activity seen\n"); + network_activity_seen = 1; } @@ -1782,6 +1783,7 @@ housekeeping_thread (void *arg) { static int sentinel; time_t curtime; + struct server_control_s ctrlbuf; (void)arg; @@ -1795,7 +1797,18 @@ housekeeping_thread (void *arg) if (opt.verbose > 1) log_info ("starting housekeeping\n"); + memset (&ctrlbuf, 0, sizeof ctrlbuf); + dirmngr_init_default_ctrl (&ctrlbuf); + ks_hkp_housekeeping (curtime); + if (network_activity_seen) + { + network_activity_seen = 0; + if (opt.use_tor || opt.allow_version_check) + dirmngr_load_swdb (&ctrlbuf, 0); + } + + dirmngr_deinit_default_ctrl (&ctrlbuf); if (opt.verbose > 1) log_info ("ready with housekeeping\n"); diff --git a/dirmngr/dirmngr.h b/dirmngr/dirmngr.h index 42b3b2b..da1c4be 100644 --- a/dirmngr/dirmngr.h +++ b/dirmngr/dirmngr.h @@ -92,6 +92,7 @@ struct int running_detached; /* We are running in detached mode. */ int use_tor; /* Tor mode has been enabled. */ + int allow_version_check; /* --allow-version-check is active. */ int force; /* Force loading outdated CRLs. */ diff --git a/doc/dirmngr.texi b/doc/dirmngr.texi index 300068e..73afbc3 100644 --- a/doc/dirmngr.texi +++ b/doc/dirmngr.texi @@ -244,6 +244,15 @@ this still leaks the DNS queries; e.g. to lookup the hosts in a keyserver pool. Certain other features are disabled if this mode is active. + at item --allow-version-check + at opindex allow-version-check +Allow Dirmngr to connect to @code{https://versions.gnupg.org} to get +the list of current software versions. If this option is enabled, or +if @option{use-tor} is active, the list is retrieved when the local +copy does not exist or is older than 5 to 7 days. See the option + at option{--query-swdb} of the command @command{gpgconf} for more +details. + @item --keyserver @var{name} @opindex keyserver Use @var{name} as your keyserver. This is the server that @command{gpg} diff --git a/tools/gpgconf-comp.c b/tools/gpgconf-comp.c index 48c1b68..cd99c81 100644 --- a/tools/gpgconf-comp.c +++ b/tools/gpgconf-comp.c @@ -909,11 +909,14 @@ static gc_option_t gc_options_dirmngr[] = { "force", GC_OPT_FLAG_NONE, GC_LEVEL_BASIC, "dirmngr", "force loading of outdated CRLs", GC_ARG_TYPE_NONE, GC_BACKEND_DIRMNGR }, + { "allow-version-check", GC_OPT_FLAG_NONE, GC_LEVEL_BASIC, + "dirmngr", "allow online software version check", + GC_ARG_TYPE_NONE, GC_BACKEND_DIRMNGR }, { "Tor", GC_OPT_FLAG_GROUP, GC_LEVEL_BASIC, "gnupg", N_("Options controlling the use of Tor") }, - { "use-tor", GC_OPT_FLAG_NONE, GC_LEVEL_INVISIBLE, + { "use-tor", GC_OPT_FLAG_NONE, GC_LEVEL_BASIC, "dirmngr", "route all network traffic via TOR", GC_ARG_TYPE_NONE, GC_BACKEND_DIRMNGR }, commit c45ca316a54665915ae08399484db271566db7c0 Author: Werner Koch Date: Thu Nov 17 10:07:11 2016 +0100 dirmngr: Improve downloading of swdb.lst. * dirmngr/loadswdb.c (time_of_saved_swdb): Aslo return the "verified" timestamp. (dirmngr_load_swdb): Avoid unnecessary disk or network access witout FORCE. Do not update swdb.lst if it did not change. Signed-off-by: Werner Koch diff --git a/dirmngr/loadswdb.c b/dirmngr/loadswdb.c index 57a7e04..bc56c2a 100644 --- a/dirmngr/loadswdb.c +++ b/dirmngr/loadswdb.c @@ -30,11 +30,11 @@ #include "ks-engine.h" -/* Get the time from the current swdb file and store it at R_TIME. If - * the file does not exist 0 is stored at R_TIME. The function - * returns 0 on sucess or an error code. */ +/* Get the time from the current swdb file and store it at R_FILEDATE + * and R_VERIFIED. If the file does not exist 0 is stored at there. + * The function returns 0 on sucess or an error code. */ static gpg_error_t -time_of_saved_swdb (const char *fname, time_t *r_time) +time_of_saved_swdb (const char *fname, time_t *r_filedate, time_t *r_verified) { gpg_error_t err; estream_t fp = NULL; @@ -43,9 +43,12 @@ time_of_saved_swdb (const char *fname, time_t *r_time) size_t maxlen; ssize_t len; char *fields[2]; - time_t t = (time_t)(-1); + gnupg_isotime_t isot; + time_t filedate = (time_t)(-1); + time_t verified = (time_t)(-1); - *r_time = 0; + *r_filedate = 0; + *r_verified = 0; fp = es_fopen (fname, "r"); err = fp? 0 : gpg_error_from_syserror (); @@ -76,12 +79,15 @@ time_of_saved_swdb (const char *fname, time_t *r_time) continue; /* Skip comments. */ /* Record the meta data. */ - if (!strcmp (fields[0], ".filedate")) + if (filedate == (time_t)(-1) && !strcmp (fields[0], ".filedate")) { - gnupg_isotime_t isot; - if (string2isotime (isot, fields[1]) - && (t = isotime2epoch (isot)) != (time_t)(-1)) - break; /* Got the time - stop reading. */ + if (string2isotime (isot, fields[1])) + filedate = isotime2epoch (isot); + } + else if (verified == (time_t)(-1) && !strcmp (fields[0], ".verified")) + { + if (string2isotime (isot, fields[1])) + verified = isotime2epoch (isot); } } if (len < 0 || es_ferror (fp)) @@ -89,13 +95,14 @@ time_of_saved_swdb (const char *fname, time_t *r_time) err = gpg_error_from_syserror (); goto leave; } - if (t == (time_t)(-1)) + if (filedate == (time_t)(-1) || verified == (time_t)(-1)) { err = gpg_error (GPG_ERR_INV_TIME); goto leave; } - *r_time = t; + *r_filedate = filedate; + *r_verified = verified; leave: if (err) @@ -214,6 +221,8 @@ dirmngr_load_swdb (ctrl_t ctrl, int force) struct verify_status_parm_s verify_status_parm = { (time_t)(-1), 0 }; estream_t outfp = NULL; time_t now = gnupg_get_time (); + time_t filedate = 0; /* ".filedate" from our swdb. */ + time_t verified = 0; /* ".verified" from our swdb. */ gnupg_isotime_t isotime; @@ -227,15 +236,37 @@ dirmngr_load_swdb (ctrl_t ctrl, int force) /* Check whether there is a need to get an update. */ if (!force) { - time_t filetime; + static int not_older_than; + static time_t lastcheck; + + if (!not_older_than) + { + /* To balance access to the server we use a random time from + * 5 to 7 days for update checks. */ + not_older_than = 5 * 86400; + not_older_than += (get_uint_nonce () % (2*86400)); + } - err = time_of_saved_swdb (fname, &filetime); + if (now - lastcheck < 3600) + { + /* We checked our swdb file in the last hour - don't check + * again to avoid unnecessary disk access. */ + err = 0; + goto leave; + } + lastcheck = now; + + err = time_of_saved_swdb (fname, &filedate, &verified); + if (gpg_err_code (err) == GPG_ERR_INV_TIME) + err = 0; /* Force reading. */ if (err) goto leave; - if (filetime >= now) + if (filedate >= now) goto leave; /* Current or newer. */ - if (now - filetime < 3*86400) - goto leave; /* Not older than 3 days. */ + if (now - filedate < not_older_than) + goto leave; /* Our copy is pretty new (not older than 7 days). */ + if (verified > now && now - verified < 3*3600) + goto leave; /* We downloaded and verified in the last 3 hours. */ } /* Create the filename of the file with the keys. */ @@ -277,6 +308,11 @@ dirmngr_load_swdb (ctrl_t ctrl, int force) if (err) goto leave; + /* If our swdb is not older than the downloaded one. We don't + * bother to update. */ + if (!force && filedate >= verify_status_parm.sigtime) + goto leave; + /* Create a file name for a temporary file in the home directory. * We will later rename that file to the real name. */ { diff --git a/doc/tools.texi b/doc/tools.texi index 6e578a3..b1ed615 100644 --- a/doc/tools.texi +++ b/doc/tools.texi @@ -307,7 +307,15 @@ is given, check that file instead. @item --query-swdb @var{package_name} [@var{version_string}] Returns the current version for @var{package_name} and if @var{version_string} is given also an indicator on whether an update -is available. +is available. The actual file with the software version is +automatically downloaded and checked by @command{dirmngr}. + at command{dirmngr} uses a thresholds to avoid download the file too +often and it does this by default only if it can be done via Tor. To +force an update of that file this command can be used: + + at example + gpg-connect-agent --dirmngr 'loadswdb --force' /bye + at end example @item --reload [@var{component}] commit d8da5bc50b856db3445435780311c9f8e52a5144 Author: Werner Koch Date: Thu Nov 17 09:56:32 2016 +0100 gpgconf: Change the displayed names of the components. Signed-off-by: Werner Koch diff --git a/tools/gpgconf-comp.c b/tools/gpgconf-comp.c index 55e822c..48c1b68 100644 --- a/tools/gpgconf-comp.c +++ b/tools/gpgconf-comp.c @@ -1060,12 +1060,12 @@ static struct gc_option_t *options; } gc_component[] = { - { "gpg", "gnupg", N_("GPG for OpenPGP"), gc_options_gpg }, - { "gpg-agent","gnupg", N_("GPG Agent"), gc_options_gpg_agent }, - { "scdaemon", "gnupg", N_("Smartcard Daemon"), gc_options_scdaemon }, - { "gpgsm", "gnupg", N_("GPG for S/MIME"), gc_options_gpgsm }, - { "dirmngr", "gnupg", N_("Key Acquirer"), gc_options_dirmngr }, - { "pinentry", "gnupg", N_("PIN and Passphrase Entry"), gc_options_pinentry } + { "gpg", "gnupg", N_("OpenPGP"), gc_options_gpg }, + { "gpg-agent","gnupg", N_("Private Keys"), gc_options_gpg_agent }, + { "scdaemon", "gnupg", N_("Smartcards"), gc_options_scdaemon }, + { "gpgsm", "gnupg", N_("S/MIME"), gc_options_gpgsm }, + { "dirmngr", "gnupg", N_("Network"), gc_options_dirmngr }, + { "pinentry", "gnupg", N_("Passphrase Entry"), gc_options_pinentry } }; ----------------------------------------------------------------------- Summary of changes: dirmngr/dirmngr.c | 33 ++++++++++++++++-------- dirmngr/dirmngr.h | 1 + dirmngr/loadswdb.c | 72 +++++++++++++++++++++++++++++++++++++++------------- doc/dirmngr.texi | 9 +++++++ doc/tools.texi | 10 +++++++- tools/gpgconf-comp.c | 17 ++++++++----- 6 files changed, 106 insertions(+), 36 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Thu Nov 17 13:25:48 2016 From: cvs at cvs.gnupg.org (by Justus Winter) Date: Thu, 17 Nov 2016 13:25:48 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.1.15-385-g4f18932 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via 4f189325a409bb08f7a8eabfac3f4579288cf5c5 (commit) via fc53a4d06eaf891143ab4efec9caffe31ebc2bc0 (commit) from bd91f92ace09263e3a91177f2a1644379baeb08a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 4f189325a409bb08f7a8eabfac3f4579288cf5c5 Author: Justus Winter Date: Thu Nov 17 11:58:34 2016 +0100 gpgscm: Re-enable the garbage collector in case of errors. * tests/gpgscm/scheme.c (opexe_0): Enable gc before calling 'Error_1'. Fixes-commit: 83c184a66b73f312425b01008f0495610e5329a4 Signed-off-by: Justus Winter diff --git a/tests/gpgscm/scheme.c b/tests/gpgscm/scheme.c index fe8b9dd..ee8992e 100644 --- a/tests/gpgscm/scheme.c +++ b/tests/gpgscm/scheme.c @@ -709,7 +709,8 @@ gc_reservation_failure(struct scheme *sc) /* Disable the garbage collection and reserve the given number of * cells. gc_disable may be nested, but the enclosing reservation - * must include the reservations of all nested calls. */ + * must include the reservations of all nested calls. Note: You must + * re-enable the gc before calling Error_X. */ static void _gc_disable(struct scheme *sc, size_t reserve, int lineno) { @@ -3013,6 +3014,7 @@ static pointer opexe_0(scheme *sc, enum scheme_opcodes op) { sc->args = cons(sc, sc->value, sc->args); if (is_pair(sc->code)) { /* continue */ if (!is_pair(car(sc->code)) || !is_pair(cdar(sc->code))) { + gc_enable(sc); Error_1(sc, "Bad syntax of binding spec in let :", car(sc->code)); } commit fc53a4d06eaf891143ab4efec9caffe31ebc2bc0 Author: Justus Winter Date: Wed Nov 16 09:26:37 2016 +0100 gpgscm: Fix string. * tests/gpgscm/scheme.c (type_to_string): Fix string. Signed-off-by: Justus Winter diff --git a/tests/gpgscm/scheme.c b/tests/gpgscm/scheme.c index 1db6456..fe8b9dd 100644 --- a/tests/gpgscm/scheme.c +++ b/tests/gpgscm/scheme.c @@ -144,7 +144,7 @@ type_to_string (enum scheme_types typ) case T_PROC: return "proc"; case T_PAIR: return "pair"; case T_CLOSURE: return "closure"; - case T_CONTINUATION: return "configuration"; + case T_CONTINUATION: return "continuation"; case T_FOREIGN: return "foreign"; case T_CHARACTER: return "character"; case T_PORT: return "port"; ----------------------------------------------------------------------- Summary of changes: tests/gpgscm/scheme.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Thu Nov 17 15:39:31 2016 From: cvs at cvs.gnupg.org (by Daniel Kahn Gillmor) Date: Thu, 17 Nov 2016 15:39:31 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.1.15-389-g8fb4822 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via 8fb482252436b3b4b0b33663d95d1d17188ad1d9 (commit) via 7c1613d41566f7d8db116790087de323621205fe (commit) via c4e02a3b7ad6ee1da6bfc439921378bdbd5c029c (commit) via 5210ff70bc79673d14f346297798d8d7bafc8215 (commit) from 4f189325a409bb08f7a8eabfac3f4579288cf5c5 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 8fb482252436b3b4b0b33663d95d1d17188ad1d9 Author: Daniel Kahn Gillmor Date: Thu Oct 27 18:30:59 2016 -0400 dirmngr: Use a default keyserver if none is explicitly set * configure.ac: Define DIRMNGR_DEFAULT_KEYSERVER. * dirmngr/server.c (ensure_keyserver): Use it if no keyservers are set. * doc/dirmngr.texi: Document this behavior. -- A user who doesn't specify a keyserver, but asks gnupg to fetch a key currently just gets a simple error messages "No keyserver available". If the user is asking to contact a keyserver, we should have a reasonable default, and not require them to fiddle with settings when they might not know what settings to choose. This patch makes the default hkps://hkps.pool.sks-keyservers.net. Signed-off-by: Daniel Kahn Gillmor diff --git a/configure.ac b/configure.ac index bc3e2a8..1b77a45 100644 --- a/configure.ac +++ b/configure.ac @@ -1764,6 +1764,9 @@ AC_DEFINE_UNQUOTED(SCDAEMON_SOCK_NAME, "S.scdaemon", [The name of the SCdaemon socket]) AC_DEFINE_UNQUOTED(DIRMNGR_SOCK_NAME, "S.dirmngr", [The name of the dirmngr socket]) +AC_DEFINE_UNQUOTED(DIRMNGR_DEFAULT_KEYSERVER, + "hkps://hkps.pool.sks-keyservers.net", + [The default keyserver for dirmngr to use, if none is explicitly given]) AC_DEFINE_UNQUOTED(GPGEXT_GPG, "gpg", [The standard binary file suffix]) diff --git a/dirmngr/server.c b/dirmngr/server.c index 5c78d64..0088498 100644 --- a/dirmngr/server.c +++ b/dirmngr/server.c @@ -1810,7 +1810,11 @@ ensure_keyserver (ctrl_t ctrl) if (ctrl->server_local->keyservers) return 0; /* Already set for this session. */ if (!opt.keyserver) - return 0; /* No global option set. */ + { + /* No global option set. Fall back to default: */ + return make_keyserver_item (DIRMNGR_DEFAULT_KEYSERVER, + &ctrl->server_local->keyservers); + } for (sl = opt.keyserver; sl; sl = sl->next) { diff --git a/doc/dirmngr.texi b/doc/dirmngr.texi index bc3072c..be4e97a 100644 --- a/doc/dirmngr.texi +++ b/doc/dirmngr.texi @@ -277,6 +277,8 @@ service (.onion), Dirmngr selects the keyserver to use depending on whether Tor is locally running or not. The check for a running Tor is done for each new connection. +If no keyserver is explicitly configured, dirmngr will use the +built-in default of hkps://hkps.pool.sks-keyservers.net. @item --nameserver @var{ipaddr} @opindex nameserver commit 7c1613d41566f7d8db116790087de323621205fe Author: Daniel Kahn Gillmor Date: Thu Oct 27 18:30:58 2016 -0400 dirmngr: Add system CAs if no hkp-cacert is given * dirmngr/dirmngr.c (http_session_new): If the user isn't talking to the HKPS pool, and they have not specified any hkp-cacert, then we should default to the system CAs, rather than nothing. * doc/dirmngr.texi: Document choice of CAs. -- Consider three possible classes of dirmngr configuration: a) no hkps:// keyserver URLs at all (communication with keyservers is entirely in the clear) b) hkps:// keyserver URLs, but no hkp-cacert directives c) hkps:// keyserver URLs, and at least one hkp-cacert directive class (a) provides no confidentiality of requests. class (b) currently will never work because the server certificate cannot be validated. class (c) is currently supported as intended. This patch allows users with configurations in class (b) to work as most users expect (relying on the system certificate authorities), without affecting users in classes (a) or (c). Signed-off-by: Daniel Kahn Gillmor o minor indentation fix - wk diff --git a/dirmngr/http.c b/dirmngr/http.c index 90682fa..bc62c82 100644 --- a/dirmngr/http.c +++ b/dirmngr/http.c @@ -613,6 +613,8 @@ http_session_new (http_session_t *r_session, const char *tls_priority, const char *errpos; int rc; strlist_t sl; + int add_system_cas = !!(flags & HTTP_FLAG_TRUST_SYS); + int is_hkps_pool; rc = gnutls_certificate_allocate_credentials (&sess->certcred); if (rc < 0) @@ -623,13 +625,14 @@ http_session_new (http_session_t *r_session, const char *tls_priority, goto leave; } + is_hkps_pool = (intended_hostname + && !ascii_strcasecmp (intended_hostname, + "hkps.pool.sks-keyservers.net")); + /* If the user has not specified a CA list, and they are looking * for the hkps pool from sks-keyservers.net, then default to * Kristian's certificate authority: */ - if (!tls_ca_certlist - && intended_hostname - && !ascii_strcasecmp (intended_hostname, - "hkps.pool.sks-keyservers.net")) + if (!tls_ca_certlist && is_hkps_pool) { char *pemname = make_filename_try (gnupg_datadir (), "sks-keyservers.netCA.pem", NULL); @@ -662,10 +665,12 @@ http_session_new (http_session_t *r_session, const char *tls_priority, log_info ("setting CA from file '%s' failed: %s\n", sl->d, gnutls_strerror (rc)); } + if (!tls_ca_certlist && !is_hkps_pool) + add_system_cas = 1; } /* Add system certificates to the session. */ - if ((flags & HTTP_FLAG_TRUST_SYS)) + if (add_system_cas) { #if GNUTLS_VERSION_NUMBER >= 0x030014 static int shown; diff --git a/doc/dirmngr.texi b/doc/dirmngr.texi index 73afbc3..bc3072c 100644 --- a/doc/dirmngr.texi +++ b/doc/dirmngr.texi @@ -461,6 +461,11 @@ the file is in PEM format a suffix of @code{.pem} is expected for @var{file}. This option may be given multiple times to add more root certificates. Tilde expansion is supported. +If no @code{hkp-cacert} directive is present, dirmngr will make a +reasonable choice: if the keyserver in question is the special pool + at code{hkps.pool.sks-keyservers.net}, it will use the bundled root +certificate for that pool. Otherwise, it will use the system CAs. + @end table commit c4e02a3b7ad6ee1da6bfc439921378bdbd5c029c Author: Daniel Kahn Gillmor Date: Thu Oct 27 18:30:57 2016 -0400 dirmngr: Register hkp-cacert even if the file doesn't exist yet * dirmngr/dirmngr.c (parse_readable_options): If we're unable to turn an argument for hkp-cacert into an absolute filename, terminate completely. * dirmngr/http.c (http_register_tls_ca): Show a warning if file is not immediately accessible, but register it anyway. -- Without this changeset, the condition of the filesystem when dirmngr is initialized will have an effect on later activities of dirmngr. For example, if a file identified by a hkp-cacert directive doesn't exist when dirmngr starts, dirmngr will behave as though it simply didn't have the hkp-cacert directive set at all, even if the file should appear later. dirmngr currently behaves differently if no hkp-cacert directives have been set then it does when at least one hkp-cacert directive has been set. For example, its choice of CA cert for hkps://hkps.pool.sks-keyservers.net depends on whether a TLS CA file has been registered. That behavior shouldn't additionally depend on the state of the filesystem at the time of dirmngr launch. Signed-off-by: Daniel Kahn Gillmor diff --git a/dirmngr/dirmngr.c b/dirmngr/dirmngr.c index 9d4fb14..f5dce81 100644 --- a/dirmngr/dirmngr.c +++ b/dirmngr/dirmngr.c @@ -611,15 +611,9 @@ parse_rereadable_options (ARGPARSE_ARGS *pargs, int reread) { char *tmpname; - /* Do tilde expansion and print a warning if the file can't be - accessed. */ - tmpname = make_absfilename_try (pargs->r.ret_str, NULL); - if (!tmpname || access (tmpname, F_OK)) - log_info (_("can't access '%s': %s\n"), - tmpname? tmpname : pargs->r.ret_str, - gpg_strerror (gpg_error_from_syserror())); - else - http_register_tls_ca (tmpname); + /* Do tilde expansion and make path absolute. */ + tmpname = make_absfilename (pargs->r.ret_str, NULL); + http_register_tls_ca (tmpname); xfree (tmpname); } break; diff --git a/dirmngr/http.c b/dirmngr/http.c index b74a9ef..90682fa 100644 --- a/dirmngr/http.c +++ b/dirmngr/http.c @@ -495,6 +495,11 @@ http_register_tls_ca (const char *fname) } else { + /* Warn if we can't access right now, but register it anyway in + case it becomes accessible later */ + if (access (fname, F_OK)) + log_info (_("can't access '%s': %s\n"), fname, + gpg_strerror (gpg_error_from_syserror())); sl = add_to_strlist (&tls_ca_certlist, fname); if (*sl->d && !strcmp (sl->d + strlen (sl->d) - 4, ".pem")) sl->flags = 1; commit 5210ff70bc79673d14f346297798d8d7bafc8215 Author: Werner Koch Date: Thu Nov 17 10:46:43 2016 +0100 doc: Typo fixes. -- Reported-by: Nathan Musoke diff --git a/doc/gpg.texi b/doc/gpg.texi index c69e512..e3756e9 100644 --- a/doc/gpg.texi +++ b/doc/gpg.texi @@ -1853,7 +1853,7 @@ Maximum depth of a certification chain (default is 5). @opindex no-sig-cache Do not cache the verification status of key signatures. Caching gives a much better performance in key listings. However, if -you suspect that your public keyring is not save against write +you suspect that your public keyring is not safe against write modifications, you can use this option to disable the caching. It probably does not make sense to disable it because all kind of damage can be done if someone else has write access to your public keyring. @@ -2758,8 +2758,8 @@ protected by the signature. @opindex emit-version Force inclusion of the version string in ASCII armored output. If given once only the name of the program and the major number is -emitted, given twice the minor is also emitted, given triple -the micro is added, and given quad an operating system identification +emitted, given twice the minor is also emitted, given thrice +the micro is added, and given four times an operating system identification is also emitted. @option{--no-emit-version} (default) disables the version line. diff --git a/g10/keyedit.c b/g10/keyedit.c index 171afb7..795be05 100644 --- a/g10/keyedit.c +++ b/g10/keyedit.c @@ -2953,7 +2953,7 @@ keyedit_quick_adduid (ctrl_t ctrl, const char *username, const char *newuid) keydb_release (kdbhd); } -/* Unattended revokation of a keyid. USERNAME specifies the +/* Unattended revocation of a keyid. USERNAME specifies the key. UIDTOREV is the user id revoke from the key. */ void keyedit_quick_revuid (ctrl_t ctrl, const char *username, const char *uidtorev) ----------------------------------------------------------------------- Summary of changes: configure.ac | 3 +++ dirmngr/dirmngr.c | 12 +++--------- dirmngr/http.c | 20 +++++++++++++++----- dirmngr/server.c | 6 +++++- doc/dirmngr.texi | 7 +++++++ doc/gpg.texi | 6 +++--- g10/keyedit.c | 2 +- 7 files changed, 37 insertions(+), 19 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Thu Nov 17 15:40:13 2016 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Thu, 17 Nov 2016 15:40:13 +0100 Subject: [git] GpgOL - branch, master, updated. gpgol-1.4.0-177-gc7c293a Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG extension for MS Outlook". The branch, master has been updated via c7c293a1c69de961abf388664b2897b509d9a934 (commit) via 20995f156333c9cf3d8fe0703a685890f58c54d8 (commit) via ecf4e2cca83970e9ddfe7dbd77cdf1b9d0bdd589 (commit) via 425e52bb2262c8edf96c37e60c706cfec2bbd3f5 (commit) from 7424fd0fcad08ce4de7492c28d5d1bec1060661d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit c7c293a1c69de961abf388664b2897b509d9a934 Author: Andre Heinecke Date: Thu Nov 17 15:36:45 2016 +0100 Start locate-keys when a recipient is added * src/mail.cpp (Mail::locate_keys): Check for recipient keys. (do_locate): New. (Mail::needs_crypto): Return flags. * src/mail.h: Update accordingly. * src/mailitem-events.cpp (EVENT_SINK_INVOKE): Handle recipient changes and do locate_keys if necessary. -- Checked addresses are stored in a set so that they are not searched twice per session to avoid spammy requests. This feature is mostly useful for users of auto-key-locate where this can be used to retrieve keys from dane etc. diff --git a/src/mail.cpp b/src/mail.cpp index 8c5c478..03e3347 100644 --- a/src/mail.cpp +++ b/src/mail.cpp @@ -39,9 +39,12 @@ #include #include #include +#include +#include #include #include +#include #include #include @@ -53,6 +56,7 @@ using namespace GpgME; static std::map g_mail_map; static std::map g_uid_map; +static std::set uids_searched; #define COPYBUFSIZE (8 * 1024) @@ -716,7 +720,7 @@ Mail::encrypt_sign () return err; } -bool +int Mail::needs_crypto () { LPMESSAGE message = get_oom_message (m_mailitem); @@ -1499,3 +1503,66 @@ Mail::get_sig_fpr() const } return m_sig.fingerprint(); } + + +static DWORD WINAPI +do_locate (LPVOID arg) +{ + char *recipient = (char*) arg; + log_debug ("%s:%s searching key for recipient: \"%s\"", + SRCNAME, __func__, recipient); + Context *ctx = Context::createForProtocol (OpenPGP); + + if (!ctx) + { + TRACEPOINT; + return 0; + } + + ctx->setKeyListMode (GpgME::Extern | GpgME::Local); + ctx->startKeyListing (recipient, false); + + std::vector keys; + Error err; + do { + keys.push_back (ctx->nextKey(err)); + } while (!err); + keys.pop_back (); + ctx->endKeyListing (); + delete ctx; + + if (keys.size ()) + { + log_debug ("%s:%s found key for recipient: \"%s\"", + SRCNAME, __func__, recipient); + } + xfree (recipient); + do_in_ui_thread (UNKNOWN, NULL); + return 0; +} + +/** Try to locate the keys for all recipients */ +void Mail::locate_keys() +{ + char ** recipients = get_recipients (); + + if (!recipients) + { + TRACEPOINT; + return; + } + for (int i = 0; recipients[i]; i++) + { + std::string recp = recipients[i]; + if (uids_searched.find (recp) == uids_searched.end ()) + { + uids_searched.insert (recp); + HANDLE thread = CreateThread (NULL, 0, do_locate, + (LPVOID) strdup(recipients[i]), 0, + NULL); + CloseHandle (thread); + } + xfree (recipients[i]); + } + xfree (recipients); +} diff --git a/src/mail.h b/src/mail.h index 21ca885..b0d5c59 100644 --- a/src/mail.h +++ b/src/mail.h @@ -144,8 +144,13 @@ public: /** @brief Necessary crypto operations were completed successfully. */ bool crypto_successful () { return !needs_crypto() || m_crypt_successful; } - /** @brief Message should be encrypted and or signed. */ - bool needs_crypto (); + /** @brief Message should be encrypted and or signed. + 0: No + 1: Encrypt + 2: Sign + 3: Encrypt & Sign + */ + int needs_crypto (); /** @brief wipe the plaintext from the message and encrypt attachments. * @@ -274,6 +279,8 @@ public: call. */ int close (); + /** Try to locate the keys for all recipients */ + void locate_keys(); private: void update_categories (); void update_body (); diff --git a/src/mailitem-events.cpp b/src/mailitem-events.cpp index 2eba0b8..d5e7ef4 100644 --- a/src/mailitem-events.cpp +++ b/src/mailitem-events.cpp @@ -230,11 +230,6 @@ EVENT_SINK_INVOKE(MailItemEvents) } case PropertyChange: { - const wchar_t *prop_name; - if (!m_mail->is_crypto_mail ()) - { - break; - } if (!parms || parms->cArgs != 1 || parms->rgvarg[0].vt != VT_BSTR || !parms->rgvarg[0].bstrVal) @@ -243,7 +238,24 @@ EVENT_SINK_INVOKE(MailItemEvents) SRCNAME, __func__); break; } - prop_name = parms->rgvarg[0].bstrVal; + const wchar_t *prop_name = parms->rgvarg[0].bstrVal; + if (!m_mail->is_crypto_mail ()) + { + if (!opt.autoresolve) + { + break; + } + if (!wcscmp (prop_name, L"To") || + !wcscmp (prop_name, L"BCC") || + !wcscmp (prop_name, L"CC")) + { + if ((m_mail->needs_crypto() & 1)) + { + m_mail->locate_keys(); + } + } + break; + } for (const wchar_t **cur = prop_blacklist; *cur; cur++) { if (!wcscmp (prop_name, *cur)) commit 20995f156333c9cf3d8fe0703a685890f58c54d8 Author: Andre Heinecke Date: Thu Nov 17 15:34:07 2016 +0100 Add autoresolve keys option for encryption * src/addin-options.cpp (set_labels): Improve wording. * src/dialogs.rc: Fix layout of autoresolve option. * src/main.c (read_options, write_options): Handle option. diff --git a/src/addin-options.cpp b/src/addin-options.cpp index 2e9ac64..d08b71a 100644 --- a/src/addin-options.cpp +++ b/src/addin-options.cpp @@ -44,7 +44,7 @@ set_labels (HWND dlg) { IDC_SIGN_DEFAULT, N_("&Sign new messages by default")}, { IDC_INLINE_PGP, N_("&Send OpenPGP mails without " "attachments as inline-pgp")}, - { IDC_AUTORRESOLVE, N_("&Select certificates automatically (OpenPGP only)")}, + { IDC_AUTORRESOLVE, N_("&Search for OpenPGP keys automatically when encrypting")}, { IDC_GPG_OPTIONS, N_("Debug...")}, diff --git a/src/dialogs.rc b/src/dialogs.rc index 50b3ec3..359169d 100644 --- a/src/dialogs.rc +++ b/src/dialogs.rc @@ -337,7 +337,7 @@ BEGIN CONTROL "autoresolve", IDC_AUTORRESOLVE, "Button", BS_AUTOCHECKBOX | WS_TABSTOP, - 24, 82, 215, 10 + 24, 93, 215, 10 /* Stuff at the lower left corner. */ LTEXT "GpgOL by Gpg4win", IDC_GPG4WIN_STRING, diff --git a/src/main.c b/src/main.c index d862b57..d2e7122 100644 --- a/src/main.c +++ b/src/main.c @@ -418,6 +418,9 @@ read_options (void) load_extension_value ("inlinePGP", &val); opt.inline_pgp = val == NULL || *val != '1'? 0 : 1; xfree (val); val = NULL; + load_extension_value ("autoresolve", &val); + opt.autoresolve = val == NULL || *val != '1'? 0 : 1; + xfree (val); val = NULL; /* Note, that on purpose these flags are only Registry changeable. The format of the entry is a string of of "0" and "1" digits; see the switch below for a description. */ @@ -489,6 +492,7 @@ write_options (void) {"bodyAsAttachment", 0, opt.body_as_attachment, NULL}, {"mimeUI", MIME_UI_DEFAULT, opt.mime_ui, NULL}, {"inlinePGP", 0, opt.inline_pgp, NULL}, + {"autoresolve", 0, opt.autoresolve, NULL}, {NULL, 0, 0, NULL} }; char buf[32]; commit ecf4e2cca83970e9ddfe7dbd77cdf1b9d0bdd589 Author: Andre Heinecke Date: Thu Nov 17 13:35:14 2016 +0100 Sleep a bit in engine_wait * src/engine.c (engine_wait): Sleep in the busy wait loop. diff --git a/src/engine.c b/src/engine.c index a30408d..c96cb62 100644 --- a/src/engine.c +++ b/src/engine.c @@ -692,6 +692,8 @@ engine_wait (engine_filter_t filter) release_in_lock (filter, __func__); if (more) SwitchToThread (); + /* Let's not burn at 100% CPU please */ + Sleep (100); } while (more); commit 425e52bb2262c8edf96c37e60c706cfec2bbd3f5 Author: Andre Heinecke Date: Thu Nov 17 13:32:06 2016 +0100 Fix minor memory leak in error condition * src/ommon_indep.c (qp_encode): Free outbuf on error. diff --git a/src/common_indep.c b/src/common_indep.c index 578169a..ba7b0ed 100644 --- a/src/common_indep.c +++ b/src/common_indep.c @@ -313,6 +313,7 @@ qp_encode (const char *input, size_t inlen, size_t *r_outlen) { log_error ("Quoted printable too long. Bug."); r_outlen = NULL; + xfree (outbuf); return NULL; } } ----------------------------------------------------------------------- Summary of changes: src/addin-options.cpp | 2 +- src/common_indep.c | 1 + src/dialogs.rc | 2 +- src/engine.c | 2 ++ src/mail.cpp | 69 ++++++++++++++++++++++++++++++++++++++++++++++++- src/mail.h | 11 ++++++-- src/mailitem-events.cpp | 24 ++++++++++++----- src/main.c | 4 +++ 8 files changed, 104 insertions(+), 11 deletions(-) hooks/post-receive -- GnuPG extension for MS Outlook http://git.gnupg.org From cvs at cvs.gnupg.org Thu Nov 17 15:49:31 2016 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Thu, 17 Nov 2016 15:49:31 +0100 Subject: [git] GpgOL - branch, master, updated. gpgol-1.4.0-179-g93f6204 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG extension for MS Outlook". The branch, master has been updated via 93f6204e256b1a773c1912b33e95f214a1a962d2 (commit) via f240d185cae7bc62775cbf30264aa90708e6f19d (commit) from c7c293a1c69de961abf388664b2897b509d9a934 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 93f6204e256b1a773c1912b33e95f214a1a962d2 Author: Andre Heinecke Date: Thu Nov 17 15:48:59 2016 +0100 Improve wording in debug output for failed crypto -- diff --git a/src/mailitem-events.cpp b/src/mailitem-events.cpp index d5e7ef4..4091f06 100644 --- a/src/mailitem-events.cpp +++ b/src/mailitem-events.cpp @@ -356,7 +356,7 @@ EVENT_SINK_INVOKE(MailItemEvents) } else { - log_debug ("%s:%s: Message %p cancelling send crypto failed.", + log_debug ("%s:%s: Message %p cancelling send - crypto failed.", SRCNAME, __func__, m_object); *(parms->rgvarg[0].pboolVal) = VARIANT_TRUE; } commit f240d185cae7bc62775cbf30264aa90708e6f19d Author: Andre Heinecke Date: Thu Nov 17 15:47:31 2016 +0100 Don't show MessageBox when encryption failed * src/message.cpp (sign_encrypt): Disable messagebox -- At least kleopatra returns -1 if encryption is cancelled by the user. In that case we really really don't want to have that messagebox. diff --git a/src/message.cpp b/src/message.cpp index cd99913..aca415e 100644 --- a/src/message.cpp +++ b/src/message.cpp @@ -1110,10 +1110,9 @@ sign_encrypt (LPMESSAGE message, protocol_t protocol, HWND hwnd, int signflag, "is not possible."), "GpgOL", MB_ICONERROR|MB_OK); } - else if (err && opt.enable_debug) + else if (err && err != -1) { char buf[200]; - snprintf (buf, sizeof buf, _("Encryption failed (%s)"), gpg_strerror (err)); MessageBox (hwnd, buf, "GpgOL", MB_ICONERROR|MB_OK); ----------------------------------------------------------------------- Summary of changes: src/mailitem-events.cpp | 2 +- src/message.cpp | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) hooks/post-receive -- GnuPG extension for MS Outlook http://git.gnupg.org From cvs at cvs.gnupg.org Thu Nov 17 17:00:14 2016 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Thu, 17 Nov 2016 17:00:14 +0100 Subject: [git] GpgOL - branch, master, updated. gpgol-1.4.0-180-g72c2ebb Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG extension for MS Outlook". The branch, master has been updated via 72c2ebb31d68d2c1c9999cb5180964f834152891 (commit) from 93f6204e256b1a773c1912b33e95f214a1a962d2 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 72c2ebb31d68d2c1c9999cb5180964f834152891 Author: Andre Heinecke Date: Thu Nov 17 16:57:26 2016 +0100 Ignoore WM_SYSCOMMAND / SC_CLOSE * src/windowmessages.cpp (gpgol_hook): Ignore WM_SYSCOMMAND SC_CLOSE. -- I have not found a way where SC_CLOSE is sent but WM_CLOSE is not sent. This fixes double close crashes when both WM_SYCOMMAND and SC_CLOSE are handled but the close did not complete the unload of the message. Maybe we should remove our mails from the internal map as soon as we call close. diff --git a/src/windowmessages.cpp b/src/windowmessages.cpp index 0760cdf..64e4ef1 100644 --- a/src/windowmessages.cpp +++ b/src/windowmessages.cpp @@ -250,12 +250,15 @@ gpgol_hook(int code, WPARAM wParam, LPARAM lParam) break; } case WM_SYSCOMMAND: + /* + This comes to often and when we are closed from the icon + we also get WM_CLOSE if (cwp->wParam == SC_CLOSE) { log_debug ("%s:%s: SC_CLOSE syscommand. Closing all mails.", SRCNAME, __func__); Mail::close_all_mails(); - } + } */ break; default: break; ----------------------------------------------------------------------- Summary of changes: src/windowmessages.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) hooks/post-receive -- GnuPG extension for MS Outlook http://git.gnupg.org From cvs at cvs.gnupg.org Fri Nov 18 01:39:44 2016 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Fri, 18 Nov 2016 01:39:44 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.1.15-391-gb2e1b17 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via b2e1b17efa952afcf7aeec8b15e9d0088dba587a (commit) via b6066ab18a67195817babaf9eccf896c2b3c7b0e (commit) from 8fb482252436b3b4b0b33663d95d1d17188ad1d9 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit b2e1b17efa952afcf7aeec8b15e9d0088dba587a Author: NIIBE Yutaka Date: Fri Nov 18 09:32:34 2016 +0900 g10: Fix creating a lock for ToFU. * g10/tofu.c (busy_handler): Add third argument which is mandatory for O_CREATE flag. -- Reported-by: Kristian Fiskerstrand Signed-off-by: NIIBE Yutaka diff --git a/g10/tofu.c b/g10/tofu.c index 03d8ebe..cf1d00a 100644 --- a/g10/tofu.c +++ b/g10/tofu.c @@ -732,7 +732,8 @@ busy_handler (void *cookie, int call_count) process will have to wait a bit longer, but otherwise nothing horrible should happen. */ - int fd = open (dbs->want_lock_file, O_CREAT); + int fd = open (dbs->want_lock_file, O_CREAT, + S_IRUSR|S_IRGRP|S_IROTH|S_IWUSR); if (fd == -1) log_debug ("TOFU: Error opening '%s': %s\n", dbs->want_lock_file, strerror (errno)); commit b6066ab18a67195817babaf9eccf896c2b3c7b0e Author: NIIBE Yutaka Date: Fri Nov 18 08:54:04 2016 +0900 scd: Don't limit to ST-2xxx for PC/SC. * scd/apdu.c (pcsc_vendor_specific_init): Only check vender ID. -- Some other products by Cherry works with pinpad, although it only works for smaller keys (RSA 1024). TPDU support is good for larger keys. Signed-off-by: NIIBE Yutaka diff --git a/scd/apdu.c b/scd/apdu.c index 3e2b609..54f3b30 100644 --- a/scd/apdu.c +++ b/scd/apdu.c @@ -1896,8 +1896,12 @@ pcsc_vendor_specific_init (int slot) reader_table[slot].is_spr532 = 1; reader_table[slot].pinpad_varlen_supported = 1; } - else if (vendor == 0x046a && product == 0x003e) /* Cherry ST-2xxx */ + else if (vendor == 0x046a) { + /* Cherry ST-2xxx (product == 0x003e) supports TPDU level + * exchange. Other products which only support short APDU level + * exchange only work with shorter keys like RSA 1024. + */ reader_table[slot].pcsc.pinmax = 15; reader_table[slot].pinpad_varlen_supported = 1; } ----------------------------------------------------------------------- Summary of changes: g10/tofu.c | 3 ++- scd/apdu.c | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Fri Nov 18 02:48:46 2016 From: cvs at cvs.gnupg.org (by Daniel Kahn Gillmor) Date: Fri, 18 Nov 2016 02:48:46 +0100 Subject: [git] GPG-ERROR - branch, master, updated. libgpg-error-1.25-8-gf769450 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "Error codes used by GnuPG et al.". The branch, master has been updated via f769450924367d4f495eda981025fed391cd68a8 (commit) via b5e7937128a8fccbeba0e9d3c931a5622a860a0c (commit) via 47f2f059732cad79486b48eca5cd8fc07dbc396b (commit) via c7e48340fdc33d4d0fe5a62301c1e15382022954 (commit) via 0e1e5d8f91259692f97661b7c5bd1fa7ff029e3d (commit) via 441ab0d81f4ded0555d60af7b629157a5558911c (commit) from eeef6b8724b43e105ae2beef022fc957eb228bcf (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit f769450924367d4f495eda981025fed391cd68a8 Author: Daniel Kahn Gillmor Date: Wed Nov 16 08:52:46 2016 +0900 w32-iconv: Remove invalid link to unicode.org in comment. -- http://www.unicode.org/unicode/onlinedat/languages.html currently says: The mapping information between Macintosh and Windows codes is no longer available on the Unicode site. Please consult the Macintosh and Windows developer sites. And there are no outbound links. Signed-off-by: Daniel Kahn Gillmor diff --git a/src/w32-gettext.c b/src/w32-gettext.c index 8168e30..3b54ebd 100644 --- a/src/w32-gettext.c +++ b/src/w32-gettext.c @@ -680,7 +680,6 @@ my_nl_locale_name (const char *categoryname) sub = SUBLANGID (langid); /* Dispatch on language. - See also http://www.unicode.org/unicode/onlinedat/languages.html . For details about languages, see https://www.ethnologue.com/ . */ switch (primary) { commit b5e7937128a8fccbeba0e9d3c931a5622a860a0c Author: Daniel Kahn Gillmor Date: Wed Nov 16 08:52:45 2016 +0900 w32: Update links from http to https. -- Signed-off-by: Daniel Kahn Gillmor diff --git a/src/w32-iconv.c b/src/w32-iconv.c index 47a06b2..c10bb32 100644 --- a/src/w32-iconv.c +++ b/src/w32-iconv.c @@ -389,7 +389,7 @@ static struct { /* * Code Page Identifiers - * http://msdn2.microsoft.com/en-us/library/ms776446.aspx + * https://msdn.microsoft.com/en-us/library/dd317756.aspx */ {37, "IBM037"}, /* IBM EBCDIC US-Canada */ {437, "IBM437"}, /* OEM United States */ @@ -968,7 +968,7 @@ name_to_codepage(const char *name) } /* - * http://www.faqs.org/rfcs/rfc2781.html + * https://tools.ietf.org/html/rfc2781 */ static uint utf16_to_ucs4(const ushort *wbuf) commit 47f2f059732cad79486b48eca5cd8fc07dbc396b Author: Daniel Kahn Gillmor Date: Wed Nov 16 08:52:44 2016 +0900 Fix more misspellings. -- Signed-off-by: Daniel Kahn Gillmor diff --git a/NEWS b/NEWS index ce2beb5..46ecdc9 100644 --- a/NEWS +++ b/NEWS @@ -478,8 +478,8 @@ Noteworthy changes in version 1.4 (2006-09-14) * New error codes for the Assuan IPC library. * New error code GPG_ERR_MISSING_ERRNO to be used in cases when a - system accidently does not set errno but a system error definitely - occured. + system accidentally does not set errno but a system error + definitely occurred. * New error source GPG_ERR_SOURCE_ANY to allow proper use of libgpg-error even if a specific source is not available. diff --git a/doc/errorref.txt b/doc/errorref.txt index da4510e..d389398 100644 --- a/doc/errorref.txt +++ b/doc/errorref.txt @@ -78,7 +78,7 @@ GPG_ERR_NO_PUBKEY No public key - The public key could not be retrieved from a corresponding certificate on a card (command READKEY in scd). - A requested certificate was not found or an unspecified - error occured while selecting a X.509 certificate in + error occurred while selecting a X.509 certificate in gpgsm. - The specified certificate or key was not found. This does not necessary mean that the certifciate is not diff --git a/doc/gpgrt.texi b/doc/gpgrt.texi index b8a3008..53beef8 100644 --- a/doc/gpgrt.texi +++ b/doc/gpgrt.texi @@ -128,7 +128,7 @@ RunTime). This manual documents the Libgpg-error library application programming interface (API). The goal is to that all functions and data types provided by the library are explained. However, for now this is only -a stub and not very usefull. +a stub and not very useful. @node Features @@ -327,7 +327,7 @@ TBD. @node Generalities @chapter Generalities -TBD. (Description of the error fucntion may be taken from Libgcrypt.) +TBD. (Description of the error function may be taken from Libgcrypt.) diff --git a/src/estream-printf.c b/src/estream-printf.c index 091ff7d..f1cbcde 100644 --- a/src/estream-printf.c +++ b/src/estream-printf.c @@ -1784,7 +1784,7 @@ dynamic_buffer_out (void *outfncarg, const char *buf, size_t buflen) { parm->error_flag = errno ? errno : ENOMEM; /* Wipe out what we already accumulated. This is useful in - case sensitive data is formated. */ + case sensitive data is formatted. */ memset (parm->buffer, 0, parm->used); return -1; } commit c7e48340fdc33d4d0fe5a62301c1e15382022954 Author: Daniel Kahn Gillmor Date: Wed Nov 16 08:52:43 2016 +0900 po: Convert ro.po to UTF-8. -- Signed-off-by: Daniel Kahn Gillmor diff --git a/po/ro.po b/po/ro.po index c9ad5dd..6354580 100644 --- a/po/ro.po +++ b/po/ro.po @@ -1,6 +1,6 @@ -# Mesajele ?n limba rom?n? pentru libgpg-error. +# Mesajele ??n limba rom??n?? pentru libgpg-error. # Copyright (C) 2005 Free Software Foundation, Inc. -# Acest fi?ier este distribuit sub aceea?i licen?? ca ?i pachetul libgpg-error. +# Acest fi??ier este distribuit sub aceea??i licen???? ca ??i pachetul libgpg-error. # Laurentiu Buzdugan , 2005. # # @@ -14,12 +14,12 @@ msgstr "" "Language-Team: Romanian \n" "Language: ro\n" "MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=ISO-8859-2\n" +"Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" msgid "Unspecified source" -msgstr "Surs? nespecificat?" +msgstr "Surs?? nespecificat??" msgid "gcrypt" msgstr "gcrypt" @@ -71,58 +71,58 @@ msgstr "" #, fuzzy msgid "Any source" -msgstr "Surs? necunoscut?" +msgstr "Surs?? necunoscut??" msgid "User defined source 1" -msgstr "Surs? definit? de utilizator 1" +msgstr "Surs?? definit?? de utilizator 1" msgid "User defined source 2" -msgstr "Surs? definit? de utilizator 2" +msgstr "Surs?? definit?? de utilizator 2" msgid "User defined source 3" -msgstr "Surs? definit? de utilizator 3" +msgstr "Surs?? definit?? de utilizator 3" msgid "User defined source 4" -msgstr "Surs? definit? de utilizator 4" +msgstr "Surs?? definit?? de utilizator 4" msgid "Unknown source" -msgstr "Surs? necunoscut?" +msgstr "Surs?? necunoscut??" msgid "Success" msgstr "Succes" msgid "General error" -msgstr "Eroare general?" +msgstr "Eroare general??" msgid "Unknown packet" msgstr "Pachet necunoscut" msgid "Unknown version in packet" -msgstr "versiune necunoscut? ?n pachet" +msgstr "versiune necunoscut?? ??n pachet" msgid "Invalid public key algorithm" -msgstr "Algoritm cu cheie public? invalid" +msgstr "Algoritm cu cheie public?? invalid" msgid "Invalid digest algorithm" msgstr "Algoritm rezumat invalid" msgid "Bad public key" -msgstr "Cheie public? incorect?" +msgstr "Cheie public?? incorect??" msgid "Bad secret key" -msgstr "Cheie secret? incorect?" +msgstr "Cheie secret?? incorect??" msgid "Bad signature" -msgstr "Semn?tur? incorect?" +msgstr "Semn??tur?? incorect??" msgid "No public key" -msgstr "Nici o cheie public?" +msgstr "Nici o cheie public??" msgid "Checksum error" msgstr "Eroare checksum" msgid "Bad passphrase" -msgstr "Fraz?-parol? incorect?" +msgstr "Fraz??-parol?? incorect??" msgid "Invalid cipher algorithm" msgstr "Algoritm cifrare invalid" @@ -134,34 +134,34 @@ msgid "Invalid packet" msgstr "Pachet invalid" msgid "Invalid armor" -msgstr "Armur? invalid?" +msgstr "Armur?? invalid??" msgid "No user ID" msgstr "Nici un ID utilizator." msgid "No secret key" -msgstr "Nici o cheie secret?" +msgstr "Nici o cheie secret??" msgid "Wrong secret key used" -msgstr "A fost folosit? o cheie secret? gre?it?" +msgstr "A fost folosit?? o cheie secret?? gre??it??" msgid "Bad session key" -msgstr "Cheie de sesiune incorect?" +msgstr "Cheie de sesiune incorect??" msgid "Unknown compression algorithm" msgstr "Algoritm compresie necunoscut" msgid "Number is not prime" -msgstr "Num?rul nu este prim" +msgstr "Num??rul nu este prim" msgid "Invalid encoding method" -msgstr "Valoare de encodare invalid?" +msgstr "Valoare de encodare invalid??" msgid "Invalid encryption scheme" -msgstr "Schem? de cifrare invalid?" +msgstr "Schem?? de cifrare invalid??" msgid "Invalid signature scheme" -msgstr "Schem? de semn?turi invalid?" +msgstr "Schem?? de semn??turi invalid??" msgid "Invalid attribute" msgstr "Argument invalid" @@ -170,22 +170,22 @@ msgid "No value" msgstr "Nici o valoare" msgid "Not found" -msgstr "Nu a fost g?sit(?)" +msgstr "Nu a fost g??sit(??)" msgid "Value not found" -msgstr "Valoarea nu a fost g?sit?" +msgstr "Valoarea nu a fost g??sit??" msgid "Syntax error" -msgstr "Eroare de sintax?" +msgstr "Eroare de sintax??" msgid "Bad MPI value" -msgstr "Valoare MPI incorect?" +msgstr "Valoare MPI incorect??" msgid "Invalid passphrase" -msgstr "Fraz?-parol? invalid?" +msgstr "Fraz??-parol?? invalid??" msgid "Invalid signature class" -msgstr "Clas? semn?turi invalid?" +msgstr "Clas?? semn??turi invalid??" msgid "Resources exhausted" msgstr "Resurse epuizate" @@ -194,7 +194,7 @@ msgid "Invalid keyring" msgstr "Inel de chei invalid" msgid "Trust DB error" -msgstr "Eroare baz? de date ?ncredere" +msgstr "Eroare baz?? de date ??ncredere" msgid "Bad certificate" msgstr "Certificat incorect" @@ -203,7 +203,7 @@ msgid "Invalid user ID" msgstr "ID utilizator invalid" msgid "Unexpected error" -msgstr "Eroare nea?teptat?" +msgstr "Eroare nea??teptat??" msgid "Time conflict" msgstr "Conflict de timp" @@ -212,34 +212,34 @@ msgid "Keyserver error" msgstr "Eroare server de chei" msgid "Wrong public key algorithm" -msgstr "Algoritm cheie public? gre?it" +msgstr "Algoritm cheie public?? gre??it" msgid "Tribute to D. A." msgstr "Tribut lui D. A." msgid "Weak encryption key" -msgstr "Cheie de cifrare slab?" +msgstr "Cheie de cifrare slab??" msgid "Invalid key length" -msgstr "Lungime cheie invalid?" +msgstr "Lungime cheie invalid??" msgid "Invalid argument" msgstr "Argument invalid" msgid "Syntax error in URI" -msgstr "Eroare de sintax? ?n URI" +msgstr "Eroare de sintax?? ??n URI" msgid "Invalid URI" msgstr "URI incorect" msgid "Network error" -msgstr "Eroare re?ea" +msgstr "Eroare re??ea" msgid "Unknown host" -msgstr "Gazd? necunoscut?" +msgstr "Gazd?? necunoscut??" msgid "Selftest failed" -msgstr "Auto-test e?uat" +msgstr "Auto-test e??uat" msgid "Data not encrypted" msgstr "Date necifrate" @@ -248,37 +248,37 @@ msgid "Data not processed" msgstr "Date neprocesate" msgid "Unusable public key" -msgstr "Cheie public? de nefolosit" +msgstr "Cheie public?? de nefolosit" msgid "Unusable secret key" -msgstr "cheie secret? de nefolosit" +msgstr "cheie secret?? de nefolosit" msgid "Invalid value" -msgstr "Valoare invalid?" +msgstr "Valoare invalid??" msgid "Bad certificate chain" -msgstr "Lan? certificate incorect" +msgstr "Lan?? certificate incorect" msgid "Missing certificate" -msgstr "Certificat lips?" +msgstr "Certificat lips??" msgid "No data" -msgstr "Nici o dat?" +msgstr "Nici o dat??" msgid "Bug" msgstr "Bug" msgid "Not supported" -msgstr "Nu este suportat(?)" +msgstr "Nu este suportat(??)" msgid "Invalid operation code" -msgstr "Cod opera?ie invalid" +msgstr "Cod opera??ie invalid" msgid "Timeout" -msgstr "Pauz?" +msgstr "Pauz??" msgid "Internal error" -msgstr "Eroare intern?" +msgstr "Eroare intern??" msgid "EOF (gcrypt)" msgstr "EOF (gcrypt)" @@ -293,13 +293,13 @@ msgid "Provided object is too large" msgstr "Obiectul furnizat e prea larg" msgid "Missing item in object" -msgstr "Articol lips? ?n obiect" +msgstr "Articol lips?? ??n obiect" msgid "Not implemented" -msgstr "Nu a fost implementat(?)" +msgstr "Nu a fost implementat(??)" msgid "Conflicting use" -msgstr "Folosire ?n conflict" +msgstr "Folosire ??n conflict" msgid "Invalid cipher mode" msgstr "Mod cifru invalid" @@ -314,13 +314,13 @@ msgid "Result truncated" msgstr "Rezultat invalid" msgid "Incomplete line" -msgstr "Linie incomplet?" +msgstr "Linie incomplet??" msgid "Invalid response" -msgstr "R?spuns invalid" +msgstr "R??spuns invalid" msgid "No agent running" -msgstr "Nu ruleaz? nici un agent" +msgstr "Nu ruleaz?? nici un agent" #, fuzzy #| msgid "agent error" @@ -336,13 +336,13 @@ msgstr "Eroare server Assuan" #, fuzzy msgid "General Assuan error" -msgstr "Eroare general?" +msgstr "Eroare general??" msgid "Invalid session key" -msgstr "Cheie de sesiune invalid?" +msgstr "Cheie de sesiune invalid??" msgid "Invalid S-expression" -msgstr "Expresie-S invalid?" +msgstr "Expresie-S invalid??" msgid "Unsupported algorithm" msgstr "Algoritm nesuportat" @@ -366,7 +366,7 @@ msgid "Invalid parameter" msgstr "Parametru invalid" msgid "Wrong card" -msgstr "Card gre?it" +msgstr "Card gre??it" msgid "No dirmngr" msgstr "Nici un dirmngr" @@ -384,13 +384,13 @@ msgid "CRL too old" msgstr "CRL prea vechi" msgid "Line too long" -msgstr "Linie prea lung?" +msgstr "Linie prea lung??" msgid "Not trusted" -msgstr "Nu este de ?ncredere" +msgstr "Nu este de ??ncredere" msgid "Operation cancelled" -msgstr "Opera?iune anulat?" +msgstr "Opera??iune anulat??" msgid "Bad CA certificate" msgstr "Certificat CA incorect" @@ -405,13 +405,13 @@ msgid "Unsupported certificate" msgstr "Certificat nesuportat" msgid "Unknown S-expression" -msgstr "Expresie-S necunoscut?" +msgstr "Expresie-S necunoscut??" msgid "Unsupported protection" -msgstr "Protec?ie nesuportat?" +msgstr "Protec??ie nesuportat??" msgid "Corrupted protection" -msgstr "Protec?ie corupt?" +msgstr "Protec??ie corupt??" msgid "Ambiguous name" msgstr "Nume ambiguu" @@ -420,7 +420,7 @@ msgid "Card error" msgstr "Eroare card" msgid "Card reset required" -msgstr "Este necesar? resetarea cardului" +msgstr "Este necesar?? resetarea cardului" msgid "Card removed" msgstr "Card scos" @@ -432,10 +432,10 @@ msgid "Card not present" msgstr "Cardul nu este prezent" msgid "No PKCS15 application" -msgstr "Nici o aplica?ie PKCS15" +msgstr "Nici o aplica??ie PKCS15" msgid "Not confirmed" -msgstr "Neconfirmat(?)" +msgstr "Neconfirmat(??)" msgid "Configuration error" msgstr "Eroare de configurare" @@ -459,34 +459,34 @@ msgid "Unsupported protocol" msgstr "Protocol nesuportat" msgid "Bad PIN method" -msgstr "Metod? PIN incorect?" +msgstr "Metod?? PIN incorect??" msgid "Card not initialized" -msgstr "Card neini?ializat" +msgstr "Card neini??ializat" msgid "Unsupported operation" -msgstr "Opera?ie nesuportat?" +msgstr "Opera??ie nesuportat??" msgid "Wrong key usage" -msgstr "Folosire cheie gre?it?" +msgstr "Folosire cheie gre??it??" msgid "Nothing found" -msgstr "Nu a fost g?sit nimic" +msgstr "Nu a fost g??sit nimic" msgid "Wrong blob type" msgstr "Tip de blob incorect" msgid "Missing value" -msgstr "Valoare lips?" +msgstr "Valoare lips??" msgid "Hardware problem" -msgstr "Problem? hardware" +msgstr "Problem?? hardware" msgid "PIN blocked" msgstr "PIN blocat" msgid "Conditions of use not satisfied" -msgstr "Condi?ii de folosire nesatisf?cute" +msgstr "Condi??ii de folosire nesatisf??cute" msgid "PINs are not synced" msgstr "PIN-urile nu sunt sincronizate" @@ -501,22 +501,22 @@ msgid "Invalid BER" msgstr "BER invalid" msgid "Element not found" -msgstr "Elementul nu a fost g?sit" +msgstr "Elementul nu a fost g??sit" msgid "Identifier not found" -msgstr "Identificator nu a fost g?sit" +msgstr "Identificator nu a fost g??sit" msgid "Invalid tag" -msgstr "Etichet? invalid?" +msgstr "Etichet?? invalid??" msgid "Invalid length" -msgstr "Lungime invalid?" +msgstr "Lungime invalid??" msgid "Invalid key info" -msgstr "Informa?ii cheie invalide" +msgstr "Informa??ii cheie invalide" msgid "Unexpected tag" -msgstr "Etichet? nea?teptat?" +msgstr "Etichet?? nea??teptat??" msgid "Not DER encoded" msgstr "Nu e encodat DER" @@ -534,10 +534,10 @@ msgid "Unsupported CMS object" msgstr "Obiect CMS nesuportat" msgid "Unsupported encoding" -msgstr "Encodare nesuportat?" +msgstr "Encodare nesuportat??" msgid "Unsupported CMS version" -msgstr "Versiune CMS nesuportat?" +msgstr "Versiune CMS nesuportat??" msgid "Unknown algorithm" msgstr "Algoritm necunoscut" @@ -546,34 +546,34 @@ msgid "Invalid crypto engine" msgstr "Motor cifrare invalid" msgid "Public key not trusted" -msgstr "Cheia public? nu este de ?ncredere" +msgstr "Cheia public?? nu este de ??ncredere" msgid "Decryption failed" -msgstr "Decriptarea a e?uat" +msgstr "Decriptarea a e??uat" msgid "Key expired" -msgstr "Cheie expirat?" +msgstr "Cheie expirat??" msgid "Signature expired" -msgstr "Semn?tur? expirat?" +msgstr "Semn??tur?? expirat??" msgid "Encoding problem" -msgstr "Problem? de encodare" +msgstr "Problem?? de encodare" msgid "Invalid state" -msgstr "Stare invalid?" +msgstr "Stare invalid??" msgid "Duplicated value" -msgstr "Valoare dubl?" +msgstr "Valoare dubl??" msgid "Missing action" -msgstr "Ac?iune lips?" +msgstr "Ac??iune lips??" msgid "ASN.1 module not found" -msgstr "Modulul ASN.1 nu a fost g?sit" +msgstr "Modulul ASN.1 nu a fost g??sit" msgid "Invalid OID string" -msgstr "?ir OID invalid" +msgstr "??ir OID invalid" msgid "Invalid time" msgstr "Timp invalid" @@ -582,7 +582,7 @@ msgid "Invalid CRL object" msgstr "Obiect CRL invalid" msgid "Unsupported CRL version" -msgstr "Versiune CRL nesuportat?" +msgstr "Versiune CRL nesuportat??" msgid "Invalid certificate object" msgstr "Obiect certificat incorect" @@ -591,10 +591,10 @@ msgid "Unknown name" msgstr "Nume necunoscut" msgid "A locale function failed" -msgstr "O func?ie locale a e?uat" +msgstr "O func??ie locale a e??uat" msgid "Not locked" -msgstr "Nefor?at(?)" +msgstr "Nefor??at(??)" msgid "Protocol violation" msgstr "Violare de protocol" @@ -603,23 +603,23 @@ msgid "Invalid MAC" msgstr "MAC invalid" msgid "Invalid request" -msgstr "Cerere invalid?" +msgstr "Cerere invalid??" #, fuzzy msgid "Unknown extension" -msgstr "Expresie-S necunoscut?" +msgstr "Expresie-S necunoscut??" #, fuzzy msgid "Unknown critical extension" -msgstr "Expresie-S necunoscut?" +msgstr "Expresie-S necunoscut??" #, fuzzy msgid "Locked" -msgstr "Nefor?at(?)" +msgstr "Nefor??at(??)" #, fuzzy msgid "Unknown option" -msgstr "Expresie-S necunoscut?" +msgstr "Expresie-S necunoscut??" #, fuzzy msgid "Unknown command" @@ -627,18 +627,18 @@ msgstr "Cod de eroare necunoscut" #, fuzzy msgid "Not operational" -msgstr "Opera?ie nesuportat?" +msgstr "Opera??ie nesuportat??" #, fuzzy msgid "No passphrase given" -msgstr "Fraz?-parol? incorect?" +msgstr "Fraz??-parol?? incorect??" msgid "No PIN given" msgstr "" #, fuzzy msgid "Not enabled" -msgstr "Nefor?at(?)" +msgstr "Nefor??at(??)" #, fuzzy msgid "No crypto engine" @@ -646,7 +646,7 @@ msgstr "Motor cifrare invalid" #, fuzzy msgid "Missing key" -msgstr "Valoare lips?" +msgstr "Valoare lips??" #, fuzzy msgid "Too many objects" @@ -657,11 +657,11 @@ msgstr "" #, fuzzy msgid "Not initialized" -msgstr "Card neini?ializat" +msgstr "Card neini??ializat" #, fuzzy msgid "Missing issuer certificate" -msgstr "Certificat lips?" +msgstr "Certificat lips??" msgid "No keyserver available" msgstr "" @@ -672,12 +672,12 @@ msgstr "Timp invalid" #, fuzzy msgid "Unknown elliptic curve" -msgstr "Surs? necunoscut?" +msgstr "Surs?? necunoscut??" #, fuzzy #| msgid "Duplicated value" msgid "Duplicated key" -msgstr "Valoare dubl?" +msgstr "Valoare dubl??" #, fuzzy #| msgid "Ambiguous name" @@ -703,12 +703,12 @@ msgstr "" #, fuzzy #| msgid "No public key" msgid "Broken public key" -msgstr "Nici o cheie public?" +msgstr "Nici o cheie public??" #, fuzzy #| msgid "No secret key" msgid "Broken secret key" -msgstr "Nici o cheie secret?" +msgstr "Nici o cheie secret??" #, fuzzy #| msgid "Invalid digest algorithm" @@ -717,53 +717,53 @@ msgstr "Algoritm rezumat invalid" #, fuzzy msgid "Operation fully cancelled" -msgstr "Opera?iune anulat?" +msgstr "Opera??iune anulat??" #, fuzzy msgid "Operation not yet finished" -msgstr "Opera?iune anulat?" +msgstr "Opera??iune anulat??" msgid "Buffer too short" msgstr "Buffer prea scurt" msgid "Invalid length specifier in S-expression" -msgstr "Specificarea lungimii invalid? ?n expresia-S" +msgstr "Specificarea lungimii invalid?? ??n expresia-S" msgid "String too long in S-expression" -msgstr "?ir prea lung ?n expresia-S" +msgstr "??ir prea lung ??n expresia-S" msgid "Unmatched parentheses in S-expression" -msgstr "Parantez? f?r? pereche ?n expresia-S" +msgstr "Parantez?? f??r?? pereche ??n expresia-S" msgid "S-expression not canonical" -msgstr "Expresia-S nu este canonic?" +msgstr "Expresia-S nu este canonic??" msgid "Bad character in S-expression" -msgstr "Caracter invalid ?n expresia-S" +msgstr "Caracter invalid ??n expresia-S" msgid "Bad quotation in S-expression" -msgstr "Ghilimele incorecte ?n expresia-S" +msgstr "Ghilimele incorecte ??n expresia-S" msgid "Zero prefix in S-expression" -msgstr "Prefix zero ?n expresia-S" +msgstr "Prefix zero ??n expresia-S" msgid "Nested display hints in S-expression" -msgstr "Indica?ii de afi?are ?ncuib?rite ?n expresia-S" +msgstr "Indica??ii de afi??are ??ncuib??rite ??n expresia-S" msgid "Unmatched display hints" -msgstr "Indica?ii de afi?are f?r? pereche" +msgstr "Indica??ii de afi??are f??r?? pereche" msgid "Unexpected reserved punctuation in S-expression" -msgstr "Punctua?ie rezervat? nea?teptat? ?n expresia-S" +msgstr "Punctua??ie rezervat?? nea??teptat?? ??n expresia-S" msgid "Bad hexadecimal character in S-expression" -msgstr "Caracter hexazecimal incorect ?n expresia-S" +msgstr "Caracter hexazecimal incorect ??n expresia-S" msgid "Odd hexadecimal numbers in S-expression" -msgstr "Numere hexazecimale ciudate ?n expresia-S" +msgstr "Numere hexazecimale ciudate ??n expresia-S" msgid "Bad octal character in S-expression" -msgstr "Caracter octal incorect ?n expresia-S" +msgstr "Caracter octal incorect ??n expresia-S" msgid "All subkeys are expired or revoked" msgstr "" @@ -784,7 +784,7 @@ msgstr "Nume necunoscut" #, fuzzy #| msgid "No public key" msgid "No key" -msgstr "Nici o cheie public?" +msgstr "Nici o cheie public??" msgid "Legacy key" msgstr "" @@ -797,7 +797,7 @@ msgstr "Buffer prea scurt" #, fuzzy #| msgid "Line too long" msgid "Request too long" -msgstr "Linie prea lung?" +msgstr "Linie prea lung??" msgid "Object is in termination state" msgstr "" @@ -805,7 +805,7 @@ msgstr "" #, fuzzy #| msgid "Bad certificate chain" msgid "No certificate chain" -msgstr "Lan? certificate incorect" +msgstr "Lan?? certificate incorect" #, fuzzy #| msgid "Certificate too young" @@ -823,7 +823,7 @@ msgstr "" #, fuzzy #| msgid "Unexpected tag" msgid "Unexpected message" -msgstr "Etichet? nea?teptat?" +msgstr "Etichet?? nea??teptat??" msgid "Compression or decompression failed" msgstr "" @@ -841,7 +841,7 @@ msgstr "Algoritm cifrare invalid" #, fuzzy msgid "Missing client certificate" -msgstr "Certificat lips?" +msgstr "Certificat lips??" #, fuzzy #| msgid "Certificate revoked" @@ -851,12 +851,12 @@ msgstr "Certificat revocat" #, fuzzy #| msgid "Key expired" msgid "Ticket expired" -msgstr "Cheie expirat?" +msgstr "Cheie expirat??" #, fuzzy #| msgid "Bad public key" msgid "Bad ticket" -msgstr "Cheie public? incorect?" +msgstr "Cheie public?? incorect??" #, fuzzy #| msgid "Unknown packet" @@ -866,7 +866,7 @@ msgstr "Pachet necunoscut" #, fuzzy #| msgid "Bad certificate chain" msgid "Bad certificate message in handshake" -msgstr "Lan? certificate incorect" +msgstr "Lan?? certificate incorect" msgid "Bad certificate request message in handshake" msgstr "" @@ -904,7 +904,7 @@ msgstr "" #, fuzzy #| msgid "Key expired" msgid "Key disabled" -msgstr "Cheie expirat?" +msgstr "Cheie expirat??" msgid "Not possible with a card based key" msgstr "" @@ -922,7 +922,7 @@ msgstr "" #, fuzzy msgid "General IPC error" -msgstr "Eroare general?" +msgstr "Eroare general??" msgid "IPC accept call failed" msgstr "" @@ -932,19 +932,19 @@ msgstr "" #, fuzzy msgid "Invalid IPC response" -msgstr "R?spuns invalid" +msgstr "R??spuns invalid" #, fuzzy msgid "Invalid value passed to IPC" -msgstr "Valoare invalid?" +msgstr "Valoare invalid??" #, fuzzy msgid "Incomplete line passed to IPC" -msgstr "Linie incomplet?" +msgstr "Linie incomplet??" #, fuzzy msgid "Line passed to IPC too long" -msgstr "Linie prea lung?" +msgstr "Linie prea lung??" msgid "Nested IPC commands" msgstr "" @@ -977,7 +977,7 @@ msgstr "" #, fuzzy msgid "Unexpected IPC command" -msgstr "Etichet? nea?teptat?" +msgstr "Etichet?? nea??teptat??" #, fuzzy msgid "Unknown IPC command" @@ -985,7 +985,7 @@ msgstr "Cod de eroare necunoscut" #, fuzzy msgid "IPC syntax error" -msgstr "Eroare de sintax?" +msgstr "Eroare de sintax??" msgid "IPC call has been cancelled" msgstr "" @@ -1002,7 +1002,7 @@ msgstr "Eroare card" #, fuzzy msgid "Unknown IPC inquire" -msgstr "Surs? necunoscut?" +msgstr "Surs?? necunoscut??" #, fuzzy msgid "Crypto engine too old" @@ -1026,7 +1026,7 @@ msgstr "" #, fuzzy #| msgid "Duplicated value" msgid "Duplicated name" -msgstr "Valoare dubl?" +msgstr "Valoare dubl??" #, fuzzy #| msgid "Certificate too young" @@ -1040,30 +1040,30 @@ msgstr "Obiectul furnizat e prea scurt" #, fuzzy msgid "General LDAP error" -msgstr "Eroare general?" +msgstr "Eroare general??" #, fuzzy #| msgid "General error" msgid "General LDAP attribute error" -msgstr "Eroare general?" +msgstr "Eroare general??" #, fuzzy #| msgid "General error" msgid "General LDAP name error" -msgstr "Eroare general?" +msgstr "Eroare general??" #, fuzzy msgid "General LDAP security error" -msgstr "Eroare general?" +msgstr "Eroare general??" #, fuzzy #| msgid "General error" msgid "General LDAP service error" -msgstr "Eroare general?" +msgstr "Eroare general??" #, fuzzy msgid "General LDAP update error" -msgstr "Eroare general?" +msgstr "Eroare general??" msgid "Experimental LDAP error code" msgstr "" @@ -1074,17 +1074,17 @@ msgstr "Eroare card" #, fuzzy msgid "Other general LDAP error" -msgstr "Eroare general?" +msgstr "Eroare general??" #, fuzzy #| msgid "Decryption failed" msgid "LDAP connecting failed (X)" -msgstr "Decriptarea a e?uat" +msgstr "Decriptarea a e??uat" #, fuzzy #| msgid "General error" msgid "LDAP referral limit exceeded" -msgstr "Eroare general?" +msgstr "Eroare general??" msgid "LDAP client loop" msgstr "" @@ -1092,22 +1092,22 @@ msgstr "" #, fuzzy #| msgid "Card reset required" msgid "No LDAP results returned" -msgstr "Este necesar? resetarea cardului" +msgstr "Este necesar?? resetarea cardului" #, fuzzy #| msgid "Element not found" msgid "LDAP control not found" -msgstr "Elementul nu a fost g?sit" +msgstr "Elementul nu a fost g??sit" #, fuzzy #| msgid "Not supported" msgid "Not supported by LDAP" -msgstr "Nu este suportat(?)" +msgstr "Nu este suportat(??)" #, fuzzy #| msgid "Unexpected error" msgid "LDAP connect error" -msgstr "Eroare nea?teptat?" +msgstr "Eroare nea??teptat??" msgid "Out of memory in LDAP" msgstr "" @@ -1118,7 +1118,7 @@ msgstr "" #, fuzzy #| msgid "Unsupported operation" msgid "User cancelled LDAP operation" -msgstr "Opera?ie nesuportat?" +msgstr "Opera??ie nesuportat??" #, fuzzy #| msgid "Bad certificate" @@ -1127,12 +1127,12 @@ msgstr "Certificat incorect" #, fuzzy msgid "Unknown LDAP authentication method" -msgstr "Expresie-S necunoscut?" +msgstr "Expresie-S necunoscut??" #, fuzzy #| msgid "Timeout" msgid "Timeout in LDAP" -msgstr "Pauz?" +msgstr "Pauz??" #, fuzzy #| msgid "dirmngr error" @@ -1180,7 +1180,7 @@ msgstr "" #, fuzzy msgid "LDAP authentication method not supported" -msgstr "Expresie-S necunoscut?" +msgstr "Expresie-S necunoscut??" msgid "Strong(er) LDAP authentication required" msgstr "" @@ -1191,7 +1191,7 @@ msgstr "" #, fuzzy #| msgid "General error" msgid "LDAP referral" -msgstr "Eroare general?" +msgstr "Eroare general??" msgid "Administrative LDAP limit exceeded" msgstr "" @@ -1202,7 +1202,7 @@ msgstr "" #, fuzzy #| msgid "Card reset required" msgid "Confidentiality required by LDAP" -msgstr "Este necesar? resetarea cardului" +msgstr "Este necesar?? resetarea cardului" msgid "LDAP SASL bind in progress" msgstr "" @@ -1218,7 +1218,7 @@ msgstr "Argument invalid" #, fuzzy #| msgid "Unsupported protection" msgid "Inappropriate matching in LDAP" -msgstr "Protec?ie nesuportat?" +msgstr "Protec??ie nesuportat??" #, fuzzy #| msgid "Protocol violation" @@ -1231,7 +1231,7 @@ msgstr "" #, fuzzy #| msgid "Invalid state" msgid "Invalid syntax in LDAP" -msgstr "Stare invalid?" +msgstr "Stare invalid??" #, fuzzy #| msgid "No CMS object" @@ -1241,12 +1241,12 @@ msgstr "Nici un obiect CMS" #, fuzzy #| msgid "Hardware problem" msgid "LDAP alias problem" -msgstr "Problem? hardware" +msgstr "Problem?? hardware" #, fuzzy #| msgid "Invalid state" msgid "Invalid DN syntax in LDAP" -msgstr "Stare invalid?" +msgstr "Stare invalid??" msgid "LDAP entry is a leaf" msgstr "" @@ -1254,7 +1254,7 @@ msgstr "" #, fuzzy #| msgid "Encoding problem" msgid "LDAP alias dereferencing problem" -msgstr "Problem? de encodare" +msgstr "Problem?? de encodare" msgid "LDAP proxy authorization failure (X)" msgstr "" @@ -1262,7 +1262,7 @@ msgstr "" #, fuzzy #| msgid "Unsupported protection" msgid "Inappropriate LDAP authentication" -msgstr "Protec?ie nesuportat?" +msgstr "Protec??ie nesuportat??" #, fuzzy #| msgid "Invalid card" @@ -1287,7 +1287,7 @@ msgstr "" #, fuzzy #| msgid "Missing action" msgid "LDAP naming violation" -msgstr "Ac?iune lips?" +msgstr "Ac??iune lips??" #, fuzzy #| msgid "Protocol violation" @@ -1296,12 +1296,12 @@ msgstr "Violare de protocol" #, fuzzy msgid "LDAP operation not allowed on non-leaf" -msgstr "Opera?iune anulat?" +msgstr "Opera??iune anulat??" #, fuzzy #| msgid "Operation cancelled" msgid "LDAP operation not allowed on RDN" -msgstr "Opera?iune anulat?" +msgstr "Opera??iune anulat??" msgid "Already exists (LDAP)" msgstr "" @@ -1312,19 +1312,19 @@ msgstr "" #, fuzzy #| msgid "Line too long" msgid "LDAP results too large" -msgstr "Linie prea lung?" +msgstr "Linie prea lung??" #, fuzzy #| msgid "Operation cancelled" msgid "LDAP operation affects multiple DSAs" -msgstr "Opera?iune anulat?" +msgstr "Opera??iune anulat??" msgid "Virtual LDAP list view error" msgstr "" #, fuzzy msgid "Other LDAP error" -msgstr "Eroare general?" +msgstr "Eroare general??" #, fuzzy #| msgid "Resources exhausted" @@ -1339,7 +1339,7 @@ msgstr "Violare de protocol" #, fuzzy #| msgid "Invalid state" msgid "Invalid data in LCUP" -msgstr "Stare invalid?" +msgstr "Stare invalid??" #, fuzzy #| msgid "Unsupported certificate" @@ -1349,7 +1349,7 @@ msgstr "Certificat nesuportat" #, fuzzy #| msgid "Card reset required" msgid "Reload required in LCUP" -msgstr "Este necesar? resetarea cardului" +msgstr "Este necesar?? resetarea cardului" #, fuzzy #| msgid "Success" @@ -1358,11 +1358,11 @@ msgstr "Succes" #, fuzzy msgid "No LDAP operation to cancel" -msgstr "Opera?ie nesuportat?" +msgstr "Opera??ie nesuportat??" #, fuzzy msgid "Too late to cancel LDAP" -msgstr "Opera?ie nesuportat?" +msgstr "Opera??ie nesuportat??" msgid "Cannot cancel LDAP" msgstr "" @@ -1370,7 +1370,7 @@ msgstr "" #, fuzzy #| msgid "Decryption failed" msgid "LDAP assertion failed" -msgstr "Decriptarea a e?uat" +msgstr "Decriptarea a e??uat" msgid "Proxied authorization denied by LDAP" msgstr "" @@ -1427,10 +1427,10 @@ msgid "System error w/o errno" msgstr "" msgid "Unknown system error" -msgstr "Eroare de sistem necunoscut?" +msgstr "Eroare de sistem necunoscut??" msgid "End of file" -msgstr "Sf?r?it de fi?ier" +msgstr "Sf??r??it de fi??ier" msgid "Unknown error code" msgstr "Cod de eroare necunoscut" @@ -1441,7 +1441,7 @@ msgstr "Folosire: %s EROARE-GPG [...]\n" #, c-format msgid "%s: warning: could not recognize %s\n" -msgstr "%s: avertisment: nu am putut recunoa?te %s\n" +msgstr "%s: avertisment: nu am putut recunoa??te %s\n" #, fuzzy #~| msgid "Resources exhausted" @@ -1456,12 +1456,12 @@ msgstr "%s: avertisment: nu am putut recunoa #, fuzzy #~| msgid "Decryption failed" #~ msgid "Assertion failed in lDAP" -#~ msgstr "Decriptarea a e?uat" +#~ msgstr "Decriptarea a e??uat" #, fuzzy #~| msgid "General error" #~ msgid "LDAP Other general error" -#~ msgstr "Eroare general?" +#~ msgstr "Eroare general??" #, fuzzy #~| msgid "dirmngr error" commit 0e1e5d8f91259692f97661b7c5bd1fa7ff029e3d Author: Daniel Kahn Gillmor Date: Wed Nov 16 08:52:42 2016 +0900 Convert THANKS to UTF-8. -- Signed-off-by: Daniel Kahn Gillmor diff --git a/THANKS b/THANKS index 9250249..9f37446 100644 --- a/THANKS +++ b/THANKS @@ -1,5 +1,5 @@ -Albrecht Dre? albrecht.dress at arcor de +Albrecht Dre?? albrecht.dress at arcor de Guillaume Libersat glibersat at hurdfr org Jakub Bogusz qboosh at pld-linux org Petr Pisar petr.pisar at atlas cz commit 441ab0d81f4ded0555d60af7b629157a5558911c Author: Daniel Kahn Gillmor Date: Wed Nov 16 08:52:41 2016 +0900 Fix misspellings in error descriptions. -- Signed-off-by: Daniel Kahn Gillmor diff --git a/doc/errorref.txt b/doc/errorref.txt index 0203724..da4510e 100644 --- a/doc/errorref.txt +++ b/doc/errorref.txt @@ -739,7 +739,7 @@ GPG_ERR_BAD_HS_CERT_VER Bad certificate verify message in handshake NTBTLS: - As the description says. -GPG_ERR_BAD_HS_CHANGE_CIPHER Bad change cipher messsage in handshake +GPG_ERR_BAD_HS_CHANGE_CIPHER Bad change cipher message in handshake NTBTLS: - As the description says. diff --git a/po/cs.po b/po/cs.po index 4b58c21..4ff6ef0 100644 --- a/po/cs.po +++ b/po/cs.po @@ -824,7 +824,7 @@ msgstr "Chybn?? zpr??va s??po??adavkem na certifik??t v??zah??jen??" msgid "Bad certificate verify message in handshake" msgstr "Chybn?? zpr??va o??ov????en?? certifik??tu v??zah??jen??" -msgid "Bad change cipher messsage in handshake" +msgid "Bad change cipher message in handshake" msgstr "Chybn?? zpr??va se zm??nou ??ifry v??zah??jen??" msgid "Bad client hello message in handshake" @@ -833,7 +833,7 @@ msgstr "Chybn?? zpr??va s??pozdravem klienta v??zah??jen??" msgid "Bad server hello message in handshake" msgstr "Chybn?? zpr??va s??pozdravem serveru v??zah??jen??" -msgid "Bad server hello done message in hanshake" +msgid "Bad server hello done message in handshake" msgstr "Chybn?? zpr??va o??dokon??en?? pozdravu serveru v??zah??jen??" msgid "Bad finished message in handshake" diff --git a/po/da.po b/po/da.po index 7fd9f11..61ba1e2 100644 --- a/po/da.po +++ b/po/da.po @@ -819,7 +819,7 @@ msgstr "Besked om ??delagt certifikatforesp??rgsel i h??ndtrykket" msgid "Bad certificate verify message in handshake" msgstr "Besked om ??delagt certifikatforesp??rgsel i h??ndtrykket" -msgid "Bad change cipher messsage in handshake" +msgid "Bad change cipher message in handshake" msgstr "??delagt ????ndr chiffer??-besked i h??ndtrykket" msgid "Bad client hello message in handshake" @@ -829,7 +829,7 @@ msgid "Bad server hello message in handshake" msgstr "Besked om ??delagt serverhilsen i h??ndtrykket" # engelsk fejl -msgid "Bad server hello done message in hanshake" +msgid "Bad server hello done message in handshake" msgstr "??delagt ??afsluttet serverhilsen??-besked i h??ndtrykket" msgid "Bad finished message in handshake" diff --git a/po/de.po b/po/de.po index 2abbf88..1a8ebcc 100644 --- a/po/de.po +++ b/po/de.po @@ -810,7 +810,7 @@ msgstr "Fehlerhafte Zertifikatsanforderungsnachricht im Handshake" msgid "Bad certificate verify message in handshake" msgstr "Fehlerhafte Zertifikats??berpr??fungsnachricht im Handshake" -msgid "Bad change cipher messsage in handshake" +msgid "Bad change cipher message in handshake" msgstr "Fehlerhafte Verschl??sselungsalgorithmuswechselnachricht im Handshake" msgid "Bad client hello message in handshake" @@ -819,7 +819,7 @@ msgstr "Fehlerhafte \"Client Hello\" Nachricht im Handshake" msgid "Bad server hello message in handshake" msgstr "Fehlerhafte \"Server Hello\" Nachricht im Handshake" -msgid "Bad server hello done message in hanshake" +msgid "Bad server hello done message in handshake" msgstr "Fehlerhafte \"Server Hello Done\" Nachricht im Handshake" msgid "Bad finished message in handshake" diff --git a/po/eo.po b/po/eo.po index a511ac9..5948f9a 100644 --- a/po/eo.po +++ b/po/eo.po @@ -874,7 +874,7 @@ msgstr "" msgid "Bad certificate verify message in handshake" msgstr "" -msgid "Bad change cipher messsage in handshake" +msgid "Bad change cipher message in handshake" msgstr "" msgid "Bad client hello message in handshake" @@ -883,7 +883,7 @@ msgstr "" msgid "Bad server hello message in handshake" msgstr "" -msgid "Bad server hello done message in hanshake" +msgid "Bad server hello done message in handshake" msgstr "" msgid "Bad finished message in handshake" diff --git a/po/fr.po b/po/fr.po index a03a9e7..db1cdcb 100644 --- a/po/fr.po +++ b/po/fr.po @@ -817,8 +817,7 @@ msgstr "Mauvais message de demande de certificat dans l???initialisation" msgid "Bad certificate verify message in handshake" msgstr "Mauvais message de v??rification de certificat dans l???initialisation" -# NOTE: s/messsage/message/ -msgid "Bad change cipher messsage in handshake" +msgid "Bad change cipher message in handshake" msgstr "Mauvais message de modification d???algorithme dans l???initialisation" msgid "Bad client hello message in handshake" @@ -827,8 +826,7 @@ msgstr "Mauvais message de salut du client dans l???initialisation" msgid "Bad server hello message in handshake" msgstr "Mauvais message de salut du serveur dans l???initialisation" -# NOTE: s/hanshake/handshake/ -msgid "Bad server hello done message in hanshake" +msgid "Bad server hello done message in handshake" msgstr "Mauvais message de fin de salut du serveur dans l???initialisation" msgid "Bad finished message in handshake" diff --git a/po/hu.po b/po/hu.po index b271089..cb143e0 100644 --- a/po/hu.po +++ b/po/hu.po @@ -872,7 +872,7 @@ msgstr "" msgid "Bad certificate verify message in handshake" msgstr "" -msgid "Bad change cipher messsage in handshake" +msgid "Bad change cipher message in handshake" msgstr "" msgid "Bad client hello message in handshake" @@ -881,7 +881,7 @@ msgstr "" msgid "Bad server hello message in handshake" msgstr "" -msgid "Bad server hello done message in hanshake" +msgid "Bad server hello done message in handshake" msgstr "" msgid "Bad finished message in handshake" diff --git a/po/it.po b/po/it.po index 82d1782..dc17bcb 100644 --- a/po/it.po +++ b/po/it.po @@ -815,7 +815,7 @@ msgstr "Messaggio di richiesta del certificato errato nell'handshake" msgid "Bad certificate verify message in handshake" msgstr "Messaggio di verifica del certificato errato nell'handshake" -msgid "Bad change cipher messsage in handshake" +msgid "Bad change cipher message in handshake" msgstr "Messaggi di modifica cifrario errato nell'handshake" msgid "Bad client hello message in handshake" @@ -824,7 +824,7 @@ msgstr "Messaggio client hello errato nell'handshake" msgid "Bad server hello message in handshake" msgstr "Messaggio server hello errato nell'handshake" -msgid "Bad server hello done message in hanshake" +msgid "Bad server hello done message in handshake" msgstr "Messaggio server hello completato errato nell'handshake" msgid "Bad finished message in handshake" diff --git a/po/ja.po b/po/ja.po index f1d44e4..e0e76c5 100644 --- a/po/ja.po +++ b/po/ja.po @@ -806,7 +806,7 @@ msgstr "?????????????????????????????????????????????????????????????????????" msgid "Bad certificate verify message in handshake" msgstr "?????????????????????????????????????????????????????????????????????" -msgid "Bad change cipher messsage in handshake" +msgid "Bad change cipher message in handshake" msgstr "??????????????????????????????????????????????????????????????????" msgid "Bad client hello message in handshake" @@ -815,7 +815,7 @@ msgstr "???????????????????????????????????????????????????????????????????????? msgid "Bad server hello message in handshake" msgstr "????????????????????????????????????????????????????????????????????????" -msgid "Bad server hello done message in hanshake" +msgid "Bad server hello done message in handshake" msgstr "??????????????????????????????????????????????????????????????????????????????" msgid "Bad finished message in handshake" diff --git a/po/nl.po b/po/nl.po index e5734a1..d90ac4f 100644 --- a/po/nl.po +++ b/po/nl.po @@ -816,7 +816,7 @@ msgstr "Slecht verzoek om certificaatbericht in uitwisseling" msgid "Bad certificate verify message in handshake" msgstr "Slecht certificaatbericht over verificatie in uitwisseling" -msgid "Bad change cipher messsage in handshake" +msgid "Bad change cipher message in handshake" msgstr "Slecht wijzigingsbericht over vercijfering in uitwisseling" msgid "Bad client hello message in handshake" @@ -825,7 +825,7 @@ msgstr "Slecht hello-bericht van client in uitwisseling" msgid "Bad server hello message in handshake" msgstr "Slecht hello-bericht van server in uitwisseling" -msgid "Bad server hello done message in hanshake" +msgid "Bad server hello done message in handshake" msgstr "Slecht hello-gedaan-bericht van server in uitwisseling" msgid "Bad finished message in handshake" diff --git a/po/pl.po b/po/pl.po index dcb26d9..66f66f2 100644 --- a/po/pl.po +++ b/po/pl.po @@ -804,7 +804,7 @@ msgstr "B????dny komunikat ????dania certyfikatu przy powitaniu" msgid "Bad certificate verify message in handshake" msgstr "B????dny komunikat weryfikacji certyfikatu przy powitaniu" -msgid "Bad change cipher messsage in handshake" +msgid "Bad change cipher message in handshake" msgstr "B????dny komunikat zmiany szyfru przy powitaniu" msgid "Bad client hello message in handshake" @@ -813,7 +813,7 @@ msgstr "B????dny komunikat przywitania klienta w powitaniu" msgid "Bad server hello message in handshake" msgstr "B????dny komunikat przywitania serwera w powitaniu" -msgid "Bad server hello done message in hanshake" +msgid "Bad server hello done message in handshake" msgstr "B????dny komunikat zako??czenia przywitania serwera w powitaniu" msgid "Bad finished message in handshake" diff --git a/po/pt.po b/po/pt.po index 691c64c..822d307 100644 --- a/po/pt.po +++ b/po/pt.po @@ -816,7 +816,7 @@ msgstr "Mensagem de pedido de certificado errada no handshake" msgid "Bad certificate verify message in handshake" msgstr "Mensagem de verifica????o de certificado errada no handshake" -msgid "Bad change cipher messsage in handshake" +msgid "Bad change cipher message in handshake" msgstr "Mensagem de altera????o de certificado errada no handshake" msgid "Bad client hello message in handshake" @@ -825,7 +825,7 @@ msgstr "Mensagem de hello do cliente errada no handshake" msgid "Bad server hello message in handshake" msgstr "Mensagem de hello do servidor errada no handshake" -msgid "Bad server hello done message in hanshake" +msgid "Bad server hello done message in handshake" msgstr "Mensagem de hello done do servidor errada no handshake" msgid "Bad finished message in handshake" diff --git a/po/ro.po b/po/ro.po index 2e5f404..c9ad5dd 100644 --- a/po/ro.po +++ b/po/ro.po @@ -874,7 +874,7 @@ msgstr "" msgid "Bad certificate verify message in handshake" msgstr "" -msgid "Bad change cipher messsage in handshake" +msgid "Bad change cipher message in handshake" msgstr "" msgid "Bad client hello message in handshake" @@ -883,7 +883,7 @@ msgstr "" msgid "Bad server hello message in handshake" msgstr "" -msgid "Bad server hello done message in hanshake" +msgid "Bad server hello done message in handshake" msgstr "" msgid "Bad finished message in handshake" diff --git a/po/ru.po b/po/ru.po index 69cd250..8ff628b 100644 --- a/po/ru.po +++ b/po/ru.po @@ -810,7 +810,7 @@ msgstr "???????????? ??????????????????-???????????? ?????????????????????? ???? msgid "Bad certificate verify message in handshake" msgstr "???????????? ??????????????????-???????????????? ?????????????????????? ?????? ???????????????????????? ??????????" -msgid "Bad change cipher messsage in handshake" +msgid "Bad change cipher message in handshake" msgstr "???????????? ?????????????????? ?????????? ?????????? ?????? ???????????????????????? ??????????" msgid "Bad client hello message in handshake" @@ -819,7 +819,7 @@ msgstr "???????????? ?????????????????? ?????????????????? ?????????????? ?????? msgid "Bad server hello message in handshake" msgstr "???????????? ?????????????????? ?????????????????? ?????????????? ?????? ???????????????????????? ??????????" -msgid "Bad server hello done message in hanshake" +msgid "Bad server hello done message in handshake" msgstr "???????????? ?????????????????? ?????????????? ???? ?????????????????? ?????????????????? ?????? ???????????????????????? ??????????" msgid "Bad finished message in handshake" diff --git a/po/sr.po b/po/sr.po index be7117d..1a0f4f4 100644 --- a/po/sr.po +++ b/po/sr.po @@ -871,7 +871,7 @@ msgstr "" msgid "Bad certificate verify message in handshake" msgstr "" -msgid "Bad change cipher messsage in handshake" +msgid "Bad change cipher message in handshake" msgstr "" msgid "Bad client hello message in handshake" @@ -880,7 +880,7 @@ msgstr "" msgid "Bad server hello message in handshake" msgstr "" -msgid "Bad server hello done message in hanshake" +msgid "Bad server hello done message in handshake" msgstr "" msgid "Bad finished message in handshake" diff --git a/po/sv.po b/po/sv.po index b4b6ea3..5ed1db1 100644 --- a/po/sv.po +++ b/po/sv.po @@ -861,7 +861,7 @@ msgstr "" msgid "Bad certificate verify message in handshake" msgstr "" -msgid "Bad change cipher messsage in handshake" +msgid "Bad change cipher message in handshake" msgstr "" msgid "Bad client hello message in handshake" @@ -870,7 +870,7 @@ msgstr "" msgid "Bad server hello message in handshake" msgstr "" -msgid "Bad server hello done message in hanshake" +msgid "Bad server hello done message in handshake" msgstr "" msgid "Bad finished message in handshake" diff --git a/po/uk.po b/po/uk.po index cbab08a..173bacd 100644 --- a/po/uk.po +++ b/po/uk.po @@ -815,7 +815,7 @@ msgstr "" "?????????????????? ???????????????????????? ???????? ?????????????????? ???????????????????????? ?????? ?????? ?????????????????????????? " "???????????????" -msgid "Bad change cipher messsage in handshake" +msgid "Bad change cipher message in handshake" msgstr "?????????????????? ???????????????????????? ???????? ?????????? ?????????? ?????? ?????? ?????????????????????????? ???????????????" msgid "Bad client hello message in handshake" @@ -824,7 +824,7 @@ msgstr "?????????????????? ???????????????? ???????????????????????? ?????????? msgid "Bad server hello message in handshake" msgstr "?????????????????? ???????????????? ???????????????????????? ?????????????? ?????? ?????? ?????????????????????????? ???????????????" -msgid "Bad server hello done message in hanshake" +msgid "Bad server hello done message in handshake" msgstr "" "?????????????????? ???????????????????????? ?????? ???????????????????? ?????????????? ?????? ?????????????? ?????? ?????? " "?????????????????????????? ???????????????" diff --git a/po/vi.po b/po/vi.po index 4ee1ec9..1179fca 100644 --- a/po/vi.po +++ b/po/vi.po @@ -863,7 +863,7 @@ msgstr "" msgid "Bad certificate verify message in handshake" msgstr "" -msgid "Bad change cipher messsage in handshake" +msgid "Bad change cipher message in handshake" msgstr "" msgid "Bad client hello message in handshake" @@ -872,7 +872,7 @@ msgstr "" msgid "Bad server hello message in handshake" msgstr "" -msgid "Bad server hello done message in hanshake" +msgid "Bad server hello done message in handshake" msgstr "" msgid "Bad finished message in handshake" diff --git a/po/zh_CN.po b/po/zh_CN.po index 680af4b..a65757e 100644 --- a/po/zh_CN.po +++ b/po/zh_CN.po @@ -860,7 +860,7 @@ msgstr "" msgid "Bad certificate verify message in handshake" msgstr "" -msgid "Bad change cipher messsage in handshake" +msgid "Bad change cipher message in handshake" msgstr "" msgid "Bad client hello message in handshake" @@ -869,7 +869,7 @@ msgstr "" msgid "Bad server hello message in handshake" msgstr "" -msgid "Bad server hello done message in hanshake" +msgid "Bad server hello done message in handshake" msgstr "" msgid "Bad finished message in handshake" diff --git a/po/zh_TW.po b/po/zh_TW.po index ac6d7e3..afa8ae4 100644 --- a/po/zh_TW.po +++ b/po/zh_TW.po @@ -818,7 +818,7 @@ msgstr "????????????????????????????????????" msgid "Bad certificate verify message in handshake" msgstr "????????????????????????????????????" -msgid "Bad change cipher messsage in handshake" +msgid "Bad change cipher message in handshake" msgstr "???????????????????????????????????????" msgid "Bad client hello message in handshake" @@ -827,7 +827,7 @@ msgstr "???????????????????????????????????????" msgid "Bad server hello message in handshake" msgstr "???????????????????????????????????????" -msgid "Bad server hello done message in hanshake" +msgid "Bad server hello done message in handshake" msgstr "?????????????????????????????????????????????" msgid "Bad finished message in handshake" diff --git a/src/err-codes.h.in b/src/err-codes.h.in index 082819e..de703d7 100644 --- a/src/err-codes.h.in +++ b/src/err-codes.h.in @@ -274,10 +274,10 @@ 240 GPG_ERR_BAD_HS_CERT Bad certificate message in handshake 241 GPG_ERR_BAD_HS_CERT_REQ Bad certificate request message in handshake 242 GPG_ERR_BAD_HS_CERT_VER Bad certificate verify message in handshake -243 GPG_ERR_BAD_HS_CHANGE_CIPHER Bad change cipher messsage in handshake +243 GPG_ERR_BAD_HS_CHANGE_CIPHER Bad change cipher message in handshake 244 GPG_ERR_BAD_HS_CLIENT_HELLO Bad client hello message in handshake 245 GPG_ERR_BAD_HS_SERVER_HELLO Bad server hello message in handshake -246 GPG_ERR_BAD_HS_SERVER_HELLO_DONE Bad server hello done message in hanshake +246 GPG_ERR_BAD_HS_SERVER_HELLO_DONE Bad server hello done message in handshake 247 GPG_ERR_BAD_HS_FINISHED Bad finished message in handshake 248 GPG_ERR_BAD_HS_SERVER_KEX Bad server key exchange message in handshake 249 GPG_ERR_BAD_HS_CLIENT_KEX Bad client key exchange message in handshake ----------------------------------------------------------------------- Summary of changes: NEWS | 4 +- THANKS | 2 +- doc/errorref.txt | 4 +- doc/gpgrt.texi | 4 +- po/cs.po | 4 +- po/da.po | 4 +- po/de.po | 4 +- po/eo.po | 4 +- po/fr.po | 6 +- po/hu.po | 4 +- po/it.po | 4 +- po/ja.po | 4 +- po/nl.po | 4 +- po/pl.po | 4 +- po/pt.po | 4 +- po/ro.po | 380 +++++++++++++++++++++++++-------------------------- po/ru.po | 4 +- po/sr.po | 4 +- po/sv.po | 4 +- po/uk.po | 4 +- po/vi.po | 4 +- po/zh_CN.po | 4 +- po/zh_TW.po | 4 +- src/err-codes.h.in | 4 +- src/estream-printf.c | 2 +- src/w32-gettext.c | 1 - src/w32-iconv.c | 4 +- 27 files changed, 238 insertions(+), 241 deletions(-) hooks/post-receive -- Error codes used by GnuPG et al. http://git.gnupg.org From cvs at cvs.gnupg.org Fri Nov 18 08:40:06 2016 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Fri, 18 Nov 2016 08:40:06 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.1.15-393-g833eef9 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via 833eef974ad4721b9b3e247bae9c890476a936ce (commit) via b3a917201207898059c048dd101344765201b03c (commit) from b2e1b17efa952afcf7aeec8b15e9d0088dba587a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 833eef974ad4721b9b3e247bae9c890476a936ce Author: Werner Koch Date: Fri Nov 18 08:28:15 2016 +0100 dirmngr: Use a longer timer tick interval. * dirmngr/dirmngr.c (TIMERTICK_INTERVAL): Always use 60 seconds like we did for WindowsCE. -- Given that the timer tick is only used for housekeeping tasks and these are done every 10 minutes, it makes no sense to use 2 seconds. The minor drawback is tha the housekeeping may be delayed by one minute. NB: For the purpose of power saving, we already make sure that the process wakes up at the full second so that it is synchronized to the wakeup time of other processes. Signed-off-by: Werner Koch diff --git a/dirmngr/dirmngr.c b/dirmngr/dirmngr.c index 2a6729e..7214d49 100644 --- a/dirmngr/dirmngr.c +++ b/dirmngr/dirmngr.c @@ -296,17 +296,10 @@ static int active_connections; * thread to run background network tasks. */ static int network_activity_seen; -/* The timer tick used for housekeeping stuff. For Windows we use a - longer period as the SetWaitableTimer seems to signal earlier than - the 2 seconds. All values are in seconds. */ -#if defined(HAVE_W32CE_SYSTEM) -# define TIMERTICK_INTERVAL (60) -#elif defined(HAVE_W32_SYSTEM) -# define TIMERTICK_INTERVAL (4) -#else -# define TIMERTICK_INTERVAL (2) -#endif +/* The timer tick used for housekeeping stuff. */ +#define TIMERTICK_INTERVAL (60) +/* How oft to run the housekeeping. */ #define HOUSEKEEPING_INTERVAL (600) commit b3a917201207898059c048dd101344765201b03c Author: Daniel Kahn Gillmor Date: Mon Oct 31 20:33:02 2016 -0400 dirmngr: More w32 system daemon cleanup * dirmngr/dirmngr.c (handle_tick): Remove w32 tests for shutdown_pending; no longer needed. -- In d83ba4897bf217d1045c58d1b99e52bd31c58812, we removed the Windows-specific system daemon features, where shutdown_pending was set from w32_service_control(). shutdown_pending is now never assigned outside of handle_signal() or within an inotify test, neither of which are available on w32. As a result, this stanza in handle_tick() should be dead code, and can be removed to keep things simple. Signed-off-by: Daniel Kahn Gillmor s/win32/w32/ to please RMS ;-) -wk diff --git a/dirmngr/dirmngr.c b/dirmngr/dirmngr.c index f5dce81..2a6729e 100644 --- a/dirmngr/dirmngr.c +++ b/dirmngr/dirmngr.c @@ -1842,20 +1842,6 @@ time_for_housekeeping_p (time_t curtime) static void handle_tick (void) { - /* Under Windows we don't use signals and need a way for the loop to - check for the shutdown flag. */ -#ifdef HAVE_W32_SYSTEM - if (shutdown_pending) - log_info (_("SIGTERM received - shutting down ...\n")); - if (shutdown_pending > 2) - { - log_info (_("shutdown forced\n")); - log_info ("%s %s stopped\n", strusage(11), strusage(13) ); - cleanup (); - dirmngr_exit (0); - } -#endif /*HAVE_W32_SYSTEM*/ - if (time_for_housekeeping_p (gnupg_get_time ())) { npth_t thread; ----------------------------------------------------------------------- Summary of changes: dirmngr/dirmngr.c | 27 +++------------------------ 1 file changed, 3 insertions(+), 24 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Fri Nov 18 12:38:09 2016 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Fri, 18 Nov 2016 12:38:09 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.1.15-394-g1c0b140 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via 1c0b140cccfb884c6d07785c3284b9df06dccd3c (commit) from 833eef974ad4721b9b3e247bae9c890476a936ce (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 1c0b140cccfb884c6d07785c3284b9df06dccd3c Author: NIIBE Yutaka Date: Fri Nov 18 20:32:22 2016 +0900 g10: Fix flags to open for lock of ToFU. * g10/tofu.c (busy_handler): Fix the flags and utime is not needed. -- The argument flags must include one of O_RDONLY, O_WRONLY, or O_RDWR. Adding O_TRUNC, the file is updated. So, utime is not needed. Fixes-commit: b2e1b17efa952afcf7aeec8b15e9d0088dba587a Signed-off-by: NIIBE Yutaka diff --git a/g10/tofu.c b/g10/tofu.c index cf1d00a..2c9d17c 100644 --- a/g10/tofu.c +++ b/g10/tofu.c @@ -732,16 +732,13 @@ busy_handler (void *cookie, int call_count) process will have to wait a bit longer, but otherwise nothing horrible should happen. */ - int fd = open (dbs->want_lock_file, O_CREAT, + int fd = open (dbs->want_lock_file, O_CREAT|O_WRONLY|O_TRUNC, S_IRUSR|S_IRGRP|S_IROTH|S_IWUSR); if (fd == -1) log_debug ("TOFU: Error opening '%s': %s\n", dbs->want_lock_file, strerror (errno)); else - { - utime (dbs->want_lock_file, NULL); - close (fd); - } + close (fd); } /* Call again. */ ----------------------------------------------------------------------- Summary of changes: g10/tofu.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Fri Nov 18 15:26:10 2016 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Fri, 18 Nov 2016 15:26:10 +0100 Subject: [git] GnuPG - branch, STABLE-BRANCH-2-2, updated. gnupg-2.1.15-394-g1c0b140 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, STABLE-BRANCH-2-2 has been updated via 1c0b140cccfb884c6d07785c3284b9df06dccd3c (commit) via 833eef974ad4721b9b3e247bae9c890476a936ce (commit) via b3a917201207898059c048dd101344765201b03c (commit) via b2e1b17efa952afcf7aeec8b15e9d0088dba587a (commit) via b6066ab18a67195817babaf9eccf896c2b3c7b0e (commit) via 8fb482252436b3b4b0b33663d95d1d17188ad1d9 (commit) via 7c1613d41566f7d8db116790087de323621205fe (commit) via c4e02a3b7ad6ee1da6bfc439921378bdbd5c029c (commit) via 5210ff70bc79673d14f346297798d8d7bafc8215 (commit) via 4f189325a409bb08f7a8eabfac3f4579288cf5c5 (commit) via fc53a4d06eaf891143ab4efec9caffe31ebc2bc0 (commit) via bd91f92ace09263e3a91177f2a1644379baeb08a (commit) via c45ca316a54665915ae08399484db271566db7c0 (commit) via d8da5bc50b856db3445435780311c9f8e52a5144 (commit) via 52c10a280af6ce06eb1732ff35b095f2b8d24b9f (commit) via 4839e6d002a8ad1f7d3260792c3c9641e258f342 (commit) via c4506a3f15bba5d257cb4c6738800c5e00ecc9a2 (commit) via c564790df723beef031d83802bd7830737bd330a (commit) via 43bfaf2c5417ede621c0a07721952ea549a7a139 (commit) via 500e594c2da530e69a63fc1a40d173458682fa0e (commit) via b47603a0ac24902c5bb000f8ef27cfb99aceeb81 (commit) via 4bd12b571e661c7f208cf8a96c32bbacfc8b2598 (commit) via 8ea3b4c4102dc67ed83d4419b7171e422fc01047 (commit) via 12834e84aca9d74800245f0f2f2e6b5123e76173 (commit) via d20107f6da094edd782947abb357abae5129a12c (commit) via 1d03cc77e1706f7da653153ad4b58c61e4fd2573 (commit) via bd60742925414e0ef2a497df827c1913ea211a44 (commit) via 26c7c1d72c5f2acb3edb58d610c09a635c87bdbf (commit) via 1f7639ebbe58af1b581b0be7809da9ee55482992 (commit) via f86b1a15ad4bb7bcc1e9f7d209aabcb23641f7df (commit) via 809d67e74014cb563efd965744fd11f87bbae743 (commit) via 64a58e23c38db8658423bbe26fcd650330e24a88 (commit) via 93cc322ac06d3045a24aece90091f7f80f3dacb8 (commit) via 2cd281c4def1ea881b92b9aba18c1892f89c1870 (commit) via 83c184a66b73f312425b01008f0495610e5329a4 (commit) via 4ee4d0b02172cf56d9582bb99e32a65c75315b25 (commit) via 6bf698197222bf6081c249c815aebb075e8ec820 (commit) via 4473db1ef24031ff4e26c9a9de95dbe898ed2b97 (commit) via 7b04a43c05834b937b32a596f1941e9728add5fa (commit) via 57e95f5413e21cfcb957af2346b292686a5647b7 (commit) via e51912f467fda963c7abcfcd4082d6eb084ba5be (commit) via 1854f0f6112651c4fc3b92372b98c932e830ed21 (commit) via 5d13581f4737c18430f6572dd4ef486d1ad80dd1 (commit) via c8044c6e335f044d7386b9e8869bc4a0d3adff70 (commit) via ee08677d63a900cea85228024861a4f5c5a87c69 (commit) via e0cbd3389e2dd6ec19ee3a4c7bad81fa0f1907f5 (commit) via d3a98ff5bc972a4c9b01b9e5338a4a59b5b4ac48 (commit) via 568cfcde45a0d6c456d8f8be1ea0e408416badad (commit) via 9ee184bc0afaea06785d836ed175b851b9ae532f (commit) via d7c5799c282a03dcce0e3d327075233353cb76cc (commit) via 088d955bd8a6ec8bbf76c8a4c01eb08499d1d9fa (commit) via c7ea98cd3d44abf00e32c081e5049ad1d0b1f12c (commit) via 1062953d5132af674aacfc6372e3e9f066c5d145 (commit) via 2a7615c48ed79e6b28710cc293ce30c812b2e5b0 (commit) via 4dd4801bfa4c3f7ba279b3d171a8ed299dbffaaa (commit) via 591d61d80f4f81176f7e236df794922df9e001a1 (commit) via d4454837cd60981c2863955b11c9e1cc8f9e3833 (commit) via dd13b2a561e31045fd3d3576bab99543cd4eb6cc (commit) via 7cbb0803847b8db618d39ff50ae6015e409ab1ae (commit) via 26df829fa22f027ca4a5eaf155cdaa2123afbdd5 (commit) via abe0cc7a21d2b0b5c77cc525b999d1ede2d29185 (commit) via 4d98a72b88cf167295e1ecd6125b9c7a11b6239f (commit) via a55393cb5f4b331cb3a715c7d9a8b91f7606f337 (commit) via ac078469cbafe85cf771fca84f376740850d10b0 (commit) via 37751d2b194bc33539f5b9ea0e02e9f209d2bcf6 (commit) via 56e1864aa337f36317534db521fd4434d70e0784 (commit) via 70215ff470c82d144e872057dfa5a478cc9195f2 (commit) via 413cc50345557e0a516f33b98e8aab19bbc8b4fe (commit) via 6e677f9b55fdb610e93134042ee41ee5c641cbdf (commit) via 5840353d8bbcd9e75374f3bdb2547ffa7bbea897 (commit) via 4d7dc432b598d7d28d6caba78a94d12034134b96 (commit) via 2312a7f836b89b812298f25cf50ba56c6ce1806c (commit) via 1f45878a72f23d4bae08d73b614096b485f35274 (commit) via 43f8006f5c75e3d15fe200e2fa41587a73bfb07b (commit) via cd00b07ec26c3408e6aee66957b08c6fd319b700 (commit) via f9da935c3eb302e75a80def51128fb6f669661d7 (commit) via c1ea0b577a468030d2b006317ba27fc1746c4b14 (commit) via ab89164be02012f1bf159c971853b8610e966301 (commit) via 1ec07cbc209f247fd85704f5701564e31aa56d0b (commit) via d10b67b9bc32e8feff1be86e6646fc23e58fe45d (commit) via 0ed6a6df5aa421a9c5cdb1e63867f0deee79af9e (commit) via 488b183811fc25c1ae49b4730491accf1adf518e (commit) via 60ad1a7f37ffc10e601e69a3e2d2bb14af510257 (commit) via 5e693ddfbe44d149ce0d9393d699c613ad5ea706 (commit) via 68b59bbc42ba9ec69496758743924d54a95742f0 (commit) via 5d4f1408d0dd055d412ae44bb4a0f28f74617f05 (commit) via ad491ceec6145b3781a05dc7b4a36052abeeb4b4 (commit) via 3b6b8fe32af7568ff51066d4c2e3679df6dea86f (commit) via 7a634e48b13c5d5d295b8fed9b429e1b2109a333 (commit) via eec365a02bd35d2d5c9e4d2c8d18bcd9180cf859 (commit) via 614ca00676bb8ca12b5107fec0e4ef8818445254 (commit) via b6f08dbb0b45059cdbbb5d9be9725e437f42a8cc (commit) via 5a1f6a0062488aaf345b1c73ba98a540e673d619 (commit) via 8fced66be35db5ac2a6bfdb9bccb2c0e582d8256 (commit) via ece9ade4b44fb3d5d120cfd32b23632e5efd2134 (commit) via 8ea72a776a88f3c851e812d258355be80caa1bc1 (commit) via 445f0c13d751f6dee9d70ef0785866ab2a7ea120 (commit) via 66a0091d74768ab3a4a5342d3645e1834c59045a (commit) via cf20b23c146c9e499263654644035796475de097 (commit) via a9c8b5fbe7ae241bf45bdee15884abc7891aedf9 (commit) via 45dfc02b47f798f5a3b9973ca6a9f5a907d7e665 (commit) via a15ed5a1fd5307b3ec1822daf3b138b187db0b5e (commit) via 8b3d0d1a36cab83dafb98ccb7895144edb95e298 (commit) via 6f1d8123d61b3efac94b4c61ee75bd947790ba42 (commit) via 8a9341b42cd1891090d45cc068bff84b2b3edb50 (commit) via ca0ee4e381d0b6a57e4ddc8f4bb2390eb97a2540 (commit) via 6bbd97d6c771b2e2c7cfcff6d5a823f0fb44d443 (commit) via b648f28f9f8b889f1217a649ded1d45f261bb2bf (commit) via 75f8aaf5bc2dc7fcffe2987a572d489155c91eb9 (commit) via 6316b28e896957adb76a61a41d2e1c2a08d9f716 (commit) via 6bb6ac56cca8135666387a0b9d88dd6b50311418 (commit) via bc28f320fa6f5b9fcdb73dba5e6c582daf7992c5 (commit) via 96414baf36b8e6385b71847c789d489ebe176a93 (commit) via d1ccab5176d7719328b287544b54b85e0277b146 (commit) via b77f95a4a675fd20f6eeb611f4e7b519eceb4ad3 (commit) via ece13f177d948013b6f3df926406c0cd947abc25 (commit) via 21b318452abbfe21c45c2a67dae0e3a81cff1090 (commit) via 900c18f0b5f11cf2e9f30df5ec77ac511b533785 (commit) via 27f6d5b9f4b6057ddeb9ace87a1e7e61ebac63e6 (commit) via 3b5f5e0eb02ecbdcf59722755f22a9d2f88de6e6 (commit) via 852b8f0b89d447536dfdf6cd4ea91615c75491ce (commit) via f88f11a25665dca7490a09088aa24edf396e4c40 (commit) via b120f358c25cc846ca9d841d47e71ca1a7fe02e4 (commit) via 7983f8758703071710c11bf2a255efcd71836b65 (commit) via 9d6146d6f9870fbfcec15cdc4becaf094d5a90e0 (commit) via 8c40b3b98d3ddeda79fde981e6539c5b3b09d9a2 (commit) via fdb653a33ea1a24d1159880624dbbcc0867865b5 (commit) via 5e7dfd979d2d91800d90c3ce9a66755df3217682 (commit) via b1828c17fc475def1ee9e06f083f513f568c241b (commit) via 945e7ab0ddedf5f58afd97d81e101939de5b5d89 (commit) via acef0951646b47c87ccc1c616f0105a068e7ed86 (commit) via 987bbb2276aeb6bee2793e8406e223717b605009 (commit) via f7e50634be71ce3028726f23edf14454109a04a8 (commit) via d2653b1a6db90aed073194a51fd61023d69773ec (commit) via 693e657ff04756737dce025203c0deba480ea8de (commit) via dafce6f698bec6e9d4c0125b90754d0687294e86 (commit) via 161cb22f13bcd8cbdb08558d9926b2168a8297ac (commit) via 6e85ac77af594035137950d801d8a1bacce548a3 (commit) via 1ffd475f99eaff4e40950eda88702f8db9288eb5 (commit) via 71158d8d5f823888abc8588caa6497860ce59c06 (commit) via ca9597f080f70a8435daaeb5449bef0462a1402a (commit) via 8c7c4faf3de28ca70a60e6b15f51c1b206e0ddd9 (commit) via bf37916a23bd0929fc4a5f28c9a41f43c5a473f6 (commit) via 2d794779e0fd9d9a1efc98e7bd77a296a25f4293 (commit) via 9a34e2142b426b98c73fd888102ea1596bbce62a (commit) via b680f79cc112c4831293e259d7db2921bcd783a4 (commit) via 980c037bedb968ddf155dd334c0a70b918a17759 (commit) via 82cbab906a3e72a98fdc16096f2f0451465969a2 (commit) via 72a99f582dad4cb4c3b05b97c7ebb8d537f10b79 (commit) via 8dce5ee55a0268d196023224dcf3020306922490 (commit) via 05a1e412332dd980353a4e3e59bc75ba40bae7fc (commit) via f2d39a6d051413289c717b9cd2dc387a270b8e7c (commit) via 727ca74bb942464217e678012cccbfc347ae08a5 (commit) via 34439da2d62b964a914ace66bae7e38f619582a4 (commit) via f1845f25dbea79c191427710fa56ed01e63a045b (commit) via e0e782b4c619d3f83080fb4324c89f6b756f21a3 (commit) via c2e713d9e25ef8b61e8eeb3c01ee1e31cb70b794 (commit) via 869c06efa791bbc8330becdb3f13f7cf9506257e (commit) via c53ce53ab1fa6a328c368f2a15e3ccd803f03ee2 (commit) via 25428be52168fa9c581b7f11c95a5c63b25343b7 (commit) via 70a8584ec4389209762eb65bb77f20f7881577be (commit) via 0b0f9a3788cb5d3c26cec16cd24acc973069d280 (commit) via 2f7d4c38c9e7bcc14e6e0bf219d688c40a4afecb (commit) via c318561ef4c97f0c2767aef377531d58174060a1 (commit) via f99c5fa1c970dc1122ac62371eb8d758f380ed57 (commit) via 0c56ad5a8d89d69a9ed00571720b3b105f955214 (commit) via 95d0f3e5eebd85dcf226dca14891a1215bfe93ae (commit) via d2d936fbe86d61b89cead95df633b2b575690e05 (commit) via 4c0389f8eb19ae7dfd9c5d784a629b386d93cc5c (commit) via e09166c77273f459c8f87cab9224f85808af2cba (commit) via 5bf92e51dfdfb4f4746ecd817d8d2240ed27ea74 (commit) via 2282c3b761413dfa894300e70084bbd58908c0b1 (commit) via 3ad17e72fa81d18c95732ddcd4def244f52bb5b1 (commit) via ca84f65c7cf2c6a08a01018519965a82e6c52cac (commit) via 6fdf37f0831949cb279de6dc6b247ab2ed53fe5a (commit) via 78eda335fd1c29038b74b9cc912b6a4515fccd9f (commit) via cbbf0a7a8da1757fea29cff0daaa42a6bbb95b26 (commit) via 1f76f8d8bc65fad98927c977baf4d5e36dafe52b (commit) via 11eac7eb2fa3392a9aa052f8f5bb9875129ab84b (commit) via dff266059813d22d1e2ba7e77279999cd41ceb75 (commit) via 5afbfdfd59540cb882d891ff1f4afa73fe48f99a (commit) via fb3b3e1e7a4219f61a834fd07809898918611c2f (commit) via 1a24c67e20e6ccc6c8e37403a26c715c0f1b6216 (commit) via 5d43d28aa3c44c3a27fde823f467b0c4be1a58c2 (commit) via fc0b392e766af8127094e8b529d25abb84ad1d65 (commit) via 4aadc751f201f8f97c9c1f454e3a29803cce3edb (commit) via b0d2526bc4e5c663eeffe04500420c70cee98712 (commit) via 73000d1ce0317210f5a9e5262404cc90258041ff (commit) via 2d446759bd43ae38fbce9a18c955285ca535bc08 (commit) via 6b626824c8e30b41c47724b5ccbf761937499512 (commit) via 32f81f56a8be6d13dea0a64d24f52343c7e72c84 (commit) via 07cfb3b27a77491eae818d57f6eb660e75fa013f (commit) via 8ce800d21919eaaba7ed4f04f712292be310fd66 (commit) via e514a5b725f0c997cef4362808b2778a3faa9cf8 (commit) via 1cedc32c95c2e3c3ab98af23ddc2845d51e596c1 (commit) via f57dc2b1e6f28d164f882373535dbcb0d632ca17 (commit) via a2127c71dbf87c1710b43d91a733dd4c9b2953bc (commit) via 1a9c8d78ece2f31fdb1a8e2be049aa71053061fa (commit) via afcfae7959f39e7d85309b9496e1f1cf9acd5cc2 (commit) via dc059af1ff007842e2633e686c87d05daf1d45e3 (commit) via 9f92b62a51d2d60f038fdbe01602865c5933fa95 (commit) via 4a232d23a8f51bebf9ee382e480248b4bde30f28 (commit) via 41b510f9c510f8fd1b59eb0c5dd2e2b2deaf0a1b (commit) via 949e70115eb2c04bd09da6477f6c433e6fd9a366 (commit) via fbc83c0cdd390473c044953fb774571ffc636c6d (commit) via eda17649f8bd3b8ce7bfc00a3c11cbcae63c845d (commit) via a43739a2456a38c01704d8a52dca441055e29bc6 (commit) via 80cc16e0728256f6b07a12980e1f3512cf2324fa (commit) via 95cf7afff074613825f4442fa131145a2c0d3cf7 (commit) via de67055aff916455cec89fab1d95177d3b383008 (commit) via 6054e8aaecbd355bb7559697eecaadf2225189b8 (commit) via e11686f973b35869d7b299ce4726003ac22e2e3a (commit) via 8d37018050373a47566bf8ea0d894da20ed292c7 (commit) via 33800280da55a859e08dfa57f29144c89dd1bead (commit) via c738f92c195d91662ddc7848cc3c92c7f091f1f8 (commit) via f776757ea94542e2f425840dddaf3e65b0ff7757 (commit) via 29db3be6e8dbc9b4dd52cd1781106fa9fa3954a5 (commit) via 95d60c6ce9e8a7a7741553af957978c1f91547c5 (commit) via 4ac138c84d0f344ca9442f90c96f0e1f76062a4a (commit) via 9e6f8a55ed04f876635792125858ee76a948802a (commit) via cbf2ac66692daa7a324108724698d60d6c7e473f (commit) via 80393661bdfa7ae0288644513575e8a5d708b084 (commit) via c9237bf2ba2c49588576dcece756ebf5fe89aada (commit) via 829949f3823c2306022928ce782f9c9d9c5f1cc8 (commit) via 20a16833ee2bb05f735377f705899302bcf2b4d3 (commit) via 2e64ccb0f96d615b1eb87e37f230a5d761aa9c36 (commit) via 2b23a321ac0b07beeac1dfa8d71f223e66c49b71 (commit) via 4e4843e735f32b5e79a51d8062da55bfaab6ad77 (commit) via 836b72363168cbb0051fc2356f61788468db211c (commit) via 98bc6f480ac973dccce90378dc021a2e24e58704 (commit) via df5353b95eefc13135e7df50a7c197f270d6080d (commit) via 7e0379a75475abfd15e0623913795779ff0f40d7 (commit) via c644962fcfe988c8b70bf705b0f1553fa9bfbf52 (commit) via 6c4c0e3ac2aeafba7a2b7c2dd92a18be8aec92b1 (commit) via 49fae88fd170f2bdc12a1794a2637260e3c73a73 (commit) via 988a04b98d42ff9cc9e62007ebcc0e4c03f4047d (commit) via 285d193f1e1464495bce57bd0f323468515b4513 (commit) via 4644c27514f34f5efc555d43672a25088a611a72 (commit) via b9b4ff857034df51e055ceddce567ca97e94e075 (commit) via 8078d8246fa38c3e478fc9a542117468780ace00 (commit) via 05e488943ca5d980b9bda2f21426cc7a17b41410 (commit) via 81cb71ab4d516a1e8b09a69508f7887f98508642 (commit) via 9c1b3bc25a1b38c4eda31bf12ccc10d94bb05212 (commit) via 91d5e6f805aaf24a3f1f03a95998f757dce04cb2 (commit) via 0eaab1af48f600b636183321e4a4e9c6bc361610 (commit) via 32bcf8b73ede9c8f1469821a54dedc6be75241d2 (commit) via 377624207e9b2895ce00dfc4d1163d72f349841f (commit) via 9d2b7bff12b268638465da222ca7cc9042bba072 (commit) via 789916281c25e737d8fb44add5ca61f8fd25de2f (commit) via 00d6d8bc8772e48b6f200d359e11eb93ab65f51f (commit) via f25e04005af5831053ba194a09e3afa48d1e162b (commit) via 825c1dfb3ee4c1704f42eaf064161b9731c20134 (commit) via f32689f833838a742243e94c900e98f5b59a5811 (commit) via 20a27d8a57c4c990fcada4278a1ce2e6fc9043e9 (commit) via fa346508fe323e61cf157ee30c13301e1d2117c0 (commit) via 858af2b3473e436af53470d53cdac334edce9f09 (commit) via 884e78efe1f3ba50513bf81c8b4804d22b25eac4 (commit) via 9a0659a65c52378de1c4736a0eddf8518eb20948 (commit) via 58007e52593e6b0f838de2e464ceeacf22757018 (commit) via ab483eff9a8254adf127cdee178e14ba74f0a2b3 (commit) via 83a406b38a21d0eeb4963db824a27783c212d2fb (commit) via 998643666c016dbacf10f813c22efc97deadec65 (commit) via 5bf1facc973eb6e0bfab0f8f17129534dec56e04 (commit) via 086d219d96caa3501048aff82a282481e07c195b (commit) via 293d265290e0556f57f4812d66b6be87a3b91b9a (commit) via 3899041cd2877ce9584c7bd149f232f35a07c399 (commit) from 47baeac50ccaaf06dc8b0cebece50f47754de6ca (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: AUTHORS | 9 +- COPYING | 12 +- tests/fake-pinentries/COPYING => COPYING.CC0 | 2 + COPYING.LIB | 8 +- Makefile.am | 14 +- NEWS | 2 +- acinclude.m4 | 2 +- agent/Makefile.am | 8 +- agent/agent.h | 14 +- agent/cache.c | 2 +- agent/call-pinentry.c | 115 +-- agent/call-scd.c | 14 +- agent/command-ssh.c | 36 +- agent/command.c | 96 ++- agent/cvt-openpgp.c | 2 +- agent/cvt-openpgp.h | 2 +- agent/divert-scd.c | 2 +- agent/findkey.c | 59 +- agent/genkey.c | 2 +- agent/gpg-agent.c | 429 ++++++++-- agent/learncard.c | 32 +- agent/pkdecrypt.c | 2 +- agent/pksign.c | 24 +- agent/preset-passphrase.c | 2 +- agent/protect-tool.c | 2 +- agent/protect.c | 2 +- agent/t-protect.c | 2 +- agent/trans.c | 2 +- agent/trustlist.c | 2 +- agent/w32main.c | 2 +- agent/w32main.h | 2 +- am/cmacros.am | 2 +- autogen.sh | 2 +- build-aux/speedo/w32/exdll.h | 2 +- build-aux/speedo/w32/g4wihelp.c | 10 +- common/Makefile.am | 10 +- common/agent-opt.c | 2 +- common/argparse.h | 2 +- common/asshelp.c | 51 +- common/asshelp.h | 2 +- common/asshelp2.c | 2 +- common/audit.c | 2 +- common/audit.h | 2 +- common/b64dec.c | 2 +- common/b64enc.c | 2 +- common/call-gpg.c | 2 +- common/call-gpg.h | 2 +- common/ccparray.c | 2 +- common/ccparray.h | 2 +- common/common-defs.h | 2 +- common/convert.c | 4 +- common/dotlock.c | 2 +- common/dotlock.h | 2 +- common/dynload.h | 2 +- common/exechelp-posix.c | 2 +- common/exechelp-w32.c | 74 +- common/exechelp-w32ce.c | 2 +- common/exechelp.h | 2 +- common/exectool.c | 14 +- common/exectool.h | 2 +- common/fwddecl.h | 2 +- common/get-passphrase.c | 10 +- common/get-passphrase.h | 2 +- common/gettime.c | 8 +- common/gettime.h | 2 +- common/gpgrlhelp.c | 2 +- common/helpfile.c | 2 +- common/homedir.c | 9 +- common/host2net.h | 2 +- common/i18n.c | 2 +- common/init.c | 13 +- common/init.h | 2 +- common/iobuf.c | 2 +- common/iobuf.h | 2 +- common/keyserver.h | 2 +- common/localename.c | 2 +- common/logging.c | 2 +- common/logging.h | 2 +- common/mapstrings.c | 2 +- common/mbox-util.c | 2 +- common/mbox-util.h | 2 +- common/membuf.c | 2 +- common/membuf.h | 2 +- common/miscellaneous.c | 2 +- common/mischelp.c | 2 +- common/mischelp.h | 2 +- common/mkdir_p.c | 2 +- common/mkdir_p.h | 2 +- common/name-value.c | 2 +- common/name-value.h | 2 +- common/openpgp-oid.c | 6 +- common/openpgpdefs.h | 2 +- common/percent.c | 2 +- common/recsel.c | 2 +- common/recsel.h | 2 +- common/server-help.c | 2 +- common/server-help.h | 2 +- common/session-env.c | 4 +- common/session-env.h | 2 +- common/sexp-parse.h | 2 +- common/sexputil.c | 2 +- common/shareddefs.h | 2 +- common/signal.c | 4 +- common/simple-pwquery.c | 2 +- common/simple-pwquery.h | 2 +- common/ssh-utils.c | 2 +- common/ssh-utils.h | 2 +- common/status.c | 2 +- common/status.h | 2 +- common/stringhelp.c | 65 +- common/stringhelp.h | 2 +- common/strlist.c | 2 +- common/strlist.h | 2 +- common/sysutils.c | 418 +++++++-- common/sysutils.h | 10 +- common/t-b64.c | 2 +- common/t-ccparray.c | 2 +- common/t-convert.c | 2 +- common/t-dotlock.c | 2 +- common/t-exechelp.c | 2 +- common/t-exectool.c | 2 +- common/t-gettime.c | 2 +- common/t-helpfile.c | 2 +- common/t-mapstrings.c | 2 +- common/t-mbox-util.c | 2 +- common/t-name-value.c | 2 +- common/t-openpgp-oid.c | 2 +- common/t-percent.c | 2 +- common/t-recsel.c | 2 +- common/t-session-env.c | 2 +- common/t-sexputil.c | 2 +- common/t-ssh-utils.c | 2 +- common/t-stringhelp.c | 67 +- common/t-strlist.c | 2 +- common/t-support.c | 2 +- common/t-support.h | 2 +- common/t-sysutils.c | 2 +- common/t-timestuff.c | 2 +- common/t-w32-reg.c | 2 +- common/t-zb32.c | 2 +- common/tlv.c | 2 +- common/tlv.h | 2 +- common/ttyio.c | 2 +- common/ttyio.h | 2 +- common/types.h | 2 +- common/userids.c | 2 +- common/userids.h | 2 +- common/utf8conv.c | 2 +- common/utf8conv.h | 2 +- common/util.h | 3 +- common/utilproto.h | 2 +- common/w32-reg.c | 2 +- common/w32help.h | 2 +- common/xasprintf.c | 2 +- common/xreadline.c | 2 +- common/yesno.c | 2 +- common/zb32.c | 2 +- common/zb32.h | 2 +- configure.ac | 43 +- dirmngr/Makefile.am | 12 +- dirmngr/certcache.c | 2 +- dirmngr/crlcache.c | 4 +- dirmngr/crlfetch.c | 2 +- dirmngr/crlfetch.h | 2 +- dirmngr/dirmngr-client.c | 2 +- dirmngr/dirmngr.c | 205 +++-- dirmngr/dirmngr.h | 7 +- dirmngr/dirmngr_ldap.c | 2 +- dirmngr/dns-stuff.c | 40 +- dirmngr/dns-stuff.h | 2 +- dirmngr/http.c | 51 +- dirmngr/http.h | 4 +- dirmngr/ks-action.c | 2 +- dirmngr/ks-action.h | 2 +- dirmngr/ks-engine-finger.c | 2 +- dirmngr/ks-engine-hkp.c | 71 +- dirmngr/ks-engine-http.c | 2 +- dirmngr/ks-engine-kdns.c | 2 +- dirmngr/ks-engine-ldap.c | 20 +- dirmngr/ks-engine.h | 2 +- dirmngr/ldap-parse-uri.c | 2 +- dirmngr/ldap-parse-uri.h | 2 +- dirmngr/ldap-wrapper-ce.c | 2 +- dirmngr/ldap-wrapper.c | 2 +- dirmngr/ldap-wrapper.h | 2 +- dirmngr/ldapserver.h | 2 +- dirmngr/loadswdb.c | 394 +++++++++ dirmngr/server.c | 30 +- dirmngr/t-dns-stuff.c | 2 +- dirmngr/t-http.c | 2 +- dirmngr/t-ldap-parse-uri.c | 2 +- dirmngr/t-support.h | 2 +- dirmngr/w32-ldap-help.h | 2 +- doc/HACKING | 53 +- doc/Makefile.am | 11 +- doc/contrib.texi | 2 +- doc/debugging.texi | 21 +- doc/dirmngr.texi | 71 +- doc/examples/README | 4 +- doc/examples/systemd-user/README | 66 ++ doc/examples/systemd-user/dirmngr.service | 10 + doc/examples/systemd-user/dirmngr.socket | 11 + doc/examples/systemd-user/gpg-agent-browser.socket | 13 + doc/examples/systemd-user/gpg-agent-extra.socket | 13 + doc/examples/systemd-user/gpg-agent-ssh.socket | 13 + doc/examples/systemd-user/gpg-agent.service | 10 + doc/examples/systemd-user/gpg-agent.socket | 12 + doc/faq.org | 2 +- doc/glossary.texi | 2 +- doc/gpg-agent.texi | 67 +- doc/gpg.texi | 101 ++- doc/gpgsm.texi | 76 +- doc/gpgv.texi | 6 + doc/gpl.texi | 8 +- doc/help.be.txt | 4 +- doc/help.ca.txt | 4 +- doc/help.cs.txt | 4 +- doc/help.da.txt | 4 +- doc/help.de.txt | 2 +- doc/help.el.txt | 4 +- doc/help.eo.txt | 4 +- doc/help.es.txt | 2 +- doc/help.et.txt | 4 +- doc/help.fi.txt | 2 +- doc/help.fr.txt | 2 +- doc/help.gl.txt | 4 +- doc/help.hu.txt | 2 +- doc/help.id.txt | 2 +- doc/help.it.txt | 2 +- doc/help.ja.txt | 2 +- doc/help.nb.txt | 4 +- doc/help.pl.txt | 2 +- doc/help.pt.txt | 2 +- doc/help.pt_BR.txt | 2 +- doc/help.ro.txt | 2 +- doc/help.ru.txt | 2 +- doc/help.sk.txt | 2 +- doc/help.sv.txt | 4 +- doc/help.tr.txt | 2 +- doc/help.txt | 4 +- doc/help.zh_CN.txt | 2 +- doc/help.zh_TW.txt | 2 +- doc/howto-create-a-server-cert.texi | 3 +- doc/instguide.texi | 6 +- doc/opt-homedir.texi | 4 +- doc/scdaemon.texi | 54 +- doc/specify-user-id.texi | 10 +- doc/sysnotes.texi | 2 +- doc/tools.texi | 195 ++++- doc/yat2m.c | 3 +- g10/ChangeLog-2011 | 4 +- g10/Makefile.am | 2 +- g10/armor.c | 2 +- g10/build-packet.c | 17 +- g10/call-agent.c | 264 +----- g10/call-agent.h | 12 +- g10/call-dirmngr.c | 18 +- g10/call-dirmngr.h | 6 +- g10/card-util.c | 67 +- g10/cipher.c | 2 +- g10/compress-bz2.c | 2 +- g10/compress.c | 2 +- g10/cpr.c | 8 +- g10/dearmor.c | 2 +- g10/decrypt-data.c | 2 +- g10/decrypt.c | 2 +- g10/dek.h | 2 +- g10/delkey.c | 2 +- g10/ecdh.c | 28 +- g10/encrypt.c | 2 +- g10/exec.c | 2 +- g10/exec.h | 2 +- g10/export.c | 2 +- g10/filter.h | 2 +- g10/free-packet.c | 120 +-- g10/getkey.c | 354 ++++++-- g10/gpg.c | 231 +++-- g10/gpg.h | 4 +- g10/gpgcompose.c | 2 +- g10/gpgsql.c | 2 +- g10/gpgsql.h | 2 +- g10/gpgv.c | 16 +- g10/helptext.c | 2 +- g10/import.c | 105 ++- g10/kbnode.c | 2 +- g10/keydb.c | 22 +- g10/keydb.h | 9 +- g10/keyedit.c | 8 +- g10/keygen.c | 199 +++-- g10/keyid.c | 2 +- g10/keylist.c | 6 +- g10/keyring.c | 6 +- g10/keyring.h | 2 +- g10/keyserver-internal.h | 8 +- g10/keyserver.c | 81 +- g10/main.h | 8 +- g10/mainproc.c | 52 +- g10/mdfilter.c | 2 +- g10/migrate.c | 2 +- g10/misc.c | 7 +- g10/openfile.c | 6 +- g10/options.h | 9 +- g10/packet.h | 2 +- g10/parse-packet.c | 4 +- g10/passphrase.c | 6 +- g10/photoid.c | 2 +- g10/photoid.h | 2 +- g10/pkclist.c | 8 +- g10/pkglue.c | 2 +- g10/pkglue.h | 2 +- g10/plaintext.c | 2 +- g10/progress.c | 2 +- g10/pubkey-enc.c | 2 +- g10/revoke.c | 2 +- g10/rmd160.c | 2 +- g10/rmd160.h | 2 +- g10/seckey-cert.c | 2 +- g10/server.c | 16 +- g10/seskey.c | 2 +- g10/sig-check.c | 2 +- g10/sign.c | 2 +- g10/skclist.c | 2 +- g10/t-keydb-get-keyblock.c | 2 +- g10/t-keydb.c | 2 +- g10/t-rmd160.c | 2 +- g10/t-stutter.c | 2 +- g10/tdbdump.c | 2 +- g10/tdbio.c | 2 +- g10/tdbio.h | 2 +- g10/test-stubs.c | 11 +- g10/test.c | 2 +- g10/textfilter.c | 2 +- g10/tofu.c | 268 ++++-- g10/tofu.h | 2 +- g10/trust.c | 2 +- g10/trustdb.c | 2 +- g10/trustdb.h | 2 +- g10/verify.c | 2 +- g10/zlib-riscos.h | 2 +- g13/Makefile.am | 2 +- g13/backend.c | 2 +- g13/backend.h | 2 +- g13/be-dmcrypt.c | 2 +- g13/be-dmcrypt.h | 2 +- g13/be-encfs.c | 2 +- g13/be-encfs.h | 2 +- g13/be-truecrypt.c | 2 +- g13/be-truecrypt.h | 2 +- g13/call-syshelp.c | 2 +- g13/call-syshelp.h | 2 +- g13/create.c | 2 +- g13/create.h | 2 +- g13/g13-common.c | 2 +- g13/g13-common.h | 2 +- g13/g13-syshelp.c | 2 +- g13/g13-syshelp.h | 2 +- g13/g13.c | 2 +- g13/g13.h | 2 +- g13/g13tuple.c | 2 +- g13/g13tuple.h | 2 +- g13/keyblob.c | 2 +- g13/keyblob.h | 2 +- g13/mount.c | 2 +- g13/mount.h | 2 +- g13/mountinfo.c | 2 +- g13/mountinfo.h | 2 +- g13/runner.c | 2 +- g13/runner.h | 2 +- g13/server.c | 2 +- g13/server.h | 2 +- g13/sh-blockdev.c | 2 +- g13/sh-cmd.c | 4 +- g13/sh-dmcrypt.c | 2 +- g13/suspend.c | 2 +- g13/suspend.h | 2 +- g13/t-g13tuple.c | 2 +- kbx/Makefile.am | 2 +- kbx/kbxutil.c | 2 +- kbx/keybox-blob.c | 2 +- kbx/keybox-defs.h | 2 +- kbx/keybox-dump.c | 2 +- kbx/keybox-file.c | 2 +- kbx/keybox-init.c | 2 +- kbx/keybox-openpgp.c | 2 +- kbx/keybox-search-desc.h | 2 +- kbx/keybox-search.c | 2 +- kbx/keybox-update.c | 6 +- kbx/keybox-util.c | 68 +- kbx/keybox.h | 4 +- po/ca.po | 2 +- po/cs.po | 2 +- po/de.po | 2 +- po/el.po | 2 +- po/eo.po | 2 +- po/es.po | 2 +- po/et.po | 2 +- po/fi.po | 2 +- po/gl.po | 2 +- po/hu.po | 2 +- po/id.po | 2 +- po/it.po | 2 +- po/pt.po | 2 +- po/ro.po | 2 +- po/sk.po | 2 +- po/zh_CN.po | 2 +- scd/Makefile.am | 2 +- scd/apdu.c | 10 +- scd/apdu.h | 2 +- scd/app-common.h | 6 +- scd/app-dinsig.c | 2 +- scd/app-geldkarte.c | 2 +- scd/app-help.c | 2 +- scd/app-nks.c | 12 +- scd/app-openpgp.c | 768 ++++++++++------- scd/app-p15.c | 2 +- scd/app-sc-hsm.c | 2 +- scd/app.c | 7 +- scd/atr.c | 2 +- scd/atr.h | 2 +- scd/ccid-driver.c | 2 +- scd/ccid-driver.h | 2 +- scd/command.c | 18 +- scd/iso7816.c | 11 +- scd/iso7816.h | 6 +- scd/scdaemon.c | 27 +- scd/scdaemon.h | 2 +- sm/Makefile.am | 2 +- sm/base64.c | 2 +- sm/call-agent.c | 97 ++- sm/call-dirmngr.c | 26 +- sm/certchain.c | 74 +- sm/certcheck.c | 2 +- sm/certdump.c | 2 +- sm/certlist.c | 17 +- sm/certreqgen-ui.c | 2 +- sm/certreqgen.c | 4 +- sm/decrypt.c | 6 +- sm/delete.c | 10 +- sm/encrypt.c | 4 +- sm/export.c | 13 +- sm/fingerprint.c | 2 +- sm/gpgsm.c | 15 +- sm/gpgsm.h | 7 +- sm/import.c | 10 +- sm/keydb.c | 94 +- sm/keydb.h | 30 +- sm/keylist.c | 11 +- sm/minip12.c | 2 +- sm/minip12.h | 2 +- sm/misc.c | 2 +- sm/passphrase.c | 2 +- sm/passphrase.h | 2 +- sm/qualified.c | 2 +- sm/server.c | 17 +- sm/sign.c | 14 +- sm/verify.c | 8 +- tests/Makefile.am | 18 +- tests/asschk.c | 2 +- tests/fake-pinentries/README.txt | 5 +- tests/gpgscm/Makefile.am | 2 +- tests/gpgscm/ffi-private.h | 2 +- tests/gpgscm/ffi.c | 235 +++-- tests/gpgscm/ffi.h | 4 +- tests/gpgscm/ffi.scm | 40 + tests/gpgscm/init.scm | 10 +- tests/gpgscm/lib.scm | 74 ++ tests/gpgscm/main.c | 6 +- tests/gpgscm/private.h | 2 +- tests/gpgscm/repl.scm | 42 +- tests/gpgscm/scheme-config.h | 2 +- tests/gpgscm/scheme-private.h | 9 +- tests/gpgscm/scheme.c | 948 ++++++++++++--------- tests/gpgscm/scheme.h | 17 +- tests/gpgscm/t-child.c | 12 +- tests/gpgscm/t-child.scm | 25 + tests/gpgscm/tests.scm | 48 +- tests/migrations/Makefile.am | 2 +- tests/openpgp/4gb-packet.scm | 1 + tests/openpgp/4gb-packet.test | 14 - tests/openpgp/Makefile.am | 33 +- tests/openpgp/README | 62 +- tests/openpgp/armdetach.scm | 1 + tests/openpgp/armdetach.test | 19 - tests/openpgp/armdetachm.scm | 1 + tests/openpgp/armdetachm.test | 17 - tests/openpgp/armencrypt.scm | 1 + tests/openpgp/armencrypt.test | 19 - tests/openpgp/armencryptp.scm | 1 + tests/openpgp/armencryptp.test | 20 - tests/openpgp/armor.scm | 1 + tests/openpgp/armor.test | 763 ----------------- tests/openpgp/armsignencrypt.scm | 1 + tests/openpgp/armsignencrypt.test | 21 - tests/openpgp/armsigs.scm | 1 + tests/openpgp/armsigs.test | 19 - tests/openpgp/clearsig.scm | 1 + tests/openpgp/clearsig.test | 99 --- tests/openpgp/conventional-mdc.scm | 19 +- tests/openpgp/conventional-mdc.test | 44 - tests/openpgp/conventional.scm | 1 + tests/openpgp/conventional.test | 34 - tests/openpgp/decrypt-dsa.scm | 1 + tests/openpgp/decrypt-dsa.test | 18 - tests/openpgp/decrypt.scm | 1 + tests/openpgp/decrypt.test | 18 - tests/openpgp/default-key.scm | 3 +- tests/openpgp/default-key.test | 73 -- tests/openpgp/defs.inc | 265 ------ tests/openpgp/defs.scm | 146 +++- tests/openpgp/detach.scm | 1 + tests/openpgp/detach.test | 18 - tests/openpgp/detachm.scm | 1 + tests/openpgp/detachm.test | 17 - tests/openpgp/ecc.scm | 3 +- tests/openpgp/ecc.test | 253 ------ tests/openpgp/encrypt-dsa.scm | 1 + tests/openpgp/encrypt-dsa.test | 30 - tests/openpgp/encrypt.scm | 1 + tests/openpgp/encrypt.test | 29 - tests/openpgp/encryptp.scm | 1 + tests/openpgp/encryptp.test | 18 - tests/openpgp/export.scm | 5 +- tests/openpgp/export.test | 110 --- tests/openpgp/fake-pinentry.c | 95 ++- tests/openpgp/finish.scm | 23 - tests/openpgp/finish.test | 17 - tests/openpgp/genkey1024.scm | 1 + tests/openpgp/genkey1024.test | 41 - tests/openpgp/gpgtar.scm | 1 + tests/openpgp/gpgtar.test | 126 --- tests/openpgp/gpgv-forged-keyring.scm | 1 + tests/openpgp/import.scm | 5 +- tests/openpgp/import.test | 48 -- tests/openpgp/issue2015.scm | 4 +- tests/openpgp/issue2346.scm | 15 +- tests/openpgp/issue2417.scm | 23 +- tests/openpgp/issue2419.scm | 3 +- tests/openpgp/key-selection.scm | 83 ++ tests/openpgp/key-selection/0.asc | 30 + tests/openpgp/key-selection/1.asc | 30 + tests/openpgp/key-selection/2.asc | 30 + tests/openpgp/key-selection/3.asc | 43 + tests/openpgp/key-selection/4.asc | 18 + tests/openpgp/mds.scm | 1 + tests/openpgp/mds.test | 89 -- tests/openpgp/multisig.scm | 1 + tests/openpgp/multisig.test | 154 ---- tests/openpgp/pinentry.sh | 28 - tests/openpgp/quick-key-manipulation.scm | 83 ++ tests/openpgp/quick-key-manipulation.test | 70 -- tests/openpgp/run-tests.scm | 156 ++-- tests/openpgp/seat.scm | 1 + tests/openpgp/seat.test | 19 - tests/openpgp/setup.scm | 125 +-- tests/openpgp/{4gb-packet.scm => shell.scm} | 18 +- tests/openpgp/signencrypt-dsa.scm | 1 + tests/openpgp/signencrypt-dsa.test | 37 - tests/openpgp/signencrypt.scm | 1 + tests/openpgp/signencrypt.test | 34 - tests/openpgp/sigs-dsa.scm | 1 + tests/openpgp/sigs-dsa.test | 36 - tests/openpgp/sigs.scm | 1 + tests/openpgp/sigs.test | 46 - tests/openpgp/ssh.scm | 1 + tests/openpgp/tofu.scm | 157 +++- tests/openpgp/tofu.test | 248 ------ tests/openpgp/tofu/cross-sigs/871C2247-1.gpg | Bin 0 -> 1173 bytes tests/openpgp/tofu/cross-sigs/871C2247-1.txt | Bin 0 -> 321 bytes tests/openpgp/tofu/cross-sigs/871C2247-2.gpg | Bin 0 -> 1460 bytes tests/openpgp/tofu/cross-sigs/871C2247-2.txt | Bin 0 -> 333 bytes tests/openpgp/tofu/cross-sigs/871C2247-3.gpg | Bin 0 -> 1800 bytes tests/openpgp/tofu/cross-sigs/871C2247-3.txt | Bin 0 -> 334 bytes tests/openpgp/tofu/cross-sigs/871C2247-4.gpg | Bin 0 -> 2087 bytes tests/openpgp/tofu/cross-sigs/871C2247-secret.gpg | Bin 0 -> 2475 bytes tests/openpgp/tofu/cross-sigs/EC38277E-1.gpg | Bin 0 -> 1171 bytes tests/openpgp/tofu/cross-sigs/EC38277E-1.txt | Bin 0 -> 321 bytes tests/openpgp/tofu/cross-sigs/EC38277E-2.gpg | Bin 0 -> 1458 bytes tests/openpgp/tofu/cross-sigs/EC38277E-2.txt | Bin 0 -> 334 bytes tests/openpgp/tofu/cross-sigs/EC38277E-3.txt | Bin 0 -> 334 bytes tests/openpgp/tofu/cross-sigs/EC38277E-secret.gpg | Bin 0 -> 2473 bytes tests/openpgp/tofu/cross-sigs/README | 79 ++ tests/openpgp/use-exact-key.scm | 1 + tests/openpgp/use-exact-key.test | 55 -- tests/openpgp/verify.scm | 11 +- tests/openpgp/verify.test | 260 ------ tests/openpgp/version.scm | 1 + tests/openpgp/version.test | 110 --- tests/pkits/Makefile.am | 2 +- tools/Makefile.am | 27 +- tools/call-dirmngr.c | 2 +- tools/call-dirmngr.h | 2 +- tools/ccidmon.c | 2 +- tools/gpg-check-pattern.c | 2 +- tools/gpg-connect-agent.c | 2 +- tools/gpg-wks-client.c | 284 +++++- tools/gpg-wks-server.c | 245 +++++- tools/gpg-wks.h | 15 +- tools/gpgconf-comp.c | 99 ++- tools/gpgconf.c | 261 +++++- tools/gpgconf.h | 2 +- tools/gpgparsemail.c | 2 +- tools/gpgsplit.c | 2 +- tools/gpgtar-create.c | 6 +- tools/gpgtar-extract.c | 10 +- tools/gpgtar-list.c | 2 +- tools/gpgtar.c | 2 +- tools/gpgtar.h | 2 +- tools/make-dns-cert.c | 2 +- tools/mime-maker.c | 274 ++++-- tools/mime-maker.h | 8 +- tools/mime-parser.c | 77 +- tools/mime-parser.h | 9 +- tools/mk-tdata.c | 75 -- tools/rfc822parse.c | 2 +- tools/rfc822parse.h | 2 +- tools/send-mail.c | 2 +- tools/send-mail.h | 2 +- tools/sockprox.c | 2 +- tools/symcryptrun.c | 2 +- tools/watchgnupg.c | 2 +- tools/wks-receive.c | 78 +- tools/wks-util.c | 2 +- 622 files changed, 8019 insertions(+), 7094 deletions(-) rename tests/fake-pinentries/COPYING => COPYING.CC0 (99%) create mode 100644 dirmngr/loadswdb.c create mode 100644 doc/examples/systemd-user/README create mode 100644 doc/examples/systemd-user/dirmngr.service create mode 100644 doc/examples/systemd-user/dirmngr.socket create mode 100644 doc/examples/systemd-user/gpg-agent-browser.socket create mode 100644 doc/examples/systemd-user/gpg-agent-extra.socket create mode 100644 doc/examples/systemd-user/gpg-agent-ssh.socket create mode 100644 doc/examples/systemd-user/gpg-agent.service create mode 100644 doc/examples/systemd-user/gpg-agent.socket delete mode 100755 tests/openpgp/4gb-packet.test delete mode 100755 tests/openpgp/armdetach.test delete mode 100755 tests/openpgp/armdetachm.test delete mode 100755 tests/openpgp/armencrypt.test delete mode 100755 tests/openpgp/armencryptp.test delete mode 100755 tests/openpgp/armor.test delete mode 100755 tests/openpgp/armsignencrypt.test delete mode 100755 tests/openpgp/armsigs.test delete mode 100755 tests/openpgp/clearsig.test delete mode 100755 tests/openpgp/conventional-mdc.test delete mode 100755 tests/openpgp/conventional.test delete mode 100755 tests/openpgp/decrypt-dsa.test delete mode 100755 tests/openpgp/decrypt.test delete mode 100755 tests/openpgp/default-key.test delete mode 100755 tests/openpgp/defs.inc delete mode 100755 tests/openpgp/detach.test delete mode 100755 tests/openpgp/detachm.test delete mode 100755 tests/openpgp/ecc.test delete mode 100755 tests/openpgp/encrypt-dsa.test delete mode 100755 tests/openpgp/encrypt.test delete mode 100755 tests/openpgp/encryptp.test delete mode 100755 tests/openpgp/export.test delete mode 100755 tests/openpgp/finish.scm delete mode 100755 tests/openpgp/finish.test delete mode 100755 tests/openpgp/genkey1024.test delete mode 100755 tests/openpgp/gpgtar.test delete mode 100755 tests/openpgp/import.test create mode 100644 tests/openpgp/key-selection.scm create mode 100644 tests/openpgp/key-selection/0.asc create mode 100644 tests/openpgp/key-selection/1.asc create mode 100644 tests/openpgp/key-selection/2.asc create mode 100644 tests/openpgp/key-selection/3.asc create mode 100644 tests/openpgp/key-selection/4.asc delete mode 100755 tests/openpgp/mds.test delete mode 100755 tests/openpgp/multisig.test delete mode 100755 tests/openpgp/pinentry.sh create mode 100755 tests/openpgp/quick-key-manipulation.scm delete mode 100755 tests/openpgp/quick-key-manipulation.test delete mode 100755 tests/openpgp/seat.test copy tests/openpgp/{4gb-packet.scm => shell.scm} (70%) mode change 100755 => 100644 delete mode 100755 tests/openpgp/signencrypt-dsa.test delete mode 100755 tests/openpgp/signencrypt.test delete mode 100755 tests/openpgp/sigs-dsa.test delete mode 100755 tests/openpgp/sigs.test delete mode 100755 tests/openpgp/tofu.test create mode 100644 tests/openpgp/tofu/cross-sigs/871C2247-1.gpg create mode 100644 tests/openpgp/tofu/cross-sigs/871C2247-1.txt create mode 100644 tests/openpgp/tofu/cross-sigs/871C2247-2.gpg create mode 100644 tests/openpgp/tofu/cross-sigs/871C2247-2.txt create mode 100644 tests/openpgp/tofu/cross-sigs/871C2247-3.gpg create mode 100644 tests/openpgp/tofu/cross-sigs/871C2247-3.txt create mode 100644 tests/openpgp/tofu/cross-sigs/871C2247-4.gpg create mode 100644 tests/openpgp/tofu/cross-sigs/871C2247-secret.gpg create mode 100644 tests/openpgp/tofu/cross-sigs/EC38277E-1.gpg create mode 100644 tests/openpgp/tofu/cross-sigs/EC38277E-1.txt create mode 100644 tests/openpgp/tofu/cross-sigs/EC38277E-2.gpg create mode 100644 tests/openpgp/tofu/cross-sigs/EC38277E-2.txt create mode 100644 tests/openpgp/tofu/cross-sigs/EC38277E-3.txt create mode 100644 tests/openpgp/tofu/cross-sigs/EC38277E-secret.gpg create mode 100644 tests/openpgp/tofu/cross-sigs/README delete mode 100755 tests/openpgp/use-exact-key.test delete mode 100755 tests/openpgp/verify.test delete mode 100755 tests/openpgp/version.test delete mode 100644 tools/mk-tdata.c hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Fri Nov 18 21:54:08 2016 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Fri, 18 Nov 2016 21:54:08 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.1.15-399-g7e174fc Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via 7e174fcc746644bbfa77ab5df9ee775e221c663b (commit) via 0a641ad25d8c3b91dc32bb9f3f1ae49ae539a4f7 (commit) via 5b5bf9bab8fecb2e05dcf64dfd3b52f13293bace (commit) via e8ce5e3a256730f3a0c394ac72fb67a9e7ac3e85 (commit) via 11aaa9c6d4ed3e47de45b4aee925ab1065120988 (commit) from 1c0b140cccfb884c6d07785c3284b9df06dccd3c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- ----------------------------------------------------------------------- Summary of changes: NEWS | 74 ++++++++++- configure.ac | 2 +- po/ca.po | 265 ++++++++++++++++++++++++-------------- po/cs.po | 290 ++++++++++++++++++++++++++++-------------- po/da.po | 267 +++++++++++++++++++++++++-------------- po/de.po | 394 ++++++++++++++++++++++++++++++++++++++++----------------- po/el.po | 261 ++++++++++++++++++++++++-------------- po/eo.po | 262 ++++++++++++++++++++++++-------------- po/es.po | 284 +++++++++++++++++++++++++---------------- po/et.po | 261 ++++++++++++++++++++++++-------------- po/fi.po | 261 ++++++++++++++++++++++++-------------- po/fr.po | 285 +++++++++++++++++++++++++++-------------- po/gl.po | 263 ++++++++++++++++++++++++-------------- po/hu.po | 261 ++++++++++++++++++++++++-------------- po/id.po | 261 ++++++++++++++++++++++++-------------- po/it.po | 261 ++++++++++++++++++++++++-------------- po/ja.po | 380 ++++++++++++++++++++++++++++++++++++++++--------------- po/nb.po | 399 ++++++++++++++++++++++++++++++++++++++++++---------------- po/pl.po | 273 ++++++++++++++++++++++++++-------------- po/pt.po | 260 ++++++++++++++++++++++++-------------- po/ro.po | 264 ++++++++++++++++++++++++-------------- po/ru.po | 367 +++++++++++++++++++++++++++-------------------------- po/sk.po | 261 ++++++++++++++++++++++++-------------- po/sv.po | 267 +++++++++++++++++++++++++-------------- po/tr.po | 265 ++++++++++++++++++++++++-------------- po/uk.po | 406 +++++++++++++++++++++++++++++++++++++++++++---------------- po/zh_CN.po | 263 ++++++++++++++++++++++++-------------- po/zh_TW.po | 271 ++++++++++++++++++++++++++------------- 28 files changed, 5060 insertions(+), 2568 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Fri Nov 18 21:57:29 2016 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Fri, 18 Nov 2016 21:57:29 +0100 Subject: [git] gnupg-doc - branch, master, updated. b7eb2deb1e36ee5832e2f0d9a925d15d7e43ff97 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GnuPG website and other docs". The branch, master has been updated via b7eb2deb1e36ee5832e2f0d9a925d15d7e43ff97 (commit) from 8e42a932e834e7f32cc1b3e1cf4ef6c4f15ed7f0 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit b7eb2deb1e36ee5832e2f0d9a925d15d7e43ff97 Author: Werner Koch Date: Fri Nov 18 21:55:03 2016 +0100 swdb: Release gnupg 2.1.16 diff --git a/web/swdb.mac b/web/swdb.mac index e6fef67..c1a03a1 100644 --- a/web/swdb.mac +++ b/web/swdb.mac @@ -21,18 +21,17 @@ # # GnuPG-2.1 # -#+macro: gnupg21_ver 2.1.15 -#+macro: gnupg21_date 2016-08-18 -#+macro: gnupg21_size 5589k -#+macro: gnupg21_sha1 908c86dac8e9a1fbf47e1605e570b11391b04ece -#+macro: gnupg21_sha2 c28c1a208f1b8ad63bdb6b88d252f6734ff4d33de6b54e38494b11d49e00ffdd +#+macro: gnupg21_ver 2.1.16 +#+macro: gnupg21_date 2016-11-18 +#+macro: gnupg21_size 5703k +#+macro: gnupg21_sha1 67540161c9fe289153c4a5ea60f7cdce0ef48897 +#+macro: gnupg21_sha2 49b9a6a6787ad00d4d2d69d8c7ee8905923782583f06078a064a0c80531d8844 # -#+macro: gnupg21_w32_ver 2.1.15_20160818 -#+macro: gnupg21_w32_date 2016-08-18 -#+macro: gnupg21_w32_size 3566k -#+macro: gnupg21_w32_sha1 c13fdb4daa2a2c715d86365e6ab6c3b70506340e -#+macro: gnupg21_w32_sha2 4802c8c08fc67964235eddacfd45553363bac0a081e1f38a76008e2bad9617a2 - +#+macro: gnupg21_w32_ver 2.1.16_20161118 +#+macro: gnupg21_w32_date 2016-11-18 +#+macro: gnupg21_w32_size 3681k +#+macro: gnupg21_w32_sha1 50b0bd286faa90e5c71417b5f2f36cf5de964084 +#+macro: gnupg21_w32_sha2 14b17454b32f93099133056833b17dafc76946560be4439fb1894d5dc52fd9dc # @@ -71,11 +70,11 @@ # # GPGME # -#+macro: gpgme_ver 1.7.1 -#+macro: gpgme_date 2016-10-18 -#+macro: gpgme_size 1255k -#+macro: gpgme_sha1 af95d75878200407eb577245eeb0681b1ad313ed -#+macro: gpgme_sha2 d0abe1449395315eac37e4e45076bbb82732cedf94210937b37776e10cdc2bb6 +#+macro: gpgme_ver 1.8.0 +#+macro: gpgme_date 2016-11-16 +#+macro: gpgme_size 1267k +#+macro: gpgme_sha1 efa043064dbf675fd713228c6fcfcc4116feb221 +#+macro: gpgme_sha2 596097257c2ce22e747741f8ff3d7e24f6e26231fa198a41b2a072e62d1e5d33 # ----------------------------------------------------------------------- Summary of changes: web/swdb.mac | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) hooks/post-receive -- The GnuPG website and other docs http://git.gnupg.org From cvs at cvs.gnupg.org Fri Nov 18 22:35:14 2016 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Fri, 18 Nov 2016 22:35:14 +0100 Subject: [git] gnupg-doc - branch, master, updated. 184768972601b78c946623aa5a3418c2b33082ba Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GnuPG website and other docs". The branch, master has been updated via 184768972601b78c946623aa5a3418c2b33082ba (commit) from b7eb2deb1e36ee5832e2f0d9a925d15d7e43ff97 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 184768972601b78c946623aa5a3418c2b33082ba Author: Werner Koch Date: Fri Nov 18 22:24:44 2016 +0100 web: Add news about the 2.1.16 release. diff --git a/web/index.org b/web/index.org index 63c0717..49e4196 100644 --- a/web/index.org +++ b/web/index.org @@ -66,6 +66,12 @@ The latest release news:\\ # point or paste the [[news.en.rss][RSS file]] into your aggregator. +** GnuPG 2.1.16 released (2016-11-18) + +It has been 3 months since the last GnuPG /modern/ release and thus it +was time for a new one: Version 2.1.16 is now available. Read the +full [[https://lists.gnupg.org/pipermail/gnupg-announce/2016q4/000398.html][announcement mail]] for details. + ** GnuPG Made Easy (GPGME) 1.7.0 released (2016-09-21) [[file:related_software/gpgme/index.org][GPGME]] is a library that allows to add support for cryptography to a ----------------------------------------------------------------------- Summary of changes: web/index.org | 6 ++++++ 1 file changed, 6 insertions(+) hooks/post-receive -- The GnuPG website and other docs http://git.gnupg.org From cvs at cvs.gnupg.org Sat Nov 19 17:24:16 2016 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Sat, 19 Nov 2016 17:24:16 +0100 Subject: [git] gnupg-doc - branch, master, updated. fbc5f3f0b8783d2ec62695db0ac5208641ba07ee Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GnuPG website and other docs". The branch, master has been updated via fbc5f3f0b8783d2ec62695db0ac5208641ba07ee (commit) from 184768972601b78c946623aa5a3418c2b33082ba (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit fbc5f3f0b8783d2ec62695db0ac5208641ba07ee Author: Werner Koch Date: Sat Nov 19 17:21:52 2016 +0100 swdb: Release GPA 0.9.10 diff --git a/web/index.org b/web/index.org index 49e4196..2d548c6 100644 --- a/web/index.org +++ b/web/index.org @@ -65,6 +65,11 @@ The latest release news:\\ # GnuPG's latest news are available as [[http://feedvalidator.org/check.cgi?url%3Dhttps://www.gnupg.org/news.en.rss][RSS 2.0 compliant]] feed. Just # point or paste the [[news.en.rss][RSS file]] into your aggregator. +** GPA 0.9.10 released (2016-11-19) + +A maintenance release of the [[file:related_software/gpa/index.org][GNU Privacy Assistant]] is now available. +Note that some of the changes are only available when build with the +latest [[file:related_software/gpgme/index.org][GPGME]] version and used with GnuPG 2.1.16 or later. ** GnuPG 2.1.16 released (2016-11-18) diff --git a/web/related_software/gpa/index.org b/web/related_software/gpa/index.org index dcec574..a251bbd 100644 --- a/web/related_software/gpa/index.org +++ b/web/related_software/gpa/index.org @@ -11,3 +11,14 @@ more about GPA [[file:icons.org][icons]], as well. GPA is available at the [[ftp://ftp.gnupg.org/gcrypt/gpa//][GnuPG FTP server]] and its mirrors. + +** Changes in version 0.9.10 + + - Added basic support for TOFU information. + - Removed key-ID from some listings in favor of using the + fingerprint. + - Fixed deletion of X.509 keys. + - Allow for saving to an alternate file name if the file already + exists. + - Fixed several problems with key edit functions. + - Fixed drag-and-drop. diff --git a/web/swdb.mac b/web/swdb.mac index c1a03a1..b7783e4 100644 --- a/web/swdb.mac +++ b/web/swdb.mac @@ -52,10 +52,11 @@ # # GPA # -#+macro: gpa_ver 0.9.9 -#+macro: gpa_date 2015-09-09 -#+macro: gpa_size 721k -#+macro: gpa_sha1 1cf86c9e38aa553fdb880c55cbc6755901ad21a4 +#+macro: gpa_ver 0.9.10 +#+macro: gpa_date 2016-11-19 +#+macro: gpa_size 745k +#+macro: gpa_sha1 c629348725c1bf5dafd57f8a70187dc89815ce60 +#+macro: gpa_sha2 c3b9cc36fd9916e83524930f99df13b1d5f601f4c0168cb9f5d81422e282b727 # ----------------------------------------------------------------------- Summary of changes: web/index.org | 5 +++++ web/related_software/gpa/index.org | 11 +++++++++++ web/swdb.mac | 9 +++++---- 3 files changed, 21 insertions(+), 4 deletions(-) hooks/post-receive -- The GnuPG website and other docs http://git.gnupg.org From cvs at cvs.gnupg.org Mon Nov 21 03:33:13 2016 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Mon, 21 Nov 2016 03:33:13 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.1.16-2-g9a707a2 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via 9a707a223a3d45ccf245dee7989ca144e4e6bb49 (commit) from 7e174fcc746644bbfa77ab5df9ee775e221c663b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 9a707a223a3d45ccf245dee7989ca144e4e6bb49 Author: NIIBE Yutaka Date: Mon Nov 21 11:18:33 2016 +0900 agent: Fix npth + daemon mode problem. * agent/gpg-agent.c (main): Remove duplicated initialization in daemon mode. -- The commit f57dc2b1e6f28d164f882373535dbcb0d632ca17 fixes a part of problem (for missing initialization of supervised mode). It was actually put in wrong place. Fixes-commit: 9f92b62a51d2d60f038fdbe01602865c5933fa95 Signed-off-by: NIIBE Yutaka diff --git a/agent/gpg-agent.c b/agent/gpg-agent.c index 1433f7f..175866d 100644 --- a/agent/gpg-agent.c +++ b/agent/gpg-agent.c @@ -1473,8 +1473,6 @@ main (int argc, char **argv ) pid_t pid; #endif - initialize_modules (); - /* Remove the DISPLAY variable so that a pinentry does not default to a specific display. There is still a default display when gpg-agent was started using --display or a ----------------------------------------------------------------------- Summary of changes: agent/gpg-agent.c | 2 -- 1 file changed, 2 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Mon Nov 21 08:38:40 2016 From: cvs at cvs.gnupg.org (by Daniel Kahn Gillmor) Date: Mon, 21 Nov 2016 08:38:40 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.1.16-3-g0540cfb Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via 0540cfbee455b197edd89b602a4b47ebf0be8588 (commit) from 9a707a223a3d45ccf245dee7989ca144e4e6bb49 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 0540cfbee455b197edd89b602a4b47ebf0be8588 Author: Daniel Kahn Gillmor Date: Mon Nov 21 01:06:19 2016 -0500 doc: Ship example gpg-agent-browser.socket in examples/systemd-user/. * doc/Makefile.am: Ship gpg-agent-browser.socket alongside the other systemd user service example files. Signed-off-by: Daniel Kahn Gillmor diff --git a/doc/Makefile.am b/doc/Makefile.am index 53cd639..5638530 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -28,6 +28,7 @@ examples = examples/README examples/scd-event examples/trustlist.txt \ examples/systemd-user/gpg-agent.service \ examples/systemd-user/gpg-agent.socket \ examples/systemd-user/gpg-agent-ssh.socket \ + examples/systemd-user/gpg-agent-browser.socket \ examples/systemd-user/gpg-agent-extra.socket \ examples/gpgconf.conf examples/pwpattern.list ----------------------------------------------------------------------- Summary of changes: doc/Makefile.am | 1 + 1 file changed, 1 insertion(+) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Mon Nov 21 09:36:25 2016 From: cvs at cvs.gnupg.org (by Daniel Kahn Gillmor) Date: Mon, 21 Nov 2016 09:36:25 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.1.16-4-g2c97fa8 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via 2c97fa84c11f6087872392d83bbf17fbd4f6fb0f (commit) from 0540cfbee455b197edd89b602a4b47ebf0be8588 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 2c97fa84c11f6087872392d83bbf17fbd4f6fb0f Author: Daniel Kahn Gillmor Date: Sun Nov 20 21:35:13 2016 -0500 doc: Clarify dirmngr --homedir option. -- Signed-off-by: Daniel Kahn Gillmor diff --git a/doc/dirmngr.texi b/doc/dirmngr.texi index be4e97a..963dff8 100644 --- a/doc/dirmngr.texi +++ b/doc/dirmngr.texi @@ -142,10 +142,10 @@ per-user configuration file. The default configuration file is named @item --homedir @var{dir} @opindex options Set the name of the home directory to @var{dir}. This option is only -effective when used on the command line. The default os +effective when used on the command line. The default is the directory named @file{.gnupg} directly below the home directory of the user unless the environment variable @code{GNUPGHOME} has been set -in which case its value will be used. All kind of data is stored below +in which case its value will be used. Many kinds of data are stored within this directory. ----------------------------------------------------------------------- Summary of changes: doc/dirmngr.texi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Mon Nov 21 11:54:44 2016 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Mon, 21 Nov 2016 11:54:44 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.1.16-5-g362afb4 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via 362afb4f6074aaf5c9a6cacdf6a3530ec3f55d2d (commit) from 2c97fa84c11f6087872392d83bbf17fbd4f6fb0f (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 362afb4f6074aaf5c9a6cacdf6a3530ec3f55d2d Author: Werner Koch Date: Mon Nov 21 11:51:00 2016 +0100 build: Add repo-only maintainer script append-signature.sh. -- Signed-off-by: Werner Koch diff --git a/build-aux/append-signature.sh b/build-aux/append-signature.sh new file mode 100755 index 0000000..714d286 --- /dev/null +++ b/build-aux/append-signature.sh @@ -0,0 +1,108 @@ +#!/bin/sh +# Append a signature to an existing detached signature. +# Copyright (C) 2016 g10 Code GmbH +# +# This file is free software; as a special exception the author gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +set -e +PGM="$(basename $0)" +GPGV=gpgv + +# Prints usage information. +usage() +{ + cat <&2 + ;; + *) + break; + ;; + esac + shift +done + +if [ $# -ne 2 ]; then + usage 1 1>&2 +fi +tarball="$1" +tarballsig="$1".sig +newsig="$2" + +[ -n "$verbose" ] && echo "tarball: $tarball" +[ -n "$verbose" ] && echo "sig ...: $tarballsig" +[ -n "$verbose" ] && echo "newsig : $newsig" + +if ! $GPGV --version >/dev/null 2>/dev/null ; then + echo "${PGM}: Command \"gpgv\" is not installed" >&2 + exit 1 +fi + +distsigkey="/usr/local/share/gnupg/distsigkey.gpg" +if [ ! -f "$distsigkey" ]; then + distsigkey="/usr/share/gnupg/distsigkey.gpg" +fi +if [ ! -f "$distsigkey" ]; then + echo "${PGM}: File \"$distsigkey\" is not installed" >&2 + exit 1 +fi + +if ! $GPGV $verbose --keyring "$distsigkey" \ + -- "$tarballsig" "$tarball" 2>/dev/null ; then + echo "${PGM}: Existing signature '$tarballsig' does not verify" >&2 + exit 1 +fi + +if ! $GPGV $verbose --keyring "$distsigkey" \ + -- "$newsig" "$tarball" 2>/dev/null; then + echo "${PGM}: New signature '$newsig' does not verify" >&2 + exit 1 +fi + +cat "$newsig" >> "$tarballsig" + +if ! $GPGV $verbose --keyring "$distsigkey" \ + -- "$tarballsig" "$tarball"; then + echo "${PGM}: Update signature '$tarballsig' does not verify" >&2 + exit 1 +fi ----------------------------------------------------------------------- Summary of changes: build-aux/append-signature.sh | 108 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100755 build-aux/append-signature.sh hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Mon Nov 21 23:10:24 2016 From: cvs at cvs.gnupg.org (by Neal H. Walfield) Date: Mon, 21 Nov 2016 23:10:24 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.1.16-9-g037f9de Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via 037f9de09298a31026ea2ab5fbd4a599b11cc34f (commit) via 182efc5b5d20ac0d43501a22f349a23dc06a27a4 (commit) via 7142b293c870d73ce0146bfb90e6a556e0079650 (commit) via 91a0483c5db8ee4510981448a705981ee1cce199 (commit) from 362afb4f6074aaf5c9a6cacdf6a3530ec3f55d2d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 037f9de09298a31026ea2ab5fbd4a599b11cc34f Author: Neal H. Walfield Date: Mon Nov 21 22:47:30 2016 +0100 g10: Cache the effective policy. Recompute it when required. * g10/tofu.c (initdb): Add column effective_policy to the bindings table. (record_binding): New parameters effective_policy and set_conflict. Save the effective policy. If SET_CONFLICT is set, then set conflict according to CONFLICT. Otherwise, preserve the current value of conflict. Update callers. (get_trust): Don't compute the effective policy here... (get_policy): ... do it here, if it was not cached. Take new parameters, PK, the public key, and NOW, the time that the operation started. Update callers. (show_statistics): New parameter PK. Pass it to get_policy. Update callers. (tofu_notice_key_changed): New function. * g10/gpgv.c (tofu_notice_key_changed): New stub. * g10/import.c (import_revoke_cert): Take additional argument CTRL. Pass it to keydb_update_keyblock. * g10/keydb.c (keydb_update_keyblock): Take additional argument CTRL. Update callers. [USE_TOFU]: Call tofu_notice_key_changed. * g10/test-stubs.c (tofu_notice_key_changed): New stub. * tests/openpgp/tofu.scm: Assume that manually setting a binding's policy to auto does not cause the tofu engine to forget about any conflict. -- Signed-off-by: Neal H. Walfield We now store the computed policy in the tofu DB (in the effective_policy column of the bindings table) to avoid computing it every time, which is expensive. Further, policy is never overridden in case of a conflict. Instead, we detect a conflict if CONFLICT is not empty. This change is backwards compatible to existing DBs. The only minor incompatibility is that unresolved conflicts won't be automatically resolved in case we import a direct signature, or cross signatures. diff --git a/g10/gpgv.c b/g10/gpgv.c index d9f2898..da07989 100644 --- a/g10/gpgv.c +++ b/g10/gpgv.c @@ -713,3 +713,12 @@ tofu_end_batch_update (ctrl_t ctrl) { (void)ctrl; } + +gpg_error_t +tofu_notice_key_changed (ctrl_t ctrl, kbnode_t kb) +{ + (void) ctrl; + (void) kb; + + return 0; +} diff --git a/g10/import.c b/g10/import.c index 590959d..1ed11bf 100644 --- a/g10/import.c +++ b/g10/import.c @@ -111,7 +111,8 @@ static int import_secret_one (ctrl_t ctrl, kbnode_t keyblock, struct import_stats_s *stats, int batch, unsigned int options, int for_migration, import_screener_t screener, void *screener_arg); -static int import_revoke_cert (kbnode_t node, struct import_stats_s *stats); +static int import_revoke_cert (ctrl_t ctrl, + kbnode_t node, struct import_stats_s *stats); static int chk_self_sigs (kbnode_t keyblock, u32 *keyid, int *non_self); static int delete_inv_parts (kbnode_t keyblock, u32 *keyid, unsigned int options); @@ -562,7 +563,7 @@ import (ctrl_t ctrl, IOBUF inp, const char* fname,struct import_stats_s *stats, screener, screener_arg); else if (keyblock->pkt->pkttype == PKT_SIGNATURE && keyblock->pkt->pkt.signature->sig_class == 0x20 ) - rc = import_revoke_cert (keyblock, stats); + rc = import_revoke_cert (ctrl, keyblock, stats); else { log_info (_("skipping block of type %d\n"), keyblock->pkt->pkttype); @@ -1642,7 +1643,7 @@ import_one (ctrl_t ctrl, { mod_key = 1; /* KEYBLOCK_ORIG has been updated; write */ - rc = keydb_update_keyblock (hd, keyblock_orig); + rc = keydb_update_keyblock (ctrl, hd, keyblock_orig); if (rc) log_error (_("error writing keyring '%s': %s\n"), keydb_get_resource_name (hd), gpg_strerror (rc) ); @@ -2288,7 +2289,7 @@ import_secret_one (ctrl_t ctrl, kbnode_t keyblock, * Import a revocation certificate; this is a single signature packet. */ static int -import_revoke_cert (kbnode_t node, struct import_stats_s *stats) +import_revoke_cert (ctrl_t ctrl, kbnode_t node, struct import_stats_s *stats) { PKT_public_key *pk = NULL; kbnode_t onode; @@ -2379,7 +2380,7 @@ import_revoke_cert (kbnode_t node, struct import_stats_s *stats) insert_kbnode( keyblock, clone_kbnode(node), 0 ); /* and write the keyblock back */ - rc = keydb_update_keyblock (hd, keyblock ); + rc = keydb_update_keyblock (ctrl, hd, keyblock ); if (rc) log_error (_("error writing keyring '%s': %s\n"), keydb_get_resource_name (hd), gpg_strerror (rc) ); diff --git a/g10/keydb.c b/g10/keydb.c index 1467b2d..aab90e3 100644 --- a/g10/keydb.c +++ b/g10/keydb.c @@ -1518,7 +1518,7 @@ build_keyblock_image (kbnode_t keyblock, iobuf_t *r_iobuf, u32 **r_sigstatus) * you should use keydb_push_found_state and keydb_pop_found_state to * save and restore it. */ gpg_error_t -keydb_update_keyblock (KEYDB_HANDLE hd, kbnode_t kb) +keydb_update_keyblock (ctrl_t ctrl, KEYDB_HANDLE hd, kbnode_t kb) { gpg_error_t err; PKT_public_key *pk; @@ -1542,6 +1542,10 @@ keydb_update_keyblock (KEYDB_HANDLE hd, kbnode_t kb) if (err) return err; +#ifdef USE_TOFU + tofu_notice_key_changed (ctrl, kb); +#endif + memset (&desc, 0, sizeof (desc)); fingerprint_from_pk (pk, desc.u.fpr, &len); if (len == 20) diff --git a/g10/keydb.h b/g10/keydb.h index e4fbe27..8daa9ee 100644 --- a/g10/keydb.h +++ b/g10/keydb.h @@ -181,7 +181,7 @@ const char *keydb_get_resource_name (KEYDB_HANDLE hd); gpg_error_t keydb_get_keyblock (KEYDB_HANDLE hd, KBNODE *ret_kb); /* Update the keyblock KB. */ -gpg_error_t keydb_update_keyblock (KEYDB_HANDLE hd, kbnode_t kb); +gpg_error_t keydb_update_keyblock (ctrl_t ctrl, KEYDB_HANDLE hd, kbnode_t kb); /* Insert a keyblock into one of the underlying keyrings or keyboxes. */ gpg_error_t keydb_insert_keyblock (KEYDB_HANDLE hd, kbnode_t kb); diff --git a/g10/keyedit.c b/g10/keyedit.c index 795be05..5b77ee7 100644 --- a/g10/keyedit.c +++ b/g10/keyedit.c @@ -2782,7 +2782,7 @@ keyedit_menu (ctrl_t ctrl, const char *username, strlist_t locusr, case cmdSAVE: if (modified) { - err = keydb_update_keyblock (kdbhd, keyblock); + err = keydb_update_keyblock (ctrl, kdbhd, keyblock); if (err) { log_error (_("update failed: %s\n"), gpg_strerror (err)); @@ -2936,7 +2936,7 @@ keyedit_quick_adduid (ctrl_t ctrl, const char *username, const char *newuid) if (menu_adduid (ctrl, keyblock, 0, NULL, uidstring)) { - err = keydb_update_keyblock (kdbhd, keyblock); + err = keydb_update_keyblock (ctrl, kdbhd, keyblock); if (err) { log_error (_("update failed: %s\n"), gpg_strerror (err)); @@ -3039,7 +3039,7 @@ keyedit_quick_revuid (ctrl_t ctrl, const char *username, const char *uidtorev) gpg_strerror (err)); goto leave; } - err = keydb_update_keyblock (kdbhd, keyblock); + err = keydb_update_keyblock (ctrl, kdbhd, keyblock); if (err) { log_error (_("update failed: %s\n"), gpg_strerror (err)); @@ -3261,7 +3261,7 @@ keyedit_quick_sign (ctrl_t ctrl, const char *fpr, strlist_t uids, if (modified) { - err = keydb_update_keyblock (kdbhd, keyblock); + err = keydb_update_keyblock (ctrl, kdbhd, keyblock); if (err) { log_error (_("update failed: %s\n"), gpg_strerror (err)); @@ -3326,7 +3326,7 @@ keyedit_quick_addkey (ctrl_t ctrl, const char *fpr, const char *algostr, /* Store. */ if (modified) { - err = keydb_update_keyblock (kdbhd, keyblock); + err = keydb_update_keyblock (ctrl, kdbhd, keyblock); if (err) { log_error (_("update failed: %s\n"), gpg_strerror (err)); diff --git a/g10/test-stubs.c b/g10/test-stubs.c index 8560f9d..2dc65ab 100644 --- a/g10/test-stubs.c +++ b/g10/test-stubs.c @@ -517,3 +517,12 @@ tofu_end_batch_update (ctrl_t ctrl) { (void)ctrl; } + +gpg_error_t +tofu_notice_key_changed (ctrl_t ctrl, kbnode_t kb) +{ + (void) ctrl; + (void) kb; + + return 0; +} diff --git a/g10/tofu.c b/g10/tofu.c index 696cfc3..9693893 100644 --- a/g10/tofu.c +++ b/g10/tofu.c @@ -682,13 +682,49 @@ initdb (sqlite3 *db) { /* Early version of the v1 format did not include the encryption table. Add it. */ - sqlite3_exec (db, - "create table if not exists encryptions" - " (binding INTEGER NOT NULL," - " time INTEGER);" - "create index if not exists encryptions_binding" - " on encryptions (binding);\n", - NULL, NULL, &err); + rc = sqlite3_exec (db, + "create table if not exists encryptions" + " (binding INTEGER NOT NULL," + " time INTEGER);" + "create index if not exists encryptions_binding" + " on encryptions (binding);\n", + NULL, NULL, &err); + if (rc) + { + log_error (_("error creating 'encryptions' TOFU table: %s\n"), + err); + sqlite3_free (err); + } + } + if (! rc) + { + /* The effective policy for a binding. If a key is ultimately + * trusted, then the effective policy of all of its bindings is + * good. Likewise if a key is signed by an ultimately trusted + * key, etc. If the effective policy is NONE, then we need to + * recompute the effective policy. Otherwise, the effective + * policy is considered to be up to date, i.e., effective_policy + * is a cache of the computed policy. */ + rc = gpgsql_exec_printf + (db, NULL, NULL, &err, + "alter table bindings" + " add column effective_policy INTEGER" + " DEFAULT %d" + " CHECK (effective_policy in (%d, %d, %d, %d, %d, %d));", + TOFU_POLICY_NONE, + TOFU_POLICY_NONE, TOFU_POLICY_AUTO, TOFU_POLICY_GOOD, + TOFU_POLICY_UNKNOWN, TOFU_POLICY_BAD, TOFU_POLICY_ASK); + if (rc) + { + if (rc == SQLITE_ERROR) + /* Almost certainly "duplicate column name", which we can + * safely ignore. */ + rc = 0; + else + log_error (_("adding column effective_policy to bindings DB: %s\n"), + err); + sqlite3_free (err); + } } if (rc) @@ -858,8 +894,9 @@ get_single_long_cb2 (void *cookie, int argc, char **argv, char **azColName, If SHOW_OLD is set, the binding's old policy is displayed. */ static gpg_error_t record_binding (tofu_dbs_t dbs, const char *fingerprint, const char *email, - const char *user_id, enum tofu_policy policy, - const char *conflict, + const char *user_id, + enum tofu_policy policy, enum tofu_policy effective_policy, + const char *conflict, int set_conflict, int show_old, time_t now) { char *fingerprint_pp = format_hexfingerprint (fingerprint, NULL, 0); @@ -924,19 +961,33 @@ record_binding (tofu_dbs_t dbs, const char *fingerprint, const char *email, rc = gpgsql_stepx (dbs->db, &dbs->s.record_binding_update, NULL, NULL, &err, "insert or replace into bindings\n" - " (oid, fingerprint, email, user_id, time, policy, conflict)\n" + " (oid, fingerprint, email, user_id, time," + " policy, conflict, effective_policy)\n" " values (\n" /* If we don't explicitly reuse the OID, then SQLite will - reallocate a new one. We just need to search for the OID - based on the fingerprint and email since they are unique. */ + * reallocate a new one. We just need to search for the OID + * based on the fingerprint and email since they are unique. */ " (select oid from bindings where fingerprint = ? and email = ?),\n" - " ?, ?, ?, ?, ?, ?);", + " ?, ?, ?, ?, ?," + /* If SET_CONFLICT is 0, then preserve conflict's current value. */ + " case ?" + " when 0 then" + " (select conflict from bindings where fingerprint = ? and email = ?)" + " else ?" + " end," + " ?);", + /* oid subquery. */ GPGSQL_ARG_STRING, fingerprint, GPGSQL_ARG_STRING, email, + /* values 2 through 6. */ GPGSQL_ARG_STRING, fingerprint, GPGSQL_ARG_STRING, email, GPGSQL_ARG_STRING, user_id, GPGSQL_ARG_LONG_LONG, (long long) now, GPGSQL_ARG_INT, (int) policy, + /* conflict subquery. */ + GPGSQL_ARG_INT, set_conflict ? 1 : 0, + GPGSQL_ARG_STRING, fingerprint, GPGSQL_ARG_STRING, email, GPGSQL_ARG_STRING, conflict ? conflict : "", + GPGSQL_ARG_INT, (int) effective_policy, GPGSQL_ARG_END); if (rc) { @@ -1113,108 +1164,6 @@ time_ago_scale (signed long t) } -/* Return the policy for the binding (email has - already been normalized) and any conflict information in *CONFLICT - if CONFLICT is not NULL. Returns _tofu_GET_POLICY_ERROR if an error - occurs. */ -static enum tofu_policy -get_policy (tofu_dbs_t dbs, const char *fingerprint, const char *email, - char **conflict) -{ - int rc; - char *err = NULL; - strlist_t strlist = NULL; - enum tofu_policy policy = _tofu_GET_POLICY_ERROR; - long along; - - /* Check if the binding is known - (TOFU_POLICY_NONE cannot appear in the DB. Thus, if POLICY is - still TOFU_POLICY_NONE after executing the query, then the - result set was empty.) */ - rc = gpgsql_stepx (dbs->db, &dbs->s.get_policy_select_policy_and_conflict, - strings_collect_cb2, &strlist, &err, - "select policy, conflict from bindings\n" - " where fingerprint = ? and email = ?", - GPGSQL_ARG_STRING, fingerprint, - GPGSQL_ARG_STRING, email, - GPGSQL_ARG_END); - if (rc) - { - log_error (_("error reading TOFU database: %s\n"), err); - print_further_info ("checking for existing bad bindings"); - sqlite3_free (err); - rc = gpg_error (GPG_ERR_GENERAL); - goto out; - } - - if (strlist_length (strlist) == 0) - /* No results. */ - { - policy = TOFU_POLICY_NONE; - goto out; - } - else if (strlist_length (strlist) != 2) - /* The result has the wrong form. */ - { - log_error (_("error reading TOFU database: %s\n"), - gpg_strerror (GPG_ERR_BAD_DATA)); - print_further_info ("checking for existing bad bindings:" - " expected 2 results, got %d\n", - strlist_length (strlist)); - goto out; - } - - /* The result has the right form. */ - - if (string_to_long (&along, strlist->d, 0, __LINE__)) - { - log_error (_("error reading TOFU database: %s\n"), - gpg_strerror (GPG_ERR_BAD_DATA)); - print_further_info ("bad value for policy: %s", strlist->d); - goto out; - } - policy = along; - - if (! (policy == TOFU_POLICY_AUTO - || policy == TOFU_POLICY_GOOD - || policy == TOFU_POLICY_UNKNOWN - || policy == TOFU_POLICY_BAD - || policy == TOFU_POLICY_ASK)) - { - log_error (_("error reading TOFU database: %s\n"), - gpg_strerror (GPG_ERR_DB_CORRUPTED)); - print_further_info ("invalid value for policy (%d)", policy); - policy = _tofu_GET_POLICY_ERROR; - goto out; - } - - - /* If CONFLICT is set, then policy should be TOFU_POLICY_ASK. But, - just in case, we do the check again here and ignore the conflict - if POLICY is not TOFU_POLICY_ASK. */ - if (conflict) - { - if (policy == TOFU_POLICY_ASK && *strlist->next->d) - *conflict = xstrdup (strlist->next->d); - else - *conflict = NULL; - } - - out: - log_assert (policy == _tofu_GET_POLICY_ERROR - || policy == TOFU_POLICY_NONE - || policy == TOFU_POLICY_AUTO - || policy == TOFU_POLICY_GOOD - || policy == TOFU_POLICY_UNKNOWN - || policy == TOFU_POLICY_BAD - || policy == TOFU_POLICY_ASK); - - free_strlist (strlist); - - return policy; -} - - /* Format the first part of a conflict message and return that as a * malloced string. */ static char * @@ -1862,7 +1811,7 @@ ask_about_binding (ctrl_t ctrl, } if (record_binding (dbs, fingerprint, email, user_id, - *policy, NULL, 0, now)) + *policy, TOFU_POLICY_NONE, NULL, 0, 0, now)) { /* If there's an error registering the * binding, don't save the signature. */ @@ -2150,6 +2099,328 @@ build_conflict_set (tofu_dbs_t dbs, } +/* Return the effective policy for the binding + * (email has already been normalized) and any conflict information in + * *CONFLICT_SETP, if CONFLICT_SETP is not NULL. Returns + * _tofu_GET_POLICY_ERROR if an error occurs. */ +static enum tofu_policy +get_policy (tofu_dbs_t dbs, PKT_public_key *pk, + const char *fingerprint, const char *user_id, const char *email, + strlist_t *conflict_setp, time_t now) +{ + int rc; + char *err = NULL; + strlist_t results = NULL; + enum tofu_policy policy = _tofu_GET_POLICY_ERROR; + enum tofu_policy effective_policy_orig = TOFU_POLICY_NONE; + enum tofu_policy effective_policy = _tofu_GET_POLICY_ERROR; + long along; + char *conflict_orig = NULL; + char *conflict = NULL; + strlist_t conflict_set = NULL; + int conflict_set_count; + + /* Check if the binding is known + (TOFU_POLICY_NONE cannot appear in the DB. Thus, if POLICY is + still TOFU_POLICY_NONE after executing the query, then the + result set was empty.) */ + rc = gpgsql_stepx (dbs->db, &dbs->s.get_policy_select_policy_and_conflict, + strings_collect_cb2, &results, &err, + "select policy, conflict, effective_policy from bindings\n" + " where fingerprint = ? and email = ?", + GPGSQL_ARG_STRING, fingerprint, + GPGSQL_ARG_STRING, email, + GPGSQL_ARG_END); + if (rc) + { + log_error (_("error reading TOFU database: %s\n"), err); + print_further_info ("reading the policy"); + sqlite3_free (err); + rc = gpg_error (GPG_ERR_GENERAL); + goto out; + } + + if (strlist_length (results) == 0) + { + /* No results. Use the defaults. */ + policy = TOFU_POLICY_NONE; + effective_policy = TOFU_POLICY_NONE; + } + else if (strlist_length (results) == 3) + { + /* Parse and sanity check the results. */ + + if (string_to_long (&along, results->d, 0, __LINE__)) + { + log_error (_("error reading TOFU database: %s\n"), + gpg_strerror (GPG_ERR_BAD_DATA)); + print_further_info ("bad value for policy: %s", results->d); + goto out; + } + policy = along; + + if (! (policy == TOFU_POLICY_AUTO + || policy == TOFU_POLICY_GOOD + || policy == TOFU_POLICY_UNKNOWN + || policy == TOFU_POLICY_BAD + || policy == TOFU_POLICY_ASK)) + { + log_error (_("error reading TOFU database: %s\n"), + gpg_strerror (GPG_ERR_DB_CORRUPTED)); + print_further_info ("invalid value for policy (%d)", policy); + effective_policy = _tofu_GET_POLICY_ERROR; + goto out; + } + + if (*results->next->d) + conflict = xstrdup (results->next->d); + + if (string_to_long (&along, results->next->next->d, 0, __LINE__)) + { + log_error (_("error reading TOFU database: %s\n"), + gpg_strerror (GPG_ERR_BAD_DATA)); + print_further_info ("bad value for effective policy: %s", + results->next->next->d); + goto out; + } + effective_policy = along; + + if (! (effective_policy == TOFU_POLICY_NONE + || effective_policy == TOFU_POLICY_AUTO + || effective_policy == TOFU_POLICY_GOOD + || effective_policy == TOFU_POLICY_UNKNOWN + || effective_policy == TOFU_POLICY_BAD + || effective_policy == TOFU_POLICY_ASK)) + { + log_error (_("error reading TOFU database: %s\n"), + gpg_strerror (GPG_ERR_DB_CORRUPTED)); + print_further_info ("invalid value for effective_policy (%d)", + effective_policy); + effective_policy = _tofu_GET_POLICY_ERROR; + goto out; + } + } + else + { + /* The result has the wrong form. */ + + log_error (_("error reading TOFU database: %s\n"), + gpg_strerror (GPG_ERR_BAD_DATA)); + print_further_info ("reading policy: expected 3 columns, got %d\n", + strlist_length (results)); + goto out; + } + + /* Save the effective policy and conflict so we know if we changed + * them. */ + effective_policy_orig = effective_policy; + conflict_orig = conflict; + + /* Unless there is a conflict, if the effective policy is cached, + * just return it. The reason we don't do this when there is a + * conflict is because of the following scenario: assume A and B + * conflict and B has signed A's key. Now, later we import A's + * signature on B. We need to recheck A, but the signature was on + * B, i.e., when B changes, we invalidate B's effective policy, but + * we also need to invalidate A's effective policy. Instead, we + * assume that conflicts are rare and don't optimize for them, which + * would complicate the code. */ + if (effective_policy != TOFU_POLICY_NONE && !conflict) + goto out; + + /* If the user explicitly set the policy, then respect that. */ + if (policy != TOFU_POLICY_AUTO && policy != TOFU_POLICY_NONE) + { + effective_policy = policy; + goto out; + } + + /* Unless proven wrong, assume the effective policy is 'auto'. */ + effective_policy = TOFU_POLICY_AUTO; + + /* See if the key is ultimately trusted. */ + { + u32 kid[2]; + + keyid_from_pk (pk, kid); + if (tdb_keyid_is_utk (kid)) + { + effective_policy = TOFU_POLICY_GOOD; + goto out; + } + } + + /* See if the key is signed by an ultimately trusted key. */ + { + int fingerprint_raw_len = strlen (fingerprint) / 2; + char fingerprint_raw[fingerprint_raw_len]; + int len = 0; + + if (fingerprint_raw_len != 20 + || ((len = hex2bin (fingerprint, + fingerprint_raw, fingerprint_raw_len)) + != strlen (fingerprint))) + { + if (DBG_TRUST) + log_debug ("TOFU: Bad fingerprint: %s (len: %zd, parsed: %d)\n", + fingerprint, strlen (fingerprint), len); + } + else + { + int lookup_err; + kbnode_t kb; + + lookup_err = get_pubkey_byfprint (NULL, &kb, + fingerprint_raw, + fingerprint_raw_len); + if (lookup_err) + { + if (DBG_TRUST) + log_debug ("TOFU: Looking up %s: %s\n", + fingerprint, gpg_strerror (lookup_err)); + } + else + { + int is_signed_by_utk = signed_by_utk (email, kb); + release_kbnode (kb); + if (is_signed_by_utk) + { + effective_policy = TOFU_POLICY_GOOD; + goto out; + } + } + } + } + + /* Check for any conflicts / see if a previously discovered conflict + * disappeared. The latter can happen if the conflicting bindings + * are now cross signed, for instance. */ + + conflict_set = build_conflict_set (dbs, pk, fingerprint, email); + conflict_set_count = strlist_length (conflict_set); + if (conflict_set_count == 0) + { + /* build_conflict_set should always at least return the current + binding. Something went wrong. */ + effective_policy = _tofu_GET_POLICY_ERROR; + goto out; + } + + if (conflict_set_count == 1 + && (conflict_set->flags & BINDING_NEW)) + { + /* We've never observed a binding with this email address and we + * have a default policy, which is not to ask the user. */ + + /* If we've seen this binding, then we've seen this email and + * policy couldn't possibly be TOFU_POLICY_NONE. */ + log_assert (policy == TOFU_POLICY_NONE); + + if (DBG_TRUST) + log_debug ("TOFU: New binding , no conflict.\n", + fingerprint, email); + + effective_policy = TOFU_POLICY_AUTO; + goto out; + } + + if (conflict_set_count == 1 + && (conflict_set->flags & BINDING_CONFLICT)) + { + /* No known conflicts now, but there was a conflict. That is, + * at somepoint there was a conflict, but it went away. A + * conflict can go away if there is now a cross sig between the + * two keys. In this case, we just silently clear the + * conflict. */ + + if (DBG_TRUST) + log_debug ("TOFU: binding had a conflict, but it's been resolved (probably via cross sig).\n", + fingerprint, email); + + effective_policy = TOFU_POLICY_AUTO; + conflict = NULL; + + goto out; + } + + if (conflict_set_count == 1) + { + /* No conflicts and never marked as conflicting. */ + + log_assert (!conflict); + + effective_policy = TOFU_POLICY_AUTO; + + goto out; + } + + /* There is a conflicting key. */ + log_assert (conflict_set_count > 1); + effective_policy = TOFU_POLICY_ASK; + conflict = xstrdup (conflict_set->next->d); + + out: + log_assert (policy == _tofu_GET_POLICY_ERROR + || policy == TOFU_POLICY_NONE + || policy == TOFU_POLICY_AUTO + || policy == TOFU_POLICY_GOOD + || policy == TOFU_POLICY_UNKNOWN + || policy == TOFU_POLICY_BAD + || policy == TOFU_POLICY_ASK); + /* Everything but NONE. */ + log_assert (effective_policy == _tofu_GET_POLICY_ERROR + || effective_policy == TOFU_POLICY_AUTO + || effective_policy == TOFU_POLICY_GOOD + || effective_policy == TOFU_POLICY_UNKNOWN + || effective_policy == TOFU_POLICY_BAD + || effective_policy == TOFU_POLICY_ASK); + + if (effective_policy != TOFU_POLICY_ASK && conflict) + conflict = NULL; + + /* If we don't have a record of this binding, its effective policy + * changed, or conflict changed, update the DB. */ + if (effective_policy != _tofu_GET_POLICY_ERROR + && (/* New binding. */ + policy == TOFU_POLICY_NONE + /* effective_policy changed. */ + || effective_policy != effective_policy_orig + /* conflict changed. */ + || (conflict != conflict_orig + && (!conflict || !conflict_orig + || strcmp (conflict, conflict_orig) != 0)))) + { + if (record_binding (dbs, fingerprint, email, user_id, + policy == TOFU_POLICY_NONE ? TOFU_POLICY_AUTO : policy, + effective_policy, conflict, 1, 0, now) != 0) + log_error (_("error setting TOFU binding's policy" + " to %s\n"), tofu_policy_str (policy)); + } + + /* If the caller wants the set of conflicts, return it. */ + if (effective_policy == TOFU_POLICY_ASK && conflict_setp) + { + if (! conflict_set) + conflict_set = build_conflict_set (dbs, pk, fingerprint, email); + *conflict_setp = conflict_set; + } + else + { + free_strlist (conflict_set); + + if (conflict_setp) + *conflict_setp = NULL; + } + + xfree (conflict_orig); + if (conflict != conflict_orig) + xfree (conflict); + free_strlist (results); + + return effective_policy; +} + + /* Return the trust level (TRUST_NEVER, etc.) for the binding * (email is already normalized). If no policy * is registered, returns TOFU_POLICY_NONE. If an error occurs, @@ -2175,9 +2446,7 @@ get_trust (ctrl_t ctrl, PKT_public_key *pk, enum tofu_policy policy; int rc; char *sqerr = NULL; - int change_conflicting_to_ask = 0; strlist_t conflict_set = NULL; - int conflict_set_count; int trust_level = TRUST_UNKNOWN; strlist_t iter; @@ -2201,36 +2470,22 @@ get_trust (ctrl_t ctrl, PKT_public_key *pk, && _tofu_GET_TRUST_ERROR != TRUST_FULLY && _tofu_GET_TRUST_ERROR != TRUST_ULTIMATE); - begin_transaction (ctrl, 0); - in_transaction = 1; - - policy = get_policy (dbs, fingerprint, email, NULL); + /* If the key is ultimately trusted, there is nothing to do. */ { - /* See if the key is ultimately trusted. If so, we're done. */ u32 kid[2]; keyid_from_pk (pk, kid); - if (tdb_keyid_is_utk (kid)) { - if (policy == TOFU_POLICY_NONE) - /* New binding. */ - { - if (record_binding (dbs, fingerprint, email, user_id, - TOFU_POLICY_GOOD, NULL, 0, now) != 0) - { - log_error (_("error setting TOFU binding's trust level" - " to %s\n"), "good"); - trust_level = _tofu_GET_TRUST_ERROR; - goto out; - } - } - trust_level = TRUST_ULTIMATE; goto out; } } + begin_transaction (ctrl, 0); + in_transaction = 1; + + policy = get_policy (dbs, pk, fingerprint, user_id, email, &conflict_set, now); if (policy == TOFU_POLICY_AUTO) { policy = opt.tofu_default_policy; @@ -2255,12 +2510,7 @@ get_trust (ctrl_t ctrl, PKT_public_key *pk, goto out; case TOFU_POLICY_ASK: - /* We need to ask the user what to do. Case #1 or #2 below. */ - break; - - case TOFU_POLICY_NONE: - /* The binding is new, we need to check for conflicts. Case #3 - * below. */ + /* We need to ask the user what to do. */ break; case _tofu_GET_POLICY_ERROR: @@ -2281,211 +2531,68 @@ get_trust (ctrl_t ctrl, PKT_public_key *pk, * 2. The saved policy is ask (either last time the user selected * accept once or reject once or there was a conflict and this * binding's policy was changed from auto to ask) - * (policy == TOFU_POLICY_ASK), or, - * - * 3. We don't have a saved policy (policy == TOFU_POLICY_NONE) - * (need to check for a conflict). - * - * In summary: POLICY is ask or none. + * (policy == TOFU_POLICY_ASK). */ + log_assert (policy == TOFU_POLICY_ASK); - /* Before continuing, see if the key is signed by an ultimately - * trusted key. */ - { - int fingerprint_raw_len = strlen (fingerprint) / 2; - char fingerprint_raw[fingerprint_raw_len]; - int len = 0; - int is_signed_by_utk = 0; - - if (fingerprint_raw_len != 20 - || ((len = hex2bin (fingerprint, - fingerprint_raw, fingerprint_raw_len)) - != strlen (fingerprint))) - { - if (DBG_TRUST) - log_debug ("TOFU: Bad fingerprint: %s (len: %zd, parsed: %d)\n", - fingerprint, strlen (fingerprint), len); - } - else - { - int lookup_err; - kbnode_t kb; - - lookup_err = get_pubkey_byfprint (NULL, &kb, - fingerprint_raw, - fingerprint_raw_len); - if (lookup_err) - { - if (DBG_TRUST) - log_debug ("TOFU: Looking up %s: %s\n", - fingerprint, gpg_strerror (lookup_err)); - } - else - { - is_signed_by_utk = signed_by_utk (email, kb); - release_kbnode (kb); - } - } - - if (is_signed_by_utk) - { - if (record_binding (dbs, fingerprint, email, user_id, - TOFU_POLICY_GOOD, NULL, 0, now) != 0) - { - log_error (_("error setting TOFU binding's trust level" - " to %s\n"), "good"); - trust_level = _tofu_GET_TRUST_ERROR; - } - else - trust_level = TRUST_FULLY; - - goto out; - } - } - - - /* Look for conflicts. This is needed in all 3 cases. */ - conflict_set = build_conflict_set (dbs, pk, fingerprint, email); - conflict_set_count = strlist_length (conflict_set); - if (conflict_set_count == 0) - { - /* We should always at least have the current binding. */ - trust_level = _tofu_GET_TRUST_ERROR; - goto out; - } - - if (conflict_set_count == 1 - && (conflict_set->flags & BINDING_NEW) - && opt.tofu_default_policy != TOFU_POLICY_ASK) + if (may_ask) { - /* We've never observed a binding with this email address and we - * have a default policy, which is not to ask the user. */ - - /* If we've seen this binding, then we've seen this email and - * policy couldn't possibly be TOFU_POLICY_NONE. */ - log_assert (policy == TOFU_POLICY_NONE); - - if (DBG_TRUST) - log_debug ("TOFU: New binding , no conflict.\n", - fingerprint, email); - - if (record_binding (dbs, fingerprint, email, user_id, - TOFU_POLICY_AUTO, NULL, 0, now) != 0) - { - log_error (_("error setting TOFU binding's trust level to %s\n"), - "auto"); - trust_level = _tofu_GET_TRUST_ERROR; - goto out; - } + /* We can't be in a normal transaction in ask_about_binding. */ + end_transaction (ctrl, 0); + in_transaction = 0; - trust_level = tofu_policy_to_trust_level (TOFU_POLICY_AUTO); - goto out; + /* If we get here, we need to ask the user about the binding. */ + ask_about_binding (ctrl, + &policy, + &trust_level, + conflict_set, + fingerprint, + email, + user_id, + now); } + else + trust_level = TRUST_UNDEFINED; - if (conflict_set_count == 1 - && (conflict_set->flags & BINDING_CONFLICT)) + /* Mark any conflicting bindings that have an automatic policy as + * now requiring confirmation. Note: we do this after we ask for + * confirmation so that when the current policy is printed, it is + * correct. */ + if (! in_transaction) { - /* No known conflicts now, but there was a conflict. This means - * at somepoint, there was a conflict and we changed this - * binding's policy to ask and set the conflicting key. The - * conflict can go away if there is not a cross sig between the - * two keys. In this case, just silently clear the conflict and - * reset the policy to auto. */ - - log_assert (policy == TOFU_POLICY_ASK); - - if (DBG_TRUST) - log_debug ("TOFU: binding had a conflict, but it's been resolved (probably via cross sig).\n", - fingerprint, email); - - if (record_binding (dbs, fingerprint, email, user_id, - TOFU_POLICY_AUTO, NULL, 0, now) != 0) - log_error (_("error setting TOFU binding's trust level to %s\n"), - "auto"); - - trust_level = tofu_policy_to_trust_level (TOFU_POLICY_AUTO); - goto out; + begin_transaction (ctrl, 0); + in_transaction = 1; } - /* We have a conflict. Mark any conflicting bindings that have an - * automatic policy as now requiring confirmation. Note: we delay - * this until after we ask for confirmation so that when the current - * policy is printed, it is correct. */ - change_conflicting_to_ask = 1; + /* The conflict set should always contain at least one element: + * the current key. */ + log_assert (conflict_set); - if (! may_ask) + for (iter = conflict_set->next; iter; iter = iter->next) { - log_assert (policy == TOFU_POLICY_NONE || policy == TOFU_POLICY_ASK); - if (policy == TOFU_POLICY_NONE) + /* We don't immediately set the effective policy to 'ask, + because */ + rc = gpgsql_exec_printf + (dbs->db, NULL, NULL, &sqerr, + "update bindings set effective_policy = %d, conflict = %Q" + " where email = %Q and fingerprint = %Q and effective_policy != %d;", + TOFU_POLICY_NONE, fingerprint, + email, iter->d, TOFU_POLICY_ASK); + if (rc) { - /* We get here in the third case (no saved policy) and if - * there is a conflict. */ - if (record_binding (dbs, fingerprint, email, user_id, - TOFU_POLICY_ASK, - conflict_set && conflict_set->next - ? conflict_set->next->d : NULL, - 0, now) != 0) - log_error (_("error setting TOFU binding's trust level to %s\n"), - "ask"); + log_error (_("error changing TOFU policy: %s\n"), sqerr); + print_further_info ("binding: ", + fingerprint, user_id); + sqlite3_free (sqerr); + sqerr = NULL; + rc = gpg_error (GPG_ERR_GENERAL); } - - trust_level = TRUST_UNDEFINED; - goto out; + else if (DBG_TRUST) + log_debug ("Set %s to conflict with %s\n", + iter->d, fingerprint); } - /* We can't be in a normal transaction in ask_about_binding. */ - end_transaction (ctrl, 0); - in_transaction = 0; - - /* If we get here, we need to ask the user about the binding. */ - ask_about_binding (ctrl, - &policy, - &trust_level, - conflict_set, - fingerprint, - email, - user_id, - now); - out: - - if (change_conflicting_to_ask) - { - /* Mark any conflicting bindings that have an automatic policy as - * now requiring confirmation. */ - - if (! in_transaction) - { - begin_transaction (ctrl, 0); - in_transaction = 1; - } - - /* If we weren't allowed to ask, also update this key as - * conflicting with itself. */ - for (iter = may_ask ? conflict_set->next : conflict_set; - iter; iter = iter->next) - { - rc = gpgsql_exec_printf - (dbs->db, NULL, NULL, &sqerr, - "update bindings set policy = %d, conflict = %Q" - " where email = %Q and fingerprint = %Q and policy = %d;", - TOFU_POLICY_ASK, fingerprint, - email, iter->d, TOFU_POLICY_AUTO); - if (rc) - { - log_error (_("error changing TOFU policy: %s\n"), sqerr); - print_further_info ("binding: ", - fingerprint, user_id); - sqlite3_free (sqerr); - sqerr = NULL; - rc = gpg_error (GPG_ERR_GENERAL); - } - else if (DBG_TRUST) - log_debug ("Set %s to conflict with %s\n", - iter->d, fingerprint); - } - } - if (in_transaction) end_transaction (ctrl, 0); @@ -2684,17 +2791,18 @@ write_stats_status (estream_t fp, } /* Note: If OUTFP is not NULL, this function merely prints a "tfs" record - * to OUTFP. In this case USER_ID is not required. + * to OUTFP. * * Returns whether the caller should call show_warning after iterating * over all user ids. */ static int -show_statistics (tofu_dbs_t dbs, const char *fingerprint, +show_statistics (tofu_dbs_t dbs, PKT_public_key *pk, const char *fingerprint, const char *email, const char *user_id, estream_t outfp, time_t now) { - enum tofu_policy policy = get_policy (dbs, fingerprint, email, NULL); + enum tofu_policy policy = + get_policy (dbs, pk, fingerprint, user_id, email, NULL, now); char *fingerprint_pp; int rc; @@ -3336,7 +3444,7 @@ tofu_write_tfs_record (ctrl_t ctrl, estream_t fp, fingerprint = hexfingerprint (pk, NULL, 0); email = email_from_user_id (user_id); - show_statistics (dbs, fingerprint, email, user_id, fp, now); + show_statistics (dbs, pk, fingerprint, email, user_id, fp, now); xfree (email); xfree (fingerprint); @@ -3412,7 +3520,7 @@ tofu_get_validity (ctrl_t ctrl, PKT_public_key *pk, strlist_t user_id_list, if (may_ask && tl != TRUST_ULTIMATE && tl != TRUST_EXPIRED) need_warning |= - show_statistics (dbs, fingerprint, email, user_id->d, NULL, now); + show_statistics (dbs, pk, fingerprint, email, user_id->d, NULL, now); if (tl == TRUST_NEVER) trust_level = TRUST_NEVER; @@ -3512,7 +3620,7 @@ tofu_set_policy (ctrl_t ctrl, kbnode_t kb, enum tofu_policy policy) email = email_from_user_id (user_id->name); err = record_binding (dbs, fingerprint, email, user_id->name, - policy, NULL, 1, now); + policy, TOFU_POLICY_NONE, NULL, 0, 1, now); if (err) { log_error (_("error setting policy for key %s, user id \"%s\": %s"), @@ -3561,6 +3669,7 @@ gpg_error_t tofu_get_policy (ctrl_t ctrl, PKT_public_key *pk, PKT_user_id *user_id, enum tofu_policy *policy) { + time_t now = gnupg_get_time (); tofu_dbs_t dbs; char *fingerprint; char *email; @@ -3580,7 +3689,7 @@ tofu_get_policy (ctrl_t ctrl, PKT_public_key *pk, PKT_user_id *user_id, email = email_from_user_id (user_id->name); - *policy = get_policy (dbs, fingerprint, email, NULL); + *policy = get_policy (dbs, pk, fingerprint, user_id->name, email, NULL, now); xfree (email); xfree (fingerprint); @@ -3588,3 +3697,42 @@ tofu_get_policy (ctrl_t ctrl, PKT_public_key *pk, PKT_user_id *user_id, return gpg_error (GPG_ERR_GENERAL); return 0; } + +gpg_error_t +tofu_notice_key_changed (ctrl_t ctrl, kbnode_t kb) +{ + tofu_dbs_t dbs; + PKT_public_key *pk; + char *fingerprint; + char *sqlerr = NULL; + int rc; + + /* Make sure PK is a primary key. */ + setup_main_keyids (kb); + pk = kb->pkt->pkt.public_key; + log_assert (pk_is_primary (pk)); + + fingerprint = hexfingerprint (pk, NULL, 0); + + dbs = opendbs (ctrl); + if (! dbs) + { + log_error (_("error opening TOFU database: %s\n"), + gpg_strerror (GPG_ERR_GENERAL)); + return gpg_error (GPG_ERR_GENERAL); + } + + fingerprint = hexfingerprint (pk, NULL, 0); + + rc = gpgsql_stepx (dbs->db, NULL, NULL, NULL, &sqlerr, + "update bindings set effective_policy = ?" + " where fingerprint = ?;", + GPGSQL_ARG_INT, (int) TOFU_POLICY_NONE, + GPGSQL_ARG_STRING, fingerprint, + GPGSQL_ARG_END); + xfree (fingerprint); + + if (rc == _tofu_GET_POLICY_ERROR) + return gpg_error (GPG_ERR_GENERAL); + return 0; +} diff --git a/g10/tofu.h b/g10/tofu.h index f114443..3ee2f41 100644 --- a/g10/tofu.h +++ b/g10/tofu.h @@ -139,4 +139,9 @@ void tofu_end_batch_update (ctrl_t ctrl); /* Release all of the resources associated with a DB meta-handle. */ void tofu_closedbs (ctrl_t ctrl); +/* Whenever a key is modified (e.g., a user id is added or revoked, a + * new signature, etc.), this function should be called to cause TOFU + * to update its world view. */ +gpg_error_t tofu_notice_key_changed (ctrl_t ctrl, kbnode_t kb); + #endif /*G10_TOFU_H*/ diff --git a/tests/openpgp/tofu.scm b/tests/openpgp/tofu.scm index 91c9e78..2a04d13 100755 --- a/tests/openpgp/tofu.scm +++ b/tests/openpgp/tofu.scm @@ -20,7 +20,7 @@ (load (with-path "defs.scm")) (setup-environment) - ;; Redefine GPG without --always-trust and a fixed time. +;; Redefine GPG without --always-trust and a fixed time. (define GPG `(,(tool 'gpg) --no-permission-warning --faked-system-time=1466684990)) (define GNUPGHOME (getenv "GNUPGHOME")) @@ -141,20 +141,23 @@ '("auto" "good" "unknown" "bad" "ask")))) '("good" "unknown" "bad")) -;; BC15C85A conflicts with 2183839A. On conflict, this will set -;; BC15C85A to ask. If 2183839A is auto (it's not, it's bad), then -;; it will be set to ask. -(call-check `(, at GPG --trust-model=tofu - --verify ,(in-srcdir "tofu-BC15C85A-1.txt"))) +;; At the end, 2183839A's policy should be bad. +(checkpolicy "2183839A" "bad") + +;; BC15C85A and 2183839A conflict. A policy setting of "auto" +;; (BC15C85A's state) will result in an effective policy of ask. But, +;; a policy setting of "bad" will result in an effective policy of +;; bad. +(setpolicy "BC15C85A" "auto") (checkpolicy "BC15C85A" "ask") (checkpolicy "2183839A" "bad") -;; EE37CF96 conflicts with 2183839A and BC15C85A. We change -;; BC15C85A's policy to auto and leave 2183839A's policy at bad. -;; This conflict should cause BC15C85A's policy to be changed to -;; ask (since it is auto), but not affect 2183839A's policy. +;; EE37CF96, 2183839A, and BC15C85A conflict. We change BC15C85A's +;; policy to auto and leave 2183839A's policy at bad. This conflict +;; should cause BC15C85A's policy to be changed to ask (since it is +;; auto), but not affect 2183839A's policy. (setpolicy "BC15C85A" "auto") -(checkpolicy "BC15C85A" "auto") +(checkpolicy "BC15C85A" "ask") (call-check `(, at GPG --trust-model=tofu --verify ,(in-srcdir "tofu-EE37CF96-1.txt"))) (checkpolicy "BC15C85A" "ask") @@ -225,7 +228,8 @@ (checkpolicy KEYA "ask") (checkpolicy KEYB "ask") -;; Import Alice's signature on the conflicting user id. +;; Import Alice's signature on the conflicting user id. Since there +;; is now a cross signature, we should revert to the default policy. (display " > Adding cross signature on user id. ") (call-check `(, at GPG --import ,(in-srcdir DIR (string-append KEYIDB "-4.gpg")))) (verify-messages) commit 182efc5b5d20ac0d43501a22f349a23dc06a27a4 Author: Neal H. Walfield Date: Mon Nov 21 21:22:02 2016 +0100 g10: Correctly parameterize ngettext. * g10/tofu.c (ask_about_binding): Correctly parameterize ngettext. Signed-off-by: Neal H. Walfield diff --git a/g10/tofu.c b/g10/tofu.c index deccc0f..696cfc3 100644 --- a/g10/tofu.c +++ b/g10/tofu.c @@ -1733,19 +1733,22 @@ ask_about_binding (ctrl_t ctrl, if (labs(stats_iter->time_ago) == 3) es_fprintf (fp, ngettext(" over the past day.", " over the past %d days.", - seen_in_past), + TIME_AGO_SMALL_THRESHOLD + / TIME_AGO_UNIT_SMALL), TIME_AGO_SMALL_THRESHOLD / TIME_AGO_UNIT_SMALL); else if (labs(stats_iter->time_ago) == 4) es_fprintf (fp, ngettext(" over the past month.", " over the past %d months.", - seen_in_past), + TIME_AGO_MEDIUM_THRESHOLD + / TIME_AGO_UNIT_MEDIUM), TIME_AGO_MEDIUM_THRESHOLD / TIME_AGO_UNIT_MEDIUM); else if (labs(stats_iter->time_ago) == 5) es_fprintf (fp, ngettext(" over the past year.", " over the past %d years.", - seen_in_past), + TIME_AGO_LARGE_THRESHOLD + / TIME_AGO_UNIT_LARGE), TIME_AGO_LARGE_THRESHOLD / TIME_AGO_UNIT_LARGE); else if (labs(stats_iter->time_ago) == 6) commit 7142b293c870d73ce0146bfb90e6a556e0079650 Author: Neal H. Walfield Date: Mon Nov 21 21:13:15 2016 +0100 g10: Don't use the same variable for multiple SQL compiled statements * g10/tofu.c (struct tofu_dbs_s): Remove unused field record_binding_update2. Replace register_insert with register_signature and register_encryption. (tofu_register_signature): Don't use dbs->s.register_insert, but dbs->s.register_signature. (tofu_register_encryption): Don't use dbs->s.register_insert, but dbs->s.register_encryption. Signed-off-by: Neal H. Walfield diff --git a/g10/tofu.c b/g10/tofu.c index 05d171d..deccc0f 100644 --- a/g10/tofu.c +++ b/g10/tofu.c @@ -79,14 +79,14 @@ struct tofu_dbs_s sqlite3_stmt *record_binding_get_old_policy; sqlite3_stmt *record_binding_update; - sqlite3_stmt *record_binding_update2; sqlite3_stmt *get_policy_select_policy_and_conflict; sqlite3_stmt *get_trust_bindings_with_this_email; sqlite3_stmt *get_trust_gather_other_user_ids; sqlite3_stmt *get_trust_gather_signature_stats; sqlite3_stmt *get_trust_gather_encryption_stats; sqlite3_stmt *register_already_seen; - sqlite3_stmt *register_insert; + sqlite3_stmt *register_signature; + sqlite3_stmt *register_encryption; } s; int in_batch_transaction; @@ -3093,7 +3093,7 @@ tofu_register_signature (ctrl_t ctrl, log_assert (c == 0); rc = gpgsql_stepx - (dbs->db, &dbs->s.register_insert, NULL, NULL, &err, + (dbs->db, &dbs->s.register_signature, NULL, NULL, &err, "insert into signatures\n" " (binding, sig_digest, origin, sig_time, time)\n" " values\n" @@ -3209,7 +3209,7 @@ tofu_register_encryption (ctrl_t ctrl, } rc = gpgsql_stepx - (dbs->db, &dbs->s.register_insert, NULL, NULL, &err, + (dbs->db, &dbs->s.register_encryption, NULL, NULL, &err, "insert into encryptions\n" " (binding, time)\n" " values\n" commit 91a0483c5db8ee4510981448a705981ee1cce199 Author: Neal H. Walfield Date: Mon Nov 21 16:19:32 2016 +0100 g10: Add a convenience function for checking if a key is a primary key * g10/keydb.h (pk_is_primary): New function. * g10/tofu.c (get_trust): Use it. (tofu_register_signature): Likewise. (tofu_register_encryption): Likewise. (tofu_set_policy): Likewise. (tofu_get_policy): Likewise. Signed-off-by: Neal H. Walfield diff --git a/g10/keydb.h b/g10/keydb.h index 815b17e..e4fbe27 100644 --- a/g10/keydb.h +++ b/g10/keydb.h @@ -433,6 +433,13 @@ keyid_cmp (const u32 *a, const u32 *b) return 0; } +/* Return whether PK is a primary key. */ +static int GPGRT_ATTR_UNUSED +pk_is_primary (PKT_public_key *pk) +{ + return keyid_cmp (pk_keyid (pk), pk_main_keyid (pk)) == 0; +} + /* Copy the keyid in SRC to DEST and return DEST. */ u32 *keyid_copy (u32 *dest, const u32 *src); diff --git a/g10/tofu.c b/g10/tofu.c index 2c9d17c..05d171d 100644 --- a/g10/tofu.c +++ b/g10/tofu.c @@ -2186,7 +2186,7 @@ get_trust (ctrl_t ctrl, PKT_public_key *pk, if (opt.batch) may_ask = 0; - log_assert (keyid_cmp (pk_keyid (pk), pk_main_keyid (pk)) == 0); + log_assert (pk_is_primary (pk)); /* Make sure _tofu_GET_TRUST_ERROR isn't equal to any of the trust levels. */ @@ -3009,7 +3009,7 @@ tofu_register_signature (ctrl_t ctrl, if (rc) return rc; - log_assert (keyid_cmp (pk_keyid (pk), pk_main_keyid (pk)) == 0); + log_assert (pk_is_primary (pk)); sig_digest = make_radix64_string (sig_digest_bin, sig_digest_bin_len); fingerprint = hexfingerprint (pk, NULL, 0); @@ -3155,13 +3155,13 @@ tofu_register_encryption (ctrl_t ctrl, } if (/* We need the key block to find the primary key. */ - keyid_cmp (pk_keyid (pk), pk_main_keyid (pk)) != 0 + ! pk_is_primary (pk) /* We need the key block to find all user ids. */ || ! user_id_list) kb = get_pubkeyblock (pk->keyid); /* Make sure PK is a primary key. */ - if (keyid_cmp (pk_keyid (pk), pk_main_keyid (pk)) != 0) + if (! pk_is_primary (pk)) pk = kb->pkt->pkt.public_key; if (! user_id_list) @@ -3485,7 +3485,7 @@ tofu_set_policy (ctrl_t ctrl, kbnode_t kb, enum tofu_policy policy) if (DBG_TRUST) log_debug ("Setting TOFU policy for %s to %s\n", keystr (pk->keyid), tofu_policy_str (policy)); - if (keyid_cmp (pk_main_keyid (pk), pk_keyid (pk)) != 0) + if (! pk_is_primary (pk)) log_bug ("%s: Passed a subkey, but expecting a primary key.\n", __func__); fingerprint = hexfingerprint (pk, NULL, 0); @@ -3563,8 +3563,7 @@ tofu_get_policy (ctrl_t ctrl, PKT_public_key *pk, PKT_user_id *user_id, char *email; /* Make sure PK is a primary key. */ - log_assert (pk->main_keyid[0] == pk->keyid[0] - && pk->main_keyid[1] == pk->keyid[1]); + log_assert (pk_is_primary (pk)); dbs = opendbs (ctrl); if (! dbs) ----------------------------------------------------------------------- Summary of changes: g10/gpgv.c | 9 + g10/import.c | 11 +- g10/keydb.c | 6 +- g10/keydb.h | 9 +- g10/keyedit.c | 10 +- g10/test-stubs.c | 9 + g10/tofu.c | 856 +++++++++++++++++++++++++++++-------------------- g10/tofu.h | 5 + tests/openpgp/tofu.scm | 28 +- 9 files changed, 566 insertions(+), 377 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Tue Nov 22 10:11:45 2016 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Tue, 22 Nov 2016 10:11:45 +0100 Subject: [git] Pinentry - branch, master, updated. pinentry-0.9.7-58-gd015020 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The standard pinentry collection". The branch, master has been updated via d015020b56dc11848d638d8a0f22c11971f896ea (commit) via 2fac0e82bcdc4abf3f81bded2ca49d34896d4373 (commit) via 5eb55801a70148111a78a7ffd8ee459790f1aafe (commit) via d126036671e7dd631babc118cb4113f723f15748 (commit) via 626819f0422a2b71fc2aa6bb2daf73ccf5a243bb (commit) from cf8885fd5a61654a164f470fa3e7095b8e424258 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit d015020b56dc11848d638d8a0f22c11971f896ea Author: Werner Koch Date: Tue Nov 22 09:16:05 2016 +0100 Create SWDB entry during make distcheck * Makefile.am (DISTCHECK_CONFIGURE_FLAGS): Build emacs flavor. (distcheck-hook): New. Signed-off-by: Werner Koch diff --git a/Makefile.am b/Makefile.am index 7dcc0ae..ef80f6c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -20,7 +20,7 @@ ## Process this file with automake to produce Makefile.in ACLOCAL_AMFLAGS = -I m4 -DISTCHECK_CONFIGURE_FLAGS = --disable-pinentry-qt +DISTCHECK_CONFIGURE_FLAGS = --disable-pinentry-qt --enable-pinentry-emacs GITLOG_TO_CHANGELOG=gitlog-to-changelog @@ -88,6 +88,21 @@ install-exec-local: dist-hook: gen-ChangeLog echo "$(VERSION)" > $(distdir)/VERSION +distcheck-hook: + set -e; ( \ + pref="#+macro: pinentry_" ;\ + reldate="$$(date -u +%Y-%m-%d)" ;\ + echo "$${pref}ver $(PACKAGE_VERSION)" ;\ + echo "$${pref}date $${reldate}" ;\ + list='$(DIST_ARCHIVES)'; for i in $$list; do \ + case "$$i" in *.tar.bz2) \ + echo "$${pref}size $$(wc -c <$$i|awk '{print int($$1/1024)}')k" ;\ + echo "$${pref}sha1 $$(sha1sum <$$i|cut -d' ' -f1)" ;\ + echo "$${pref}sha2 $$(sha256sum <$$i|cut -d' ' -f1)" ;;\ + esac;\ + done ) | tee $(distdir).swdb + + gen_start_date = 2012-08-08T00:00:00 .PHONY: gen-ChangeLog gen-ChangeLog: commit 2fac0e82bcdc4abf3f81bded2ca49d34896d4373 Author: Werner Koch Date: Tue Nov 22 09:11:50 2016 +0100 Post release updates -- diff --git a/NEWS b/NEWS index 6bd0e4b..16988fa 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ +Noteworthy changes in version 1.0.1 (unreleased) +------------------------------------------------ + + Noteworthy changes in version 1.0.0 (2016-11-22) ------------------------------------------------ diff --git a/configure.ac b/configure.ac index 42c1589..5119e4a 100644 --- a/configure.ac +++ b/configure.ac @@ -26,7 +26,7 @@ min_automake_version="1.14" # (git tag -s pinentry-n.m.k) and run "./autogen.sh --force". Please # bump the version number immediately after the release, do another # commit, and a push so that the git magic is able to work. -m4_define(mym4_version, [1.0.0]) +m4_define(mym4_version, [1.0.1]) # Below is m4 magic to extract and compute the git revision number, # the decimalized short revision number, a beta version string and a commit 5eb55801a70148111a78a7ffd8ee459790f1aafe Author: Werner Koch Date: Tue Nov 22 08:51:41 2016 +0100 Release 1.0.0 Signed-off-by: Werner Koch diff --git a/AUTHORS b/AUTHORS index d74004a..b526ce6 100644 --- a/AUTHORS +++ b/AUTHORS @@ -1,11 +1,24 @@ Program: Pinentry -Bug reports: +Download: ftp://ftp.gnupg.org/gcrypt/pinentry/ +Repository: git://git.gnupg.org/pinentry.git +Bug reports: https://bugs.gnupg.org (category: pinentry) Security related bug reports: License: GPLv2+ +Pinentry is free software. See the files COPYING for copying conditions. +License copyright years may be listed using range notation, e.g., +2000-2016, indicating that every year in the range, inclusive, is a +copyrightable year that would otherwise be listed individually. + + +Authors +------- + Robert Bihlmeyer Werner Koch, g10 Code GmbH -Steffen Hansen, Klar?lvdalens Datakonsult AB +Steffen Hansen, Klar?lvdalens Datakonsult AB + Marcus Brinkmann, g10 Code GmbH Timo Schulz, g10 Code GmbH Neal Walfied, g10 Code GmbH +Daniel Kahn Gillmor diff --git a/NEWS b/NEWS index 7a7ca76..6bd0e4b 100644 --- a/NEWS +++ b/NEWS @@ -1,22 +1,32 @@ -Noteworthy changes in version 0.9.8 (unreleased) +Noteworthy changes in version 1.0.0 (2016-11-22) ------------------------------------------------ * Qt pinentry now supports repeat mode in one dialog. - * Qt and GTK pinentries now make it possible to show the - entered value. + * Qt and GTK pinentries now make it possible to show the entered + value. - * Qt pinentry now only grabs the keyboard if an entry field - is focused. + * Qt pinentry now only grabs the keyboard if an entry field is + focused. - * Fixed foreground handling in pinentry-qt if compiled - with Qt5 for Windows. + * Fixed foreground handling in pinentry-qt if compiled with Qt5 for + Windows. + + * Fixed potential crash in Qt qualitybar calculation. + + * GTK keyboard grabbing is now a bit more robust. The cursor is + changed to a big dot as a visual indication that a pinentry has + popped up and is waiting for input. + + * The GNOME pinentry now falls back to curses if it can't use the + GCR system prompter or a screenlock is active. * Fixed error output for cached passwords. - * Fixed potential crash in Qt qualitybar calculation. + * A show/hide passphrase button or checkbox is now available with + some pinentry flavors. - * GTK keyboard grabbing is now a bit more robust. + * Improved diagnostics and error codes. Noteworthy changes in version 0.9.7 (2015-12-07) diff --git a/README b/README index 33f0ab4..981d653 100644 --- a/README +++ b/README @@ -1,22 +1,23 @@ -PIN Entry +PINEntry --------- -This is a collection of simple PIN or passphrase entry dialogs which -utilize the Assuan protocol as described by the aegypten project; see -https://www.gnupg.org/aegypten/ for details. +This is a collection of PIN or passphrase entry dialogs which +utilize the Assuan protocol as specified in the Libassuan manual. There are programs for different toolkits available. For all GUIs it is automatically detected which modules can be built, but it can also be requested explicitly. GUI OPTION DEPENDENCIES -Curses --enable-pinentry-curses Curses library, for example ncurses +-------------------------------------------------------------------------- GTK+ V2.0 --enable-pinentry-gtk2 Gimp Toolkit Library, Version 2.0 eg. libgtk-x11-2.0 and libglib-2.0 +GNOME --enable-pinentry-gnome GNOME Qt --enable-pinentry-qt Qt (> 4.4.0) +Curses --enable-pinentry-curses Curses library, for example ncurses TTY --enable-pinentry-tty Simple TTY version, no dependencies -The GTK+ and Qt pinentries can fall back to curses mode. The +The GTK+, GNOME, and Qt pinentries can fall back to curses mode. The option to enable this is --enable-fallback-curses, but this is also detected automatically in the same way --enable-pinentry-curses is. The fallback to curses also works if --disable-pinentry-curses is diff --git a/configure.ac b/configure.ac index 2a96ccd..42c1589 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ # configure.ac # Copyright (C) 1999 Robert Bihlmeyer -# Copyright (C) 2001, 2002, 2003, 2004, 2007, 2015 g10 Code GmbH +# Copyright (C) 2001, 2002, 2003, 2004, 2007, 2015, 2016 g10 Code GmbH # # This file is part of PINENTRY. # @@ -26,7 +26,7 @@ min_automake_version="1.14" # (git tag -s pinentry-n.m.k) and run "./autogen.sh --force". Please # bump the version number immediately after the release, do another # commit, and a push so that the git magic is able to work. -m4_define(mym4_version, [0.9.8]) +m4_define(mym4_version, [1.0.0]) # Below is m4 magic to extract and compute the git revision number, # the decimalized short revision number, a beta version string and a diff --git a/pinentry/pinentry.c b/pinentry/pinentry.c index 46e6894..322a651 100644 --- a/pinentry/pinentry.c +++ b/pinentry/pinentry.c @@ -1,5 +1,5 @@ /* pinentry.c - The PIN entry support library - Copyright (C) 2002, 2003, 2007, 2008, 2010, 2015 g10 Code GmbH + Copyright (C) 2002, 2003, 2007, 2008, 2010, 2015, 2016 g10 Code GmbH This file is part of PINENTRY. @@ -592,7 +592,7 @@ my_strusage( int level ) case 11: p = this_pgmname; break; case 12: p = "pinentry"; break; case 13: p = PACKAGE_VERSION; break; - case 14: p = "Copyright (C) 2015 g10 Code GmbH"; break; + case 14: p = "Copyright (C) 2016 g10 Code GmbH"; break; case 19: p = "Please report bugs to <" PACKAGE_BUGREPORT ">.\n"; break; case 1: case 40: commit d126036671e7dd631babc118cb4113f723f15748 Author: Werner Koch Date: Tue Nov 22 08:59:41 2016 +0100 emacs: Add curses handler stub. * emacs/pinentry-emacs.c (curses_cmd_handler): New stub. Signed-off-by: Werner Koch diff --git a/emacs/pinentry-emacs.c b/emacs/pinentry-emacs.c index da96985..b6b3eb8 100644 --- a/emacs/pinentry-emacs.c +++ b/emacs/pinentry-emacs.c @@ -29,6 +29,11 @@ pinentry_cmd_handler_t pinentry_cmd_handler = emacs_cmd_handler; +/* needed to link cleanly; should never be used except for comparison + * in pinentry/pinentry.c's cmd_getinfo(): */ +pinentry_cmd_handler_t curses_cmd_handler = NULL; + + int main (int argc, char *argv[]) commit 626819f0422a2b71fc2aa6bb2daf73ccf5a243bb Author: Werner Koch Date: Tue Nov 22 08:44:16 2016 +0100 Update config.{sub,guess} . -- diff --git a/build-aux/config.guess b/build-aux/config.guess index 7adf147..c4bd827 100755 --- a/build-aux/config.guess +++ b/build-aux/config.guess @@ -1,8 +1,8 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright 1992-2015 Free Software Foundation, Inc. +# Copyright 1992-2016 Free Software Foundation, Inc. -timestamp='2015-01-01' +timestamp='2016-05-15' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -15,7 +15,7 @@ timestamp='2015-01-01' # General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, see . +# along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -27,7 +27,7 @@ timestamp='2015-01-01' # Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # # You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess # # Please send patches to . @@ -50,7 +50,7 @@ version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright 1992-2015 Free Software Foundation, Inc. +Copyright 1992-2016 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -168,19 +168,29 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" - UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ - /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + UNAME_MACHINE_ARCH=`(uname -p 2>/dev/null || \ + /sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || \ + echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; + earmv*) + arch=`echo ${UNAME_MACHINE_ARCH} | sed -e 's,^e\(armv[0-9]\).*$,\1,'` + endian=`echo ${UNAME_MACHINE_ARCH} | sed -ne 's,^.*\(eb\)$,\1,p'` + machine=${arch}${endian}-unknown + ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched - # to ELF recently, or will in the future. + # to ELF recently (or will in the future) and ABI. case "${UNAME_MACHINE_ARCH}" in + earm*) + os=netbsdelf + ;; arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ @@ -197,6 +207,13 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in os=netbsd ;; esac + # Determine ABI tags. + case "${UNAME_MACHINE_ARCH}" in + earm*) + expr='s/^earmv[0-9]/-eabi/;s/eb$//' + abi=`echo ${UNAME_MACHINE_ARCH} | sed -e "$expr"` + ;; + esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need @@ -207,13 +224,13 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in release='-gnu' ;; *) - release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + release=`echo ${UNAME_RELEASE} | sed -e 's/[-_].*//' | cut -d. -f1,2` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. - echo "${machine}-${os}${release}" + echo "${machine}-${os}${release}${abi}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'` @@ -223,6 +240,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} exit ;; + *:LibertyBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/^.*BSD\.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-libertybsd${UNAME_RELEASE} + exit ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} exit ;; @@ -235,6 +256,9 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in *:MirBSD:*:*) echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} exit ;; + *:Sortix:*:*) + echo ${UNAME_MACHINE}-unknown-sortix + exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) @@ -251,42 +275,42 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` case "$ALPHA_CPU_TYPE" in "EV4 (21064)") - UNAME_MACHINE="alpha" ;; + UNAME_MACHINE=alpha ;; "EV4.5 (21064)") - UNAME_MACHINE="alpha" ;; + UNAME_MACHINE=alpha ;; "LCA4 (21066/21068)") - UNAME_MACHINE="alpha" ;; + UNAME_MACHINE=alpha ;; "EV5 (21164)") - UNAME_MACHINE="alphaev5" ;; + UNAME_MACHINE=alphaev5 ;; "EV5.6 (21164A)") - UNAME_MACHINE="alphaev56" ;; + UNAME_MACHINE=alphaev56 ;; "EV5.6 (21164PC)") - UNAME_MACHINE="alphapca56" ;; + UNAME_MACHINE=alphapca56 ;; "EV5.7 (21164PC)") - UNAME_MACHINE="alphapca57" ;; + UNAME_MACHINE=alphapca57 ;; "EV6 (21264)") - UNAME_MACHINE="alphaev6" ;; + UNAME_MACHINE=alphaev6 ;; "EV6.7 (21264A)") - UNAME_MACHINE="alphaev67" ;; + UNAME_MACHINE=alphaev67 ;; "EV6.8CB (21264C)") - UNAME_MACHINE="alphaev68" ;; + UNAME_MACHINE=alphaev68 ;; "EV6.8AL (21264B)") - UNAME_MACHINE="alphaev68" ;; + UNAME_MACHINE=alphaev68 ;; "EV6.8CX (21264D)") - UNAME_MACHINE="alphaev68" ;; + UNAME_MACHINE=alphaev68 ;; "EV6.9A (21264/EV69A)") - UNAME_MACHINE="alphaev69" ;; + UNAME_MACHINE=alphaev69 ;; "EV7 (21364)") - UNAME_MACHINE="alphaev7" ;; + UNAME_MACHINE=alphaev7 ;; "EV7.9 (21364A)") - UNAME_MACHINE="alphaev79" ;; + UNAME_MACHINE=alphaev79 ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 @@ -359,16 +383,16 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build - SUN_ARCH="i386" + SUN_ARCH=i386 # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if [ "$CC_FOR_BUILD" != no_compiler_found ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then - SUN_ARCH="x86_64" + SUN_ARCH=x86_64 fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` @@ -393,7 +417,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` - test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + test "x${UNAME_RELEASE}" = x && UNAME_RELEASE=3 case "`/bin/arch`" in sun3) echo m68k-sun-sunos${UNAME_RELEASE} @@ -618,13 +642,13 @@ EOF sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in - 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 - 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 + 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in - 32) HP_ARCH="hppa2.0n" ;; - 64) HP_ARCH="hppa2.0w" ;; - '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + 32) HP_ARCH=hppa2.0n ;; + 64) HP_ARCH=hppa2.0w ;; + '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 esac ;; esac fi @@ -663,11 +687,11 @@ EOF exit (0); } EOF - (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + (CCOPTS="" $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac - if [ ${HP_ARCH} = "hppa2.0w" ] + if [ ${HP_ARCH} = hppa2.0w ] then eval $set_cc_for_build @@ -680,12 +704,12 @@ EOF # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 - if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | + if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then - HP_ARCH="hppa2.0w" + HP_ARCH=hppa2.0w else - HP_ARCH="hppa64" + HP_ARCH=hppa64 fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} @@ -790,14 +814,14 @@ EOF echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) - FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_PROC=`uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz` + FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + FUJITSU_SYS=`uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/'` echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) @@ -879,7 +903,7 @@ EOF exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland - echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]"``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix @@ -902,7 +926,7 @@ EOF EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 - if test "$?" = 0 ; then LIBC="gnulibc1" ; fi + if test "$?" = 0 ; then LIBC=gnulibc1 ; fi echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; arc:Linux:*:* | arceb:Linux:*:*) @@ -933,6 +957,9 @@ EOF crisv32:Linux:*:*) echo ${UNAME_MACHINE}-axis-linux-${LIBC} exit ;; + e2k:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; frv:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; @@ -945,6 +972,9 @@ EOF ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; + k1om:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + exit ;; m32r*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} exit ;; @@ -1021,7 +1051,7 @@ EOF echo ${UNAME_MACHINE}-dec-linux-${LIBC} exit ;; x86_64:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-${LIBC} + echo ${UNAME_MACHINE}-pc-linux-${LIBC} exit ;; xtensa*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-${LIBC} @@ -1100,7 +1130,7 @@ EOF # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub - # prints for the "djgpp" host, or else GDB configury will decide that + # prints for the "djgpp" host, or else GDB configure will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; @@ -1249,6 +1279,9 @@ EOF SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux${UNAME_RELEASE} exit ;; + SX-ACE:SUPER-UX:*:*) + echo sxace-nec-superux${UNAME_RELEASE} + exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; @@ -1262,9 +1295,9 @@ EOF UNAME_PROCESSOR=powerpc fi if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then - if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if [ "$CC_FOR_BUILD" != no_compiler_found ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ - (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then case $UNAME_PROCESSOR in @@ -1286,7 +1319,7 @@ EOF exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` - if test "$UNAME_PROCESSOR" = "x86"; then + if test "$UNAME_PROCESSOR" = x86; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi @@ -1317,7 +1350,7 @@ EOF # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. - if test "$cputype" = "386"; then + if test "$cputype" = 386; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" @@ -1359,7 +1392,7 @@ EOF echo i386-pc-xenix exit ;; i*86:skyos:*:*) - echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' + echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE} | sed -e 's/ .*$//'` exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos @@ -1370,23 +1403,25 @@ EOF x86_64:VMkernel:*:*) echo ${UNAME_MACHINE}-unknown-esx exit ;; + amd64:Isilon\ OneFS:*:*) + echo x86_64-unknown-onefs + exit ;; esac cat >&2 < in order to provide the needed -information to handle your system. +If $0 has already been updated, send the following data and any +information you think might be pertinent to config-patches at gnu.org to +provide the necessary information to handle your system. config.guess timestamp = $timestamp diff --git a/build-aux/config.sub b/build-aux/config.sub index 0b2d816..9feb73b 100755 --- a/build-aux/config.sub +++ b/build-aux/config.sub @@ -1,8 +1,8 @@ #! /bin/sh # Configuration validation subroutine script. -# Copyright 1992-2015 Free Software Foundation, Inc. +# Copyright 1992-2016 Free Software Foundation, Inc. -timestamp='2015-01-01' +timestamp='2016-06-20' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -15,7 +15,7 @@ timestamp='2015-01-01' # General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program; if not, see . +# along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a @@ -33,7 +33,7 @@ timestamp='2015-01-01' # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: -# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases @@ -53,8 +53,7 @@ timestamp='2015-01-01' me=`echo "$0" | sed -e 's,.*/,,'` usage="\ -Usage: $0 [OPTION] CPU-MFR-OPSYS - $0 [OPTION] ALIAS +Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS Canonicalize a configuration name. @@ -68,7 +67,7 @@ Report bugs and patches to ." version="\ GNU config.sub ($timestamp) -Copyright 1992-2015 Free Software Foundation, Inc. +Copyright 1992-2016 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." @@ -117,7 +116,7 @@ maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ - knetbsd*-gnu* | netbsd*-gnu* | \ + knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os @@ -255,11 +254,12 @@ case $basic_machine in | arc | arceb \ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ | avr | avr32 \ + | ba \ | be32 | be64 \ | bfin \ | c4x | c8051 | clipper \ | d10v | d30v | dlx | dsp16xx \ - | epiphany \ + | e2k | epiphany \ | fido | fr30 | frv | ft32 \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ @@ -305,7 +305,7 @@ case $basic_machine in | riscv32 | riscv64 \ | rl78 | rx \ | score \ - | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ + | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[234]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ @@ -376,12 +376,13 @@ case $basic_machine in | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ + | ba-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | c8051-* | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ - | elxsi-* \ + | e2k-* | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ @@ -428,12 +429,13 @@ case $basic_machine in | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pyramid-* \ + | riscv32-* | riscv64-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ - | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ @@ -518,6 +520,9 @@ case $basic_machine in basic_machine=i386-pc os=-aros ;; + asmjs) + basic_machine=asmjs-unknown + ;; aux) basic_machine=m68k-apple os=-aux @@ -638,6 +643,14 @@ case $basic_machine in basic_machine=m68k-bull os=-sysv3 ;; + e500v[12]) + basic_machine=powerpc-unknown + os=$os"spe" + ;; + e500v[12]-*) + basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + os=$os"spe" + ;; ebmon29k) basic_machine=a29k-amd os=-ebmon @@ -1373,18 +1386,18 @@ case $os in | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ - | -aos* | -aros* \ + | -aos* | -aros* | -cloudabi* | -sortix* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ - | -bitrig* | -openbsd* | -solidbsd* \ + | -bitrig* | -openbsd* | -solidbsd* | -libertybsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ - | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ + | -midipix* | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ @@ -1393,7 +1406,8 @@ case $os in | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ - | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*) + | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* \ + | -onefs* | -tirtos* | -phoenix*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) @@ -1525,6 +1539,8 @@ case $os in ;; -nacl*) ;; + -ios) + ;; -none) ;; *) ----------------------------------------------------------------------- Summary of changes: AUTHORS | 17 +++++- Makefile.am | 17 +++++- NEWS | 32 +++++++--- README | 13 ++-- build-aux/config.guess | 161 ++++++++++++++++++++++++++++++------------------- build-aux/config.sub | 48 ++++++++++----- configure.ac | 4 +- emacs/pinentry-emacs.c | 5 ++ pinentry/pinentry.c | 4 +- 9 files changed, 200 insertions(+), 101 deletions(-) hooks/post-receive -- The standard pinentry collection http://git.gnupg.org From cvs at cvs.gnupg.org Tue Nov 22 10:19:40 2016 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Tue, 22 Nov 2016 10:19:40 +0100 Subject: [git] gnupg-doc - branch, master, updated. 18c75d8cf0cfba3d78a852d2ae5ed39b335a1a92 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GnuPG website and other docs". The branch, master has been updated via 18c75d8cf0cfba3d78a852d2ae5ed39b335a1a92 (commit) from fbc5f3f0b8783d2ec62695db0ac5208641ba07ee (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 18c75d8cf0cfba3d78a852d2ae5ed39b335a1a92 Author: Werner Koch Date: Tue Nov 22 09:10:58 2016 +0100 swdb: Release Pinentry 1.0.0 diff --git a/web/swdb.mac b/web/swdb.mac index b7783e4..87f4233 100644 --- a/web/swdb.mac +++ b/web/swdb.mac @@ -62,10 +62,11 @@ # # PINENTRY # -#+macro: pinentry_ver 0.9.7 -#+macro: pinentry_date 2015-12-07 -#+macro: pinentry_size 423k -#+macro: pinentry_sha1 9bdcf5f4096aa8b26956afb0ecdd3d7849ffa0cd +#+macro: pinentry_ver 1.0.0 +#+macro: pinentry_date 2016-11-22 +#+macro: pinentry_size 427k +#+macro: pinentry_sha1 85d9ac81ebad3fb082514c505c90c39a0456f1f6 +#+macro: pinentry_sha2 1672c2edc1feb036075b187c0773787b2afd0544f55025c645a71b4c2f79275a # ----------------------------------------------------------------------- Summary of changes: web/swdb.mac | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) hooks/post-receive -- The GnuPG website and other docs http://git.gnupg.org From cvs at cvs.gnupg.org Tue Nov 22 10:55:22 2016 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Tue, 22 Nov 2016 10:55:22 +0100 Subject: [git] gnupg-doc - branch, master, updated. b12106372e5adadda18a1c9894444772c08839b1 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GnuPG website and other docs". The branch, master has been updated via b12106372e5adadda18a1c9894444772c08839b1 (commit) from 18c75d8cf0cfba3d78a852d2ae5ed39b335a1a92 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit b12106372e5adadda18a1c9894444772c08839b1 Author: Werner Koch Date: Tue Nov 22 10:46:21 2016 +0100 web: Announce pinentry 1.0.0 diff --git a/web/index.org b/web/index.org index 2d548c6..b71f915 100644 --- a/web/index.org +++ b/web/index.org @@ -65,6 +65,13 @@ The latest release news:\\ # GnuPG's latest news are available as [[http://feedvalidator.org/check.cgi?url%3Dhttps://www.gnupg.org/news.en.rss][RSS 2.0 compliant]] feed. Just # point or paste the [[news.en.rss][RSS file]] into your aggregator. +** Pinentry 1.0.0 released (2016-11-22) + +After 14 years is was time to bump up the version of [[file:related_software/pinentry/index.org][Pinentry]] to 1.0. +This new release fixes a couple of minor bugs and introduces features +to better diagnose problems. See the [[../../download/index.org::pinentry][download]] section on how to get +Pinentry. + ** GPA 0.9.10 released (2016-11-19) A maintenance release of the [[file:related_software/gpa/index.org][GNU Privacy Assistant]] is now available. ----------------------------------------------------------------------- Summary of changes: web/index.org | 7 +++++++ 1 file changed, 7 insertions(+) hooks/post-receive -- The GnuPG website and other docs http://git.gnupg.org From cvs at cvs.gnupg.org Tue Nov 22 11:27:07 2016 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Tue, 22 Nov 2016 11:27:07 +0100 Subject: [git] gnupg-doc - branch, master, updated. 1c99eac456264ffc8979578a7e907ec238af59fc Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GnuPG website and other docs". The branch, master has been updated via 1c99eac456264ffc8979578a7e907ec238af59fc (commit) from b12106372e5adadda18a1c9894444772c08839b1 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 1c99eac456264ffc8979578a7e907ec238af59fc Author: Werner Koch Date: Tue Nov 22 11:24:36 2016 +0100 swdb: release nPth 1.3 diff --git a/web/swdb.mac b/web/swdb.mac index 87f4233..0b74259 100644 --- a/web/swdb.mac +++ b/web/swdb.mac @@ -131,9 +131,11 @@ # # nPth # -#+macro: npth_ver 1.2 -#+macro: npth_date 2015-04-11 -#+macro: npth_sha1 3bfa2a2d7521d6481850e8a611efe5bf5ed75200 +#+macro: npth_ver 1.3 +#+macro: npth_date 2016-11-22 +#+macro: npth_size 289k +#+macro: npth_sha1 1b21507cfa3f58bdd19ef2f6800ab4cb67729972 +#+macro: npth_sha2 bca81940436aed0734eb8d0ff8b179e04cc8c087f5625204419f5f45d736a82a # ----------------------------------------------------------------------- Summary of changes: web/swdb.mac | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) hooks/post-receive -- The GnuPG website and other docs http://git.gnupg.org From cvs at cvs.gnupg.org Tue Nov 22 12:11:02 2016 From: cvs at cvs.gnupg.org (by Justus Winter) Date: Tue, 22 Nov 2016 12:11:02 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.1.16-15-ga3b258d Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via a3b258d1d15953816e0567511ecc527a4ccdd626 (commit) via d8df80427238cdbb9ae0f6dae8bc7e9c24f6e265 (commit) via 7b4e2ea274ace22245264f1759279390d0300a62 (commit) via 66834eb838a8892d088f6b7332084a64d9f15008 (commit) via 893a3f7fb46021961914a8acdf1292a80e3eba93 (commit) via 6ce14a805f1da687dfb8535db57730d5c7403db7 (commit) from 037f9de09298a31026ea2ab5fbd4a599b11cc34f (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit a3b258d1d15953816e0567511ecc527a4ccdd626 Author: Justus Winter Date: Fri Nov 18 12:51:00 2016 +0100 gpgscm: Refactor. * tests/gpgscm/scheme.c (opexe_0): Reduce code duplication. Signed-off-by: Justus Winter diff --git a/tests/gpgscm/scheme.c b/tests/gpgscm/scheme.c index 4a83cd5..e011dea 100644 --- a/tests/gpgscm/scheme.c +++ b/tests/gpgscm/scheme.c @@ -2963,16 +2963,16 @@ static pointer opexe_0(scheme *sc, enum scheme_opcodes op) { } } - CASE(OP_LAMBDA1): - gc_disable(sc, 1); - s_return_enable_gc(sc, mk_closure(sc, sc->value, sc->envir)); - #else CASE(OP_LAMBDA): /* lambda */ + sc->value = sc->code; + /* Fallthrough. */ +#endif + + CASE(OP_LAMBDA1): gc_disable(sc, 1); - s_return_enable_gc(sc, mk_closure(sc, sc->code, sc->envir)); + s_return_enable_gc(sc, mk_closure(sc, sc->value, sc->envir)); -#endif CASE(OP_MKCLOSURE): /* make-closure */ x=car(sc->args); commit d8df80427238cdbb9ae0f6dae8bc7e9c24f6e265 Author: Justus Winter Date: Thu Nov 17 18:03:22 2016 +0100 gpgscm: Fix property lists. * tests/gpgscm/opdefines.h (put, get): Check arguments. Also rename to 'set-symbol-property' and 'symbol-property', the names used by Guile, because put and get are too unspecific. * tests/gpgscm/scheme.c (hasprop): Only symbols have property lists. (get_property): New function. (set_property): Likewise. (opexe_4): Use the new functions. Signed-off-by: Justus Winter diff --git a/tests/gpgscm/opdefines.h b/tests/gpgscm/opdefines.h index ceb4d0e..c7347fd 100644 --- a/tests/gpgscm/opdefines.h +++ b/tests/gpgscm/opdefines.h @@ -146,8 +146,8 @@ _OP_DEF(opexe_4, "list*", 1, INF_ARG, TST_NONE, OP_LIST_STAR ) _OP_DEF(opexe_4, "append", 0, INF_ARG, TST_NONE, OP_APPEND ) #if USE_PLIST - _OP_DEF(opexe_4, "put", 3, 3, TST_NONE, OP_PUT ) - _OP_DEF(opexe_4, "get", 2, 2, TST_NONE, OP_GET ) + _OP_DEF(opexe_4, "set-symbol-property!", 3, 3, TST_SYMBOL TST_SYMBOL TST_ANY, OP_SET_SYMBOL_PROPERTY ) + _OP_DEF(opexe_4, "symbol-property", 2, 2, TST_SYMBOL TST_SYMBOL, OP_SYMBOL_PROPERTY ) #endif _OP_DEF(opexe_4, "quit", 0, 1, TST_NUMBER, OP_QUIT ) _OP_DEF(opexe_4, "gc", 0, 0, 0, OP_GC ) diff --git a/tests/gpgscm/scheme.c b/tests/gpgscm/scheme.c index a7d3fd7..4a83cd5 100644 --- a/tests/gpgscm/scheme.c +++ b/tests/gpgscm/scheme.c @@ -250,7 +250,7 @@ INTERFACE pointer set_cdr(pointer p, pointer q) { return cdr(p)=q; } INTERFACE INLINE int is_symbol(pointer p) { return (type(p)==T_SYMBOL); } INTERFACE INLINE char *symname(pointer p) { return strvalue(car(p)); } #if USE_PLIST -SCHEME_EXPORT INLINE int hasprop(pointer p) { return (typeflag(p)&T_SYMBOL); } +SCHEME_EXPORT INLINE int hasprop(pointer p) { return (is_symbol(p)); } #define symprop(p) cdr(p) #endif @@ -3380,6 +3380,52 @@ static pointer opexe_1(scheme *sc, enum scheme_opcodes op) { return sc->T; } +#if USE_PLIST +static pointer +get_property(scheme *sc, pointer obj, pointer key) +{ + pointer x; + + assert (is_symbol(obj)); + assert (is_symbol(key)); + + for (x = symprop(obj); x != sc->NIL; x = cdr(x)) { + if (caar(x) == key) + break; + } + + if (x != sc->NIL) + return cdar(x); + + return sc->NIL; +} + +static pointer +set_property(scheme *sc, pointer obj, pointer key, pointer value) +{ +#define set_property_allocates 2 + pointer x; + + assert (is_symbol(obj)); + assert (is_symbol(key)); + + for (x = symprop(obj); x != sc->NIL; x = cdr(x)) { + if (caar(x) == key) + break; + } + + if (x != sc->NIL) + cdar(x) = value; + else { + gc_disable(sc, gc_reservations(set_property)); + symprop(obj) = cons(sc, cons(sc, key, value), symprop(obj)); + gc_enable(sc); + } + + return sc->T; +} +#endif + static pointer opexe_2(scheme *sc, enum scheme_opcodes op) { pointer x; num v; @@ -4127,36 +4173,14 @@ static pointer opexe_4(scheme *sc, enum scheme_opcodes op) { s_return(sc, reverse_in_place(sc, car(y), x)); #if USE_PLIST - CASE(OP_PUT): /* put */ - if (!hasprop(car(sc->args)) || !hasprop(cadr(sc->args))) { - Error_0(sc,"illegal use of put"); - } - for (x = symprop(car(sc->args)), y = cadr(sc->args); x != sc->NIL; x = cdr(x)) { - if (caar(x) == y) { - break; - } - } - if (x != sc->NIL) - cdar(x) = caddr(sc->args); - else - symprop(car(sc->args)) = cons(sc, cons(sc, y, caddr(sc->args)), - symprop(car(sc->args))); - s_return(sc,sc->T); + CASE(OP_SET_SYMBOL_PROPERTY): /* set-symbol-property! */ + gc_disable(sc, gc_reservations(set_property)); + s_return_enable_gc(sc, + set_property(sc, car(sc->args), + cadr(sc->args), caddr(sc->args))); - CASE(OP_GET): /* get */ - if (!hasprop(car(sc->args)) || !hasprop(cadr(sc->args))) { - Error_0(sc,"illegal use of get"); - } - for (x = symprop(car(sc->args)), y = cadr(sc->args); x != sc->NIL; x = cdr(x)) { - if (caar(x) == y) { - break; - } - } - if (x != sc->NIL) { - s_return(sc,cdar(x)); - } else { - s_return(sc,sc->NIL); - } + CASE(OP_SYMBOL_PROPERTY): /* symbol-property */ + s_return(sc, get_property(sc, car(sc->args), cadr(sc->args))); #endif /* USE_PLIST */ CASE(OP_QUIT): /* quit */ if(is_pair(sc->args)) { commit 7b4e2ea274ace22245264f1759279390d0300a62 Author: Justus Winter Date: Thu Nov 17 15:47:26 2016 +0100 gpgscm: Fix installation of error handler. * tests/gpgscm/ffi.scm: Set '*error-hook*' again so that the interpreter will use our function. Signed-off-by: Justus Winter diff --git a/tests/gpgscm/ffi.scm b/tests/gpgscm/ffi.scm index fb18538..c5f373c 100644 --- a/tests/gpgscm/ffi.scm +++ b/tests/gpgscm/ffi.scm @@ -61,6 +61,7 @@ (_exit (cadr x))) (else (apply error x)))) +(set! *error-hook* throw) ;; Terminate the process returning STATUS to the parent. (define (exit status) commit 66834eb838a8892d088f6b7332084a64d9f15008 Author: Justus Winter Date: Wed Nov 16 11:29:34 2016 +0100 gpgscm: Use a static pool of cells for small integers. * tests/gpgscm/scheme-private.h (struct scheme): New fields for the static integer cells. * tests/gpgscm/scheme.c (_alloc_cellseg): New function. (alloc_cellseg): Use the new function. (MAX_SMALL_INTEGER): New macro. (initialize_small_integers): New function. (mk_small_integer): Likewise. (mk_integer): Return a small integer if possible. (_s_return): Do not free 'op' if it is a small integer. (s_save): Use a small integer to box the opcode. (scheme_init_custom_alloc): Initialize small integers. (scheme_deinit): Free chunk of small integers. * tests/gpgscm/scheme.h (USE_SMALL_INTEGERS): New macro. Signed-off-by: Justus Winter diff --git a/tests/gpgscm/scheme-private.h b/tests/gpgscm/scheme-private.h index aa78894..2c5c749 100644 --- a/tests/gpgscm/scheme-private.h +++ b/tests/gpgscm/scheme-private.h @@ -119,6 +119,12 @@ pointer SHARP_HOOK; /* *sharp-hook* */ pointer COMPILE_HOOK; /* *compile-hook* */ #endif +#if USE_SMALL_INTEGERS +/* A fixed allocation of small integers. */ +void *integer_alloc; +pointer integer_cells; +#endif + pointer free_cell; /* pointer to top of free cells */ long fcells; /* # of free cells */ size_t inhibit_gc; /* nesting of gc_disable */ diff --git a/tests/gpgscm/scheme.c b/tests/gpgscm/scheme.c index ee8992e..a7d3fd7 100644 --- a/tests/gpgscm/scheme.c +++ b/tests/gpgscm/scheme.c @@ -598,34 +598,47 @@ static long binary_decode(const char *s) { return x; } +/* Allocate a new cell segment but do not make it available yet. */ +static int +_alloc_cellseg(scheme *sc, size_t len, void **alloc, pointer *cells) +{ + int adj = ADJ; + void *cp; + + if (adj < sizeof(struct cell)) + adj = sizeof(struct cell); + + cp = sc->malloc(len * sizeof(struct cell) + adj); + if (cp == NULL) + return 1; + + *alloc = cp; + + /* adjust in TYPE_BITS-bit boundary */ + if (((unsigned long) cp) % adj != 0) + cp = (void *) (adj * ((unsigned long) cp / adj + 1)); + + *cells = cp; + return 0; +} + /* allocate new cell segment */ static int alloc_cellseg(scheme *sc, int n) { pointer newp; pointer last; pointer p; - void *cp; long i; int k; - int adj=ADJ; - - if(adjlast_cell_seg >= CELL_NSEGMENT - 1) return k; - cp = sc->malloc(CELL_SEGSIZE * sizeof(struct cell)+adj); - if (cp == 0) - return k; - i = ++sc->last_cell_seg ; - sc->alloc_seg[i] = cp; - /* adjust in TYPE_BITS-bit boundary */ - if(((unsigned long)cp)%adj!=0) { - cp=(void *)(adj*((unsigned long)cp/adj+1)); - } + i = ++sc->last_cell_seg; + if (_alloc_cellseg(sc, CELL_SEGSIZE, &sc->alloc_seg[i], &newp)) { + sc->last_cell_seg--; + return k; + } /* insert new segment in address order */ - newp=(pointer)cp; sc->cell_seg[i] = newp; while (i > 0 && sc->cell_seg[i - 1] > sc->cell_seg[i]) { p = sc->cell_seg[i]; @@ -1128,16 +1141,64 @@ INTERFACE pointer mk_character(scheme *sc, int c) { return (x); } + + +#if USE_SMALL_INTEGERS + +/* s_save assumes that all opcodes can be expressed as a small + * integer. */ +#define MAX_SMALL_INTEGER OP_MAXDEFINED + +static int +initialize_small_integers(scheme *sc) +{ + int i; + if (_alloc_cellseg(sc, MAX_SMALL_INTEGER, &sc->integer_alloc, + &sc->integer_cells)) + return 1; + + for (i = 0; i < MAX_SMALL_INTEGER; i++) { + pointer x = &sc->integer_cells[i]; + typeflag(x) = T_NUMBER | T_ATOM | MARK; + ivalue_unchecked(x) = i; + set_num_integer(x); + } + + return 0; +} + +static INLINE pointer +mk_small_integer(scheme *sc, long n) +{ +#define mk_small_integer_allocates 0 + assert(0 <= n && n < MAX_SMALL_INTEGER); + return &sc->integer_cells[n]; +} +#else + +#define mk_small_integer_allocates 1 +#define mk_small_integer mk_integer + +#endif + /* get number atom (integer) */ INTERFACE pointer mk_integer(scheme *sc, long n) { - pointer x = get_cell(sc,sc->NIL, sc->NIL); + pointer x; + +#if USE_SMALL_INTEGERS + if (0 <= n && n < MAX_SMALL_INTEGER) + return mk_small_integer(sc, n); +#endif + x = get_cell(sc,sc->NIL, sc->NIL); typeflag(x) = (T_NUMBER | T_ATOM); ivalue_unchecked(x)= n; set_num_integer(x); return (x); } + + INTERFACE pointer mk_real(scheme *sc, double n) { pointer x = get_cell(sc,sc->NIL, sc->NIL); @@ -2645,7 +2706,9 @@ static pointer _s_return(scheme *sc, pointer a, int enable_gc) { return sc->NIL; free_cons(sc, dump, &op, &dump); sc->op = ivalue(op); +#ifndef USE_SMALL_INTEGERS free_cell(sc, op); +#endif free_cons(sc, dump, &sc->args, &dump); free_cons(sc, dump, &sc->envir, &dump); free_cons(sc, dump, &sc->code, &sc->dump); @@ -2653,12 +2716,12 @@ static pointer _s_return(scheme *sc, pointer a, int enable_gc) { } static void s_save(scheme *sc, enum scheme_opcodes op, pointer args, pointer code) { -#define s_save_allocates 5 +#define s_save_allocates (4 + mk_small_integer_allocates) pointer dump; gc_disable(sc, gc_reservations (s_save)); dump = cons(sc, sc->envir, cons(sc, (code), sc->dump)); dump = cons(sc, (args), dump); - sc->dump = cons(sc, mk_integer(sc, (long)(op)), dump); + sc->dump = cons(sc, mk_small_integer(sc, (long)(op)), dump); gc_enable(sc); } @@ -4907,6 +4970,14 @@ int scheme_init_custom_alloc(scheme *sc, func_alloc malloc, func_dealloc free) { sc->T = &sc->_HASHT; sc->F = &sc->_HASHF; sc->EOF_OBJ=&sc->_EOF_OBJ; + +#if USE_SMALL_INTEGERS + if (initialize_small_integers(sc)) { + sc->no_memory=1; + return 0; + } +#endif + sc->free_cell = &sc->_NIL; sc->fcells = 0; sc->inhibit_gc = GC_ENABLED; @@ -5052,6 +5123,10 @@ void scheme_deinit(scheme *sc) { sc->gc_verbose=0; gc(sc,sc->NIL,sc->NIL); +#if USE_SMALL_INTEGERS + sc->free(sc->integer_alloc); +#endif + for(i=0; i<=sc->last_cell_seg; i++) { sc->free(sc->alloc_seg[i]); } diff --git a/tests/gpgscm/scheme.h b/tests/gpgscm/scheme.h index 8e93177..2b5b066 100644 --- a/tests/gpgscm/scheme.h +++ b/tests/gpgscm/scheme.h @@ -43,6 +43,7 @@ extern "C" { # define USE_COMPILE_HOOK 0 # define USE_DL 0 # define USE_PLIST 0 +# define USE_SMALL_INTEGERS 0 #endif @@ -95,6 +96,13 @@ extern "C" { # define USE_THREADED_CODE 1 #endif +/* Use a static set of cells to represent small numbers. This set + * notably includes all opcodes, and hence saves a cell reservation + * during 's_save'. */ +#ifndef USE_SMALL_INTEGERS +# define USE_SMALL_INTEGERS 1 +#endif + #ifndef USE_STRCASECMP /* stricmp for Unix */ # define USE_STRCASECMP 0 #endif commit 893a3f7fb46021961914a8acdf1292a80e3eba93 Author: Justus Winter Date: Thu Nov 17 11:48:38 2016 +0100 tests: Delay querying the avaliable algorithms. * tests/openpgp/defs.scm: Set verbosity earlier, turn 'all-*-algos' into promises. * tests/openpgp/conventional-mdc.scm: Force the promises. * tests/openpgp/conventional.scm: Likewise. * tests/openpgp/encrypt-dsa.scm: Likewise. * tests/openpgp/encrypt.scm: Likewise. * tests/openpgp/gpgtar.scm: Likewise. * tests/openpgp/sigs.scm: Likewise. Signed-off-by: Justus Winter diff --git a/tests/openpgp/conventional-mdc.scm b/tests/openpgp/conventional-mdc.scm index fb92217..5b009ae 100755 --- a/tests/openpgp/conventional-mdc.scm +++ b/tests/openpgp/conventional-mdc.scm @@ -37,7 +37,7 @@ (tr:gpg passphrase `(--yes --passphrase-fd "0" ,s2k)) (tr:assert-identity source))) '("plain-1" "data-80000"))) - all-cipher-algos) + (force all-cipher-algos)) (for-each-p "Checking sign+symencrypt" diff --git a/tests/openpgp/conventional.scm b/tests/openpgp/conventional.scm index af889dc..612b992 100755 --- a/tests/openpgp/conventional.scm +++ b/tests/openpgp/conventional.scm @@ -46,4 +46,4 @@ (tr:gpg passphrase `(--yes --passphrase-fd "0" ,s2k)) (tr:assert-identity source))) '("plain-1" "data-80000"))) - all-cipher-algos) + (force all-cipher-algos)) diff --git a/tests/openpgp/defs.scm b/tests/openpgp/defs.scm index e91902c..bdb86ca 100644 --- a/tests/openpgp/defs.scm +++ b/tests/openpgp/defs.scm @@ -42,6 +42,10 @@ (define data-files '("data-500" "data-9000" "data-32000" "data-80000")) (define exp-files '()) +(let ((verbose (string->number (getenv "verbose")))) + (if (number? verbose) + (*set-verbose!* verbose))) + (define (qualify executable) (string-append executable (getenv "EXEEXT"))) @@ -95,16 +99,16 @@ (define (get-config what) (string-split (caddar (gpg-with-colons `(--list-config ,what))) #\;)) -(define all-pubkey-algos (get-config "pubkeyname")) -(define all-hash-algos (get-config "digestname")) -(define all-cipher-algos (get-config "ciphername")) +(define all-pubkey-algos (delay (get-config "pubkeyname"))) +(define all-hash-algos (delay (get-config "digestname"))) +(define all-cipher-algos (delay (get-config "ciphername"))) (define (have-pubkey-algo? x) - (not (not (member x all-pubkey-algos)))) + (not (not (member x (force all-pubkey-algos))))) (define (have-hash-algo? x) - (not (not (member x all-hash-algos)))) + (not (not (member x (force all-hash-algos))))) (define (have-cipher-algo? x) - (not (not (member x all-cipher-algos)))) + (not (not (member x (force all-cipher-algos))))) (define (gpg-pipe args0 args1 errfd) (lambda (source sink) @@ -142,10 +146,6 @@ (pipe:spawn `(, at GPG --dearmor)) (pipe:write-to sink-name (logior O_WRONLY O_CREAT O_BINARY) #o600))) -(let ((verbose (string->number (getenv "verbose")))) - (if (number? verbose) - (*set-verbose!* verbose))) - ;; ;; Support for test environment creation and teardown. ;; diff --git a/tests/openpgp/encrypt-dsa.scm b/tests/openpgp/encrypt-dsa.scm index fccb8c9..7ac1916 100755 --- a/tests/openpgp/encrypt-dsa.scm +++ b/tests/openpgp/encrypt-dsa.scm @@ -43,4 +43,4 @@ (tr:gpg "" '(--yes)) (tr:assert-identity source))) (append plain-files data-files))) - all-cipher-algos) + (force all-cipher-algos)) diff --git a/tests/openpgp/encrypt.scm b/tests/openpgp/encrypt.scm index ea97b4d..4247aa8 100755 --- a/tests/openpgp/encrypt.scm +++ b/tests/openpgp/encrypt.scm @@ -43,7 +43,7 @@ (tr:gpg "" '(--yes)) (tr:assert-identity source))) (append plain-files data-files))) - all-cipher-algos) + (force all-cipher-algos)) ;; We encrypt to two keys and we have also put the first key into our diff --git a/tests/openpgp/gpgtar.scm b/tests/openpgp/gpgtar.scm index 69206b4..cd692de 100755 --- a/tests/openpgp/gpgtar.scm +++ b/tests/openpgp/gpgtar.scm @@ -84,7 +84,8 @@ (info "Checking gpgtar with symmetric encryption and chosen cipher") (do-test `(, at ppflags --symmetric --gpg-args - ,(string-append "--cipher=" (car all-cipher-algos))) + ,(string-append "--cipher=" + (car (force all-cipher-algos)))) ppflags (cons '--decrypt ppflags)) (info "Checking gpgtar with both symmetric and asymmetric encryption") diff --git a/tests/openpgp/sigs.scm b/tests/openpgp/sigs.scm index abdcd8f..5a1efa7 100755 --- a/tests/openpgp/sigs.scm +++ b/tests/openpgp/sigs.scm @@ -48,4 +48,4 @@ `(--yes --sign --passphrase-fd "0" --digest-algo ,hash)) (tr:gpg "" '(--yes)) (tr:assert-identity (car plain-files))))) - all-hash-algos) + (force all-hash-algos)) commit 6ce14a805f1da687dfb8535db57730d5c7403db7 Author: Justus Winter Date: Tue Nov 22 12:07:55 2016 +0100 g10: Fix memory leak. * g10/tofu.c (tofu_notice_key_changed): Remove spurious duplicate call to 'hexfingerprint'. Fixes-commit: 037f9de09298a31026ea2ab5fbd4a599b11cc34f Signed-off-by: Justus Winter diff --git a/g10/tofu.c b/g10/tofu.c index 9693893..6eb7f5e 100644 --- a/g10/tofu.c +++ b/g10/tofu.c @@ -3712,8 +3712,6 @@ tofu_notice_key_changed (ctrl_t ctrl, kbnode_t kb) pk = kb->pkt->pkt.public_key; log_assert (pk_is_primary (pk)); - fingerprint = hexfingerprint (pk, NULL, 0); - dbs = opendbs (ctrl); if (! dbs) { ----------------------------------------------------------------------- Summary of changes: g10/tofu.c | 2 - tests/gpgscm/ffi.scm | 1 + tests/gpgscm/opdefines.h | 4 +- tests/gpgscm/scheme-private.h | 6 ++ tests/gpgscm/scheme.c | 209 +++++++++++++++++++++++++++---------- tests/gpgscm/scheme.h | 8 ++ tests/openpgp/conventional-mdc.scm | 2 +- tests/openpgp/conventional.scm | 2 +- tests/openpgp/defs.scm | 20 ++-- tests/openpgp/encrypt-dsa.scm | 2 +- tests/openpgp/encrypt.scm | 2 +- tests/openpgp/gpgtar.scm | 3 +- tests/openpgp/sigs.scm | 2 +- 13 files changed, 188 insertions(+), 75 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Tue Nov 22 12:59:09 2016 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Tue, 22 Nov 2016 12:59:09 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.1.16-16-g5c2db9d Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via 5c2db9dedfe9dbb14ffec24751ca23a69cead94e (commit) from a3b258d1d15953816e0567511ecc527a4ccdd626 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 5c2db9dedfe9dbb14ffec24751ca23a69cead94e Author: NIIBE Yutaka Date: Tue Nov 22 20:53:57 2016 +0900 scd: Fix receive buffer size. * scd/apdu.c (send_le): Fix the size, adding two for status bytes to Le. -- This is long standing bug. So far, Le was not exact value. Since forthcoming change will introduce exact value of expected length of response data, this change is needed. Signed-off-by: NIIBE Yutaka diff --git a/scd/apdu.c b/scd/apdu.c index 54f3b30..b32fe80 100644 --- a/scd/apdu.c +++ b/scd/apdu.c @@ -3757,8 +3757,9 @@ send_le (int slot, int class, int ins, int p0, int p1, if (use_extended_length && (le > 256 || le < 0)) { - result_buffer_size = le < 0? 4096 : le; - result_buffer = xtrymalloc (result_buffer_size + 10); + /* Two more bytes are needed for status bytes. */ + result_buffer_size = le < 0? 4096 : (le + 2); + result_buffer = xtrymalloc (result_buffer_size); if (!result_buffer) { xfree (apdu_buffer); ----------------------------------------------------------------------- Summary of changes: scd/apdu.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Tue Nov 22 15:26:42 2016 From: cvs at cvs.gnupg.org (by Neal H. Walfield) Date: Tue, 22 Nov 2016 15:26:42 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.1.16-17-g44c17bc Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via 44c17bcb003a3330f595a6ab144e8439b7b630cb (commit) from 5c2db9dedfe9dbb14ffec24751ca23a69cead94e (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 44c17bcb003a3330f595a6ab144e8439b7b630cb Author: Neal H. Walfield Date: Tue Nov 22 15:05:59 2016 +0100 g10: If the set of UTKs changes, invalidate any changed policies. * g10/trustdb.c (tdb_utks): New function. * g10/tofu.c (check_utks): New function. (initdb): Call it. * tests/openpgp/tofu.scm: Modify test to check the effective policy of keys whose effective policy changes when we change the set of UTKs. -- Signed-off-by: Neal H. Walfield If the set of ultimately trusted keys changes, then it is possible that a binding's effective policy changes. To deal with this, we detect when the set of ultimately trusted keys changes and invalidate all cached policies. diff --git a/g10/tofu.c b/g10/tofu.c index 6eb7f5e..d7730a3 100644 --- a/g10/tofu.c +++ b/g10/tofu.c @@ -506,6 +506,152 @@ version_check_cb (void *cookie, int argc, char **argv, char **azColName) return 1; } +static int +check_utks (sqlite3 *db) +{ + int rc; + char *err = NULL; + struct key_item *utks; + struct key_item *ki; + int utk_count; + char *utks_string = NULL; + char keyid_str[16+1]; + long utks_unchanged = 0; + + /* An early version of the v1 format did not include the list of + * known ultimately trusted keys. + * + * This list is used to detect when the set of ultimately trusted + * keys changes. We need to detect this to invalidate the effective + * policy, which can change if an ultimately trusted key is added or + * removed. */ + rc = sqlite3_exec (db, + "create table if not exists ultimately_trusted_keys" + " (keyid);\n", + NULL, NULL, &err); + if (rc) + { + log_error (_("error creating 'ultimately_trusted_keys' TOFU table: %s\n"), + err); + sqlite3_free (err); + goto out; + } + + + utks = tdb_utks (); + for (ki = utks, utk_count = 0; ki; ki = ki->next, utk_count ++) + ; + + if (utk_count) + { + /* Build a list of keyids of the form "XXX","YYY","ZZZ". */ + int len = (1 + 16 + 1 + 1) * utk_count; + int o = 0; + + utks_string = xmalloc (len); + *utks_string = 0; + for (ki = utks, utk_count = 0; ki; ki = ki->next, utk_count ++) + { + utks_string[o ++] = '\''; + format_keyid (ki->kid, KF_LONG, + keyid_str, sizeof (keyid_str)); + memcpy (&utks_string[o], keyid_str, 16); + o += 16; + utks_string[o ++] = '\''; + utks_string[o ++] = ','; + } + utks_string[o - 1] = 0; + log_assert (o == len); + } + + rc = gpgsql_exec_printf + (db, get_single_unsigned_long_cb, &utks_unchanged, &err, + "select" + /* Removed UTKs? (Known UTKs in current UTKs.) */ + " ((select count(*) from ultimately_trusted_keys" + " where (keyid in (%s))) == %d)" + " and" + /* New UTKs? */ + " ((select count(*) from ultimately_trusted_keys" + " where keyid not in (%s)) == 0);", + utks_string ? utks_string : "", + utk_count, + utks_string ? utks_string : ""); + xfree (utks_string); + if (rc) + { + log_error (_("TOFU DB error")); + print_further_info ("checking if ultimately trusted keys changed: %s", + err); + sqlite3_free (err); + goto out; + } + + if (utks_unchanged) + goto out; + + if (DBG_TRUST) + log_debug ("TOFU: ultimately trusted keys changed.\n"); + + /* Given that the set of ultimately trusted keys + * changed, clear any cached policies. */ + rc = gpgsql_exec_printf + (db, NULL, NULL, &err, + "update bindings set effective_policy = %d;", + TOFU_POLICY_NONE); + if (rc) + { + log_error (_("TOFU DB error")); + print_further_info ("clearing cached policies: %s", err); + sqlite3_free (err); + goto out; + } + + /* Now, update the UTK table. */ + rc = sqlite3_exec (db, + "drop table ultimately_trusted_keys;", + NULL, NULL, &err); + if (rc) + { + log_error (_("TOFU DB error")); + print_further_info ("dropping ultimately_trusted_keys: %s", err); + sqlite3_free (err); + goto out; + } + + rc = sqlite3_exec (db, + "create table if not exists" + " ultimately_trusted_keys (keyid);\n", + NULL, NULL, &err); + if (rc) + { + log_error (_("TOFU DB error")); + print_further_info ("creating ultimately_trusted_keys: %s", err); + sqlite3_free (err); + goto out; + } + + for (ki = utks; ki; ki = ki->next) + { + format_keyid (ki->kid, KF_LONG, + keyid_str, sizeof (keyid_str)); + rc = gpgsql_exec_printf + (db, NULL, NULL, &err, + "insert into ultimately_trusted_keys values ('%s');", + keyid_str); + if (rc) + { + log_error (_("TOFU DB error")); + print_further_info ("updating ultimately_trusted_keys: %s", + err); + sqlite3_free (err); + goto out; + } + } + + out: + return rc; +} /* If the DB is new, initialize it. Otherwise, check the DB's version. @@ -727,6 +873,9 @@ initdb (sqlite3 *db) } } + if (! rc) + rc = check_utks (db); + if (rc) { rc = sqlite3_exec (db, "rollback;", NULL, NULL, &err); diff --git a/g10/trustdb.c b/g10/trustdb.c index edae6ef..51a8f22 100644 --- a/g10/trustdb.c +++ b/g10/trustdb.c @@ -324,6 +324,13 @@ tdb_keyid_is_utk (u32 *kid) return 0; } + +/* Return the list of ultimately trusted keys. */ +struct key_item * +tdb_utks (void) +{ + return utk_list; +} /********************************************* *********** TrustDB stuff ******************* diff --git a/g10/trustdb.h b/g10/trustdb.h index 77aa79d..45ecc56 100644 --- a/g10/trustdb.h +++ b/g10/trustdb.h @@ -117,6 +117,9 @@ void tdb_register_trusted_keyid (u32 *keyid); void tdb_register_trusted_key (const char *string); /* Returns whether KID is on the list of ultimately trusted keys. */ int tdb_keyid_is_utk (u32 *kid); +/* Return the list of ultimately trusted keys. The caller must not + * modify this list nor must it free the list. */ +struct key_item *tdb_utks (void); void check_trustdb (ctrl_t ctrl); void update_trustdb (ctrl_t ctrl); int setup_trustdb( int level, const char *dbname ); diff --git a/tests/openpgp/tofu.scm b/tests/openpgp/tofu.scm index 2a04d13..e1fa001 100755 --- a/tests/openpgp/tofu.scm +++ b/tests/openpgp/tofu.scm @@ -248,6 +248,21 @@ ;; Alice has an ultimately trusted key and she signs Bob's key. Then ;; Bob adds a new user id, "Alice". TOFU should now detect a ;; conflict, because Alice only signed Bob's "Bob" user id. +;; +;; +;; The Alice key: +;; pub rsa2048 2016-10-11 [SC] +;; 1938C3A0E4674B6C217AC0B987DB2814EC38277E +;; uid [ultimate] Spy Cow +;; sub rsa2048 2016-10-11 [E] +;; +;; The Bob key: +;; +;; pub rsa2048 2016-10-11 [SC] +;; DC463A16E42F03240D76E8BA8B48C6BD871C2247 +;; uid [ full ] Spy R. Cow +;; uid [ full ] Spy R. Cow +;; sub rsa2048 2016-10-11 [E] (display "Checking UTK sigs...\n") (define GPG `(,(tool 'gpg) --no-permission-warning @@ -279,12 +294,18 @@ (call-check `(, at GPG --import ,(in-srcdir DIR (string-append KEYIDB "-1.gpg")))) (display "<\n") +(checkpolicy KEYA "auto") +(checkpolicy KEYB "auto") + ;; Import the cross sigs. (display " > Adding cross signatures. ") (call-check `(, at GPG --import ,(in-srcdir DIR (string-append KEYIDA "-2.gpg")))) (call-check `(, at GPG --import ,(in-srcdir DIR (string-append KEYIDB "-2.gpg")))) (display "<\n") +(checkpolicy KEYA "auto") +(checkpolicy KEYB "auto") + ;; Make KEYA ultimately trusted. (display (string-append " > Marking " KEYA " as ultimately trusted. ")) (pipe:do ----------------------------------------------------------------------- Summary of changes: g10/tofu.c | 149 +++++++++++++++++++++++++++++++++++++++++++++++++ g10/trustdb.c | 7 +++ g10/trustdb.h | 3 + tests/openpgp/tofu.scm | 21 +++++++ 4 files changed, 180 insertions(+) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Tue Nov 22 17:12:41 2016 From: cvs at cvs.gnupg.org (by Neal H. Walfield) Date: Tue, 22 Nov 2016 17:12:41 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.1.16-18-gbfeafe2 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via bfeafe2d3f9bbaa7f11f3ad870a446141c038b0d (commit) from 44c17bcb003a3330f595a6ab144e8439b7b630cb (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit bfeafe2d3f9bbaa7f11f3ad870a446141c038b0d Author: Neal H. Walfield Date: Tue Nov 22 17:12:38 2016 +0100 g10: Use es_fopen instead of open. * g10/tofu.c: Don't include , or . (busy_handler): Replace use of open with es_fopen. -- Signed-off-by: Neal H. Walfield Thanks for Werner for pointing this out: es_fopen is more portable than open. diff --git a/g10/tofu.c b/g10/tofu.c index d7730a3..8575947 100644 --- a/g10/tofu.c +++ b/g10/tofu.c @@ -29,9 +29,6 @@ #include #include #include -#include -#include -#include #include "gpg.h" #include "types.h" @@ -909,21 +906,23 @@ busy_handler (void *cookie, int call_count) (void) call_count; - /* Update the lock file time stamp so that the current owner knows - that we want the lock. */ + /* Update the want-lock-file time stamp (specifically, the ctime) so + * that the current owner knows that we (well, someone) want the + * lock. */ if (dbs) { /* Note: we don't fail if we can't create the lock file: this - process will have to wait a bit longer, but otherwise nothing - horrible should happen. */ + * process will have to wait a bit longer, but otherwise nothing + * horrible should happen. */ - int fd = open (dbs->want_lock_file, O_CREAT|O_WRONLY|O_TRUNC, - S_IRUSR|S_IRGRP|S_IROTH|S_IWUSR); - if (fd == -1) + estream_t fp; + + fp = es_fopen (dbs->want_lock_file, "w"); + if (! fp) log_debug ("TOFU: Error opening '%s': %s\n", dbs->want_lock_file, strerror (errno)); else - close (fd); + es_fclose (fp); } /* Call again. */ ----------------------------------------------------------------------- Summary of changes: g10/tofu.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Wed Nov 23 12:30:22 2016 From: cvs at cvs.gnupg.org (by Neal H. Walfield) Date: Wed, 23 Nov 2016 12:30:22 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.1.16-19-g03a65a5 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via 03a65a53231cc3132a50a1871e81a512c44da169 (commit) from bfeafe2d3f9bbaa7f11f3ad870a446141c038b0d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 03a65a53231cc3132a50a1871e81a512c44da169 Author: Neal H. Walfield Date: Wed Nov 23 12:29:22 2016 +0100 g10: Avoid gratuitously loading a keyblock when it is already available * g10/trust.c (get_validity): Add new, optional parameter KB. Only load the keyblock if KB is NULL. Update callers. (get_validity): Likewise. * g10/trustdb.c (tdb_get_validity_core): Likewise. -- Signed-off-by: Neal H. Walfield GnuPG-bug-id: 2812 diff --git a/g10/getkey.c b/g10/getkey.c index f0e33c5..68e6a1b 100644 --- a/g10/getkey.c +++ b/g10/getkey.c @@ -1543,7 +1543,7 @@ pubkey_cmp (ctrl_t ctrl, const char *name, struct pubkey_cmp_cookie *old, new->uid = scopy_user_id (uid); new->validity = - get_validity (ctrl, &new->key, uid, NULL, 0) & TRUST_MASK; + get_validity (ctrl, new_keyblock, &new->key, uid, NULL, 0) & TRUST_MASK; new->valid = 1; if (! old->valid) diff --git a/g10/gpgv.c b/g10/gpgv.c index da07989..0ecf232 100644 --- a/g10/gpgv.c +++ b/g10/gpgv.c @@ -292,19 +292,22 @@ check_trustdb_stale (ctrl_t ctrl) } int -get_validity_info (ctrl_t ctrl, PKT_public_key *pk, PKT_user_id *uid) +get_validity_info (ctrl_t ctrl, kbnode_t kb, PKT_public_key *pk, + PKT_user_id *uid) { (void)ctrl; + (void)kb; (void)pk; (void)uid; return '?'; } unsigned int -get_validity (ctrl_t ctrl, PKT_public_key *pk, PKT_user_id *uid, +get_validity (ctrl_t ctrl, kbnode_t kb, PKT_public_key *pk, PKT_user_id *uid, PKT_signature *sig, int may_ask) { (void)ctrl; + (void)kb; (void)pk; (void)uid; (void)sig; diff --git a/g10/keyedit.c b/g10/keyedit.c index 5b77ee7..94fa8c4 100644 --- a/g10/keyedit.c +++ b/g10/keyedit.c @@ -3585,7 +3585,7 @@ show_key_with_all_names_colon (ctrl_t ctrl, estream_t fp, kbnode_t keyblock) es_putc ('e', fp); else if (!(opt.fast_list_mode || opt.no_expensive_trust_checks)) { - int trust = get_validity_info (ctrl, pk, NULL); + int trust = get_validity_info (ctrl, keyblock, pk, NULL); if (trust == 'u') ulti_hack = 1; es_putc (trust, fp); @@ -3644,7 +3644,7 @@ show_key_with_all_names_colon (ctrl_t ctrl, estream_t fp, kbnode_t keyblock) int uid_validity; if (primary && !ulti_hack) - uid_validity = get_validity_info (ctrl, primary, uid); + uid_validity = get_validity_info (ctrl, keyblock, primary, uid); else uid_validity = 'u'; es_fprintf (fp, "%c::::::::", uid_validity); @@ -3819,7 +3819,7 @@ show_key_with_all_names (ctrl_t ctrl, estream_t fp, /* Show a warning once */ if (!did_warn - && (get_validity (ctrl, pk, NULL, NULL, 0) + && (get_validity (ctrl, keyblock, pk, NULL, NULL, 0) & TRUST_FLAG_PENDING_CHECK)) { did_warn = 1; @@ -6304,7 +6304,8 @@ core_revuid (ctrl_t ctrl, kbnode_t keyblock, KBNODE node, /* If the trustdb has an entry for this key+uid then the trustdb needs an update. */ if (!update_trust - && ((get_validity (ctrl, pk, uid, NULL, 0) & TRUST_MASK) + && ((get_validity (ctrl, keyblock, pk, uid, NULL, 0) + & TRUST_MASK) >= TRUST_UNDEFINED)) update_trust = 1; #endif /*!NO_TRUST_MODELS*/ diff --git a/g10/keylist.c b/g10/keylist.c index 0523be0..a5fdc06 100644 --- a/g10/keylist.c +++ b/g10/keylist.c @@ -1228,7 +1228,7 @@ list_keyblock_colon (ctrl_t ctrl, kbnode_t keyblock, trustletter_print = 0; else { - trustletter = get_validity_info (ctrl, pk, NULL); + trustletter = get_validity_info (ctrl, keyblock, pk, NULL); if (trustletter == 'u') ulti_hack = 1; trustletter_print = trustletter; @@ -1309,7 +1309,7 @@ list_keyblock_colon (ctrl_t ctrl, kbnode_t keyblock, else if (ulti_hack) uid_validity = 'u'; else - uid_validity = get_validity_info (ctrl, pk, uid); + uid_validity = get_validity_info (ctrl, keyblock, pk, uid); es_fputs (uid->attrib_data? "uat:":"uid:", es_stdout); if (uid_validity) diff --git a/g10/mainproc.c b/g10/mainproc.c index c1819f0..30e19fe 100644 --- a/g10/mainproc.c +++ b/g10/mainproc.c @@ -1015,8 +1015,13 @@ list_node (CTX c, kbnode_t node) keyid_from_pk( pk, keyid ); if (pk->flags.primary) - c->trustletter = (opt.fast_list_mode? - 0 : get_validity_info (c->ctrl, pk, NULL)); + c->trustletter = (opt.fast_list_mode + ? 0 + : get_validity_info + (c->ctrl, + node->pkt->pkttype == PKT_PUBLIC_KEY + ? node : NULL, + pk, NULL)); es_printf ("%s:", pk->flags.primary? "pub":"sub" ); if (c->trustletter) es_putc (c->trustletter, es_stdout); @@ -1973,8 +1978,8 @@ check_sig_and_print (CTX c, kbnode_t node) does not print a LF we need to compute the validity before calling that function. */ if ((opt.verify_options & VERIFY_SHOW_UID_VALIDITY)) - valid = get_validity (c->ctrl, mainpk, un->pkt->pkt.user_id, - NULL, 0); + valid = get_validity (c->ctrl, keyblock, mainpk, + un->pkt->pkt.user_id, NULL, 0); else valid = 0; /* Not used. */ @@ -2075,7 +2080,7 @@ check_sig_and_print (CTX c, kbnode_t node) actually ask the user to update any trust information. */ valid = (trust_value_to_string - (get_validity (c->ctrl, mainpk, + (get_validity (c->ctrl, keyblock, mainpk, un->pkt->pkt.user_id, NULL, 0))); log_printf (" [%s]\n",valid); } diff --git a/g10/photoid.c b/g10/photoid.c index b61ed1b..8b193b3 100644 --- a/g10/photoid.c +++ b/g10/photoid.c @@ -304,7 +304,7 @@ show_photos (ctrl_t ctrl, const struct user_attribute *attrs, int count, memset (&args, 0, sizeof(args)); args.pk = pk; - args.validity_info = get_validity_info (ctrl, pk, uid); + args.validity_info = get_validity_info (ctrl, NULL, pk, uid); args.validity_string = get_validity_string (ctrl, pk, uid); namehash_from_uid (uid); args.namehash = uid->namehash; diff --git a/g10/pkclist.c b/g10/pkclist.c index 51e8f27..0426da8 100644 --- a/g10/pkclist.c +++ b/g10/pkclist.c @@ -569,7 +569,7 @@ check_signatures_trust (ctrl_t ctrl, PKT_signature *sig) log_info(_("WARNING: this key might be revoked (revocation key" " not present)\n")); - trustlevel = get_validity (ctrl, pk, NULL, sig, 1); + trustlevel = get_validity (ctrl, NULL, pk, NULL, sig, 1); if ( (trustlevel & TRUST_FLAG_REVOKED) ) { @@ -872,7 +872,7 @@ find_and_check_key (ctrl_t ctrl, const char *name, unsigned int use, { int trustlevel; - trustlevel = get_validity (ctrl, pk, pk->user_id, NULL, 1); + trustlevel = get_validity (ctrl, NULL, pk, pk->user_id, NULL, 1); if ( (trustlevel & TRUST_FLAG_DISABLED) ) { /* Key has been disabled. */ @@ -1212,7 +1212,8 @@ build_pk_list (ctrl_t ctrl, strlist_t rcpts, PK_LIST *ret_pk_list) { /* Check validity of this key. */ int trustlevel; - trustlevel = get_validity (ctrl, pk, pk->user_id, NULL, 1); + trustlevel = + get_validity (ctrl, NULL, pk, pk->user_id, NULL, 1); if ( (trustlevel & TRUST_FLAG_DISABLED) ) { tty_printf (_("Public key is disabled.\n") ); diff --git a/g10/test-stubs.c b/g10/test-stubs.c index 2dc65ab..8752f88 100644 --- a/g10/test-stubs.c +++ b/g10/test-stubs.c @@ -98,19 +98,22 @@ check_trustdb_stale (ctrl_t ctrl) } int -get_validity_info (ctrl_t ctrl, PKT_public_key *pk, PKT_user_id *uid) +get_validity_info (ctrl_t ctrl, kbnode_t kb, PKT_public_key *pk, + PKT_user_id *uid) { (void)ctrl; + (void)kb; (void)pk; (void)uid; return '?'; } unsigned int -get_validity (ctrl_t ctrl, PKT_public_key *pk, PKT_user_id *uid, +get_validity (ctrl_t ctrl, kbnode_t kb, PKT_public_key *pk, PKT_user_id *uid, PKT_signature *sig, int may_ask) { (void)ctrl; + (void)kb; (void)pk; (void)uid; (void)sig; diff --git a/g10/trust.c b/g10/trust.c index 2a829b8..080926a 100644 --- a/g10/trust.c +++ b/g10/trust.c @@ -151,7 +151,7 @@ uid_trust_string_fixed (ctrl_t ctrl, PKT_public_key *key, PKT_user_id *uid) return _("[ expired]"); else if(key) { - switch (get_validity (ctrl, key, uid, NULL, 0) & TRUST_MASK) + switch (get_validity (ctrl, NULL, key, uid, NULL, 0) & TRUST_MASK) { case TRUST_UNKNOWN: return _("[ unknown]"); case TRUST_EXPIRED: return _("[ expired]"); @@ -297,12 +297,13 @@ check_or_update_trustdb (ctrl_t ctrl) /* - * Return the validity information for PK. If the namehash is not - * NULL, the validity of the corresponding user ID is returned, - * otherwise, a reasonable value for the entire key is returned. + * Return the validity information for KB/PK (at least one must be + * non-NULL). If the namehash is not NULL, the validity of the + * corresponding user ID is returned, otherwise, a reasonable value + * for the entire key is returned. */ unsigned int -get_validity (ctrl_t ctrl, PKT_public_key *pk, PKT_user_id *uid, +get_validity (ctrl_t ctrl, kbnode_t kb, PKT_public_key *pk, PKT_user_id *uid, PKT_signature *sig, int may_ask) { int rc; @@ -310,6 +311,16 @@ get_validity (ctrl_t ctrl, PKT_public_key *pk, PKT_user_id *uid, u32 kid[2]; PKT_public_key *main_pk; + if (kb && pk) + log_assert (keyid_cmp (pk_main_keyid (pk), + pk_main_keyid (kb->pkt->pkt.public_key)) == 0); + + if (! pk) + { + log_assert (kb); + pk = kb->pkt->pkt.public_key; + } + if (uid) namehash_from_uid (uid); @@ -317,17 +328,22 @@ get_validity (ctrl_t ctrl, PKT_public_key *pk, PKT_user_id *uid, if (pk->main_keyid[0] != kid[0] || pk->main_keyid[1] != kid[1]) { /* This is a subkey - get the mainkey. */ - main_pk = xmalloc_clear (sizeof *main_pk); - rc = get_pubkey (main_pk, pk->main_keyid); - if (rc) + if (kb) + main_pk = kb->pkt->pkt.public_key; + else { - char *tempkeystr = xstrdup (keystr (pk->main_keyid)); - log_error ("error getting main key %s of subkey %s: %s\n", - tempkeystr, keystr (kid), gpg_strerror (rc)); - xfree (tempkeystr); - validity = TRUST_UNKNOWN; - goto leave; - } + main_pk = xmalloc_clear (sizeof *main_pk); + rc = get_pubkey (main_pk, pk->main_keyid); + if (rc) + { + char *tempkeystr = xstrdup (keystr (pk->main_keyid)); + log_error ("error getting main key %s of subkey %s: %s\n", + tempkeystr, keystr (kid), gpg_strerror (rc)); + xfree (tempkeystr); + validity = TRUST_UNKNOWN; + goto leave; + } + } } else main_pk = pk; @@ -335,7 +351,7 @@ get_validity (ctrl_t ctrl, PKT_public_key *pk, PKT_user_id *uid, #ifdef NO_TRUST_MODELS validity = TRUST_UNKNOWN; #else - validity = tdb_get_validity_core (ctrl, pk, uid, main_pk, sig, may_ask); + validity = tdb_get_validity_core (ctrl, kb, pk, uid, main_pk, sig, may_ask); #endif leave: @@ -350,21 +366,28 @@ get_validity (ctrl_t ctrl, PKT_public_key *pk, PKT_user_id *uid, validity = ((validity & (~TRUST_MASK | TRUST_FLAG_PENDING_CHECK)) | TRUST_EXPIRED); - if (main_pk != pk) + if (main_pk != pk && !kb) free_public_key (main_pk); return validity; } int -get_validity_info (ctrl_t ctrl, PKT_public_key *pk, PKT_user_id *uid) +get_validity_info (ctrl_t ctrl, kbnode_t kb, PKT_public_key *pk, + PKT_user_id *uid) { int trustlevel; + if (kb && pk) + log_assert (keyid_cmp (pk_main_keyid (pk), + pk_main_keyid (kb->pkt->pkt.public_key)) == 0); + + if (! pk && kb) + pk = kb->pkt->pkt.public_key; if (!pk) return '?'; /* Just in case a NULL PK is passed. */ - trustlevel = get_validity (ctrl, pk, uid, NULL, 0); + trustlevel = get_validity (ctrl, kb, pk, uid, NULL, 0); if ((trustlevel & TRUST_FLAG_REVOKED)) return 'r'; return trust_letter (trustlevel); @@ -379,7 +402,7 @@ get_validity_string (ctrl_t ctrl, PKT_public_key *pk, PKT_user_id *uid) if (!pk) return "err"; /* Just in case a NULL PK is passed. */ - trustlevel = get_validity (ctrl, pk, uid, NULL, 0); + trustlevel = get_validity (ctrl, NULL, pk, uid, NULL, 0); if ((trustlevel & TRUST_FLAG_REVOKED)) return _("revoked"); return trust_value_to_string (trustlevel); diff --git a/g10/trustdb.c b/g10/trustdb.c index 51a8f22..d402cb2 100644 --- a/g10/trustdb.c +++ b/g10/trustdb.c @@ -983,13 +983,15 @@ tdb_check_trustdb_stale (ctrl_t ctrl) } /* - * Return the validity information for PK. This is the core of - * get_validity. If SIG is not NULL, then the trust is being - * evaluated in the context of the provided signature. This is used - * by the TOFU code to record statistics. + * Return the validity information for KB/PK (at least one of them + * must be non-NULL). This is the core of get_validity. If SIG is + * not NULL, then the trust is being evaluated in the context of the + * provided signature. This is used by the TOFU code to record + * statistics. */ unsigned int tdb_get_validity_core (ctrl_t ctrl, + kbnode_t kb, PKT_public_key *pk, PKT_user_id *uid, PKT_public_key *main_pk, PKT_signature *sig, @@ -1002,6 +1004,17 @@ tdb_get_validity_core (ctrl_t ctrl, unsigned int tofu_validity = TRUST_UNKNOWN; #endif unsigned int validity = TRUST_UNKNOWN; + int free_kb = 0; + + if (kb && pk) + log_assert (keyid_cmp (pk_main_keyid (pk), + pk_main_keyid (kb->pkt->pkt.public_key)) == 0); + + if (! pk) + { + log_assert (kb); + pk = kb->pkt->pkt.public_key; + } #ifndef USE_TOFU (void)sig; @@ -1030,14 +1043,20 @@ tdb_get_validity_core (ctrl_t ctrl, #ifdef USE_TOFU if (opt.trust_model == TM_TOFU || opt.trust_model == TM_TOFU_PGP) { - kbnode_t kb = NULL; kbnode_t n = NULL; strlist_t user_id_list = NULL; int done = 0; /* If the caller didn't supply a user id then use all uids. */ if (! uid) - kb = n = get_pubkeyblock (main_pk->keyid); + { + if (! kb) + { + kb = get_pubkeyblock (main_pk->keyid); + free_kb = 1; + } + n = kb; + } if (DBG_TRUST && sig && sig->signers_uid) log_debug ("TOFU: only considering user id: '%s'\n", @@ -1132,7 +1151,8 @@ tdb_get_validity_core (ctrl_t ctrl, may_ask); free_strlist (user_id_list); - release_kbnode (kb); + if (free_kb) + release_kbnode (kb); } #endif /*USE_TOFU*/ diff --git a/g10/trustdb.h b/g10/trustdb.h index 45ecc56..6081d10 100644 --- a/g10/trustdb.h +++ b/g10/trustdb.h @@ -94,9 +94,11 @@ void revalidation_mark (void); void check_trustdb_stale (ctrl_t ctrl); void check_or_update_trustdb (ctrl_t ctrl); -unsigned int get_validity (ctrl_t ctrl, PKT_public_key *pk, PKT_user_id *uid, +unsigned int get_validity (ctrl_t ctrl, kbnode_t kb, PKT_public_key *pk, + PKT_user_id *uid, PKT_signature *sig, int may_ask); -int get_validity_info (ctrl_t ctrl, PKT_public_key *pk, PKT_user_id *uid); +int get_validity_info (ctrl_t ctrl, kbnode_t kb, PKT_public_key *pk, + PKT_user_id *uid); const char *get_validity_string (ctrl_t ctrl, PKT_public_key *pk, PKT_user_id *uid); @@ -135,7 +137,7 @@ void tdb_check_or_update (ctrl_t ctrl); int tdb_cache_disabled_value (PKT_public_key *pk); -unsigned int tdb_get_validity_core (ctrl_t ctrl, +unsigned int tdb_get_validity_core (ctrl_t ctrl, kbnode_t kb, PKT_public_key *pk, PKT_user_id *uid, PKT_public_key *main_pk, PKT_signature *sig, int may_ask); ----------------------------------------------------------------------- Summary of changes: g10/getkey.c | 2 +- g10/gpgv.c | 7 +++++-- g10/keyedit.c | 9 ++++---- g10/keylist.c | 4 ++-- g10/mainproc.c | 15 +++++++++----- g10/photoid.c | 2 +- g10/pkclist.c | 7 ++++--- g10/test-stubs.c | 7 +++++-- g10/trust.c | 63 ++++++++++++++++++++++++++++++++++++++------------------ g10/trustdb.c | 34 +++++++++++++++++++++++------- g10/trustdb.h | 8 ++++--- 11 files changed, 108 insertions(+), 50 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Wed Nov 23 12:52:41 2016 From: cvs at cvs.gnupg.org (by Justus Winter) Date: Wed, 23 Nov 2016 12:52:41 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.1.16-22-g005d326 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via 005d326d19ba28005182205f25edc4f7499ec0b5 (commit) via 3fb9954c43425775a517060959dad01fa00238f7 (commit) via 7856e3efaad7614979bc0b91379a0a4dcbc739d5 (commit) from 03a65a53231cc3132a50a1871e81a512c44da169 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 005d326d19ba28005182205f25edc4f7499ec0b5 Author: Justus Winter Date: Wed Nov 23 12:27:41 2016 +0100 gpgscm: Make 'reverse' compatible with 'reverse_in_place'. * tests/gpgscm/scheme.c (reverse): Update prototype, add terminator argument. (opexe_4): Update callsite. Signed-off-by: Justus Winter diff --git a/tests/gpgscm/scheme.c b/tests/gpgscm/scheme.c index d088931..8666548 100644 --- a/tests/gpgscm/scheme.c +++ b/tests/gpgscm/scheme.c @@ -409,7 +409,7 @@ static void printatom(scheme *sc, pointer l, int f); static pointer mk_proc(scheme *sc, enum scheme_opcodes op); static pointer mk_closure(scheme *sc, pointer c, pointer e); static pointer mk_continuation(scheme *sc, pointer d); -static pointer reverse(scheme *sc, pointer a); +static pointer reverse(scheme *sc, pointer term, pointer list); static pointer reverse_in_place(scheme *sc, pointer term, pointer list); static pointer revappend(scheme *sc, pointer a, pointer b); static void dump_stack_mark(scheme *); @@ -2356,9 +2356,9 @@ static pointer list_star(scheme *sc, pointer d) { } /* reverse list -- produce new list */ -static pointer reverse(scheme *sc, pointer a) { +static pointer reverse(scheme *sc, pointer term, pointer list) { /* a must be checked by gc */ - pointer p = sc->NIL; + pointer a = list, p = term; for ( ; is_pair(a); a = cdr(a)) { p = cons(sc, car(a), p); @@ -4148,7 +4148,7 @@ static pointer opexe_4(scheme *sc, enum scheme_opcodes op) { } CASE(OP_REVERSE): /* reverse */ - s_return(sc,reverse(sc, car(sc->args))); + s_return(sc,reverse(sc, sc->NIL, car(sc->args))); CASE(OP_LIST_STAR): /* list* */ s_return(sc,list_star(sc,sc->args)); commit 3fb9954c43425775a517060959dad01fa00238f7 Author: Justus Winter Date: Wed Nov 23 12:35:15 2016 +0100 gpgscm: Clean sweeped cells. * tests/gpgscm/scheme.c (gc): Zero typeflag and car of free cells. Signed-off-by: Justus Winter diff --git a/tests/gpgscm/scheme.c b/tests/gpgscm/scheme.c index 673d199..d088931 100644 --- a/tests/gpgscm/scheme.c +++ b/tests/gpgscm/scheme.c @@ -1569,10 +1569,10 @@ static void gc(scheme *sc, pointer a, pointer b) { /* reclaim cell */ if (typeflag(p) & T_FINALIZE) { finalize_cell(sc, p); - typeflag(p) = 0; - car(p) = sc->NIL; } ++sc->fcells; + typeflag(p) = 0; + car(p) = sc->NIL; cdr(p) = sc->free_cell; sc->free_cell = p; } commit 7856e3efaad7614979bc0b91379a0a4dcbc739d5 Author: Justus Winter Date: Tue Nov 22 14:49:27 2016 +0100 gpgscm: Fix initialization of 'sink'. * tests/gpgscm/scheme.c (scheme_init_custom_alloc): Also initialize cdr. Signed-off-by: Justus Winter diff --git a/tests/gpgscm/scheme.c b/tests/gpgscm/scheme.c index e011dea..673d199 100644 --- a/tests/gpgscm/scheme.c +++ b/tests/gpgscm/scheme.c @@ -5045,7 +5045,7 @@ int scheme_init_custom_alloc(scheme *sc, func_alloc malloc, func_dealloc free) { car(sc->EOF_OBJ) = cdr(sc->EOF_OBJ) = sc->EOF_OBJ; /* init sink */ typeflag(sc->sink) = (T_SINK | T_PAIR | MARK); - car(sc->sink) = sc->NIL; + car(sc->sink) = cdr(sc->sink) = sc->NIL; /* init c_nest */ sc->c_nest = sc->NIL; ----------------------------------------------------------------------- Summary of changes: tests/gpgscm/scheme.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Fri Nov 25 04:39:32 2016 From: cvs at cvs.gnupg.org (by Dmitry Eremin-Solenikov) Date: Fri, 25 Nov 2016 04:39:32 +0100 Subject: [git] GCRYPT - branch, master, updated. libgcrypt-1.7.3-16-g1a67e31 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU crypto library". The branch, master has been updated via 1a67e3195896704f8b3ba09e3db1214bab834491 (commit) via dc8ceb8d2dfef949f3afa14fc75f9de8cd07c7ad (commit) via 4f5c26c73c66daf2e4aff966e43c22b2db7e0138 (commit) from 5ca63c92825453fdb369a97bbc19cb95b49b4296 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 1a67e3195896704f8b3ba09e3db1214bab834491 Author: Dmitry Eremin-Solenikov Date: Wed Nov 23 08:38:33 2016 +0300 Cast oid argument of gcry_cipher_set_sbox to disable compiler warning. * src/gcrypt.h.in (gcry_cipher_set_sbox): Cast oid to (void *). Signed-off-by: Dmitry Eremin-Solenikov diff --git a/src/gcrypt.h.in b/src/gcrypt.h.in index f896a78..77ff947 100644 --- a/src/gcrypt.h.in +++ b/src/gcrypt.h.in @@ -1062,7 +1062,7 @@ gcry_error_t gcry_cipher_checktag (gcry_cipher_hd_t hd, const void *intag, NULL, on ) #define gcry_cipher_set_sbox(h,oid) gcry_cipher_ctl( (h), GCRYCTL_SET_SBOX, \ - (oid), 0); + (void *) oid, 0); /* Indicate to the encrypt and decrypt functions that the next call provides the final data. Only used with some modes. */ commit dc8ceb8d2dfef949f3afa14fc75f9de8cd07c7ad Author: Dmitry Eremin-Solenikov Date: Wed Nov 23 08:38:32 2016 +0300 gost: Rename tc26 s-box from A to Z. * cipher/gost-s-box.c (gost_sboxes): Rename TC26_A to TC26_Z as it is the name that ended up in all standards. Signed-off-by: Dmitry Eremin-Solenikov diff --git a/cipher/gost-s-box.c b/cipher/gost-s-box.c index 7bf6041..7aa5444 100644 --- a/cipher/gost-s-box.c +++ b/cipher/gost-s-box.c @@ -182,7 +182,7 @@ struct gost_sbox 0x3, 0x1, 0x2, 0x8, 0x1, 0x6, 0x7, 0xE, } }, - { "TC26_A", "1.2.643.7.1.2.5.1.1", { + { "TC26_Z", "1.2.643.7.1.2.5.1.1", { 0xc, 0x6, 0xb, 0xc, 0x7, 0x5, 0x8, 0x1, 0x4, 0x8, 0x3, 0x8, 0xf, 0xd, 0xe, 0x7, 0x6, 0x2, 0x5, 0x2, 0x5, 0xf, 0x2, 0xe, commit 4f5c26c73c66daf2e4aff966e43c22b2db7e0138 Author: Dmitry Eremin-Solenikov Date: Wed Nov 23 08:38:31 2016 +0300 tests: Add test to verify GOST 28147-89 against known results. * tests/basic.c (check_gost28147_cipher): new test function. -- Currently the only test executed against GOST 28147-89 cipher is a basic cipher test: it checks that decoding of encoded text returns the original plaintext. Add a function to verify the cipher against test vectors. Signed-off-by: Dmitry Eremin-Solenikov diff --git a/tests/basic.c b/tests/basic.c index e5a325b..7f7bce3 100644 --- a/tests/basic.c +++ b/tests/basic.c @@ -3874,6 +3874,170 @@ check_ocb_cipher (void) check_ocb_cipher_splitaad (); } +static void +check_gost28147_cipher (void) +{ +#if USE_GOST28147 + static const struct { + char key[MAX_DATA_LEN]; + const char *oid; + unsigned char plaintext[MAX_DATA_LEN]; + int inlen; + char out[MAX_DATA_LEN]; + } tv[] = + { + { + "\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x80" + "\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xd0", + "1.2.643.7.1.2.5.1.1", + "\x01\x02\x03\x04\x05\x06\x07\x08", + 8, + "\xce\x5a\x5e\xd7\xe0\x57\x7a\x5f", + }, { + "\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x80" + "\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xd0", + "1.2.643.2.2.31.0", + "\x01\x02\x03\x04\x05\x06\x07\x08", + 8, + "\x98\x56\xcf\x8b\xfc\xc2\x82\xf4", + }, { + "\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x80" + "\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xd0", + "1.2.643.2.2.31.1", + "\x01\x02\x03\x04\x05\x06\x07\x08", + 8, + "\x66\x81\x84\xae\xdc\x48\xc9\x17", + }, { + "\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x80" + "\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xd0", + "1.2.643.2.2.31.2", + "\x01\x02\x03\x04\x05\x06\x07\x08", + 8, + "\xdb\xee\x81\x14\x7b\x74\xb0\xf2", + }, { + "\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x80" + "\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xd0", + "1.2.643.2.2.31.3", + "\x01\x02\x03\x04\x05\x06\x07\x08", + 8, + "\x31\xa3\x85\x9d\x0a\xee\xb8\x0e", + }, { + "\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x80" + "\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xd0", + "1.2.643.2.2.31.4", + "\x01\x02\x03\x04\x05\x06\x07\x08", + 8, + "\xb1\x32\x3e\x0b\x21\x73\xcb\xd1", + }, { + "\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x80" + "\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xd0", + "1.2.643.2.2.30.0", + "\x01\x02\x03\x04\x05\x06\x07\x08", + 8, + "\xce\xd5\x2a\x7f\xf7\xf2\x60\xd5", + }, { + "\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x80" + "\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xd0", + "1.2.643.2.2.30.1", + "\x01\x02\x03\x04\x05\x06\x07\x08", + 8, + "\xe4\x21\x75\xe1\x69\x22\xd0\xa8", + } + }; + + gcry_cipher_hd_t hde, hdd; + unsigned char out[MAX_DATA_LEN]; + int i, keylen; + gcry_error_t err = 0; + + if (verbose) + fprintf (stderr, " Starting GOST28147 cipher checks.\n"); + keylen = gcry_cipher_get_algo_keylen(GCRY_CIPHER_GOST28147); + if (!keylen) + { + fail ("gost28147, gcry_cipher_get_algo_keylen failed\n"); + return; + } + + for (i = 0; i < sizeof (tv) / sizeof (tv[0]); i++) + { + err = gcry_cipher_open (&hde, GCRY_CIPHER_GOST28147, + GCRY_CIPHER_MODE_ECB, 0); + if (!err) + err = gcry_cipher_open (&hdd, GCRY_CIPHER_GOST28147, + GCRY_CIPHER_MODE_ECB, 0); + if (err) + { + fail ("gost28147, gcry_cipher_open failed: %s\n", gpg_strerror (err)); + return; + } + + err = gcry_cipher_setkey (hde, tv[i].key, keylen); + if (!err) + err = gcry_cipher_setkey (hdd, tv[i].key, keylen); + if (err) + { + fail ("gost28147, gcry_cipher_setkey failed: %s\n", + gpg_strerror (err)); + gcry_cipher_close (hde); + gcry_cipher_close (hdd); + return; + } + + err = gcry_cipher_set_sbox (hde, tv[i].oid); + if (!err) + err = gcry_cipher_set_sbox (hdd, tv[i].oid); + if (err) + { + fail ("gost28147, gcry_cipher_set_sbox failed: %s\n", + gpg_strerror (err)); + gcry_cipher_close (hde); + gcry_cipher_close (hdd); + return; + } + + err = gcry_cipher_encrypt (hde, out, MAX_DATA_LEN, + tv[i].plaintext, + tv[i].inlen == -1 ? + strlen ((char*)tv[i].plaintext) : + tv[i].inlen); + if (err) + { + fail ("gost28147, gcry_cipher_encrypt (%d) failed: %s\n", + i, gpg_strerror (err)); + gcry_cipher_close (hde); + gcry_cipher_close (hdd); + return; + } + + if (memcmp (tv[i].out, out, tv[i].inlen)) + { + fail ("gost28147, encrypt mismatch entry %d\n", i); + mismatch (tv[i].out, tv[i].inlen, + out, tv[i].inlen); + } + + err = gcry_cipher_decrypt (hdd, out, tv[i].inlen, NULL, 0); + if (err) + { + fail ("gost28147, gcry_cipher_decrypt (%d) failed: %s\n", + i, gpg_strerror (err)); + gcry_cipher_close (hde); + gcry_cipher_close (hdd); + return; + } + + if (memcmp (tv[i].plaintext, out, tv[i].inlen)) + { + fail ("gost28147, decrypt mismatch entry %d\n", i); + mismatch (tv[i].plaintext, tv[i].inlen, + out, tv[i].inlen); + } + } + +#endif +} + static void check_stream_cipher (void) @@ -5750,6 +5914,7 @@ check_cipher_modes(void) check_gcm_cipher (); check_poly1305_cipher (); check_ocb_cipher (); + check_gost28147_cipher (); check_stream_cipher (); check_stream_cipher_large_block (); ----------------------------------------------------------------------- Summary of changes: cipher/gost-s-box.c | 2 +- src/gcrypt.h.in | 2 +- tests/basic.c | 165 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 167 insertions(+), 2 deletions(-) hooks/post-receive -- The GNU crypto library http://git.gnupg.org From cvs at cvs.gnupg.org Fri Nov 25 04:43:40 2016 From: cvs at cvs.gnupg.org (by Dmitry Eremin-Solenikov) Date: Fri, 25 Nov 2016 04:43:40 +0100 Subject: [git] GCRYPT - branch, LIBGCRYPT-1-7-BRANCH, updated. libgcrypt-1.7.3-15-ga22d7bb Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU crypto library". The branch, LIBGCRYPT-1-7-BRANCH has been updated via a22d7bb3945cec2d8a6b23d8f2bd2f675bb2f4e6 (commit) via 298cb926d28ae76ab2af1b028e7b06ae2358a234 (commit) via 76fa65940ff9d4baf17b42f671191720b9ea96f1 (commit) from 15718db54b2888a704b020cb1032954b443c6686 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit a22d7bb3945cec2d8a6b23d8f2bd2f675bb2f4e6 Author: Dmitry Eremin-Solenikov Date: Wed Nov 23 08:38:33 2016 +0300 Cast oid argument of gcry_cipher_set_sbox to disable compiler warning. * src/gcrypt.h.in (gcry_cipher_set_sbox): Cast oid to (void *). -- Backport of master commit: 1a67e3195896704f8b3ba09e3db1214bab834491 Signed-off-by: Dmitry Eremin-Solenikov diff --git a/src/gcrypt.h.in b/src/gcrypt.h.in index 02b8772..34a3cb7 100644 --- a/src/gcrypt.h.in +++ b/src/gcrypt.h.in @@ -1061,7 +1061,7 @@ gcry_error_t gcry_cipher_checktag (gcry_cipher_hd_t hd, const void *intag, NULL, on ) #define gcry_cipher_set_sbox(h,oid) gcry_cipher_ctl( (h), GCRYCTL_SET_SBOX, \ - (oid), 0); + (void *) oid, 0); /* Indicate to the encrypt and decrypt functions that the next call provides the final data. Only used with some modes. */ commit 298cb926d28ae76ab2af1b028e7b06ae2358a234 Author: Dmitry Eremin-Solenikov Date: Wed Nov 23 08:38:32 2016 +0300 gost: Rename tc26 s-box from A to Z. * cipher/gost-s-box.c (gost_sboxes): Rename TC26_A to TC26_Z as it is the name that ended up in all standards. -- Backport of master commit:dc8ceb8d2dfef949f3afa14fc75f9de8cd07c7ad Signed-off-by: Dmitry Eremin-Solenikov diff --git a/cipher/gost-s-box.c b/cipher/gost-s-box.c index 7bf6041..7aa5444 100644 --- a/cipher/gost-s-box.c +++ b/cipher/gost-s-box.c @@ -182,7 +182,7 @@ struct gost_sbox 0x3, 0x1, 0x2, 0x8, 0x1, 0x6, 0x7, 0xE, } }, - { "TC26_A", "1.2.643.7.1.2.5.1.1", { + { "TC26_Z", "1.2.643.7.1.2.5.1.1", { 0xc, 0x6, 0xb, 0xc, 0x7, 0x5, 0x8, 0x1, 0x4, 0x8, 0x3, 0x8, 0xf, 0xd, 0xe, 0x7, 0x6, 0x2, 0x5, 0x2, 0x5, 0xf, 0x2, 0xe, commit 76fa65940ff9d4baf17b42f671191720b9ea96f1 Author: Dmitry Eremin-Solenikov Date: Wed Nov 23 08:38:31 2016 +0300 tests: Add test to verify GOST 28147-89 against known results. * tests/basic.c (check_gost28147_cipher): new test function. -- Currently the only test executed against GOST 28147-89 cipher is a basic cipher test: it checks that decoding of encoded text returns the original plaintext. Add a function to verify the cipher against test vectors. Signed-off-by: Dmitry Eremin-Solenikov Backport of master commit: 4f5c26c73c66daf2e4aff966e43c22b2db7e0138 diff --git a/tests/basic.c b/tests/basic.c index e5a325b..7f7bce3 100644 --- a/tests/basic.c +++ b/tests/basic.c @@ -3874,6 +3874,170 @@ check_ocb_cipher (void) check_ocb_cipher_splitaad (); } +static void +check_gost28147_cipher (void) +{ +#if USE_GOST28147 + static const struct { + char key[MAX_DATA_LEN]; + const char *oid; + unsigned char plaintext[MAX_DATA_LEN]; + int inlen; + char out[MAX_DATA_LEN]; + } tv[] = + { + { + "\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x80" + "\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xd0", + "1.2.643.7.1.2.5.1.1", + "\x01\x02\x03\x04\x05\x06\x07\x08", + 8, + "\xce\x5a\x5e\xd7\xe0\x57\x7a\x5f", + }, { + "\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x80" + "\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xd0", + "1.2.643.2.2.31.0", + "\x01\x02\x03\x04\x05\x06\x07\x08", + 8, + "\x98\x56\xcf\x8b\xfc\xc2\x82\xf4", + }, { + "\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x80" + "\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xd0", + "1.2.643.2.2.31.1", + "\x01\x02\x03\x04\x05\x06\x07\x08", + 8, + "\x66\x81\x84\xae\xdc\x48\xc9\x17", + }, { + "\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x80" + "\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xd0", + "1.2.643.2.2.31.2", + "\x01\x02\x03\x04\x05\x06\x07\x08", + 8, + "\xdb\xee\x81\x14\x7b\x74\xb0\xf2", + }, { + "\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x80" + "\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xd0", + "1.2.643.2.2.31.3", + "\x01\x02\x03\x04\x05\x06\x07\x08", + 8, + "\x31\xa3\x85\x9d\x0a\xee\xb8\x0e", + }, { + "\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x80" + "\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xd0", + "1.2.643.2.2.31.4", + "\x01\x02\x03\x04\x05\x06\x07\x08", + 8, + "\xb1\x32\x3e\x0b\x21\x73\xcb\xd1", + }, { + "\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x80" + "\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xd0", + "1.2.643.2.2.30.0", + "\x01\x02\x03\x04\x05\x06\x07\x08", + 8, + "\xce\xd5\x2a\x7f\xf7\xf2\x60\xd5", + }, { + "\x81\x82\x83\x84\x85\x86\x87\x88\x89\x8a\x8b\x8c\x8d\x8e\x8f\x80" + "\xd1\xd2\xd3\xd4\xd5\xd6\xd7\xd8\xd9\xda\xdb\xdc\xdd\xde\xdf\xd0", + "1.2.643.2.2.30.1", + "\x01\x02\x03\x04\x05\x06\x07\x08", + 8, + "\xe4\x21\x75\xe1\x69\x22\xd0\xa8", + } + }; + + gcry_cipher_hd_t hde, hdd; + unsigned char out[MAX_DATA_LEN]; + int i, keylen; + gcry_error_t err = 0; + + if (verbose) + fprintf (stderr, " Starting GOST28147 cipher checks.\n"); + keylen = gcry_cipher_get_algo_keylen(GCRY_CIPHER_GOST28147); + if (!keylen) + { + fail ("gost28147, gcry_cipher_get_algo_keylen failed\n"); + return; + } + + for (i = 0; i < sizeof (tv) / sizeof (tv[0]); i++) + { + err = gcry_cipher_open (&hde, GCRY_CIPHER_GOST28147, + GCRY_CIPHER_MODE_ECB, 0); + if (!err) + err = gcry_cipher_open (&hdd, GCRY_CIPHER_GOST28147, + GCRY_CIPHER_MODE_ECB, 0); + if (err) + { + fail ("gost28147, gcry_cipher_open failed: %s\n", gpg_strerror (err)); + return; + } + + err = gcry_cipher_setkey (hde, tv[i].key, keylen); + if (!err) + err = gcry_cipher_setkey (hdd, tv[i].key, keylen); + if (err) + { + fail ("gost28147, gcry_cipher_setkey failed: %s\n", + gpg_strerror (err)); + gcry_cipher_close (hde); + gcry_cipher_close (hdd); + return; + } + + err = gcry_cipher_set_sbox (hde, tv[i].oid); + if (!err) + err = gcry_cipher_set_sbox (hdd, tv[i].oid); + if (err) + { + fail ("gost28147, gcry_cipher_set_sbox failed: %s\n", + gpg_strerror (err)); + gcry_cipher_close (hde); + gcry_cipher_close (hdd); + return; + } + + err = gcry_cipher_encrypt (hde, out, MAX_DATA_LEN, + tv[i].plaintext, + tv[i].inlen == -1 ? + strlen ((char*)tv[i].plaintext) : + tv[i].inlen); + if (err) + { + fail ("gost28147, gcry_cipher_encrypt (%d) failed: %s\n", + i, gpg_strerror (err)); + gcry_cipher_close (hde); + gcry_cipher_close (hdd); + return; + } + + if (memcmp (tv[i].out, out, tv[i].inlen)) + { + fail ("gost28147, encrypt mismatch entry %d\n", i); + mismatch (tv[i].out, tv[i].inlen, + out, tv[i].inlen); + } + + err = gcry_cipher_decrypt (hdd, out, tv[i].inlen, NULL, 0); + if (err) + { + fail ("gost28147, gcry_cipher_decrypt (%d) failed: %s\n", + i, gpg_strerror (err)); + gcry_cipher_close (hde); + gcry_cipher_close (hdd); + return; + } + + if (memcmp (tv[i].plaintext, out, tv[i].inlen)) + { + fail ("gost28147, decrypt mismatch entry %d\n", i); + mismatch (tv[i].plaintext, tv[i].inlen, + out, tv[i].inlen); + } + } + +#endif +} + static void check_stream_cipher (void) @@ -5750,6 +5914,7 @@ check_cipher_modes(void) check_gcm_cipher (); check_poly1305_cipher (); check_ocb_cipher (); + check_gost28147_cipher (); check_stream_cipher (); check_stream_cipher_large_block (); ----------------------------------------------------------------------- Summary of changes: cipher/gost-s-box.c | 2 +- src/gcrypt.h.in | 2 +- tests/basic.c | 165 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 167 insertions(+), 2 deletions(-) hooks/post-receive -- The GNU crypto library http://git.gnupg.org From cvs at cvs.gnupg.org Fri Nov 25 08:36:31 2016 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Fri, 25 Nov 2016 08:36:31 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.1.16-23-gb89e63e Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via b89e63e5c326af71470124b410e6429cbd2b5c43 (commit) from 005d326d19ba28005182205f25edc4f7499ec0b5 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit b89e63e5c326af71470124b410e6429cbd2b5c43 Author: NIIBE Yutaka Date: Fri Nov 25 16:12:26 2016 +0900 scd: Support OpenPGP card V3 for RSA. * scd/app-openpgp.c (struct app_local_s): Remove max_cmd_data and max_rsp_data fields as Extended Capabilities bits are different. (get_cached_data) Use extcap.max_certlen_3. (get_one_do): Don't use exmode=1. (determine_rsa_response): New. (get_public_key, do_genkey): Call determine_rsa_response. (do_sign): Use keyattr[0].rsa.n_bits / 8, instead of max_rsp_data. (do_auth): Use keyattr[2].rsa.n_bits / 8, instead of max_rsp_data. (do_decipher): Likewise with Use keyattr[1].rsa.n_bits / 8. (show_caps): Remove max_cmd_data and max_rsp_data. (app_select_openpgp): Likewise. -- OpenPGP card V3 had introduced incompatible change in Extended Capabilities bits. We can work around by this change by not using those bits. Signed-off-by: NIIBE Yutaka diff --git a/scd/app-openpgp.c b/scd/app-openpgp.c index d1c9efe..8de9b80 100644 --- a/scd/app-openpgp.c +++ b/scd/app-openpgp.c @@ -197,8 +197,6 @@ struct app_local_s { unsigned int sm_algo:2; /* Symmetric crypto algo for SM. */ unsigned int max_certlen_3:16; unsigned int max_get_challenge:16; /* Maximum size for get_challenge. */ - unsigned int max_cmd_data:16; /* Maximum data size for a command. */ - unsigned int max_rsp_data:16; /* Maximum size of a response. */ } extcap; /* Flags used to control the application. */ @@ -325,7 +323,7 @@ get_cached_data (app_t app, int tag, } if (try_extlen && app->app_local->cardcap.ext_lc_le) - exmode = app->app_local->extcap.max_rsp_data; + exmode = app->app_local->extcap.max_certlen_3; else exmode = 0; @@ -455,10 +453,7 @@ get_one_do (app_t app, int tag, unsigned char **result, size_t *nbytes, if (app->card_version > 0x0100 && data_objects[i].get_immediate_in_v11) { - if (data_objects[i].try_extlen && app->app_local->cardcap.ext_lc_le) - exmode = app->app_local->extcap.max_rsp_data; - else - exmode = 0; + exmode = 0; rc = iso7816_get_data (app->slot, exmode, tag, &buffer, &buflen); if (rc) { @@ -922,6 +917,22 @@ send_key_attr (ctrl_t ctrl, app_t app, const char *keyword, int keyno) } +#define RSA_SMALL_SIZE_KEY 1952 +#define RSA_SMALL_SIZE_OP 2048 + +static int +determine_rsa_response (app_t app, int keyno) +{ + int size; + + size = 2 + 3 /* header */ + + 4 /* tag+len */ + app->app_local->keyattr[keyno].rsa.n_bits/8 + + 2 /* tag+len */ + app->app_local->keyattr[keyno].rsa.e_bits/8; + + return size; +} + + /* Implement the GETATTR command. This is similar to the LEARN command but returns just one value via the status interface. */ static gpg_error_t @@ -1531,10 +1542,12 @@ get_public_key (app_t app, int keyno) int exmode, le_value; /* We may simply read the public key out of these cards. */ - if (app->app_local->cardcap.ext_lc_le) + if (app->app_local->cardcap.ext_lc_le + && app->app_local->keyattr[keyno].key_type == KEY_TYPE_RSA + && app->app_local->keyattr[keyno].rsa.n_bits > RSA_SMALL_SIZE_KEY) { exmode = 1; /* Use extended length. */ - le_value = app->app_local->extcap.max_rsp_data; + le_value = determine_rsa_response (app, keyno); } else { @@ -3769,12 +3782,11 @@ do_genkey (app_t app, ctrl_t ctrl, const char *keynostr, unsigned int flags, if (keybits > 4096) return gpg_error (GPG_ERR_TOO_LARGE); - /* Test whether we will need extended length mode. (1900 is an - arbitrary length which for sure fits into a short apdu.) */ - if (app->app_local->cardcap.ext_lc_le && keybits > 1900) + if (app->app_local->cardcap.ext_lc_le && keybits > RSA_SMALL_SIZE_KEY + && app->app_local->keyattr[keyno].key_type == KEY_TYPE_RSA) { exmode = 1; /* Use extended length w/o a limit. */ - le_value = app->app_local->extcap.max_rsp_data; + le_value = determine_rsa_response (app, keyno); /* No need to check le_value because it comes from a 16 bit value and thus can't create an overflow on a 32 bit system. */ @@ -4122,10 +4134,12 @@ do_sign (app_t app, const char *keyidstr, int hashalgo, } - if (app->app_local->cardcap.ext_lc_le) + if (app->app_local->cardcap.ext_lc_le + && app->app_local->keyattr[0].key_type == KEY_TYPE_RSA + && app->app_local->keyattr[0].rsa.n_bits > RSA_SMALL_SIZE_OP) { exmode = 1; /* Use extended length. */ - le_value = app->app_local->extcap.max_rsp_data; + le_value = app->app_local->keyattr[0].rsa.n_bits / 8; } else { @@ -4225,10 +4239,12 @@ do_auth (app_t app, const char *keyidstr, { int exmode, le_value; - if (app->app_local->cardcap.ext_lc_le) + if (app->app_local->cardcap.ext_lc_le + && app->app_local->keyattr[2].key_type == KEY_TYPE_RSA + && app->app_local->keyattr[2].rsa.n_bits > RSA_SMALL_SIZE_OP) { exmode = 1; /* Use extended length. */ - le_value = app->app_local->extcap.max_rsp_data; + le_value = app->app_local->keyattr[2].rsa.n_bits / 8; } else { @@ -4417,10 +4433,13 @@ do_decipher (app_t app, const char *keyidstr, else return gpg_error (GPG_ERR_INV_VALUE); - if (app->app_local->cardcap.ext_lc_le && indatalen > 254 ) + if (app->app_local->cardcap.ext_lc_le + && (indatalen > 254 + || (app->app_local->keyattr[1].key_type == KEY_TYPE_RSA + && app->app_local->keyattr[1].rsa.n_bits > RSA_SMALL_SIZE_OP))) { exmode = 1; /* Extended length w/o a limit. */ - le_value = app->app_local->extcap.max_rsp_data; + le_value = app->app_local->keyattr[1].rsa.n_bits / 8; } else if (app->app_local->cardcap.cmd_chaining && indatalen > 254) { @@ -4578,8 +4597,6 @@ show_caps (struct app_local_s *s) log_printf (" (%s)", s->extcap.sm_algo==2? "3DES": (s->extcap.sm_algo==2? "AES-128" : "AES-256")); log_info ("Max-Cert3-Len ..: %u\n", s->extcap.max_certlen_3); - log_info ("Max-Cmd-Data ...: %u\n", s->extcap.max_cmd_data); - log_info ("Max-Rsp-Data ...: %u\n", s->extcap.max_rsp_data); log_info ("Cmd-Chaining ...: %s\n", s->cardcap.cmd_chaining?"yes":"no"); log_info ("Ext-Lc-Le ......: %s\n", s->cardcap.ext_lc_le?"yes":"no"); log_info ("Status Indicator: %02X\n", s->status_indicator); @@ -4883,8 +4900,6 @@ app_select_openpgp (app_t app) app->app_local->extcap.max_get_challenge = (buffer[2] << 8 | buffer[3]); app->app_local->extcap.max_certlen_3 = (buffer[4] << 8 | buffer[5]); - app->app_local->extcap.max_cmd_data = (buffer[6] << 8 | buffer[7]); - app->app_local->extcap.max_rsp_data = (buffer[8] << 8 | buffer[9]); } xfree (relptr); ----------------------------------------------------------------------- Summary of changes: scd/app-openpgp.c | 61 ++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 38 insertions(+), 23 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Fri Nov 25 09:15:56 2016 From: cvs at cvs.gnupg.org (by Justus Winter) Date: Fri, 25 Nov 2016 09:15:56 +0100 Subject: [git] GPGME - branch, master, updated. gpgme-1.8.0-3-g9b22f82 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via 9b22f82afc5518961e4bea1fc516b79800e379a2 (commit) from 572c1aac107125ce62230251713349348373db5a (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 9b22f82afc5518961e4bea1fc516b79800e379a2 Author: Justus Winter Date: Fri Nov 25 09:13:01 2016 +0100 tests: Remove tofu.db. * lang/python/Makefile.am (CLEANFILES): Add 'tofu.db'. * tests/gpg/Makefile.am (CLEANFILES): Likewise. Signed-off-by: Justus Winter diff --git a/lang/python/Makefile.am b/lang/python/Makefile.am index e32fd12..d7dea4a 100644 --- a/lang/python/Makefile.am +++ b/lang/python/Makefile.am @@ -81,7 +81,7 @@ upload: dist/gpg-$(VERSION).tar.gz dist/gpg-$(VERSION).tar.gz.asc twine upload $^ CLEANFILES = gpgme.h errors.i gpgme_wrap.c gpg/gpgme.py \ - data.h config.h copystamp + data.h config.h copystamp tofu.db # Remove the rest. # diff --git a/tests/gpg/Makefile.am b/tests/gpg/Makefile.am index c46feb0..6b6b5a8 100644 --- a/tests/gpg/Makefile.am +++ b/tests/gpg/Makefile.am @@ -45,7 +45,8 @@ TESTS = initial.test $(c_tests) final.test CLEANFILES = secring.gpg pubring.gpg pubring.kbx trustdb.gpg dirmngr.conf \ gpg-agent.conf pubring.kbx~ S.gpg-agent gpg.conf pubring.gpg~ \ - random_seed S.gpg-agent .gpg-v21-migrated pubring-stamp + random_seed S.gpg-agent .gpg-v21-migrated pubring-stamp \ + tofu.db private_keys = \ 13CD0F3BDF24BE53FE192D62F18737256FF6E4FD \ ----------------------------------------------------------------------- Summary of changes: lang/python/Makefile.am | 2 +- tests/gpg/Makefile.am | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Fri Nov 25 09:41:33 2016 From: cvs at cvs.gnupg.org (by Justus Winter) Date: Fri, 25 Nov 2016 09:41:33 +0100 Subject: [git] GCRYPT - branch, master, updated. libgcrypt-1.7.3-17-g5530a82 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU crypto library". The branch, master has been updated via 5530a8234d703ce9b685f78fb6e951136eb0aeb2 (commit) from 1a67e3195896704f8b3ba09e3db1214bab834491 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 5530a8234d703ce9b685f78fb6e951136eb0aeb2 Author: Justus Winter Date: Fri Nov 25 09:38:51 2016 +0100 tests: Fix memory leak. * tests/basic.c (check_gost28147_cipher): Free cipher handles. Fixes-commit: 4f5c26c73c66daf2e4aff966e43c22b2db7e0138 Signed-off-by: Justus Winter diff --git a/tests/basic.c b/tests/basic.c index 7f7bce3..b6f4f4b 100644 --- a/tests/basic.c +++ b/tests/basic.c @@ -4033,6 +4033,9 @@ check_gost28147_cipher (void) mismatch (tv[i].plaintext, tv[i].inlen, out, tv[i].inlen); } + + gcry_cipher_close (hde); + gcry_cipher_close (hdd); } #endif ----------------------------------------------------------------------- Summary of changes: tests/basic.c | 3 +++ 1 file changed, 3 insertions(+) hooks/post-receive -- The GNU crypto library http://git.gnupg.org From cvs at cvs.gnupg.org Fri Nov 25 09:58:00 2016 From: cvs at cvs.gnupg.org (by Justus Winter) Date: Fri, 25 Nov 2016 09:58:00 +0100 Subject: [git] GPGME - branch, master, updated. gpgme-1.8.0-4-gfd4d476 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG Made Easy". The branch, master has been updated via fd4d476214ae06e33f4a6dac534d3deca5cc6cd3 (commit) from 9b22f82afc5518961e4bea1fc516b79800e379a2 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit fd4d476214ae06e33f4a6dac534d3deca5cc6cd3 Author: Justus Winter Date: Fri Nov 25 09:55:42 2016 +0100 python: Fix removing the TOFU database. * lang/python/Makefile.am (CLEANFILES): Move 'tofu.db'... * lang/python/tests/Makefile.am (CLEANFILES): ... here. Fixes-commit: 9b22f82afc5518961e4bea1fc516b79800e379a2 Signed-off-by: Justus Winter diff --git a/lang/python/Makefile.am b/lang/python/Makefile.am index d7dea4a..e32fd12 100644 --- a/lang/python/Makefile.am +++ b/lang/python/Makefile.am @@ -81,7 +81,7 @@ upload: dist/gpg-$(VERSION).tar.gz dist/gpg-$(VERSION).tar.gz.asc twine upload $^ CLEANFILES = gpgme.h errors.i gpgme_wrap.c gpg/gpgme.py \ - data.h config.h copystamp tofu.db + data.h config.h copystamp # Remove the rest. # diff --git a/lang/python/tests/Makefile.am b/lang/python/tests/Makefile.am index 39f532c..f9366dd 100644 --- a/lang/python/tests/Makefile.am +++ b/lang/python/tests/Makefile.am @@ -73,7 +73,7 @@ xcheck: ./pubring-stamp CLEANFILES = secring.gpg pubring.gpg pubring.kbx trustdb.gpg dirmngr.conf \ gpg-agent.conf pubring.kbx~ gpg.conf pubring.gpg~ \ - random_seed .gpg-v21-migrated \ + random_seed .gpg-v21-migrated tofu.db \ pubring-stamp private-keys-v1.d/gpg-sample.stamp private_keys = \ ----------------------------------------------------------------------- Summary of changes: lang/python/Makefile.am | 2 +- lang/python/tests/Makefile.am | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) hooks/post-receive -- GnuPG Made Easy http://git.gnupg.org From cvs at cvs.gnupg.org Mon Nov 28 01:46:41 2016 From: cvs at cvs.gnupg.org (by Dmitry Eremin-Solenikov) Date: Mon, 28 Nov 2016 01:46:41 +0100 Subject: [git] GCRYPT - branch, master, updated. libgcrypt-1.7.3-20-ga0580d4 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU crypto library". The branch, master has been updated via a0580d446fef648a177ca4ab060d0e449780db84 (commit) via fe6077e6ee8565bfcc91bad14a73e68f45b3c32b (commit) via ccffacaf6c3abe6120a0898db922981d28ab7af2 (commit) from 5530a8234d703ce9b685f78fb6e951136eb0aeb2 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit a0580d446fef648a177ca4ab060d0e449780db84 Author: Dmitry Eremin-Solenikov Date: Fri Nov 25 15:52:47 2016 +0300 tests: Add PBKDF2 tests for Stribog512. * tests/t-kdf.c (check_pbkdf2): Add Stribog512 test cases from TC26's additions to PKCS#5. Signed-off-by: Dmitry Eremin-Solenikov diff --git a/tests/t-kdf.c b/tests/t-kdf.c index bf31c83..4299141 100644 --- a/tests/t-kdf.c +++ b/tests/t-kdf.c @@ -1047,11 +1047,80 @@ check_pbkdf2 (void) 20, "\x43\xe0\x6c\x55\x90\xb0\x8c\x02\x25\x24" "\x23\x73\x12\x7e\xdf\x9c\x8e\x9c\x32\x91" + }, + { + "password", 8, + "salt", 4, + GCRY_MD_STRIBOG512, + 1, + 64, + "\x64\x77\x0a\xf7\xf7\x48\xc3\xb1\xc9\xac\x83\x1d\xbc\xfd\x85\xc2" + "\x61\x11\xb3\x0a\x8a\x65\x7d\xdc\x30\x56\xb8\x0c\xa7\x3e\x04\x0d" + "\x28\x54\xfd\x36\x81\x1f\x6d\x82\x5c\xc4\xab\x66\xec\x0a\x68\xa4" + "\x90\xa9\xe5\xcf\x51\x56\xb3\xa2\xb7\xee\xcd\xdb\xf9\xa1\x6b\x47" + }, + { + "password", 8, + "salt", 4, + GCRY_MD_STRIBOG512, + 2, + 64, + "\x5a\x58\x5b\xaf\xdf\xbb\x6e\x88\x30\xd6\xd6\x8a\xa3\xb4\x3a\xc0" + "\x0d\x2e\x4a\xeb\xce\x01\xc9\xb3\x1c\x2c\xae\xd5\x6f\x02\x36\xd4" + "\xd3\x4b\x2b\x8f\xbd\x2c\x4e\x89\xd5\x4d\x46\xf5\x0e\x47\xd4\x5b" + "\xba\xc3\x01\x57\x17\x43\x11\x9e\x8d\x3c\x42\xba\x66\xd3\x48\xde" + }, + { + "password", 8, + "salt", 4, + GCRY_MD_STRIBOG512, + 4096, + 64, + "\xe5\x2d\xeb\x9a\x2d\x2a\xaf\xf4\xe2\xac\x9d\x47\xa4\x1f\x34\xc2" + "\x03\x76\x59\x1c\x67\x80\x7f\x04\x77\xe3\x25\x49\xdc\x34\x1b\xc7" + "\x86\x7c\x09\x84\x1b\x6d\x58\xe2\x9d\x03\x47\xc9\x96\x30\x1d\x55" + "\xdf\x0d\x34\xe4\x7c\xf6\x8f\x4e\x3c\x2c\xda\xf1\xd9\xab\x86\xc3" + }, + /* { -- takes toooo long + "password", 8, + "salt", 4, + GCRY_MD_STRIBOG512, + 16777216, + 64, + "\x49\xe4\x84\x3b\xba\x76\xe3\x00\xaf\xe2\x4c\x4d\x23\xdc\x73\x92" + "\xde\xf1\x2f\x2c\x0e\x24\x41\x72\x36\x7c\xd7\x0a\x89\x82\xac\x36" + "\x1a\xdb\x60\x1c\x7e\x2a\x31\x4e\x8c\xb7\xb1\xe9\xdf\x84\x0e\x36" + "\xab\x56\x15\xbe\x5d\x74\x2b\x6c\xf2\x03\xfb\x55\xfd\xc4\x80\x71" + }, */ + { + "passwordPASSWORDpassword", 24, + "saltSALTsaltSALTsaltSALTsaltSALTsalt", 36, + GCRY_MD_STRIBOG512, + 4096, + 100, + "\xb2\xd8\xf1\x24\x5f\xc4\xd2\x92\x74\x80\x20\x57\xe4\xb5\x4e\x0a" + "\x07\x53\xaa\x22\xfc\x53\x76\x0b\x30\x1c\xf0\x08\x67\x9e\x58\xfe" + "\x4b\xee\x9a\xdd\xca\xe9\x9b\xa2\xb0\xb2\x0f\x43\x1a\x9c\x5e\x50" + "\xf3\x95\xc8\x93\x87\xd0\x94\x5a\xed\xec\xa6\xeb\x40\x15\xdf\xc2" + "\xbd\x24\x21\xee\x9b\xb7\x11\x83\xba\x88\x2c\xee\xbf\xef\x25\x9f" + "\x33\xf9\xe2\x7d\xc6\x17\x8c\xb8\x9d\xc3\x74\x28\xcf\x9c\xc5\x2a" + "\x2b\xaa\x2d\x3a" + }, + { + "pass\0word", 9, + "sa\0lt", 5, + GCRY_MD_STRIBOG512, + 4096, + 64, + "\x50\xdf\x06\x28\x85\xb6\x98\x01\xa3\xc1\x02\x48\xeb\x0a\x27\xab" + "\x6e\x52\x2f\xfe\xb2\x0c\x99\x1c\x66\x0f\x00\x14\x75\xd7\x3a\x4e" + "\x16\x7f\x78\x2c\x18\xe9\x7e\x92\x97\x6d\x9c\x1d\x97\x08\x31\xea" + "\x78\xcc\xb8\x79\xf6\x70\x68\xcd\xac\x19\x10\x74\x08\x44\xe8\x30" } }; int tvidx; gpg_error_t err; - unsigned char outbuf[40]; + unsigned char outbuf[100]; int i; for (tvidx=0; tvidx < DIM(tv); tvidx++) commit fe6077e6ee8565bfcc91bad14a73e68f45b3c32b Author: Dmitry Eremin-Solenikov Date: Fri Nov 25 15:52:46 2016 +0300 tests: Add Stribog HMAC tests from TC26ALG. * tests/basic.c (check_mac): add HMAC test vectors from TC26ALG document for Stribog. Signed-off-by: Dmitry Eremin-Solenikov diff --git a/tests/basic.c b/tests/basic.c index b6f4f4b..ffb4397 100644 --- a/tests/basic.c +++ b/tests/basic.c @@ -8164,6 +8164,22 @@ check_mac (void) "\x5e\xad\x03\xb7\x43\x4f\x87\xa1\x14\x8e\x17\x8f\x2a\x97\x7d\xe8" "\xbd\xb0\x37\x3b\x67\xb9\x97\x36\xa5\x82\x9b\xdc\x0d\xe4\x5a\x8c" "\x5e\xda\xb5\xca\xea\xa9\xb4\x6e\xba\xca\x25\xc8\xbf\xa1\x0e\xb0" }, + { GCRY_MAC_HMAC_STRIBOG256, + "\x01\x26\xbd\xb8\x78\x00\xaf\x21\x43\x41\x45\x65\x63\x78\x01\x00", + "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" + "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f", + "\xa1\xaa\x5f\x7d\xe4\x02\xd7\xb3\xd3\x23\xf2\x99\x1c\x8d\x45\x34" + "\x01\x31\x37\x01\x0a\x83\x75\x4f\xd0\xaf\x6d\x7c\xd4\x92\x2e\xd9", + NULL, 16, 32 }, + { GCRY_MAC_HMAC_STRIBOG512, + "\x01\x26\xbd\xb8\x78\x00\xaf\x21\x43\x41\x45\x65\x63\x78\x01\x00", + "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" + "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f", + "\xa5\x9b\xab\x22\xec\xae\x19\xc6\x5f\xbd\xe6\xe5\xf4\xe9\xf5\xd8" + "\x54\x9d\x31\xf0\x37\xf9\xdf\x9b\x90\x55\x00\xe1\x71\x92\x3a\x77" + "\x3d\x5f\x15\x30\xf2\xed\x7e\x96\x4c\xb2\xee\xdc\x29\xe9\xad\x2f" + "\x3a\xfe\x93\xb2\x81\x4f\x79\xf5\x00\x0f\xfc\x03\x66\xc2\x51\xe6", + NULL, 16, 32 }, /* CMAC AES and DES test vectors from http://web.archive.org/web/20130930212819/http://csrc.nist.gov/publica\ tions/nistpubs/800-38B/Updated_CMAC_Examples.pdf */ commit ccffacaf6c3abe6120a0898db922981d28ab7af2 Author: Dmitry Eremin-Solenikov Date: Fri Nov 25 15:52:45 2016 +0300 cipher: Add Stribog OIDs from TC26 space. * cipher/stribog.c (oid_spec_stribog256, oid_spec_stribog512): New. Signed-off-by: Dmitry Eremin-Solenikov diff --git a/cipher/stribog.c b/cipher/stribog.c index 7f38e6f..7b6e330 100644 --- a/cipher/stribog.c +++ b/cipher/stribog.c @@ -1321,10 +1321,28 @@ stribog_read_256 (void *context) return hd->result + 32; } +static gcry_md_oid_spec_t oid_spec_stribog256[] = + { + /* id-tc26-signwithdigest-gost3410-12-256 */ + { "1.2.643.7.1.1.3.2" }, + /* id-tc26-gost3411-12-256 */ + { "1.2.643.7.1.1.2.2" }, + { NULL }, + }; + +static gcry_md_oid_spec_t oid_spec_stribog512[] = + { + /* id-tc26-signwithdigest-gost3410-12-512 */ + { "1.2.643.7.1.1.3.3" }, + /* id-tc26-gost3411-12-512 */ + { "1.2.643.7.1.1.2.3" }, + { NULL }, + }; + gcry_md_spec_t _gcry_digest_spec_stribog_256 = { GCRY_MD_STRIBOG256, {0, 0}, - "STRIBOG256", NULL, 0, NULL, 32, + "STRIBOG256", NULL, 0, oid_spec_stribog256, 32, stribog_init_256, _gcry_md_block_write, stribog_final, stribog_read_256, NULL, sizeof (STRIBOG_CONTEXT) @@ -1333,7 +1351,7 @@ gcry_md_spec_t _gcry_digest_spec_stribog_256 = gcry_md_spec_t _gcry_digest_spec_stribog_512 = { GCRY_MD_STRIBOG512, {0, 0}, - "STRIBOG512", NULL, 0, NULL, 64, + "STRIBOG512", NULL, 0, oid_spec_stribog512, 64, stribog_init_512, _gcry_md_block_write, stribog_final, stribog_read_512, NULL, sizeof (STRIBOG_CONTEXT) ----------------------------------------------------------------------- Summary of changes: cipher/stribog.c | 22 ++++++++++++++++-- tests/basic.c | 16 +++++++++++++ tests/t-kdf.c | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 106 insertions(+), 3 deletions(-) hooks/post-receive -- The GNU crypto library http://git.gnupg.org From cvs at cvs.gnupg.org Mon Nov 28 01:53:27 2016 From: cvs at cvs.gnupg.org (by Dmitry Eremin-Solenikov) Date: Mon, 28 Nov 2016 01:53:27 +0100 Subject: [git] GCRYPT - branch, LIBGCRYPT-1-7-BRANCH, updated. libgcrypt-1.7.3-19-ga8b2d8b Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU crypto library". The branch, LIBGCRYPT-1-7-BRANCH has been updated via a8b2d8b502d9cbc9157c261f12e4623ec20b3960 (commit) via 432eaf2ab83631a4e70ad4ecd20a9b6f81c1c329 (commit) via d0940e3d194296bc334f06f97ae91b411e1f152f (commit) via 4bfec0a52af8c847f558b9ade56d896c224019b3 (commit) from a22d7bb3945cec2d8a6b23d8f2bd2f675bb2f4e6 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit a8b2d8b502d9cbc9157c261f12e4623ec20b3960 Author: Dmitry Eremin-Solenikov Date: Fri Nov 25 15:52:47 2016 +0300 tests: Add PBKDF2 tests for Stribog512. * tests/t-kdf.c (check_pbkdf2): Add Stribog512 test cases from TC26's additions to PKCS#5. -- Signed-off-by: Dmitry Eremin-Solenikov Backport from master commit: a0580d446fef648a177ca4ab060d0e449780db84 diff --git a/tests/t-kdf.c b/tests/t-kdf.c index bf31c83..4299141 100644 --- a/tests/t-kdf.c +++ b/tests/t-kdf.c @@ -1047,11 +1047,80 @@ check_pbkdf2 (void) 20, "\x43\xe0\x6c\x55\x90\xb0\x8c\x02\x25\x24" "\x23\x73\x12\x7e\xdf\x9c\x8e\x9c\x32\x91" + }, + { + "password", 8, + "salt", 4, + GCRY_MD_STRIBOG512, + 1, + 64, + "\x64\x77\x0a\xf7\xf7\x48\xc3\xb1\xc9\xac\x83\x1d\xbc\xfd\x85\xc2" + "\x61\x11\xb3\x0a\x8a\x65\x7d\xdc\x30\x56\xb8\x0c\xa7\x3e\x04\x0d" + "\x28\x54\xfd\x36\x81\x1f\x6d\x82\x5c\xc4\xab\x66\xec\x0a\x68\xa4" + "\x90\xa9\xe5\xcf\x51\x56\xb3\xa2\xb7\xee\xcd\xdb\xf9\xa1\x6b\x47" + }, + { + "password", 8, + "salt", 4, + GCRY_MD_STRIBOG512, + 2, + 64, + "\x5a\x58\x5b\xaf\xdf\xbb\x6e\x88\x30\xd6\xd6\x8a\xa3\xb4\x3a\xc0" + "\x0d\x2e\x4a\xeb\xce\x01\xc9\xb3\x1c\x2c\xae\xd5\x6f\x02\x36\xd4" + "\xd3\x4b\x2b\x8f\xbd\x2c\x4e\x89\xd5\x4d\x46\xf5\x0e\x47\xd4\x5b" + "\xba\xc3\x01\x57\x17\x43\x11\x9e\x8d\x3c\x42\xba\x66\xd3\x48\xde" + }, + { + "password", 8, + "salt", 4, + GCRY_MD_STRIBOG512, + 4096, + 64, + "\xe5\x2d\xeb\x9a\x2d\x2a\xaf\xf4\xe2\xac\x9d\x47\xa4\x1f\x34\xc2" + "\x03\x76\x59\x1c\x67\x80\x7f\x04\x77\xe3\x25\x49\xdc\x34\x1b\xc7" + "\x86\x7c\x09\x84\x1b\x6d\x58\xe2\x9d\x03\x47\xc9\x96\x30\x1d\x55" + "\xdf\x0d\x34\xe4\x7c\xf6\x8f\x4e\x3c\x2c\xda\xf1\xd9\xab\x86\xc3" + }, + /* { -- takes toooo long + "password", 8, + "salt", 4, + GCRY_MD_STRIBOG512, + 16777216, + 64, + "\x49\xe4\x84\x3b\xba\x76\xe3\x00\xaf\xe2\x4c\x4d\x23\xdc\x73\x92" + "\xde\xf1\x2f\x2c\x0e\x24\x41\x72\x36\x7c\xd7\x0a\x89\x82\xac\x36" + "\x1a\xdb\x60\x1c\x7e\x2a\x31\x4e\x8c\xb7\xb1\xe9\xdf\x84\x0e\x36" + "\xab\x56\x15\xbe\x5d\x74\x2b\x6c\xf2\x03\xfb\x55\xfd\xc4\x80\x71" + }, */ + { + "passwordPASSWORDpassword", 24, + "saltSALTsaltSALTsaltSALTsaltSALTsalt", 36, + GCRY_MD_STRIBOG512, + 4096, + 100, + "\xb2\xd8\xf1\x24\x5f\xc4\xd2\x92\x74\x80\x20\x57\xe4\xb5\x4e\x0a" + "\x07\x53\xaa\x22\xfc\x53\x76\x0b\x30\x1c\xf0\x08\x67\x9e\x58\xfe" + "\x4b\xee\x9a\xdd\xca\xe9\x9b\xa2\xb0\xb2\x0f\x43\x1a\x9c\x5e\x50" + "\xf3\x95\xc8\x93\x87\xd0\x94\x5a\xed\xec\xa6\xeb\x40\x15\xdf\xc2" + "\xbd\x24\x21\xee\x9b\xb7\x11\x83\xba\x88\x2c\xee\xbf\xef\x25\x9f" + "\x33\xf9\xe2\x7d\xc6\x17\x8c\xb8\x9d\xc3\x74\x28\xcf\x9c\xc5\x2a" + "\x2b\xaa\x2d\x3a" + }, + { + "pass\0word", 9, + "sa\0lt", 5, + GCRY_MD_STRIBOG512, + 4096, + 64, + "\x50\xdf\x06\x28\x85\xb6\x98\x01\xa3\xc1\x02\x48\xeb\x0a\x27\xab" + "\x6e\x52\x2f\xfe\xb2\x0c\x99\x1c\x66\x0f\x00\x14\x75\xd7\x3a\x4e" + "\x16\x7f\x78\x2c\x18\xe9\x7e\x92\x97\x6d\x9c\x1d\x97\x08\x31\xea" + "\x78\xcc\xb8\x79\xf6\x70\x68\xcd\xac\x19\x10\x74\x08\x44\xe8\x30" } }; int tvidx; gpg_error_t err; - unsigned char outbuf[40]; + unsigned char outbuf[100]; int i; for (tvidx=0; tvidx < DIM(tv); tvidx++) commit 432eaf2ab83631a4e70ad4ecd20a9b6f81c1c329 Author: Dmitry Eremin-Solenikov Date: Fri Nov 25 15:52:46 2016 +0300 tests: Add Stribog HMAC tests from TC26ALG. * tests/basic.c (check_mac): add HMAC test vectors from TC26ALG document for Stribog. -- Signed-off-by: Dmitry Eremin-Solenikov Backport from master commit: fe6077e6ee8565bfcc91bad14a73e68f45b3c32b diff --git a/tests/basic.c b/tests/basic.c index b6f4f4b..ffb4397 100644 --- a/tests/basic.c +++ b/tests/basic.c @@ -8164,6 +8164,22 @@ check_mac (void) "\x5e\xad\x03\xb7\x43\x4f\x87\xa1\x14\x8e\x17\x8f\x2a\x97\x7d\xe8" "\xbd\xb0\x37\x3b\x67\xb9\x97\x36\xa5\x82\x9b\xdc\x0d\xe4\x5a\x8c" "\x5e\xda\xb5\xca\xea\xa9\xb4\x6e\xba\xca\x25\xc8\xbf\xa1\x0e\xb0" }, + { GCRY_MAC_HMAC_STRIBOG256, + "\x01\x26\xbd\xb8\x78\x00\xaf\x21\x43\x41\x45\x65\x63\x78\x01\x00", + "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" + "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f", + "\xa1\xaa\x5f\x7d\xe4\x02\xd7\xb3\xd3\x23\xf2\x99\x1c\x8d\x45\x34" + "\x01\x31\x37\x01\x0a\x83\x75\x4f\xd0\xaf\x6d\x7c\xd4\x92\x2e\xd9", + NULL, 16, 32 }, + { GCRY_MAC_HMAC_STRIBOG512, + "\x01\x26\xbd\xb8\x78\x00\xaf\x21\x43\x41\x45\x65\x63\x78\x01\x00", + "\x00\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f" + "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f", + "\xa5\x9b\xab\x22\xec\xae\x19\xc6\x5f\xbd\xe6\xe5\xf4\xe9\xf5\xd8" + "\x54\x9d\x31\xf0\x37\xf9\xdf\x9b\x90\x55\x00\xe1\x71\x92\x3a\x77" + "\x3d\x5f\x15\x30\xf2\xed\x7e\x96\x4c\xb2\xee\xdc\x29\xe9\xad\x2f" + "\x3a\xfe\x93\xb2\x81\x4f\x79\xf5\x00\x0f\xfc\x03\x66\xc2\x51\xe6", + NULL, 16, 32 }, /* CMAC AES and DES test vectors from http://web.archive.org/web/20130930212819/http://csrc.nist.gov/publica\ tions/nistpubs/800-38B/Updated_CMAC_Examples.pdf */ commit d0940e3d194296bc334f06f97ae91b411e1f152f Author: Dmitry Eremin-Solenikov Date: Fri Nov 25 15:52:45 2016 +0300 cipher: Add Stribog OIDs from TC26 space. * cipher/stribog.c (oid_spec_stribog256, oid_spec_stribog512): New. -- Signed-off-by: Dmitry Eremin-Solenikov Backport from master commit: ccffacaf6c3abe6120a0898db922981d28ab7af2 diff --git a/cipher/stribog.c b/cipher/stribog.c index 7f38e6f..7b6e330 100644 --- a/cipher/stribog.c +++ b/cipher/stribog.c @@ -1321,10 +1321,28 @@ stribog_read_256 (void *context) return hd->result + 32; } +static gcry_md_oid_spec_t oid_spec_stribog256[] = + { + /* id-tc26-signwithdigest-gost3410-12-256 */ + { "1.2.643.7.1.1.3.2" }, + /* id-tc26-gost3411-12-256 */ + { "1.2.643.7.1.1.2.2" }, + { NULL }, + }; + +static gcry_md_oid_spec_t oid_spec_stribog512[] = + { + /* id-tc26-signwithdigest-gost3410-12-512 */ + { "1.2.643.7.1.1.3.3" }, + /* id-tc26-gost3411-12-512 */ + { "1.2.643.7.1.1.2.3" }, + { NULL }, + }; + gcry_md_spec_t _gcry_digest_spec_stribog_256 = { GCRY_MD_STRIBOG256, {0, 0}, - "STRIBOG256", NULL, 0, NULL, 32, + "STRIBOG256", NULL, 0, oid_spec_stribog256, 32, stribog_init_256, _gcry_md_block_write, stribog_final, stribog_read_256, NULL, sizeof (STRIBOG_CONTEXT) @@ -1333,7 +1351,7 @@ gcry_md_spec_t _gcry_digest_spec_stribog_256 = gcry_md_spec_t _gcry_digest_spec_stribog_512 = { GCRY_MD_STRIBOG512, {0, 0}, - "STRIBOG512", NULL, 0, NULL, 64, + "STRIBOG512", NULL, 0, oid_spec_stribog512, 64, stribog_init_512, _gcry_md_block_write, stribog_final, stribog_read_512, NULL, sizeof (STRIBOG_CONTEXT) commit 4bfec0a52af8c847f558b9ade56d896c224019b3 Author: Justus Winter Date: Fri Nov 25 09:38:51 2016 +0100 tests: Fix memory leak. * tests/basic.c (check_gost28147_cipher): Free cipher handles. -- Fixes-commit: 4f5c26c73c66daf2e4aff966e43c22b2db7e0138 Signed-off-by: Justus Winter Backport from master commit: 5530a8234d703ce9b685f78fb6e951136eb0aeb2 diff --git a/tests/basic.c b/tests/basic.c index 7f7bce3..b6f4f4b 100644 --- a/tests/basic.c +++ b/tests/basic.c @@ -4033,6 +4033,9 @@ check_gost28147_cipher (void) mismatch (tv[i].plaintext, tv[i].inlen, out, tv[i].inlen); } + + gcry_cipher_close (hde); + gcry_cipher_close (hdd); } #endif ----------------------------------------------------------------------- Summary of changes: cipher/stribog.c | 22 ++++++++++++++++-- tests/basic.c | 19 +++++++++++++++ tests/t-kdf.c | 71 +++++++++++++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 109 insertions(+), 3 deletions(-) hooks/post-receive -- The GNU crypto library http://git.gnupg.org From cvs at cvs.gnupg.org Mon Nov 28 12:41:10 2016 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Mon, 28 Nov 2016 12:41:10 +0100 Subject: [git] GpgOL - branch, master, updated. gpgol-1.4.0-182-gf098d08 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG extension for MS Outlook". The branch, master has been updated via f098d08f7bb700e8b1e4868838c79aab844e3ffa (commit) via 3517d6d33ce05c9c55e3e5400bd1d7f5eee13419 (commit) from 72c2ebb31d68d2c1c9999cb5180964f834152891 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit f098d08f7bb700e8b1e4868838c79aab844e3ffa Author: Andre Heinecke Date: Mon Nov 28 12:38:44 2016 +0100 Use inline text as body if no body seen * src/mimedataprovider.cpp (t2body): Use first text attachment as body if it is an inline attachment. (MimeDataProvider::create_attachment): Log the attachment name. -- This fixes handling mails from kmail 1 diff --git a/src/mimedataprovider.cpp b/src/mimedataprovider.cpp index 9e27844..bb74bc1 100644 --- a/src/mimedataprovider.cpp +++ b/src/mimedataprovider.cpp @@ -214,7 +214,14 @@ t2body (MimeDataProvider *provider, rfc822parse_t msg) if (s && strcmp (s, "inline")) not_inline_text = 1; */ - is_text_attachment = 1; + if (ctx->body_seen) + { + /* Some MUA's like kontact e3.5 send the body as + an inline text attachment. So if we have not + seen the body yet we treat the first text/plain + element as the body and not as an inline attachment. */ + is_text_attachment = 1; + } rfc822parse_release_field (field); } @@ -864,6 +871,8 @@ MimeDataProvider::create_attachment() } else { + log_mime_parser ("%s:%s: Attachment filename: %s", + SRCNAME, __func__, m_mime_ctx->mimestruct_cur->filename); attach->set_display_name (m_mime_ctx->mimestruct_cur->filename); } } commit 3517d6d33ce05c9c55e3e5400bd1d7f5eee13419 Author: Andre Heinecke Date: Mon Nov 28 12:36:13 2016 +0100 Handle detected attachments without filenames * src/mail.cpp (Mail::add_attachments): Ingore attachments without filenames. (Mail::parsing_done): Don't fail hard on attachment add failure. -- This fixes the case if some mimestructure or unknown multipart/mixed attachments like the "private-headers" mimepart from Enigmail is present. Before this the first empty attachment filename would result in an error and no other attachments would have been shown. diff --git a/src/mail.cpp b/src/mail.cpp index 03e3347..1db0d6f 100644 --- a/src/mail.cpp +++ b/src/mail.cpp @@ -409,6 +409,12 @@ add_attachments(LPDISPATCH mail, int err = 0; for (auto att: attachments) { + if (att->get_display_name().empty()) + { + log_error ("%s:%s: Ignoring attachment without display name.", + SRCNAME, __func__); + continue; + } wchar_t* wchar_name = utf8_to_wchar (att->get_display_name().c_str()); HANDLE hFile; wchar_t* wchar_file = get_tmp_outfile (GpgOLStr (att->get_display_name().c_str()), @@ -433,12 +439,8 @@ add_attachments(LPDISPATCH mail, } xfree (wchar_file); xfree (wchar_name); - if (err) - { - return err; - } } - return 0; + return err; } GPGRT_LOCK_DEFINE(parser_lock); @@ -663,7 +665,6 @@ Mail::parsing_done() { log_error ("%s:%s: Failed to update attachments.", SRCNAME, __func__); - return; } /* Invalidate UI to set the correct sig status. */ ----------------------------------------------------------------------- Summary of changes: src/mail.cpp | 13 +++++++------ src/mimedataprovider.cpp | 11 ++++++++++- 2 files changed, 17 insertions(+), 7 deletions(-) hooks/post-receive -- GnuPG extension for MS Outlook http://git.gnupg.org From cvs at cvs.gnupg.org Mon Nov 28 13:52:03 2016 From: cvs at cvs.gnupg.org (by Justus Winter) Date: Mon, 28 Nov 2016 13:52:03 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.1.16-26-g47b8b9e Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via 47b8b9e2ce5af7fba117ae0b00e10bec414dcfb0 (commit) via 4db9a425644dccaf81b51ebc97b32a9cc21941a4 (commit) via cc1d21342659a7def5d662d0547579f9e0d3b109 (commit) from b89e63e5c326af71470124b410e6429cbd2b5c43 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 47b8b9e2ce5af7fba117ae0b00e10bec414dcfb0 Author: Justus Winter Date: Mon Nov 28 13:47:07 2016 +0100 tests: Add test for the ssh key export. * tests/openpgp/Makefile.am (XTESTS): Add new test. (sample_keys): Add new files. * tests/openpgp/samplekeys/authenticate-only.pub.asc: New file. * tests/openpgp/samplekeys/authenticate-only.sec.asc: Likewise. * tests/openpgp/ssh-export.scm: Likewise. GnuPG-bug-id: 2848 Signed-off-by: Justus Winter diff --git a/tests/openpgp/Makefile.am b/tests/openpgp/Makefile.am index 532cdb3..3cdf3d1 100644 --- a/tests/openpgp/Makefile.am +++ b/tests/openpgp/Makefile.am @@ -81,6 +81,7 @@ XTESTS = \ default-key.scm \ export.scm \ ssh-import.scm \ + ssh-export.scm \ quick-key-manipulation.scm \ key-selection.scm \ issue2015.scm \ @@ -186,7 +187,9 @@ sample_keys = samplekeys/README \ samplekeys/ssh-ecdsa.key \ samplekeys/ssh-ed25519.key \ samplekeys/ssh-rsa.key \ - samplekeys/issue2346.gpg + samplekeys/issue2346.gpg \ + samplekeys/authenticate-only.pub.asc \ + samplekeys/authenticate-only.sec.asc sample_msgs = samplemsgs/issue2419.asc diff --git a/tests/openpgp/samplekeys/authenticate-only.pub.asc b/tests/openpgp/samplekeys/authenticate-only.pub.asc new file mode 100644 index 0000000..a08a003 --- /dev/null +++ b/tests/openpgp/samplekeys/authenticate-only.pub.asc @@ -0,0 +1,31 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- + +mQENBFg8F68BCAC5VS/59Nrg5mw+wEAnk/vi0CGI+K5rGTmyAruy/aiS4kYfUJiE +Pq/JZYCeNQ9GTbJN5M+Fiv1bhw6xeEfl4FAC/A0Uo39fvUSLJH2V+8lT3GxXt8KR +Yx8MvotvoKiG1DRvgnwRh1qibX6+htJahPwHDViUuFz0ZeEPWiCwuoMOELmiTsuE +VZbQsv08BwCOzIc3M8s63TtwMCUe+MBhqfRjEu6/Gt7miuGGVFXB96ao2O9u1HsR +7cUjgVQp6JwGLgIIijjy167Ms+fKZetqA9tzu1C1SAtNYiqmAUoqGG1YEjS7oApo +AKmHD+LGCMUPg5d6bhw+NyHjDAFWJEYv3kG3ABEBAAG0NVRlc3QgS2V5IChkbyBu +b3QgdXNlKSA8YXV0aGVudGljYXRlLW9ubHlAZXhhbXBsZS5vcmc+iQFOBBMBCAA4 +FiEEkn7zd/0aG295XkDAKoeRfY/7pJ8FAlg8F68CGwEFCwkIBwIGFQgJCgsCBBYC +AwECHgECF4AACgkQKoeRfY/7pJ9+zAf9FVZknDCWCNY42+RIR36fq2l1Gs8KfMsX +rNXtfYPtLqioP8fz2LE0LoudSsZMLVygonPG0ZAxdIUHXcFdUqPrEzs4fEyR4xae +OSxui2Q/u6+9bi7eilYYzVNRWkuyx2TrRQZEjMXMnuJcWptGbRWs/ipRUZBHWfLl +2udLl+0TRIL7hni06xVCHbwE5szcLoyzzvIowGVADXFqeG7nty7uRNZNAD+ZWMH2 +J0vspZlUSVi7z1VygzDI3U42SMJmVqnRmICsB3QLI8Ns4nxWXO2z8fheSFcrP+LA +cY3W6JgnLCzvyuogxnWmd4fzr1iB3E2Hcy/sr0cgQ5wtuseQRhmTlrkBDQRYPBfZ +AQgAtKcbBYrIqh3cRTqyZjMxw492RVQoFawYmpr1bQ4HphVGnT4IhJZQ4DAm1JJZ +QjzwDQiZMc1wD9Om6UC/g8gUBuFCpLCobwBzjH4an/G3Cfa8zGz5ANAROo5i5T1j +vgoFEFdVue/GpAmMNixz+0ItQBh9jiOC6IYk1yyv/OsTzsj6AHnH0XiDpGoTNkca +tb6Mu1VcXTMNf620Mxj6c7WE7awxL6MwKIa7XQSgXaO+JnbB+5Szz1wZ1ZhlnDp3 +KOurlfcXIbZirEaqmRByb+V21Dj3icXOJEj1RUbyVNqBS8rhw17kSxcehw/6ZAMW +ehDmhXO98VVUknS0Mf+OJBi2JwARAQABiQE2BBgBCAAgFiEEkn7zd/0aG295XkDA +KoeRfY/7pJ8FAlg8F9kCGyAACgkQKoeRfY/7pJ+sawf/eSjxxAglAdolF9lK070u +VmMgq4GFPqJ3RqJPUFjwEFFSYLXkiALnMGXDSmOfPqCQ4c+PWwumFhKCz4MXVDD8 +x6mi9Z+HlEwIMaCnckrSTuQ5OgwO/6vkhz42OcgMZ3WQnWfNVM8jbNP9vX1vroPe +HLFaPGy9KJMM0Z/hlCIIeyK/a90zWlT5UMfRoqNQRbY/iiYdmpvf69I9PobGVbo/ +7ahZTumPWwjiGOztNXeuo5UUaAVVxMQBYKp2w3wil2sHzYfTfYUSMyh+oUFx4Xlz +WF3bLzsafRaeuK1h5+JuvIcimvU5zWZtn0hOpiIXpZOoJvvM9r5D4ZRT5UX2blQ8 +Pw== +=vt5C +-----END PGP PUBLIC KEY BLOCK----- diff --git a/tests/openpgp/samplekeys/authenticate-only.sec.asc b/tests/openpgp/samplekeys/authenticate-only.sec.asc new file mode 100644 index 0000000..109a7a1 --- /dev/null +++ b/tests/openpgp/samplekeys/authenticate-only.sec.asc @@ -0,0 +1,60 @@ +-----BEGIN PGP PRIVATE KEY BLOCK----- + +lQPGBFg8F68BCAC5VS/59Nrg5mw+wEAnk/vi0CGI+K5rGTmyAruy/aiS4kYfUJiE +Pq/JZYCeNQ9GTbJN5M+Fiv1bhw6xeEfl4FAC/A0Uo39fvUSLJH2V+8lT3GxXt8KR +Yx8MvotvoKiG1DRvgnwRh1qibX6+htJahPwHDViUuFz0ZeEPWiCwuoMOELmiTsuE +VZbQsv08BwCOzIc3M8s63TtwMCUe+MBhqfRjEu6/Gt7miuGGVFXB96ao2O9u1HsR +7cUjgVQp6JwGLgIIijjy167Ms+fKZetqA9tzu1C1SAtNYiqmAUoqGG1YEjS7oApo +AKmHD+LGCMUPg5d6bhw+NyHjDAFWJEYv3kG3ABEBAAH+BwMCzWzbxiWo+krZWBSs +jFH7f5mn3T/L0PBesTdqiwKwUOj8Fltri+6OY9G028CJB4UlTrEmvD4zdu7HFlvo +XgrNhZiE8INjEY6QDrNTKNX474dWcCQDDinz6NIwitYNMkv//Ct19qhrqd9WpGVH +QtKVe0BOHimiokpqu3YBMvV8tZmM2Am8vN32nn/lHo8G/UhSRVnYewazSvAjCSPG +OqJAPuD3vldssTgpPA2BhBeh6Q7jDkghGfd97a1LkB+JpuDF6UNXs1OxVthONb7q +ScEsxUhiYne7LrglzZhfDdqsRWcyQyaTzIg/3tOh69hRI2I+8EoJJ9PeLx4rMGFJ +Z0DkgSbUwXDYYa8GgewT5yZSkfJyhcx/q8eI3PW39TB0YI48TaN3KufzqS+U8ITz +bQygpzX2WGBXKcwXV0zDXjpapqd/77m600FhvrrIJuJNGmNNSQ1eWAYmY13rmR1R +7aXRrocVlF3ZPfWzKLi6DophmW0vfcwlt9XxgQ2VxF0rk2f6OF4WcTYbaOCwh8M3 +Ffo98i3OO+upHsJLKyvQRrM1/LVeecGTxV9cXOnE+YB+aU36AS+AjeLRTqM2ZbzU +UgNTdkcs6+8B4q3XMWtTojXXCYfHMpFYu2FuKT+cXi1UEKWF7/Rhu2i3aeRahRLF +zdtSwWhbx0WNqH4BL4hhGZ85BUXKrOwdDiRyzgzKQilwWXu1ZEJuaWrY+vxdqdxi +PyikwO7/JXlBgcICO7v5hKDVuHGll8jP1CQU3hvfcSKuzny++ComI3ND2H2Wj3Jh +ocz9/7Z+hAp/RMeE2MbptvnJTzeTEg/Wk2aMt6ArxEKCpcpvXlvm5TENl20/oejo +H/o6DNJhtU75AI5tQZ315cXfK56ae0Swc90UGPImTDl3LiG+qTgQbcHdNV+I0zL9 +FeqvLZg5ZgpBtDVUZXN0IEtleSAoZG8gbm90IHVzZSkgPGF1dGhlbnRpY2F0ZS1v +bmx5QGV4YW1wbGUub3JnPokBTgQTAQgAOBYhBJJ+83f9GhtveV5AwCqHkX2P+6Sf +BQJYPBevAhsBBQsJCAcCBhUICQoLAgQWAgMBAh4BAheAAAoJECqHkX2P+6SffswH +/RVWZJwwlgjWONvkSEd+n6tpdRrPCnzLF6zV7X2D7S6oqD/H89ixNC6LnUrGTC1c +oKJzxtGQMXSFB13BXVKj6xM7OHxMkeMWnjksbotkP7uvvW4u3opWGM1TUVpLssdk +60UGRIzFzJ7iXFqbRm0VrP4qUVGQR1ny5drnS5ftE0SC+4Z4tOsVQh28BObM3C6M +s87yKMBlQA1xanhu57cu7kTWTQA/mVjB9idL7KWZVElYu89VcoMwyN1ONkjCZlap +0ZiArAd0CyPDbOJ8Vlzts/H4XkhXKz/iwHGN1uiYJyws78rqIMZ1pneH869YgdxN +h3Mv7K9HIEOcLbrHkEYZk5adA8YEWDwX2QEIALSnGwWKyKod3EU6smYzMcOPdkVU +KBWsGJqa9W0OB6YVRp0+CISWUOAwJtSSWUI88A0ImTHNcA/TpulAv4PIFAbhQqSw +qG8Ac4x+Gp/xtwn2vMxs+QDQETqOYuU9Y74KBRBXVbnvxqQJjDYsc/tCLUAYfY4j +guiGJNcsr/zrE87I+gB5x9F4g6RqEzZHGrW+jLtVXF0zDX+ttDMY+nO1hO2sMS+j +MCiGu10EoF2jviZ2wfuUs89cGdWYZZw6dyjrq5X3FyG2YqxGqpkQcm/ldtQ494nF +ziRI9UVG8lTagUvK4cNe5EsXHocP+mQDFnoQ5oVzvfFVVJJ0tDH/jiQYticAEQEA +Af4HAwLbL5r0DsoKEtmeahTDsYhsRTH/hmOPCGKyjhblVfWoNVQjmrDNsRVrPx+2 +CVj304Npu9XpkKsgp/U20pv6y00xET/l+FfftyN5zUTdGC4qi0gN3AXE5amQkbnJ +/ItzUTnf8YPYenSKioiQSrk39Q+ikRZ3WBIPVQcMR2bPnzAobNupit5fgS7e/aRA +0vswD12SeqqNM82JWAuSFJc51F+Gn8xTkWnnK2AdA8Rz351qqUHpmFwg8kaRVhVe +TwSP7nAN5JPS7lrr91vvp3jRlH84XgaUxFk/8Gm8pSNN4tyxNjo9Cv6YaG0PR/rO +skg6G/9AfqVtAuRyaRNu1HP/JPDyuGGEqOt7mfMr2vd43a5LTVO3EkO5OfQkXg1/ +t2HXn6dzc0hBolq0pWAUU+sVwZD9h2F8pEWPPyeInv5H4c95J9HU466tro9VJpvm +p/iw55evDiBRAu+nNkCI8eyFEpB06d3ikjxLAJ5xS3Fb6Vj3PX0TdZMieRNHQXlt +Gpi8UQOpOLhj+lytW9NYCGG3SYcy2ytYVgs2IoIycx37c4tz5+v1yi8/FvnQPPTf +8LjLZUrrFL6GRJm0fNtp0I3jm5Ic/oESQ4UDrVmQO1+G6/+9iOalgA7x67+X13rD +6nz0Et0WBH0HpZrOEFe2b07livdfs5gS3xtyqyMBRLu4lKYDWYJ55R0nbMiwQ1dQ +EG5U/ur0E1ENJeFDE2MmL06RIXtizVcGmoU23m/tAEShNJBaHGe1qKKDGk8lutmF +9S4UN5eXE3qzBJmqWQTG4/z2N+QRB/Nj6h1IbKPvAMML2c5vdI1V1LniCa55vytJ +F6Ngtyw6f7M2UVqyPr6FZmzZyw6SPxjGqFUcp/o30Pqm6k0AYr3HVQLLnCM9vpCY +Y73QV1EOpBNPNIPTyiWWFSnrXID6xoObHg2JATYEGAEIACAWIQSSfvN3/Robb3le +QMAqh5F9j/uknwUCWDwX2QIbIAAKCRAqh5F9j/ukn6xrB/95KPHECCUB2iUX2UrT +vS5WYyCrgYU+ondGok9QWPAQUVJgteSIAucwZcNKY58+oJDhz49bC6YWEoLPgxdU +MPzHqaL1n4eUTAgxoKdyStJO5Dk6DA7/q+SHPjY5yAxndZCdZ81UzyNs0/29fW+u +g94csVo8bL0okwzRn+GUIgh7Ir9r3TNaVPlQx9Gio1BFtj+KJh2am9/r0j0+hsZV +uj/tqFlO6Y9bCOIY7O01d66jlRRoBVXExAFgqnbDfCKXawfNh9N9hRIzKH6hQXHh +eXNYXdsvOxp9Fp64rWHn4m68hyKa9TnNZm2fSE6mIhelk6gm+8z2vkPhlFPlRfZu +VDw/ +=vLFX +-----END PGP PRIVATE KEY BLOCK----- diff --git a/tests/openpgp/ssh-export.scm b/tests/openpgp/ssh-export.scm new file mode 100755 index 0000000..322620e --- /dev/null +++ b/tests/openpgp/ssh-export.scm @@ -0,0 +1,52 @@ +#!/usr/bin/env gpgscm + +;; Copyright (C) 2016 g10 Code GmbH +;; +;; This file is part of GnuPG. +;; +;; GnuPG is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 3 of the License, or +;; (at your option) any later version. +;; +;; GnuPG 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 General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with this program; if not, see . + +(load (with-path "defs.scm")) +(setup-environment) + +(define key + `(,(in-srcdir "samplekeys" "authenticate-only.sec.asc") + "927EF377FD1A1B6F795E40C02A87917D8FFBA49F" + "72360FDB6380212D5DAF2FA9E51185A9253C496D" + "ssh-rsa")) + +(define :file car) +(define :fpr cadr) +(define :subkey-fpr caddr) +(define :kind cadddr) + +;; Return true if a-str and b-str share a suffix of length n. +(define (string-common-suffix? n a-str b-str) + (let ((a-len (string-length a-str)) + (b-len (string-length b-str))) + (if (> n (min a-len b-len)) + #f + (string=? (substring a-str (- a-len n) a-len) + (substring b-str (- b-len n) b-len))))) + +(info "Checking ssh export...") +(call-check `(, at GPG --yes --import ,(:file key))) + +(let* ((result (call-check `(, at GPG --export-ssh-key ,(:fpr key)))) + ;; XXX: We should split at any whitespace here. + (parts (string-split (string-trim char-whitespace? result) #\space))) + (assert (string=? (car parts) (:kind key))) + ;; XXX: We should not use a short keyid as the comment when + ;; exporting an ssh key. + (assert (string-common-suffix? 8 (caddr parts) (:subkey-fpr key)))) commit 4db9a425644dccaf81b51ebc97b32a9cc21941a4 Author: Justus Winter Date: Mon Nov 28 13:36:56 2016 +0100 g10: Fix iteration over getkey results. * g10/getkey.c (getkey_next): Only ask 'lookup' for the exact match if our caller requested the key. Fixes a crash in 'lookup'. GnuPG-bug-id: 2848 Fixes-commit: 1d03cc77e1706f7da653153ad4b58c61e4fd2573 Signed-off-by: Justus Winter diff --git a/g10/getkey.c b/g10/getkey.c index 68e6a1b..6eec087 100644 --- a/g10/getkey.c +++ b/g10/getkey.c @@ -2178,7 +2178,7 @@ getkey_next (getkey_ctx_t ctx, PKT_public_key *pk, kbnode_t *ret_keyblock) if (pk && ret_keyblock == NULL) ret_keyblock = &keyblock; - rc = lookup (ctx, ret_keyblock, &found_key, ctx->want_secret); + rc = lookup (ctx, ret_keyblock, pk ? &found_key : NULL, ctx->want_secret); if (!rc && pk) { log_assert (found_key); commit cc1d21342659a7def5d662d0547579f9e0d3b109 Author: Justus Winter Date: Mon Nov 28 12:36:33 2016 +0100 tests: Rename ssh test. * tests/openpgp/ssh.scm: Rename to 'ssh-import.scm'. * tests/openpgp/Makefile (XTESTS): Likewise. Signed-off-by: Justus Winter diff --git a/tests/openpgp/Makefile.am b/tests/openpgp/Makefile.am index 8f565b3..532cdb3 100644 --- a/tests/openpgp/Makefile.am +++ b/tests/openpgp/Makefile.am @@ -80,7 +80,7 @@ XTESTS = \ use-exact-key.scm \ default-key.scm \ export.scm \ - ssh.scm \ + ssh-import.scm \ quick-key-manipulation.scm \ key-selection.scm \ issue2015.scm \ diff --git a/tests/openpgp/ssh.scm b/tests/openpgp/ssh-import.scm similarity index 100% rename from tests/openpgp/ssh.scm rename to tests/openpgp/ssh-import.scm ----------------------------------------------------------------------- Summary of changes: g10/getkey.c | 2 +- tests/openpgp/Makefile.am | 7 ++- tests/openpgp/samplekeys/authenticate-only.pub.asc | 31 +++++++++++ tests/openpgp/samplekeys/authenticate-only.sec.asc | 60 ++++++++++++++++++++++ tests/openpgp/ssh-export.scm | 52 +++++++++++++++++++ tests/openpgp/{ssh.scm => ssh-import.scm} | 0 6 files changed, 149 insertions(+), 3 deletions(-) create mode 100644 tests/openpgp/samplekeys/authenticate-only.pub.asc create mode 100644 tests/openpgp/samplekeys/authenticate-only.sec.asc create mode 100755 tests/openpgp/ssh-export.scm rename tests/openpgp/{ssh.scm => ssh-import.scm} (100%) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Mon Nov 28 17:05:18 2016 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Mon, 28 Nov 2016 17:05:18 +0100 Subject: [git] GpgOL - branch, master, updated. gpgol-1.4.0-185-gf9efc49 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG extension for MS Outlook". The branch, master has been updated via f9efc49ffaf5302b680c17ef0eede636b62319e1 (commit) via 27c65853abdcccf7d739a7e2b09d7910641ac011 (commit) via c9775be375292e1f268937c099ed8bf9b994b771 (commit) from f098d08f7bb700e8b1e4868838c79aab844e3ffa (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit f9efc49ffaf5302b680c17ef0eede636b62319e1 Author: Andre Heinecke Date: Mon Nov 28 16:45:26 2016 +0100 Rework close and remove hacks for bad events * src/mail.cpp (Mail::close): Make it static to handle the case were close causes a mail deletion. (Mail::close_inspector): Make it static. (Mail::close_all_mails): Close inspector first. Handle map changes and object deletion. (Mail::~Mail): Don't delete event sink. (Mail::get_close_triggered, Mail::set_close_triggered): New. * src/mailitem-events.h (EVENT_SINK_INVOKE): Remove uneccessary Close hacks. Fix fallthrough from Open to before read. Fix fallthrough from Close to unload. Check if a close was triggered by us. (request_close, request_decrypt): Remvoed. * src/windowmessages.cpp, src/windowmessages.h (REQUEST_DECRYPT) (REQUEST_CLOSE): Removed. -- This fixes various inconsistentcies in the Close handling, especially if the Object calling the close was deleted during the call. Also closing the inspectors before closing the mail fixes a crash that could be triggered if more then one mail was open when closing. The proper closing now also prevents the necessity for decrypt again. The Open to BeforeRead fallthrough should not be a big issue, still a problem. And the close to unload fallthrough with my long comments explaining it,.. well *facepalm*.. GnuPG-Bug-Id: 2855 diff --git a/src/mail.cpp b/src/mail.cpp index 25d851a..b294f16 100644 --- a/src/mail.cpp +++ b/src/mail.cpp @@ -75,6 +75,7 @@ Mail::Mail (LPDISPATCH mailitem) : m_is_smime_checked(false), m_is_signed(false), m_is_valid(false), + m_close_triggered(false), m_moss_position(0), m_sender(NULL), m_type(MSGTYPE_UNKNOWN) @@ -859,17 +860,18 @@ Mail::close_all_mails () int err = 0; std::map::iterator it; TRACEPOINT; - for (it = g_mail_map.begin(); it != g_mail_map.end(); ++it) + std::map mail_map_copy = g_mail_map; + for (it = mail_map_copy.begin(); it != mail_map_copy.end(); ++it) { if (!it->second->is_crypto_mail()) { continue; } - if (it->second->close ()) + if (close_inspector (it->second) || close (it->second)) { log_error ("Failed to close mail: %p ", it->first); /* Should not happen */ - if (it->second->revert()) + if (is_valid_ptr (it->second) && it->second->revert()) { err++; } @@ -1029,9 +1031,9 @@ Mail::get_recipients() const } int -Mail::close_inspector () +Mail::close_inspector (Mail *mail) { - LPDISPATCH inspector = get_oom_object (m_mailitem, "GetInspector"); + LPDISPATCH inspector = get_oom_object (mail->item(), "GetInspector"); HRESULT hr; DISPID dispid; if (!inspector) @@ -1066,8 +1068,9 @@ Mail::close_inspector () return 0; } +/* static */ int -Mail::close () +Mail::close (Mail *mail) { VARIANT aVariant[1]; DISPPARAMS dispparams; @@ -1079,24 +1082,27 @@ Mail::close () dispparams.cNamedArgs = 0; log_oom_extra ("%s:%s: Invoking close for: %p", - SRCNAME, __func__, this); - int rc = invoke_oom_method_with_parms (m_mailitem, "Close", - NULL, &dispparams); - - /* Reset the uuid after discarding all changes in the oom - so that we can still find ourself. */ - set_uuid (); + SRCNAME, __func__, mail->item()); + mail->set_close_triggered (true); + int rc = invoke_oom_method_with_parms (mail->item(), "Close", + NULL, &dispparams); - if (!rc) - { - /* Now that we have closed it with discard changes we no - longer need to wipe the mail because the plaintext was - discarded. */ - m_needs_wipe = false; - } + log_debug ("returned from invoke"); return rc; } +void +Mail::set_close_triggered (bool value) +{ + m_close_triggered = value; +} + +bool +Mail::get_close_triggered () const +{ + return m_close_triggered; +} + static const UserID get_uid_for_sender (const Key k, const char *sender) { diff --git a/src/mail.h b/src/mail.h index b0d5c59..3ca144a 100644 --- a/src/mail.h +++ b/src/mail.h @@ -210,11 +210,11 @@ public: */ bool is_smime (); - /** @brief closes the inspector for this mail + /** @brief closes the inspector for a mail * * @returns true on success. */ - int close_inspector (); + static int close_inspector (Mail *mail); /** @brief get the associated parser. only valid while the actual parsing happens. */ @@ -276,11 +276,17 @@ public: /** Call close with discard changes to discard plaintext. returns the value of the oom close - call. */ - int close (); + call. This may have delete the mail if the close + triggers an unload. + */ + static int close (Mail *mail); /** Try to locate the keys for all recipients */ void locate_keys(); + + /** State variable to check if a close was triggerd by us. */ + void set_close_triggered (bool value); + bool get_close_triggered () const; private: void update_categories (); void update_body (); @@ -295,7 +301,8 @@ private: m_is_smime, /* This is an smime mail. */ m_is_smime_checked, /* it was checked if this is an smime mail */ m_is_signed, /* Mail is signed */ - m_is_valid; /* Mail is valid signed. */ + m_is_valid, /* Mail is valid signed. */ + m_close_triggered; /* We have programtically triggered a close */ int m_moss_position; /* The number of the original message attachment. */ char *m_sender; msgtype_t m_type; /* Our messagetype as set in mapi */ diff --git a/src/mailitem-events.cpp b/src/mailitem-events.cpp index 4091f06..33b48e9 100644 --- a/src/mailitem-events.cpp +++ b/src/mailitem-events.cpp @@ -78,9 +78,6 @@ BEGIN_EVENT_SINK(MailItemEvents, IDispatch) private: Mail * m_mail; /* The mail object related to this mailitem */ bool m_send_seen; /* The message is about to be submitted */ - bool m_decrypt_after_write; - bool m_ignore_unloads; - bool m_ignore_next_unload; }; MailItemEvents::MailItemEvents() : @@ -89,10 +86,7 @@ MailItemEvents::MailItemEvents() : m_cookie(0), m_ref(1), m_mail(NULL), - m_send_seen (false), - m_decrypt_after_write(false), - m_ignore_unloads(false), - m_ignore_next_unload(false) + m_send_seen (false) { } @@ -104,32 +98,6 @@ MailItemEvents::~MailItemEvents() gpgol_release (m_object); } -static DWORD WINAPI -request_decrypt (LPVOID arg) -{ - log_debug ("%s:%s: requesting decrypt again for: %p", - SRCNAME, __func__, arg); - if (do_in_ui_thread (REQUEST_DECRYPT, arg)) - { - log_debug ("%s:%s: second decrypt failed for: %p", - SRCNAME, __func__, arg); - } - return 0; -} - -static DWORD WINAPI -request_close (LPVOID arg) -{ - log_debug ("%s:%s: requesting close for: %s", - SRCNAME, __func__, (char*) arg); - if (do_in_ui_thread (REQUEST_CLOSE, arg)) - { - log_debug ("%s:%s: close request failed for: %s", - SRCNAME, __func__, (char*) arg); - } - return 0; -} - static bool propchangeWarnShown = false; /* The main Invoke function. The return value of this @@ -182,11 +150,7 @@ EVENT_SINK_INVOKE(MailItemEvents) } set_gpgol_draft_info_flags (message, draft_flags); gpgol_release (message); - - if (m_mail->is_crypto_mail()) - { - m_ignore_unloads = true; - } + break; } case BeforeRead: { @@ -281,10 +245,6 @@ EVENT_SINK_INVOKE(MailItemEvents) problem of a revert that the mail is created by outlook and e.g. multipart/signed signatures from most MUA's are broken. - Close -> discard changes -> then setting the property and - then saving also works but then the mail is closed / unloaded - and we can't decrypt again. - Some things to try out might be the close approach and then another open or a selection change. But for now we just warn. @@ -407,14 +367,6 @@ EVENT_SINK_INVOKE(MailItemEvents) m_mail->encrypt_sign (); return S_OK; } - else if (m_decrypt_after_write) - { - char *uuid = strdup (m_mail->get_uuid ().c_str()); - HANDLE thread = CreateThread (NULL, 0, request_decrypt, - (LPVOID) uuid, 0, NULL); - CloseHandle (thread); - m_decrypt_after_write = false; - } break; } case Close: @@ -428,20 +380,8 @@ EVENT_SINK_INVOKE(MailItemEvents) (Which would save the decrypted data without an event to prevent it) we cancel the close and then either close it with discard changes or revert / save it. - This happens with a window message as we can't invoke close from + Contrary to documentation we can invoke close from close. - - But as a side effect the mail, if opened in the explorer still will - be reverted, too. So shown as empty. To prevent that - we request a decrypt in the AfterWrite event which checks if the - message is opened in the explorer. If not it destroys the mail. - - Evil Hack: Outlook sends an Unload event after the message is closed - This is not true our Internal Object is kept alive if it is opened - in the explorer. So we ignore the unload event and then check in - the window message handler that checks for decrypt again if the - mail is currently open in the active explorer. If not we delete our - Mail object so that the message is released. */ if (parms->cArgs != 1 || parms->rgvarg[0].vt != (VT_BOOL | VT_BYREF)) { @@ -450,64 +390,30 @@ EVENT_SINK_INVOKE(MailItemEvents) SRCNAME, __func__); break; } + if (m_mail->get_close_triggered ()) + { + /* Our close with discard changes, pass through */ + m_mail->set_close_triggered (false); + return S_OK; + } *(parms->rgvarg[0].pboolVal) = VARIANT_TRUE; log_oom_extra ("%s:%s: Canceling close event.", SRCNAME, __func__); - m_decrypt_after_write = true; - m_ignore_unloads = false; - m_ignore_next_unload = true; - - char *uuid = strdup (m_mail->get_uuid ().c_str()); - HANDLE thread = CreateThread (NULL, 0, request_close, - (LPVOID) uuid, 0, NULL); - CloseHandle (thread); + if (Mail::close(m_mail)) + { + log_debug ("%s:%s: Close request failed.", + SRCNAME, __func__); + } } + return S_OK; } case Unload: { log_oom_extra ("%s:%s: Unload : %p", SRCNAME, __func__, m_mail); - /* Unload. Experiments have shown that this does not - mean a mail is actually unloaded in Outlook. E.g. - If it was open in an inspector and then closed we - see an unload event but the mail is still shown in - the explorer. Fun. On the other hand if a message - was opened and the explorer selection changes - we also get an unload but the mail is still open. - - Really we still get events after the unload and - can make changes to the object. - - In case the mail was opened m_ignore_unloads is set - to true so the mail is not removed when the message - selection changes. As close invokes decrypt_again - the mail object is removed there when the explorer - selection changed. - - In case the mail was closed m_ignore_next_unload - is set so only the Unload thad follows the canceled - close is ignored and not the unload that comes from - our then triggered close (save / discard). - - - This is horribly hackish and feels wrong. But it - works. - */ - if (m_ignore_unloads || m_ignore_next_unload) - { - if (m_ignore_next_unload) - { - m_ignore_next_unload = false; - } - log_debug ("%s:%s: Ignoring unload for message: %p.", - SRCNAME, __func__, m_object); - } - else - { - log_debug ("%s:%s: Removing Mail for message: %p.", - SRCNAME, __func__, m_object); - delete m_mail; - } + log_debug ("%s:%s: Removing Mail for message: %p.", + SRCNAME, __func__, m_object); + delete m_mail; return S_OK; } default: diff --git a/src/windowmessages.cpp b/src/windowmessages.cpp index 64e4ef1..a4bf62c 100644 --- a/src/windowmessages.cpp +++ b/src/windowmessages.cpp @@ -54,65 +54,6 @@ gpgol_window_proc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) mail->parsing_done(); break; } - case (REQUEST_DECRYPT): - { - char *uuid = (char *) ctx->data; - auto mail = Mail::get_mail_for_uuid (uuid); - if (!mail) - { - log_debug ("%s:%s: Decrypt again for uuid which is gone.", - SRCNAME, __func__); - xfree (uuid); - break; - } - /* Check if we are still in the active explorer. */ - LPDISPATCH mailitem = get_oom_object (GpgolAddin::get_instance()->get_application (), - "ActiveExplorer.Selection.Item(1)"); - if (!mailitem) - { - log_debug ("%s:%s: Decrypt again but no selected mailitem.", - SRCNAME, __func__); - xfree (uuid); - delete mail; - break; - } - - char *active_uuid = get_unique_id (mailitem, 0, nullptr); - if (!active_uuid || strcmp (active_uuid, uuid)) - { - log_debug ("%s:%s: UUID mismatch", - SRCNAME, __func__); - xfree (uuid); - delete mail; - break; - } - log_debug ("%s:%s: Decrypting %s again", - SRCNAME, __func__, uuid); - xfree (uuid); - xfree (active_uuid); - - mail->decrypt_verify (); - break; - } - case (REQUEST_CLOSE): - { - char *uuid = (char *) ctx->data; - auto mail = Mail::get_mail_for_uuid (uuid); - if (!mail) - { - log_debug ("%s:%s: Close request for uuid which is gone.", - SRCNAME, __func__); - break; - } - if (mail->close()) - { - log_debug ("%s:%s: Close request failed.", - SRCNAME, __func__); - } - ctx->wmsg_type = REQUEST_DECRYPT; - gpgol_window_proc (hWnd, message, wParam, (LPARAM) ctx); - break; - } case (INVALIDATE_UI): { log_debug ("%s:%s: Invalidating UI", diff --git a/src/windowmessages.h b/src/windowmessages.h index 7c07ae3..4dbd711 100644 --- a/src/windowmessages.h +++ b/src/windowmessages.h @@ -39,9 +39,6 @@ typedef enum _gpgol_wmsg_type INVALIDATE_UI = 1, /* The UI should be invalidated. */ PARSING_DONE = 2, /* A mail was parsed. Data should be a pointer to the mail object. */ - REQUEST_DECRYPT = 3, - REQUEST_CLOSE = 4 /* Request the mail to be closed with discard - changes set to true */ } gpgol_wmsg_type; typedef struct commit 27c65853abdcccf7d739a7e2b09d7910641ac011 Author: Andre Heinecke Date: Mon Nov 28 14:59:48 2016 +0100 Don't close non-crypto mails * src/mail.cpp (Mail::close_all_mails): Ignore non crypto mails. Don't delete mail on error. -- Closing non crypto mails is a chance for data loss as it could have caused drafts to be discarded. The delete on error is also not good as we don't know if the close already triggered the unload event and so may have unloaded the mail already. diff --git a/src/mail.cpp b/src/mail.cpp index 1b2cb70..25d851a 100644 --- a/src/mail.cpp +++ b/src/mail.cpp @@ -861,6 +861,10 @@ Mail::close_all_mails () TRACEPOINT; for (it = g_mail_map.begin(); it != g_mail_map.end(); ++it) { + if (!it->second->is_crypto_mail()) + { + continue; + } if (it->second->close ()) { log_error ("Failed to close mail: %p ", it->first); @@ -870,10 +874,6 @@ Mail::close_all_mails () err++; } } - else - { - delete it->second; - } } return err; } commit c9775be375292e1f268937c099ed8bf9b994b771 Author: Andre Heinecke Date: Mon Nov 28 14:58:09 2016 +0100 Fix race between deletion and parser access * src/mail.cpp (Mail::~Mail): Lock destruction. (do_decrypt): Lock validity check and parser access. -- This fixes a crash that could be triggered by wildly switching between encrypted / signed mails. diff --git a/src/mail.cpp b/src/mail.cpp index 1db0d6f..1b2cb70 100644 --- a/src/mail.cpp +++ b/src/mail.cpp @@ -99,8 +99,16 @@ Mail::Mail (LPDISPATCH mailitem) : g_mail_map.insert (std::pair (mailitem, this)); } +GPGRT_LOCK_DEFINE(dtor_lock); + Mail::~Mail() { + /* This should fix a race condition where the mail is + deleted before the parser is accessed in the decrypt + thread. The shared_ptr of the parser then ensures + that the parser is alive even if the mail is deleted + while parsing. */ + gpgrt_lock_lock (&dtor_lock); std::map::iterator it; detach_MailItemEvents_sink (m_event_sink); @@ -123,8 +131,17 @@ Mail::~Mail() xfree (m_sender); gpgol_release(m_mailitem); - log_oom_extra ("%s:%s: destroyed: %p uuid: %s", - SRCNAME, __func__, this, m_uuid.c_str()); + if (!m_uuid.empty()) + { + log_oom_extra ("%s:%s: destroyed: %p uuid: %s", + SRCNAME, __func__, this, m_uuid.c_str()); + } + else + { + log_oom_extra ("%s:%s: non crypto mail: %p destroyed", + SRCNAME, __func__, this); + } + gpgrt_lock_unlock (&dtor_lock); } Mail * @@ -448,32 +465,41 @@ GPGRT_LOCK_DEFINE(parser_lock); static DWORD WINAPI do_parsing (LPVOID arg) { - log_debug ("%s:%s: preparing the parser for: %p", - SRCNAME, __func__, arg); - + gpgrt_lock_lock (&dtor_lock); + /* We lock with mail dtors so we can be sure the mail->parser + call is valid. */ Mail *mail = (Mail *)arg; - auto parser = mail->parser(); - if (!parser) + if (!Mail::is_valid_ptr (mail)) { - log_error ("%s:%s: no parser found for mail: %p", + log_debug ("%s:%s: canceling parsing for: %p already deleted", SRCNAME, __func__, arg); - return -1; + gpgrt_lock_unlock (&dtor_lock); + return 0; } + /* This takes a shared ptr of parser. So the parser is + still valid when the mail is deleted. */ + auto parser = mail->parser(); + gpgrt_lock_unlock (&dtor_lock); + gpgrt_lock_lock (&parser_lock); - /* Serialize here to avoid too many + /* We lock the parser here to avoid too many decryption attempts if there are multiple mailobjects which might have already - been deleted (e.g. by quick switches of the mailview. */ - if (Mail::is_valid_ptr (mail)) - { - parser->parse(); - do_in_ui_thread (PARSING_DONE, arg); - } - else + been deleted (e.g. by quick switches of the mailview.) + Let's rather be a bit slower. + */ + log_debug ("%s:%s: preparing the parser for: %p", + SRCNAME, __func__, arg); + + if (!parser) { - log_debug ("%s:%s: canceling parsing for: %p already deleted", + log_error ("%s:%s: no parser found for mail: %p", SRCNAME, __func__, arg); + gpgrt_lock_unlock (&parser_lock); + return -1; } + parser->parse(); + do_in_ui_thread (PARSING_DONE, arg); gpgrt_lock_unlock (&parser_lock); return 0; } ----------------------------------------------------------------------- Summary of changes: src/mail.cpp | 116 ++++++++++++++++++++++++++---------------- src/mail.h | 17 +++++-- src/mailitem-events.cpp | 130 +++++++----------------------------------------- src/windowmessages.cpp | 59 ---------------------- src/windowmessages.h | 3 -- 5 files changed, 104 insertions(+), 221 deletions(-) hooks/post-receive -- GnuPG extension for MS Outlook http://git.gnupg.org From cvs at cvs.gnupg.org Tue Nov 29 10:16:35 2016 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Tue, 29 Nov 2016 10:16:35 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.1.16-27-gecc126a Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via ecc126a7cef371e3b88e65715ba37fb77e92ea0f (commit) from 47b8b9e2ce5af7fba117ae0b00e10bec414dcfb0 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit ecc126a7cef371e3b88e65715ba37fb77e92ea0f Author: Werner Koch Date: Tue Nov 29 10:13:46 2016 +0100 build: Remove more keywords from the generated ChangeLog * build-aux/gitlog-to-changelog (parse_amend_file): Generalize keyword removal. -- This simplified rule does now match most special keywords like Signed-off-by: GnuPG-bug-id: Fixes-commit: However it does not match the sometimes used Fixes: which should be avoided anyway. This patch helps in cases where the "--" delimiter line was not used and only keywords were given. Signed-off-by: Werner Koch diff --git a/build-aux/gitlog-to-changelog b/build-aux/gitlog-to-changelog index 5cf071f..24a3d72 100755 --- a/build-aux/gitlog-to-changelog +++ b/build-aux/gitlog-to-changelog @@ -294,9 +294,8 @@ sub parse_amend_file($) $prev_date_line = $date_line; @prev_coauthors = @coauthors; - # Omit "Co-authored-by..." and "Signed-off-by..." lines. - @line = grep !/^Signed-off-by: .*>$/, @line; - @line = grep !/^Co-authored-by: /, @line; + # Omit keyword lines like "Signed-off-by:" or "GnuPG-bug-id:" + @line = grep !/^[A-Z][A-Za-z]+-[a-z-]+: /, @line; # Remove everything after a line with 2 dashes at the beginning. if ($tear_off) ----------------------------------------------------------------------- Summary of changes: build-aux/gitlog-to-changelog | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Tue Nov 29 14:37:30 2016 From: cvs at cvs.gnupg.org (by Daniel Kahn Gillmor) Date: Tue, 29 Nov 2016 14:37:30 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.1.16-28-gf6728d1 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via f6728d13e8e544dbd4b9351ed981613e5504293f (commit) from ecc126a7cef371e3b88e65715ba37fb77e92ea0f (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit f6728d13e8e544dbd4b9351ed981613e5504293f Author: Daniel Kahn Gillmor Date: Mon Oct 31 19:52:31 2016 -0400 dirmngr: Lazily launch ldap reaper thread. * dirmngr/dirmngr.c (main): Avoid calling ldap_wrapper_launch_thread() Before we need it. * dirmngr/ldap-wrapper.c (ldap_wrapper): Call ldap_wrapper_launch_thread() just in time (before any attempt to use an ldap subprocess). -- A dirmngr process that never looks anything up in LDAP has no need for a reaper thread, but one was started automatically. This thread wakes up every two seconds to look for ldap processes that might never have been running. We won't start more than one reaper thread for any given dirmngr due to the static int "done" in ldap_wrapper_launch_thread(), so it's safe to call this every time there is a use of ldap_wrapper. If someone wants to do further dirmngr optimizations for ldap users, the reaper thread itself could use dynamically-calculated timeouts (and probably needs to be alerted dynamically when a new ldap subprocess is available so it can re-calculate those timeouts). Note: It's not clear to me how to test ldap access effectively; i know of no public ldap services that i can verify against, and i do not run my own ldap servers. If someone has a publicly-available ldap server that developers can run tests against, i would be happy to hear about it. Signed-off-by: Daniel Kahn Gillmor diff --git a/dirmngr/dirmngr.c b/dirmngr/dirmngr.c index 7214d49..f60173b 100644 --- a/dirmngr/dirmngr.c +++ b/dirmngr/dirmngr.c @@ -989,9 +989,6 @@ main (int argc, char **argv) thread_init (); cert_cache_init (); crl_cache_init (); -#if USE_LDAP - ldap_wrapper_launch_thread (); -#endif /*USE_LDAP*/ http_register_netactivity_cb (netactivity_action); start_command_handler (ASSUAN_INVALID_FD); shutdown_reaper (); @@ -1027,9 +1024,6 @@ main (int argc, char **argv) thread_init (); cert_cache_init (); crl_cache_init (); -#if USE_LDAP - ldap_wrapper_launch_thread (); -#endif /*USE_LDAP*/ http_register_netactivity_cb (netactivity_action); handle_connections (3); assuan_sock_close (3); @@ -1238,9 +1232,6 @@ main (int argc, char **argv) thread_init (); cert_cache_init (); crl_cache_init (); -#if USE_LDAP - ldap_wrapper_launch_thread (); -#endif /*USE_LDAP*/ http_register_netactivity_cb (netactivity_action); handle_connections (fd); assuan_sock_close (fd); @@ -1251,9 +1242,6 @@ main (int argc, char **argv) /* Just list the CRL cache and exit. */ if (argc) wrong_args ("--list-crls"); -#if USE_LDAP - ldap_wrapper_launch_thread (); -#endif /*USE_LDAP*/ crl_cache_init (); crl_cache_list (es_stdout); } @@ -1267,9 +1255,6 @@ main (int argc, char **argv) thread_init (); cert_cache_init (); crl_cache_init (); -#if USE_LDAP - ldap_wrapper_launch_thread (); -#endif /*USE_LDAP*/ if (!argc) rc = crl_cache_load (&ctrlbuf, NULL); else @@ -1293,9 +1278,6 @@ main (int argc, char **argv) thread_init (); cert_cache_init (); crl_cache_init (); -#if USE_LDAP - ldap_wrapper_launch_thread (); -#endif /*USE_LDAP*/ rc = crl_fetch (&ctrlbuf, argv[0], &reader); if (rc) log_error (_("fetching CRL from '%s' failed: %s\n"), diff --git a/dirmngr/ldap-wrapper.c b/dirmngr/ldap-wrapper.c index b9931a0..b313848 100644 --- a/dirmngr/ldap-wrapper.c +++ b/dirmngr/ldap-wrapper.c @@ -654,8 +654,9 @@ ldap_wrapper (ctrl_t ctrl, ksba_reader_t *reader, const char *argv[]) only viable solutions are either to have another thread responsible for logging the messages or to add an option to the wrapper module to do the logging on its own. Given that we anyway - need a way to rip the child process and this is best done using a - general ripping thread, that thread can do the logging too. */ + need a way to reap the child process and this is best done using a + general reaping thread, that thread can do the logging too. */ + ldap_wrapper_launch_thread (); *reader = NULL; ----------------------------------------------------------------------- Summary of changes: dirmngr/dirmngr.c | 18 ------------------ dirmngr/ldap-wrapper.c | 5 +++-- 2 files changed, 3 insertions(+), 20 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Tue Nov 29 14:47:28 2016 From: cvs at cvs.gnupg.org (by Justus Winter) Date: Tue, 29 Nov 2016 14:47:28 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.1.16-30-gbde4fdd Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via bde4fddadc75ad6071e3fc6c0980905de14c03cb (commit) via e062bc4da8062b822ee85096d9adfcbca8dcb56a (commit) from f6728d13e8e544dbd4b9351ed981613e5504293f (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit bde4fddadc75ad6071e3fc6c0980905de14c03cb Author: Justus Winter Date: Tue Nov 29 14:25:19 2016 +0100 tests: Add test for '--decrypt --multifile'. * tests/openpgp/Makefile.am (XTESTS): Add new test. * tests/openpgp/decrypt-multifile.scm: New file. Signed-off-by: Justus Winter diff --git a/tests/openpgp/Makefile.am b/tests/openpgp/Makefile.am index 3cdf3d1..9eb69ee 100644 --- a/tests/openpgp/Makefile.am +++ b/tests/openpgp/Makefile.am @@ -47,6 +47,7 @@ XTESTS = \ version.scm \ mds.scm \ decrypt.scm \ + decrypt-multifile.scm \ decrypt-dsa.scm \ sigs.scm \ sigs-dsa.scm \ diff --git a/tests/openpgp/decrypt-multifile.scm b/tests/openpgp/decrypt-multifile.scm new file mode 100755 index 0000000..4efdf66 --- /dev/null +++ b/tests/openpgp/decrypt-multifile.scm @@ -0,0 +1,47 @@ +#!/usr/bin/env gpgscm + +;; Copyright (C) 2016 g10 Code GmbH +;; +;; This file is part of GnuPG. +;; +;; GnuPG is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 3 of the License, or +;; (at your option) any later version. +;; +;; GnuPG 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 General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with this program; if not, see . + +(load (with-path "defs.scm")) +(setup-legacy-environment) + +(info "Checking decryption of supplied files using --multifile.") + +(define my-wd (getcwd)) +(define encrypted-files (map (lambda (name) + (string-append name ".asc")) + plain-files)) + +(with-temporary-working-directory + ;; First, copy the files so that GnuPG writes the decrypted files here + ;; and not into the source directory. + (for-each (lambda (name) + (file-copy (in-srcdir name) name)) + encrypted-files) + + ;; Now decrypt all files. + (call-check `(, at gpg --decrypt --multifile , at encrypted-files)) + + ;; And verify the result. Reference files are in our original + ;; working directory courtesy of setup-legacy-environment. + (for-each-p + "Verifying files:" + (lambda (name) + (unless (file=? (path-join my-wd name) name) + (error "decrypted file differs"))) + plain-files)) commit e062bc4da8062b822ee85096d9adfcbca8dcb56a Author: Justus Winter Date: Tue Nov 29 13:31:38 2016 +0100 gpgscm: Avoid truncating pointers. * tests/gpgscm/scheme.c (_alloc_cellseg): Avoid truncating pointers on systems where sizeof(unsigned long) < sizeof(void *). Signed-off-by: Justus Winter diff --git a/tests/gpgscm/scheme.c b/tests/gpgscm/scheme.c index 8666548..30b5915 100644 --- a/tests/gpgscm/scheme.c +++ b/tests/gpgscm/scheme.c @@ -29,6 +29,7 @@ #include #include +#include #include #include @@ -615,8 +616,8 @@ _alloc_cellseg(scheme *sc, size_t len, void **alloc, pointer *cells) *alloc = cp; /* adjust in TYPE_BITS-bit boundary */ - if (((unsigned long) cp) % adj != 0) - cp = (void *) (adj * ((unsigned long) cp / adj + 1)); + if (((uintptr_t) cp) % adj != 0) + cp = (void *) (adj * ((uintptr_t) cp / adj + 1)); *cells = cp; return 0; ----------------------------------------------------------------------- Summary of changes: tests/gpgscm/scheme.c | 5 ++-- tests/openpgp/Makefile.am | 1 + tests/openpgp/{setup.scm => decrypt-multifile.scm} | 31 +++++++++++++++++----- 3 files changed, 28 insertions(+), 9 deletions(-) copy tests/openpgp/{setup.scm => decrypt-multifile.scm} (50%) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Tue Nov 29 14:57:21 2016 From: cvs at cvs.gnupg.org (by Neal H. Walfield) Date: Tue, 29 Nov 2016 14:57:21 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.1.16-32-g522f74f Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via 522f74f7e377135cf098b6b0b9b35284c1dfc963 (commit) via 2f27cb12e30c9f6e780354eecc3ff0039ed52c63 (commit) from bde4fddadc75ad6071e3fc6c0980905de14c03cb (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 522f74f7e377135cf098b6b0b9b35284c1dfc963 Author: Neal H. Walfield Date: Tue Nov 29 14:41:22 2016 +0100 Improve some comments. diff --git a/g10/armor.c b/g10/armor.c index c80e902..58d8e01 100644 --- a/g10/armor.c +++ b/g10/armor.c @@ -1026,17 +1026,20 @@ armor_filter( void *opaque, int control, if( control == IOBUFCTRL_UNDERFLOW && afx->inp_bypass ) { n = 0; if( afx->buffer_len ) { + /* Copy the data from AFX->BUFFER to BUF. */ for(; n < size && afx->buffer_pos < afx->buffer_len; n++ ) buf[n++] = afx->buffer[afx->buffer_pos++]; if( afx->buffer_pos >= afx->buffer_len ) afx->buffer_len = 0; } + /* If there is still space in BUF, read directly into it. */ for(; n < size; n++ ) { if( (c=iobuf_get(a)) == -1 ) break; buf[n] = c & 0xff; } if( !n ) + /* We didn't get any data. EOF. */ rc = -1; *ret_len = n; } diff --git a/g10/cpr.c b/g10/cpr.c index c20c3f4..0133cad 100644 --- a/g10/cpr.c +++ b/g10/cpr.c @@ -405,7 +405,7 @@ myread(int fd, void *buf, size_t count) /* Request a string from the client over the command-fd. If GETBOOL is set the function returns a static string (do not free) if the - netered value was true or NULL if the entered value was false. */ + entered value was true or NULL if the entered value was false. */ static char * do_get_from_fd ( const char *keyword, int hidden, int getbool ) { diff --git a/g10/packet.h b/g10/packet.h index 65f60a9..9780d93 100644 --- a/g10/packet.h +++ b/g10/packet.h @@ -95,7 +95,9 @@ typedef struct typedef struct { /* RFC 4880: this must be 4. */ byte version; - /* The cipher algorithm used. */ + /* The cipher algorithm used to encrypt the session key. (This may + be different from the algorithm that is used to encrypt the SED + packet.) */ byte cipher_algo; /* The string-to-key specifier. */ STRING2KEY s2k; @@ -269,7 +271,7 @@ typedef struct struct user_attribute *attribs; int numattribs; /* If this is not NULL, the packet is a user attribute rather than a - user id. (Serialized.) */ + user id (See RFC 4880 5.12). (Serialized.) */ byte *attrib_data; /* The length of ATTRIB_DATA. */ unsigned long attrib_len; diff --git a/g10/parse-packet.c b/g10/parse-packet.c index 38cfdd9..31e2a92 100644 --- a/g10/parse-packet.c +++ b/g10/parse-packet.c @@ -809,8 +809,8 @@ dump_hex_line (int c, int *i) decoded values are given as PKGTYPE and PKTLEN. If the packet is a partial body length packet (RFC 4880, Section - 4.2.2.4), then iobuf_set_partial_block_mode should already have - been called on INP and PARTIAL should be set. + 4.2.2.4), then iobuf_set_partial_block_modeiobuf_set_partial_block_mode + should already have been called on INP and PARTIAL should be set. If PARTIAL is set or PKTLEN is 0 and PKTTYPE is PKT_COMPRESSED, copy until the first EOF is encountered on INP. diff --git a/g10/sign.c b/g10/sign.c index a391128..19ca484 100644 --- a/g10/sign.c +++ b/g10/sign.c @@ -1386,14 +1386,30 @@ sign_symencrypt_file (ctrl_t ctrl, const char *fname, strlist_t locusr) /**************** - * Create a signature packet for the given public key certificate and - * the user id and return it in ret_sig. User signature class SIGCLASS - * user-id is not used (and may be NULL if sigclass is 0x20) If - * DIGEST_ALGO is 0 the function selects an appropriate one. - * SIGVERSION gives the minimal required signature packet version; - * this is needed so that special properties like local sign are not - * applied (actually: dropped) when a v3 key is used. TIMESTAMP is - * the timestamp to use for the signature. 0 means "now" */ + * Create a v4 signature in *RET_SIG. + * + * PK is the primary key to sign (required for all sigs) + * UID is the user id to sign (required for 0x10..0x13, 0x30) + * SUBPK is subkey to sign (required for 0x18, 0x19, 0x28) + * + * PKSK is the signing key + * + * SIGCLASS is the type of signature to create. + * + * DIGEST_ALGO is the digest algorithm. If it is 0 the function + * selects an appropriate one. + * + * TIMESTAMP is the timestamp to use for the signature. 0 means "now" + * + * DURATION is the amount of time (in seconds) until the signature + * expires. + * + * This function creates the following subpackets: issuer, created, + * and expire (if duration is not 0). Additional subpackets can be + * added using MKSUBPKT, which is called after these subpackets are + * added and before the signature is generated. OPAQUE is passed to + * MKSUBPKT. + */ int make_keysig_packet (PKT_signature **ret_sig, PKT_public_key *pk, PKT_user_id *uid, PKT_public_key *subpk, diff --git a/g10/tofu.c b/g10/tofu.c index bf2a048..14e4f1d 100644 --- a/g10/tofu.c +++ b/g10/tofu.c @@ -57,12 +57,11 @@ #define FULL_TRUST_THRESHOLD 100 -/* An struct with data pertaining to the tofu DB. - - To initialize this data structure, call opendbs(). Cleanup is done - when the CTRL object is released. To get a handle to a database, - use the getdb() function. This will either return an existing - handle or open a new DB connection, as appropriate. */ +/* A struct with data pertaining to the tofu DB. There is one such + struct per session and it is cached in session's ctrl structure. + To initialize this or get the current singleton, call opendbs(). + There is no need to explicitly release it; cleanup is done when the + CTRL object is released. */ struct tofu_dbs_s { sqlite3 *db; @@ -179,8 +178,8 @@ begin_transaction (ctrl_t ctrl, int only_batch) * than 500 ms), to prevent starving other gpg processes, we drop * and retake the batch lock. * - * Note: if we wanted higher resolution, we could use - * npth_clock_gettime. */ + * Note: gnupg_get_time has a one second resolution, if we wanted a + * higher resolution, we could use npth_clock_gettime. */ if (/* No real transactions. */ dbs->in_transaction == 0 /* There is an open batch transaction. */ @@ -264,8 +263,8 @@ begin_transaction (ctrl_t ctrl, int only_batch) /* Commit a transaction. If ONLY_BATCH is 1, then this only ends the * batch transaction if we have left batch mode. If ONLY_BATCH is 2, - * this ends any open batch transaction even if we are still in batch - * mode. */ + * this commits any open batch transaction even if we are still in + * batch mode. */ static gpg_error_t end_transaction (ctrl_t ctrl, int only_batch) { @@ -341,7 +340,7 @@ rollback_transaction (ctrl_t ctrl) log_assert (dbs); log_assert (dbs->in_transaction > 0); - /* Be careful to not any progress made by closed transactions in + /* Be careful to not undo any progress made by closed transactions in batch mode. */ rc = gpgsql_exec_printf (dbs->db, NULL, NULL, &err, "rollback to inner%d;", @@ -1152,7 +1151,7 @@ record_binding (tofu_dbs_t dbs, const char *fingerprint, const char *email, } -/* Collect the strings returned by a query in a simply string list. +/* Collect the strings returned by a query in a simple string list. Any NULL values are converted to the empty string. If a result has 3 rows and each row contains two columns, then the @@ -2475,11 +2474,12 @@ get_policy (tofu_dbs_t dbs, PKT_public_key *pk, if (conflict_set_count == 1 && (conflict_set->flags & BINDING_CONFLICT)) { - /* No known conflicts now, but there was a conflict. That is, - * at somepoint there was a conflict, but it went away. A - * conflict can go away if there is now a cross sig between the - * two keys. In this case, we just silently clear the - * conflict. */ + /* No known conflicts now, but there was a conflict. This means + * at some point, there was a conflict and we changed this + * binding's policy to ask and set the conflicting key. The + * conflict can go away if there is not a cross sig between the + * two keys. In this case, just silently clear the conflict and + * reset the policy to auto. */ if (DBG_TRUST) log_debug ("TOFU: binding had a conflict, but it's been resolved (probably via cross sig).\n", commit 2f27cb12e30c9f6e780354eecc3ff0039ed52c63 Author: Neal H. Walfield Date: Tue Nov 29 14:33:29 2016 +0100 g10: Extend TOFU_STATS to always show the validity * doc/DETAILS (TOFU_STATS): Rename the VALIDITY field to SUMMARY. Add a new field called VALIDITY. * g10/tofu.c (write_stats_status): Update output accordingly. -- Signed-off-by: Neal H. Walfield Change TOFU_STATS as discussed offline with Werner, Justus and Andre. diff --git a/doc/DETAILS b/doc/DETAILS index a264e53..534c48c 100644 --- a/doc/DETAILS +++ b/doc/DETAILS @@ -722,14 +722,14 @@ pkd:0:1024:B665B1435F4C2 .... FF26ABB: userid encoded in UTF-8 and percent escaped. The fingerprint is identical for all TOFU_USER lines up to a NEWSIG line. -*** TOFU_STATS 0 [ [ ]] +*** TOFU_STATS [ [ []]] Statistics for the current user id. - Values for VALIDITY are: - - 0 :: conflict - - 1 :: key without history - - 2 :: key with too little history + Values for SUMMARY are: + - 0 :: attention, an interaction with the user is required (conflict) + - 1 :: key with no verification/encryption history + - 2 :: key with little history - 3 :: key with enough history for basic trust - 4 :: key with a lot of history @@ -739,7 +739,8 @@ pkd:0:1024:B665B1435F4C2 .... FF26ABB: - good :: Policy is "good" - bad :: Policy is "bad" - ask :: Policy is "ask" - - unknown :: Policy is not known. + - unknown :: Policy is "unknown" (TOFU information does not + contribute to the key's validity) TM1 ist the time the first message was verified. TM2 is the time the most recent message was verified. TM3 is the time the first @@ -747,6 +748,11 @@ pkd:0:1024:B665B1435F4C2 .... FF26ABB: either be seconds since Epoch or an ISO time string (yyyymmddThhmmss). + VALIDITY is the same as SUMMARY with the exception that VALIDITY + doesn't reflect whether the key needs attention. That is it never + takes on value 0. Instead, if there is a conflict, VALIDITY still + reflects the key's validity (values: 1-4). + *** TOFU_STATS_SHORT Information about the TOFU binding for the signature. diff --git a/g10/tofu.c b/g10/tofu.c index 8575947..bf2a048 100644 --- a/g10/tofu.c +++ b/g10/tofu.c @@ -2897,7 +2897,8 @@ write_stats_status (estream_t fp, unsigned long encryption_first_done, unsigned long encryption_most_recent) { - const char *validity; + int summary; + int validity; unsigned long messages; /* Use the euclidean distance (m = sqrt(a^2 + b^2)) rather then the @@ -2907,34 +2908,41 @@ write_stats_status (estream_t fp, + encryption_count * encryption_count); if (messages < 1) - validity = "1"; /* Key without history. */ + validity = 1; /* Key without history. */ else if (messages < 2 * BASIC_TRUST_THRESHOLD) - validity = "2"; /* Key with too little history. */ + validity = 2; /* Key with too little history. */ else if (messages < 2 * FULL_TRUST_THRESHOLD) - validity = "3"; /* Key with enough history for basic trust. */ + validity = 3; /* Key with enough history for basic trust. */ else - validity = "4"; /* Key with a lot of history. */ + validity = 4; /* Key with a lot of history. */ + + if (policy == TOFU_POLICY_ASK) + summary = 0; /* Key requires attention. */ + else + summary = validity; if (fp) { - es_fprintf (fp, "tfs:1:%s:%lu:%lu:%s:%lu:%lu:%lu:%lu:\n", - validity, signature_count, encryption_count, + es_fprintf (fp, "tfs:1:%d:%lu:%lu:%s:%lu:%lu:%lu:%lu:%d:\n", + summary, signature_count, encryption_count, tofu_policy_str (policy), signature_first_seen, signature_most_recent, - encryption_first_done, encryption_most_recent); + encryption_first_done, encryption_most_recent, + validity); } else { write_status_printf (STATUS_TOFU_STATS, - "%s %lu %lu %s %lu %lu %lu %lu", - validity, + "%d %lu %lu %s %lu %lu %lu %lu %d", + summary, signature_count, encryption_count, tofu_policy_str (policy), signature_first_seen, signature_most_recent, encryption_first_done, - encryption_most_recent); + encryption_most_recent, + validity); } } ----------------------------------------------------------------------- Summary of changes: doc/DETAILS | 18 ++++++++++----- g10/armor.c | 3 +++ g10/cpr.c | 2 +- g10/packet.h | 6 +++-- g10/parse-packet.c | 4 ++-- g10/sign.c | 32 ++++++++++++++++++++------- g10/tofu.c | 64 ++++++++++++++++++++++++++++++------------------------ 7 files changed, 82 insertions(+), 47 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Tue Nov 29 16:03:03 2016 From: cvs at cvs.gnupg.org (by Justus Winter) Date: Tue, 29 Nov 2016 16:03:03 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.1.16-33-g9fb5e9c Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via 9fb5e9c14557f7567cbc7c50b9881b7d7bfa2f12 (commit) from 522f74f7e377135cf098b6b0b9b35284c1dfc963 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 9fb5e9c14557f7567cbc7c50b9881b7d7bfa2f12 Author: Justus Winter Date: Tue Nov 29 16:00:48 2016 +0100 tools,build: Build WKS tools against libintl. * tools/Makefile.am (gpg_wks_server_LDADD): Link against libintl. (gpg_wks_client_LDADD): Likewise. GnuPG-bug-id: 2846 Signed-off-by: Justus Winter diff --git a/tools/Makefile.am b/tools/Makefile.am index 94b53f2..38abd7c 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -155,7 +155,7 @@ gpg_wks_server_SOURCES = \ gpg_wks_server_CFLAGS = $(GPG_ERROR_CFLAGS) $(INCICONV) gpg_wks_server_LDADD = $(libcommon) $(LIBGCRYPT_LIBS) $(GPG_ERROR_LIBS) \ - $(LIBICONV) + $(LIBINTL) $(LIBICONV) gpg_wks_client_SOURCES = \ gpg-wks-client.c \ @@ -171,7 +171,7 @@ gpg_wks_client_SOURCES = \ gpg_wks_client_CFLAGS = $(LIBASSUAN_CFLAGS) $(GPG_ERROR_CFLAGS) $(INCICONV) gpg_wks_client_LDADD = $(libcommon) \ $(LIBASSUAN_LIBS) $(LIBGCRYPT_LIBS) $(GPG_ERROR_LIBS) \ - $(LIBICONV) + $(LIBINTL) $(LIBICONV) # Make sure that all libs are build before we use them. This is ----------------------------------------------------------------------- Summary of changes: tools/Makefile.am | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Tue Nov 29 16:50:49 2016 From: cvs at cvs.gnupg.org (by Justus Winter) Date: Tue, 29 Nov 2016 16:50:49 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.1.16-34-g52385a2 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via 52385a2ba1bf7e53f500ffde5fd34f28e69cf76b (commit) from 9fb5e9c14557f7567cbc7c50b9881b7d7bfa2f12 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 52385a2ba1bf7e53f500ffde5fd34f28e69cf76b Author: Justus Winter Date: Tue Nov 29 16:48:35 2016 +0100 g10: Fix memory leak. * g10/decrypt.c (decrypt_messages): Properly decrease the reference count of the armor filters after pushing them. Signed-off-by: Justus Winter diff --git a/g10/decrypt.c b/g10/decrypt.c index 751b7be..c99f064 100644 --- a/g10/decrypt.c +++ b/g10/decrypt.c @@ -180,7 +180,6 @@ void decrypt_messages (ctrl_t ctrl, int nfiles, char *files[]) { IOBUF fp; - armor_filter_context_t *afx = NULL; progress_filter_context_t *pfx; char *p, *output = NULL; int rc=0,use_stdin=0; @@ -254,8 +253,11 @@ decrypt_messages (ctrl_t ctrl, int nfiles, char *files[]) { if (use_armor_filter(fp)) { - afx = new_armor_context (); - push_armor_filter ( afx, fp ); + armor_filter_context_t *afx = new_armor_context (); + rc = push_armor_filter (afx, fp); + if (rc) + log_error("failed to push armor filter"); + release_armor_context (afx); } } rc = proc_packets (ctrl,NULL, fp); @@ -275,6 +277,5 @@ decrypt_messages (ctrl_t ctrl, int nfiles, char *files[]) } set_next_passphrase(NULL); - release_armor_context (afx); release_progress_context (pfx); } ----------------------------------------------------------------------- Summary of changes: g10/decrypt.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Tue Nov 29 17:01:02 2016 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Tue, 29 Nov 2016 17:01:02 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.1.16-37-g81d6e98 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via 81d6e98cdf4caa3aa92398fc3b8bed397b40f58d (commit) via a5910e00ace882b8a17169faf4607163ab454af9 (commit) via 60b4982836a00ef6b2a97d16f735b3f6b74dce62 (commit) from 52385a2ba1bf7e53f500ffde5fd34f28e69cf76b (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 81d6e98cdf4caa3aa92398fc3b8bed397b40f58d Author: Werner Koch Date: Tue Nov 29 16:53:54 2016 +0100 agent,w32: Initialize nPth in server mode. * agent/gpg-agent.c (main) [W32]: Call initialize_modules in server mode. -- Fixes-commit: 9a707a223a3d45ccf245dee7989ca144e4e6bb49 Signed-off-by: Werner Koch diff --git a/agent/gpg-agent.c b/agent/gpg-agent.c index 175866d..5060c07 100644 --- a/agent/gpg-agent.c +++ b/agent/gpg-agent.c @@ -1532,10 +1532,15 @@ main (int argc, char **argv ) parent_pid = getpid (); fflush (NULL); + #ifdef HAVE_W32_SYSTEM + (void)csh_style; (void)nodetach; + initialize_modules (); + #else /*!HAVE_W32_SYSTEM*/ + pid = fork (); if (pid == (pid_t)-1) { commit a5910e00ace882b8a17169faf4607163ab454af9 Author: Werner Koch Date: Tue Nov 29 16:42:14 2016 +0100 gpg: Make --decrypt with output '-&nnnn' work. * g10/plaintext.c (get_output_file): Check and open special filename before falling back to stdout. -- GnuPG-bug-id: 2677 Signed-off-by: Werner Koch diff --git a/g10/plaintext.c b/g10/plaintext.c index bdf5592..40ce603 100644 --- a/g10/plaintext.c +++ b/g10/plaintext.c @@ -108,9 +108,25 @@ get_output_file (const byte *embedded_name, int embedded_namelen, } else if (iobuf_is_pipe_filename (fname) || !*fname) { - /* No filename or "-" given; write to stdout. */ - fp = es_stdout; - es_set_binary (fp); + /* Special file name, no filename, or "-" given; write to the + * file descriptor or to stdout. */ + int fd; + char xname[64]; + + fd = check_special_filename (fname, 1, 0); + if (fd == -1) + { + /* Not a special filename, thus we want stdout. */ + fp = es_stdout; + es_set_binary (fp); + } + else if (!(fp = es_fdopen_nc (fd, "wb"))) + { + err = gpg_error_from_syserror (); + snprintf (xname, sizeof xname, "[fd %d]", fd); + log_error (_("can't open '%s': %s\n"), xname, gpg_strerror (err)); + goto leave; + } } else { commit 60b4982836a00ef6b2a97d16f735b3f6b74dce62 Author: Werner Koch Date: Tue Nov 29 16:18:24 2016 +0100 gpg,sm: Merge the two versions of check_special_filename. * sm/gpgsm.c (check_special_filename): Move to .. * common/sysutils.c (check_special_filename): here. Add arg NOTRANSLATE. (allow_special_filenames): New local var. (enable_special_filenames): New public functions. * sm/gpgsm.c (allow_special_filenames): Remove var. (main): Call enable_special_filenames instead of setting the var. (open_read, open_es_fread, open_es_fwrite): Call check_special_filename with 0 for NOTRANSLATE. * common/iobuf.c (special_names_enabled): Remove var. (iobuf_enable_special_filenames): Remove func. (check_special_filename): Remove func. (iobuf_is_pipe_filename): Call new version of the function with NOTRANSLATE set. (do_open): Ditto. * g10/gpg.c (main): Call enable_special_filenames instead of iobuf_enable_special_filenames. * g10/gpgv.c (main): Ditto. -- Note that we keep the iobuf.c:translate_file_handle because it is a bit different (for whatever reasons) than the translate function from sysutils. Signed-off-by: Werner Koch diff --git a/common/iobuf.c b/common/iobuf.c index ed90bd7..d346027 100644 --- a/common/iobuf.c +++ b/common/iobuf.c @@ -155,11 +155,6 @@ typedef struct block_filter_ctx_t; -/* Global flag to tell whether special file names are enabled. See - gpg.c for an explanation of these file names. FIXME: This does not - belong in the iobuf subsystem. */ -static int special_names_enabled; - /* Local prototypes. */ static int underflow (iobuf_t a, int clear_pending_eof); static int underflow_target (iobuf_t a, int clear_pending_eof, size_t target); @@ -1237,41 +1232,16 @@ iobuf_temp_with_content (const char *buffer, size_t length) return a; } -void -iobuf_enable_special_filenames (int yes) -{ - special_names_enabled = yes; -} - - -/* See whether the filename has the form "-&nnnn", where n is a - non-zero number. Returns this number or -1 if it is not the - case. */ -static int -check_special_filename (const char *fname) -{ - if (special_names_enabled && fname && *fname == '-' && fname[1] == '&') - { - int i; - - fname += 2; - for (i = 0; digitp (fname+i); i++) - ; - if (!fname[i]) - return atoi (fname); - } - return -1; -} - int iobuf_is_pipe_filename (const char *fname) { if (!fname || (*fname=='-' && !fname[1]) ) return 1; - return check_special_filename (fname) != -1; + return check_special_filename (fname, 0, 1) != -1; } + static iobuf_t do_open (const char *fname, int special_filenames, int use, const char *opentype, int mode700) @@ -1304,7 +1274,8 @@ do_open (const char *fname, int special_filenames, } else if (!fname) return NULL; - else if (special_filenames && (fd = check_special_filename (fname)) != -1) + else if (special_filenames + && (fd = check_special_filename (fname, 0, 1)) != -1) return iobuf_fdopen (translate_file_handle (fd, use == IOBUF_INPUT ? 0 : 1), opentype); else diff --git a/common/iobuf.h b/common/iobuf.h index 4fa5660..22e02da 100644 --- a/common/iobuf.h +++ b/common/iobuf.h @@ -258,16 +258,10 @@ struct iobuf_struct #endif EXTERN_UNLESS_MAIN_MODULE int iobuf_debug_mode; -/* Whether iobuf_open, iobuf_create and iobuf_is_pipefilename - recognize special filenames. Special filenames are of the form - "-&nnnn" where n is a positive integer. The integer corresponds to - a file descriptor. Note: these functions always recognize the - special filename '-', which corresponds to standard input. */ -void iobuf_enable_special_filenames (int yes); /* Returns whether the specified filename corresponds to a pipe. In particular, this function checks if FNAME is "-" and, if special - filenames are enabled (see iobuf_enable_special_filenames), whether + filenames are enabled (see check_special_filename), whether FNAME is a special filename. */ int iobuf_is_pipe_filename (const char *fname); diff --git a/common/sysutils.c b/common/sysutils.c index c7df872..e67420f 100644 --- a/common/sysutils.c +++ b/common/sysutils.c @@ -1,7 +1,7 @@ /* sysutils.c - system helpers * Copyright (C) 1991-2001, 2003-2004, * 2006-2008 Free Software Foundation, Inc. - * Copyright (C) 2013-2014 Werner Koch + * Copyright (C) 2013-2016 Werner Koch * * This file is part of GnuPG. * @@ -83,6 +83,10 @@ #define tohex(n) ((n) < 10 ? ((n) + '0') : (((n) - 10) + 'A')) +/* Flag to tell whether special file names are enabled. See gpg.c for + * an explanation of these file names. */ +static int allow_special_filenames; + static GPGRT_INLINE gpg_error_t my_error_from_syserror (void) @@ -168,6 +172,13 @@ enable_core_dumps (void) } +/* Allow the use of special "-&nnn" style file names. */ +void +enable_special_filenames (void) +{ + allow_special_filenames = 1; +} + /* Return a string which is used as a kind of process ID. */ const byte * @@ -402,6 +413,29 @@ translate_sys2libc_fd_int (int fd, int for_write) } +/* Check whether FNAME has the form "-&nnnn", where N is a non-zero + * number. Returns this number or -1 if it is not the case. If the + * caller wants to use the file descriptor for writing FOR_WRITE shall + * be set to 1. If NOTRANSLATE is set the Windows spefic mapping is + * not done. */ +int +check_special_filename (const char *fname, int for_write, int notranslate) +{ + if (allow_special_filenames + && fname && *fname == '-' && fname[1] == '&') + { + int i; + + fname += 2; + for (i=0; digitp (fname+i); i++ ) + ; + if (!fname[i]) + return notranslate? atoi (fname) + /**/ : translate_sys2libc_fd_int (atoi (fname), for_write); + } + return -1; +} + /* Replacement for tmpfile(). This is required because the tmpfile function of Windows' runtime library is broken, insecure, ignores diff --git a/common/sysutils.h b/common/sysutils.h index fef6ba1..a9316d7 100644 --- a/common/sysutils.h +++ b/common/sysutils.h @@ -50,6 +50,7 @@ typedef int gnupg_fd_t; void trap_unaligned (void); int disable_core_dumps (void); int enable_core_dumps (void); +void enable_special_filenames (void); const unsigned char *get_session_marker (size_t *rlen); unsigned int get_uint_nonce (void); /*int check_permissions (const char *path,int extension,int checkonly);*/ @@ -57,6 +58,7 @@ void gnupg_sleep (unsigned int seconds); void gnupg_usleep (unsigned int usecs); int translate_sys2libc_fd (gnupg_fd_t fd, int for_write); int translate_sys2libc_fd_int (int fd, int for_write); +int check_special_filename (const char *fname, int for_write, int notranslate); FILE *gnupg_tmpfile (void); void gnupg_reopen_std (const char *pgmname); void gnupg_allow_set_foregound_window (pid_t pid); diff --git a/g10/gpg.c b/g10/gpg.c index c54facb..caa0653 100644 --- a/g10/gpg.c +++ b/g10/gpg.c @@ -3304,9 +3304,11 @@ main (int argc, char **argv) case oAllowSecretKeyImport: /* obsolete */ break; case oTryAllSecrets: opt.try_all_secrets = 1; break; case oTrustedKey: register_trusted_key( pargs.r.ret_str ); break; + case oEnableSpecialFilenames: - iobuf_enable_special_filenames (1); + enable_special_filenames (); break; + case oNoExpensiveTrustChecks: opt.no_expensive_trust_checks=1; break; case oAutoCheckTrustDB: opt.no_auto_check_trustdb=0; break; case oNoAutoCheckTrustDB: opt.no_auto_check_trustdb=1; break; diff --git a/g10/gpgv.c b/g10/gpgv.c index 0ecf232..bd16b39 100644 --- a/g10/gpgv.c +++ b/g10/gpgv.c @@ -204,7 +204,7 @@ main( int argc, char **argv ) break; case oIgnoreTimeConflict: opt.ignore_time_conflict = 1; break; case oEnableSpecialFilenames: - iobuf_enable_special_filenames (1); + enable_special_filenames (); break; default : pargs.err = ARGPARSE_PRINT_ERROR; break; } diff --git a/sm/gpgsm.c b/sm/gpgsm.c index c4fd1c2..08d4830 100644 --- a/sm/gpgsm.c +++ b/sm/gpgsm.c @@ -439,9 +439,6 @@ static int maybe_setuid = 1; static const char *debug_level; static unsigned int debug_value; -/* Option --enable-special-filenames */ -static int allow_special_filenames; - /* Default value for include-certs. We need an extra macro for gpgconf-list because the variable will be changed by the command line option. @@ -468,7 +465,6 @@ static void set_cmd (enum cmd_and_opt_values *ret_cmd, enum cmd_and_opt_values new_cmd ); static void emergency_cleanup (void); -static int check_special_filename (const char *fname, int for_write); static int open_read (const char *filename); static estream_t open_es_fread (const char *filename, const char *mode); static estream_t open_es_fwrite (const char *filename); @@ -1420,7 +1416,9 @@ main ( int argc, char **argv) case oNoRandomSeedFile: use_random_seed = 0; break; case oNoCommonCertsImport: no_common_certs_import = 1; break; - case oEnableSpecialFilenames: allow_special_filenames =1; break; + case oEnableSpecialFilenames: + enable_special_filenames (); + break; case oValidationModel: parse_validation_model (pargs.r.ret_str); break; @@ -2107,25 +2105,6 @@ gpgsm_parse_validation_model (const char *model) } -/* Check whether the filename has the form "-&nnnn", where n is a - non-zero number. Returns this number or -1 if it is not the case. */ -static int -check_special_filename (const char *fname, int for_write) -{ - if (allow_special_filenames - && fname && *fname == '-' && fname[1] == '&' ) { - int i; - - fname += 2; - for (i=0; isdigit (fname[i]); i++ ) - ; - if ( !fname[i] ) - return translate_sys2libc_fd_int (atoi (fname), for_write); - } - return -1; -} - - /* Open the FILENAME for read and return the file descriptor. Stop with an error message in case of problems. "-" denotes stdin and @@ -2140,7 +2119,7 @@ open_read (const char *filename) set_binary (stdin); return 0; /* stdin */ } - fd = check_special_filename (filename, 0); + fd = check_special_filename (filename, 0, 0); if (fd != -1) return fd; fd = open (filename, O_RDONLY | O_BINARY); @@ -2162,7 +2141,7 @@ open_es_fread (const char *filename, const char *mode) if (filename[0] == '-' && !filename[1]) fd = fileno (stdin); else - fd = check_special_filename (filename, 0); + fd = check_special_filename (filename, 0, 0); if (fd != -1) { fp = es_fdopen_nc (fd, mode); @@ -2200,7 +2179,7 @@ open_es_fwrite (const char *filename) return fp; } - fd = check_special_filename (filename, 1); + fd = check_special_filename (filename, 1, 0); if (fd != -1) { fp = es_fdopen_nc (fd, "wb"); ----------------------------------------------------------------------- Summary of changes: agent/gpg-agent.c | 5 +++++ common/iobuf.c | 37 ++++--------------------------------- common/iobuf.h | 8 +------- common/sysutils.c | 36 +++++++++++++++++++++++++++++++++++- common/sysutils.h | 2 ++ g10/gpg.c | 4 +++- g10/gpgv.c | 2 +- g10/plaintext.c | 22 +++++++++++++++++++--- sm/gpgsm.c | 33 ++++++--------------------------- 9 files changed, 76 insertions(+), 73 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Tue Nov 29 17:06:31 2016 From: cvs at cvs.gnupg.org (by Andreas Rönnquist) Date: Tue, 29 Nov 2016 17:06:31 +0100 Subject: [git] GPA - branch, master, updated. gpa-0.9.10-2-gdc05f46 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Assistant". The branch, master has been updated via dc05f46e07626d468d090564fec23cc598368589 (commit) from d53f0eb88b790bf604a327362809b63b43ffaeb9 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit dc05f46e07626d468d090564fec23cc598368589 Author: Andreas R?nnquist Date: Mon Nov 21 18:49:48 2016 +0100 Fix typo. -- Signed-off-by: Justus Winter diff --git a/src/cm-netkey.c b/src/cm-netkey.c index 656010b..5f027cc 100644 --- a/src/cm-netkey.c +++ b/src/cm-netkey.c @@ -642,7 +642,7 @@ change_nullpin (GpaCMNetkey *card) "initial PIN is required but can't be reverted.\n\n" "Please check the documentation of your card to learn " "for what the NullPIN is good.\n\n" - "If you proceeed you will be asked to enter a new PIN " + "If you proceed you will be asked to enter a new PIN " "and later to repeat that PIN. Make sure that you " "will remember that PIN - it will not be possible to " "recover the PIN if it has been entered wrongly more " ----------------------------------------------------------------------- Summary of changes: src/cm-netkey.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) hooks/post-receive -- The GNU Privacy Assistant http://git.gnupg.org From cvs at cvs.gnupg.org Tue Nov 29 18:01:38 2016 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Tue, 29 Nov 2016 18:01:38 +0100 Subject: [git] GpgOL - branch, master, updated. gpgol-1.4.0-187-g9dde244 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG extension for MS Outlook". The branch, master has been updated via 9dde24462c2ef34b215d0eb8d9ca1cced7cee222 (commit) via 4989c5e0aeb2d31576d6df653c2fec2056b3ff32 (commit) from f9efc49ffaf5302b680c17ef0eede636b62319e1 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 9dde24462c2ef34b215d0eb8d9ca1cced7cee222 Author: Andre Heinecke Date: Tue Nov 29 18:01:19 2016 +0100 Support HTML sending and fix sender updates * src/mail.cpp (Mail::Mail): Update init. (Mail::get_sender): Sender is now a string. (Mail::encrypt_sign): Update accordingly. (Mail::update_sender): Changed to update_oom_data. (Mail::update_oom_data): More generic. Caches BodyFormat, HTMLBody and sender. Changed order for sender retrieval when composing mails. (Mail::update_sigstate): Update accordingly. (Mail::is_html_alternative, Mail::get_cached_html_body): New. * src/mail.h: Update accordingly. * src/mailitem-events.cpp (EVENT_SINK_INVOKE): Update oom data on send. * src/mimemaker.cpp (create_mapi_attachment): Fix another use after free. (infer_content_type): is_mapibody now defines text/html or text/plain. The naive content deduction is removed. (add_body): Handler for the HTML / multipart body. (do_mime_sign, mime_encrypt): Use add_body. (mime_sign, mime_sign_encrypt): Pass on mail object. -- We now send multipart/alternative mails in case HTML or RichText is selected as body format. This is the way outlook does it, too. The sender update fix is a bit mushed in as this is now all update_oom_data. diff --git a/src/mail.cpp b/src/mail.cpp index b294f16..55800fc 100644 --- a/src/mail.cpp +++ b/src/mail.cpp @@ -76,8 +76,8 @@ Mail::Mail (LPDISPATCH mailitem) : m_is_signed(false), m_is_valid(false), m_close_triggered(false), + m_is_html_alternative(false), m_moss_position(0), - m_sender(NULL), m_type(MSGTYPE_UNKNOWN) { if (get_mail_for_item (mailitem)) @@ -130,7 +130,6 @@ Mail::~Mail() } } - xfree (m_sender); gpgol_release(m_mailitem); if (!m_uuid.empty()) { @@ -724,17 +723,17 @@ Mail::encrypt_sign () log_debug ("%s:%s: Sign / Encrypting message", SRCNAME, __func__); err = message_sign_encrypt (message, proto, - NULL, get_sender (), this); + NULL, get_sender ().c_str (), this); } else if (flags == 2) { err = message_sign (message, proto, - NULL, get_sender (), this); + NULL, get_sender ().c_str (), this); } else if (flags == 1) { err = message_encrypt (message, proto, - NULL, get_sender (), this); + NULL, get_sender ().c_str (), this); } else { @@ -790,34 +789,51 @@ Mail::wipe () } int -Mail::update_sender () +Mail::update_oom_data () { LPDISPATCH sender = NULL; + log_debug ("%s:%s", SRCNAME, __func__); - /* For some reason outlook my store the recipient address + /* Update the body format. */ + m_is_html_alternative = get_oom_int (m_mailitem, "BodyFormat") > 1; + + /* Store the body. It was not obvious for me (aheinecke) how + to access this through MAPI. */ + m_html_body = get_oom_string (m_mailitem, "HTMLBody"); + + /* For some reason outlook may store the recipient address in the send using account field. If we have SMTP we prefer the SenderEmailAddress string. */ - char *type = get_oom_string (m_mailitem, "SenderEmailType"); - if (type && !strcmp ("SMTP", type)) + + if (is_crypto_mail ()) { - xfree (type); - char *senderMail = get_oom_string (m_mailitem, "SenderEmailAddress"); - if (senderMail) + /* This is the case where we are reading a mail and not composing. + When composing we need to use the SendUsingAccount because if + you send from the folder of userA but change the from to userB + outlook will keep the SenderEmailAddress of UserA. This is all + so horrible. */ + char *type = get_oom_string (m_mailitem, "SenderEmailType"); + if (type && !strcmp ("SMTP", type)) { - xfree (m_sender); - m_sender = senderMail; - return 0; + char *senderMail = get_oom_string (m_mailitem, "SenderEmailAddress"); + if (senderMail) + { + m_sender = senderMail; + log_debug ("Sender %i is now: %s",__LINE__, m_sender.c_str()); + xfree (senderMail); + xfree (type); + return 0; + } } + xfree (type); } - xfree (type); - sender = get_oom_object (m_mailitem, "SendUsingAccount"); - xfree (m_sender); - m_sender = NULL; - if (sender) { - m_sender = get_oom_string (sender, "SmtpAddress"); + char *buf = get_oom_string (sender, "SmtpAddress"); + m_sender = buf; + log_debug ("Sender %i is now: %s",__LINE__, m_sender.c_str()); + xfree (buf); gpgol_release (sender); return 0; } @@ -825,7 +841,10 @@ Mail::update_sender () sender = get_oom_object (m_mailitem, "Sender"); if (sender) { - m_sender = get_pa_string (sender, PR_SMTP_ADDRESS_DASL); + char *buf = get_pa_string (sender, PR_SMTP_ADDRESS_DASL); + m_sender = buf; + log_debug ("Sender %i is now: %s",__LINE__, m_sender.c_str()); + xfree (buf); gpgol_release (sender); return 0; } @@ -834,23 +853,24 @@ Mail::update_sender () sender = get_oom_object (m_mailitem, "Session.CurrentUser"); if (sender) { - m_sender = get_pa_string (sender, PR_SMTP_ADDRESS_DASL); + char *buf = get_pa_string (sender, PR_SMTP_ADDRESS_DASL); + m_sender = buf; + log_debug ("Sender %i is now: %s",__LINE__, m_sender.c_str()); + xfree (buf); gpgol_release (sender); return 0; } - log_error ("%s:%s: All fallbacks failed.", + log_debug ("%s:%s: All fallbacks failed.", SRCNAME, __func__); return -1; } -const char * +std::string Mail::get_sender () { - if (!m_sender) - { - update_sender(); - } + if (m_sender.empty()) + update_oom_data(); return m_sender; } @@ -1146,9 +1166,9 @@ get_uid_for_sender (const Key k, const char *sender) void Mail::update_sigstate () { - const char *sender = get_sender(); + std::string sender = get_sender(); - if (!sender) + if (sender.empty()) { log_error ("%s:%s:%i", SRCNAME, __func__, __LINE__); return; @@ -1178,7 +1198,7 @@ Mail::update_sigstate () /* For our category we only care about trusted sigs. */ continue; } - const auto uid = get_uid_for_sender (sig.key(), sender); + const auto uid = get_uid_for_sender (sig.key(), sender.c_str()); if (sig.validity() == Signature::Validity::Marginal) { const auto tofu = uid.tofuInfo(); @@ -1429,7 +1449,7 @@ Mail::get_signature_status() + std::string(" "); } - const auto uid = get_uid_for_sender (sig.key(), get_sender()); + const auto uid = get_uid_for_sender (sig.key(), get_sender().c_str()); /* Now the key problems */ if ((sig.summary() & Signature::Summary::KeyMissing)) { @@ -1462,7 +1482,7 @@ Mail::get_signature_status() else if (uid.isNull()) { gpgrt_asprintf (&buf, _("does not claim the address: \"%s\"."), - get_sender()); + get_sender().c_str()); message += buf; xfree (buf); } @@ -1599,3 +1619,15 @@ void Mail::locate_keys() } xfree (recipients); } + +bool +Mail::is_html_alternative () const +{ + return m_is_html_alternative; +} + +const std::string & +Mail::get_cached_html_body () const +{ + return m_html_body; +} diff --git a/src/mail.h b/src/mail.h index 3ca144a..7eddf34 100644 --- a/src/mail.h +++ b/src/mail.h @@ -162,15 +162,20 @@ public: * @returns 0 on success; */ int revert (); - /** @brief update the sender address. + /** @brief update some data collected from the oom + * + * This updates cached values from the OOM that are not available + * in MAPI events like after Write. * * For Exchange 2013 at least we don't have any other way to get the * senders SMTP address then through the object model. So we have to * store the sender address for later events that do not allow us to * access the OOM but enable us to work with the underlying MAPI structure. * + * It also updated the is_html_alternative value. + * * @returns 0 on success */ - int update_sender (); + int update_oom_data (); /** @brief get sender SMTP address (UTF-8 encoded). * @@ -178,7 +183,7 @@ public: * calls update_sender before returning the sender. * * @returns A reference to the utf8 sender address. Or NULL. */ - const char *get_sender (); + std::string get_sender (); /** @brief get the subject string (UTF-8 encoded). * @@ -287,6 +292,13 @@ public: /** State variable to check if a close was triggerd by us. */ void set_close_triggered (bool value); bool get_close_triggered () const; + + /** Check if the mail should be sent as html alternative mail. + Only valid if update_oom_data was called before. */ + bool is_html_alternative () const; + + /** Get the html body. It is updated in update_oom_data. */ + const std::string & get_cached_html_body () const; private: void update_categories (); void update_body (); @@ -302,9 +314,11 @@ private: m_is_smime_checked, /* it was checked if this is an smime mail */ m_is_signed, /* Mail is signed */ m_is_valid, /* Mail is valid signed. */ - m_close_triggered; /* We have programtically triggered a close */ + m_close_triggered, /* We have programtically triggered a close */ + m_is_html_alternative; /* Body Format is not plain text */ int m_moss_position; /* The number of the original message attachment. */ - char *m_sender; + std::string m_sender; + std::string m_html_body; /* Cached html body. */ msgtype_t m_type; /* Our messagetype as set in mapi */ std::shared_ptr m_parser; GpgME::VerificationResult m_verify_result; diff --git a/src/mailitem-events.cpp b/src/mailitem-events.cpp index ca16bd7..101e2a8 100644 --- a/src/mailitem-events.cpp +++ b/src/mailitem-events.cpp @@ -306,7 +306,7 @@ EVENT_SINK_INVOKE(MailItemEvents) SRCNAME, __func__); break; } - m_mail->update_sender (); + m_mail->update_oom_data (); m_send_seen = true; invoke_oom_method (m_object, "Save", NULL); if (m_mail->crypto_successful ()) diff --git a/src/mimemaker.cpp b/src/mimemaker.cpp index a9e9aa6..2b98192 100644 --- a/src/mimemaker.cpp +++ b/src/mimemaker.cpp @@ -42,6 +42,7 @@ #include "mimemaker.h" #include "oomhelp.h" #include "gpgolstr.h" +#include "mail.h" static const unsigned char oid_mimetag[] = {0x2A, 0x86, 0x48, 0x86, 0xf7, 0x14, 0x03, 0x0a, 0x04}; @@ -207,8 +208,9 @@ create_mapi_attachment (LPMESSAGE message, sink_t sink) if (!hr) { prop.ulPropTag = PR_ATTACH_MIME_TAG_A; - prop.Value.lpszA = GpgOLStr("multipart/signed"); + prop.Value.lpszA = strdup("multipart/signed"); hr = HrSetOneProp ((LPMAPIPROP)att, &prop); + xfree (prop.Value.lpszA); } if (hr) { @@ -558,14 +560,14 @@ write_plain (sink_t sink, const void *data, size_t datalen) } -/* Infer the conent type from DATA and FILENAME. The return value is +/* Infer the conent type from the FILENAME. The return value is a static string there won't be an error return. In case Bae 64 encoding is required for the type true will be stored at FORCE_B64; however, this is only a shortcut and if that is not set, the caller - should infer the encoding by otehr means. */ + should infer the encoding by other means. */ static const char * -infer_content_type (const char *data, size_t datalen, const char *filename, - int is_mapibody, int *force_b64) +infer_content_type (const char * /*data*/, size_t /*datalen*/, + const char *filename, int is_mapibody, int *force_b64) { static struct { char b64; @@ -701,15 +703,14 @@ infer_content_type (const char *data, size_t datalen, const char *filename, /* Not found via filename, look at the content. */ - if (is_mapibody) + if (is_mapibody == 1) { - /* Fixme: This is too simple. */ - if (datalen > 6 && (!memcmp (data, "", 6) - ||!memcmp (data, "", 6))) - return "text/html"; return "text/plain"; } - + else if (is_mapibody == 2) + { + return "text/html"; + } return "application/octet-stream"; } @@ -1225,6 +1226,85 @@ create_top_signing_header (char *buffer, size_t buflen, protocol_t protocol, micalg, boundary); } +/* Add the body, either as multipart/alternative or just as the + simple body part. Depending on the format set in outlook. To + avoid memory duplication it takes the plain body as parameter. + + Boundary is the potential outer boundary of a multipart/mixed + mail. If it is null we assume the multipart/alternative is + the only part. + + return is zero on success. +*/ +static int +add_body (Mail *mail, const char *boundary, sink_t sink, + const char *plain_body) +{ + if (!plain_body) + { + return 0; + } + bool is_alternative = false; + if (mail) + { + is_alternative = mail->is_html_alternative (); + } + + int rc = 0; + if (!is_alternative || !plain_body) + { + if (plain_body) + { + rc = write_part (sink, plain_body, strlen (plain_body), + *boundary? boundary : NULL, NULL, 1); + } + /* Just the plain body or no body. We are done. */ + return rc; + } + + /* Now for the multipart/alternative part. We never do HTML only. */ + char alt_boundary [BOUNDARYSIZE+1]; + generate_boundary (alt_boundary); + + if ((rc=write_multistring (sink, + "Content-Type: multipart/alternative;\r\n", + "\tboundary=\"", alt_boundary, "\"\r\n", + "\r\n", /* <-- extra line */ + NULL))) + { + TRACEPOINT; + return rc; + } + + /* Now the plain body part */ + if ((rc = write_part (sink, plain_body, strlen (plain_body), + alt_boundary, NULL, 1))) + { + TRACEPOINT; + return rc; + } + + /* Now the html body. It is somehow not accessible through PR_HTML, + OutlookSpy also shows MAPI Unsported (but shows the data) strange. + We just cache it. Memory is cheap :-) */ + const auto html_body = mail->get_cached_html_body(); + if (html_body.empty()) + { + log_error ("%s:%s: BUG: Body but no html body in alternative mail?", + SRCNAME, __func__); + } + + rc = write_part (sink, html_body.c_str(), html_body.size(), + alt_boundary, NULL, 2); + if (rc) + { + TRACEPOINT; + return rc; + } + /* Finish our multipart */ + return write_boundary (sink, alt_boundary, 1); +} + /* Main body of mime_sign without the the code to delete the original attachments. On success the function returns the current @@ -1234,7 +1314,8 @@ create_top_signing_header (char *buffer, size_t buflen, protocol_t protocol, static int do_mime_sign (LPMESSAGE message, HWND hwnd, protocol_t protocol, mapi_attach_item_t **r_att_table, sink_t tmpsink, - unsigned int session_number, const char *sender) + unsigned int session_number, const char *sender, + Mail *mail) { int result = -1; int rc; @@ -1350,10 +1431,13 @@ do_mime_sign (LPMESSAGE message, HWND hwnd, protocol_t protocol, NULL))) goto failure; + if ((rc=add_body (mail, inner_boundary, hashsink, body))) + { + log_error ("%s:%s: Adding the body failed.", + SRCNAME, __func__); + goto failure; + } - if (body) - rc = write_part (hashsink, body, strlen (body), - *inner_boundary? inner_boundary : NULL, NULL, 1); if (!rc && n_att_usable) rc = write_attachments (hashsink, message, att_table, *inner_boundary? inner_boundary : NULL); @@ -1497,13 +1581,13 @@ do_mime_sign (LPMESSAGE message, HWND hwnd, protocol_t protocol, it. */ int mime_sign (LPMESSAGE message, HWND hwnd, protocol_t protocol, - const char *sender, Mail *) + const char *sender, Mail *mail) { int result = -1; mapi_attach_item_t *att_table; result = do_mime_sign (message, hwnd, protocol, &att_table, 0, - engine_new_session_number (), sender); + engine_new_session_number (), sender, mail); if (!result) { if (!finalize_message (message, att_table, protocol, 0)) @@ -1688,7 +1772,7 @@ create_top_encryption_header (sink_t sink, protocol_t protocol, char *boundary) int mime_encrypt (LPMESSAGE message, HWND hwnd, protocol_t protocol, char **recipients, - const char *sender, Mail*) + const char *sender, Mail* mail) { int result = -1; int rc; @@ -1782,9 +1866,12 @@ mime_encrypt (LPMESSAGE message, HWND hwnd, else /* Only one part. */ *inner_boundary = 0; - if (body) - rc = write_part (encsink, body, strlen (body), - *inner_boundary? inner_boundary : NULL, NULL, 1); + if ((rc=add_body (mail, inner_boundary, encsink, body))) + { + log_error ("%s:%s: Adding the body failed.", + SRCNAME, __func__); + goto failure; + } if (!rc && n_att_usable) rc = write_attachments (encsink, message, att_table, *inner_boundary? inner_boundary : NULL); @@ -1841,7 +1928,7 @@ mime_encrypt (LPMESSAGE message, HWND hwnd, int mime_sign_encrypt (LPMESSAGE message, HWND hwnd, protocol_t protocol, char **recipients, - const char *sender, Mail*) + const char *sender, Mail *mail) { int result = -1; int rc = 0; @@ -1950,7 +2037,7 @@ mime_sign_encrypt (LPMESSAGE message, HWND hwnd, the signature. Note that the protocol to use is taken from the encryption operation. */ if (do_mime_sign (message, hwnd, protocol, &att_table, tmpsink, - session_number, sender)) + session_number, sender, mail)) goto failure; /* Now send the actual ENCRYPT command. This split up between commit 4989c5e0aeb2d31576d6df653c2fec2056b3ff32 Author: Andre Heinecke Date: Tue Nov 29 17:51:26 2016 +0100 Ignore more property changes * src/mailitem-events.cpp (prop_blacklist): Add OutlookVersion and OutlookInternalVersion. -- For mails imported from the filesystem outlook changed these properties. diff --git a/src/mailitem-events.cpp b/src/mailitem-events.cpp index 33b48e9..ca16bd7 100644 --- a/src/mailitem-events.cpp +++ b/src/mailitem-events.cpp @@ -39,6 +39,8 @@ const wchar_t *prop_blacklist[] = { L"BCC", /* Ditto */ L"Categories", L"UnRead", + L"OutlookVersion", + L"OutlookInternalVersion", NULL }; typedef enum ----------------------------------------------------------------------- Summary of changes: src/mail.cpp | 100 +++++++++++++++++++++++------------- src/mail.h | 24 +++++++-- src/mailitem-events.cpp | 4 +- src/mimemaker.cpp | 133 +++++++++++++++++++++++++++++++++++++++--------- 4 files changed, 198 insertions(+), 63 deletions(-) hooks/post-receive -- GnuPG extension for MS Outlook http://git.gnupg.org From cvs at cvs.gnupg.org Tue Nov 29 18:23:29 2016 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Tue, 29 Nov 2016 18:23:29 +0100 Subject: [git] GpgOL - branch, master, updated. gpgol-1.4.0-188-g5b34e85 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG extension for MS Outlook". The branch, master has been updated via 5b34e853a15baba47a8983e5430069a0a37bcb81 (commit) from 9dde24462c2ef34b215d0eb8d9ca1cced7cee222 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 5b34e853a15baba47a8983e5430069a0a37bcb81 Author: Andre Heinecke Date: Tue Nov 29 18:22:49 2016 +0100 Fix mulipart/mixed with alternative content * src/mimemaker.cpp (add_body): Open new part if in mixed structure. diff --git a/src/mimemaker.cpp b/src/mimemaker.cpp index 2b98192..b7bd1e5 100644 --- a/src/mimemaker.cpp +++ b/src/mimemaker.cpp @@ -1262,6 +1262,13 @@ add_body (Mail *mail, const char *boundary, sink_t sink, return rc; } + /* Add a new multipart / mixed element. */ + if (boundary && write_boundary (sink, boundary, 0)) + { + TRACEPOINT; + return 1; + } + /* Now for the multipart/alternative part. We never do HTML only. */ char alt_boundary [BOUNDARYSIZE+1]; generate_boundary (alt_boundary); ----------------------------------------------------------------------- Summary of changes: src/mimemaker.cpp | 7 +++++++ 1 file changed, 7 insertions(+) hooks/post-receive -- GnuPG extension for MS Outlook http://git.gnupg.org From cvs at cvs.gnupg.org Tue Nov 29 19:49:55 2016 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Tue, 29 Nov 2016 19:49:55 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.1.16-38-g8489b12 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via 8489b12211098ad58c008cfb74b5cb91849cf68d (commit) from 81d6e98cdf4caa3aa92398fc3b8bed397b40f58d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 8489b12211098ad58c008cfb74b5cb91849cf68d Author: Werner Koch Date: Tue Nov 29 19:19:45 2016 +0100 gpgsm: Allow decryption with a card returning a PKCS#1 stripped key. * sm/decrypt.c (prepare_decryption): Handle a 16 byte session key. -- GnuPG-bug-id: 2230 Signed-off-by: Werner Koch diff --git a/sm/decrypt.c b/sm/decrypt.c index 11c1cf8..a2907f6 100644 --- a/sm/decrypt.c +++ b/sm/decrypt.c @@ -74,10 +74,12 @@ prepare_decryption (ctrl_t ctrl, const char *hexkeygrip, const char *desc, log_printhex ("pkcs1 encoded session key:", seskey, seskeylen); n=0; - if (seskeylen == 24) + if (seskeylen == 24 || seskeylen == 16) { - /* Smells like a 3-des key. This might happen because a SC has - already done the unpacking. */ + /* Smells like a 3-DES or AES-128 key. This might happen + * because a SC has already done the unpacking. A better + * solution would be to test for this only after we triggered + * the GPG_ERR_INV_SESSION_KEY. */ } else { ----------------------------------------------------------------------- Summary of changes: sm/decrypt.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Tue Nov 29 20:38:00 2016 From: cvs at cvs.gnupg.org (by Werner Koch) Date: Tue, 29 Nov 2016 20:38:00 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.1.16-40-gaa6ab9e Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via aa6ab9e0bc67fe9ce5601047e84ea4a875e8eb64 (commit) via 854adc8ae19749e44cb79dfa0c5401f48012b13a (commit) from 8489b12211098ad58c008cfb74b5cb91849cf68d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit aa6ab9e0bc67fe9ce5601047e84ea4a875e8eb64 Author: Werner Koch Date: Tue Nov 29 20:35:10 2016 +0100 agent,dirmngr: Tiny restructuring. * agent/gpg-agent.c (handle_connections): Add a comment. * dirmngr/dirmngr.c (main): Move assuan_sock_close of the listening socket to ... (handle_connections): here. Add a comment why we keep the listening socket open during a shutdown. Signed-off-by: Werner Koch diff --git a/agent/gpg-agent.c b/agent/gpg-agent.c index c2052c9..710357c 100644 --- a/agent/gpg-agent.c +++ b/agent/gpg-agent.c @@ -2829,7 +2829,12 @@ handle_connections (gnupg_fd_t listen_fd, break; /* ready */ /* Do not accept new connections but keep on running the - loop to cope with the timer events. */ + * loop to cope with the timer events. + * + * Note that we do not close the listening socket because a + * client trying to connect to that socket would instead + * restart a new dirmngr instance - which is unlikely the + * intention of a shutdown. */ FD_ZERO (&fdset); nfd = -1; if (my_inotify_fd != -1) diff --git a/dirmngr/dirmngr.c b/dirmngr/dirmngr.c index 748f309..191f772 100644 --- a/dirmngr/dirmngr.c +++ b/dirmngr/dirmngr.c @@ -1026,7 +1026,6 @@ main (int argc, char **argv) crl_cache_init (); http_register_netactivity_cb (netactivity_action); handle_connections (3); - assuan_sock_close (3); shutdown_reaper (); } #endif /*HAVE_W32_SYSTEM*/ @@ -1234,7 +1233,6 @@ main (int argc, char **argv) crl_cache_init (); http_register_netactivity_cb (netactivity_action); handle_connections (fd); - assuan_sock_close (fd); shutdown_reaper (); } else if (cmd == aListCRLs) @@ -1925,7 +1923,8 @@ my_inotify_is_name (int fd, const char *name) #endif /*HAVE_INOTIFY_INIT*/ -/* Main loop in daemon mode. */ +/* Main loop in daemon mode. Note that LISTEN_FD will be owned by + * this function. */ static void handle_connections (assuan_fd_t listen_fd) { @@ -2006,7 +2005,14 @@ handle_connections (assuan_fd_t listen_fd) break; /* ready */ /* Do not accept new connections but keep on running the - loop to cope with the timer events. */ + * loop to cope with the timer events. + * + * Note that we do not close the listening socket because a + * client trying to connect to that socket would instead + * restart a new dirmngr instance - which is unlikely the + * intention of a shutdown. */ + /* assuan_sock_close (listen_fd); */ + /* listen_fd = -1; */ FD_ZERO (&fdset); nfd = -1; if (my_inotify_fd != -1) @@ -2109,6 +2115,8 @@ handle_connections (assuan_fd_t listen_fd) close (my_inotify_fd); #endif /*HAVE_INOTIFY_INIT*/ npth_attr_destroy (&tattr); + if (listen_fd != -1) + assuan_sock_close (fd); cleanup (); log_info ("%s %s stopped\n", strusage(11), strusage(13)); } commit 854adc8ae19749e44cb79dfa0c5401f48012b13a Author: Werner Koch Date: Tue Nov 29 20:15:47 2016 +0100 agent,dirmngr: Handle corner case in shutdown mode. * agent/gpg-agent.c (handle_connections): Keep on selecting on the inotify fd even when a shutdown is pending. * dirmngr/dirmngr.c (handle_connections): Ditto. Also simplifyy the use of the HAVE_INOTIFY_INIT cpp conditional. -- Without that patch we won't notice a removed socket when a shutdown is pending. This is somewhat related to bug report 2849. Signed-off-by: Werner Koch diff --git a/agent/gpg-agent.c b/agent/gpg-agent.c index 5060c07..c2052c9 100644 --- a/agent/gpg-agent.c +++ b/agent/gpg-agent.c @@ -2831,6 +2831,12 @@ handle_connections (gnupg_fd_t listen_fd, /* Do not accept new connections but keep on running the loop to cope with the timer events. */ FD_ZERO (&fdset); + nfd = -1; + if (my_inotify_fd != -1) + { + FD_SET (my_inotify_fd, &fdset); + nfd = my_inotify_fd; + } } /* POSIX says that fd_set should be implemented as a structure, diff --git a/dirmngr/dirmngr.c b/dirmngr/dirmngr.c index f60173b..748f309 100644 --- a/dirmngr/dirmngr.c +++ b/dirmngr/dirmngr.c @@ -1942,9 +1942,7 @@ handle_connections (assuan_fd_t listen_fd) struct timespec curtime; struct timespec timeout; int saved_errno; -#ifdef HAVE_INOTIFY_INIT - int my_inotify_fd; -#endif /*HAVE_INOTIFY_INIT*/ + int my_inotify_fd = -1; npth_attr_init (&tattr); npth_attr_setdetachstate (&tattr, NPTH_CREATE_DETACHED); @@ -1988,14 +1986,12 @@ handle_connections (assuan_fd_t listen_fd) FD_ZERO (&fdset); FD_SET (FD2INT (listen_fd), &fdset); nfd = FD2INT (listen_fd); -#ifdef HAVE_INOTIFY_INIT if (my_inotify_fd != -1) { FD_SET (my_inotify_fd, &fdset); if (my_inotify_fd > nfd) nfd = my_inotify_fd; } -#endif /*HAVE_INOTIFY_INIT*/ npth_clock_gettime (&abstime); abstime.tv_sec += TIMERTICK_INTERVAL; @@ -2012,6 +2008,12 @@ handle_connections (assuan_fd_t listen_fd) /* Do not accept new connections but keep on running the loop to cope with the timer events. */ FD_ZERO (&fdset); + nfd = -1; + if (my_inotify_fd != -1) + { + FD_SET (my_inotify_fd, &fdset); + nfd = my_inotify_fd; + } } /* Take a copy of the fdset. */ ----------------------------------------------------------------------- Summary of changes: agent/gpg-agent.c | 13 ++++++++++++- dirmngr/dirmngr.c | 28 +++++++++++++++++++--------- 2 files changed, 31 insertions(+), 10 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Wed Nov 30 02:18:51 2016 From: cvs at cvs.gnupg.org (by NIIBE Yutaka) Date: Wed, 30 Nov 2016 02:18:51 +0100 Subject: [git] GnuPG - branch, STABLE-BRANCH-2-0, updated. gnupg-2.0.30-28-g5c599e4 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, STABLE-BRANCH-2-0 has been updated via 5c599e4f6edd288f4759c9fc2bcf9fe87dee1836 (commit) via bb5a153f9dd9497f58935c2a7026220f3a99cffd (commit) via 3089c76a4a6a4250489a8ea373e5810bc9593654 (commit) via 354f8119bc24c93b3ead367af7ded8dd271feb3c (commit) via 88556386a61f5fa9ce8c5abbe1fd6d66a7723854 (commit) via 68d3e461f67404d1b47dfa7b9efdb6ac2c087bb7 (commit) via 710d0ce0fd5ee33b1e57f1ae9aedb90c7f7e234d (commit) via 5acce7060ca48e6c5e06a3918950c4eb83668fda (commit) via 519c01a0fd6cfc9d4282251e187d45194325c85b (commit) via 3b3386a3fd973ed7f388b1356138941c302848f2 (commit) via f916d5756fae163896715b057a627a5fb58ddd52 (commit) via 51464a0eadc82c84780fba08a53163cb6e4da2a4 (commit) via d87699597f4b47968902324c90beb3f3c51ff1d7 (commit) via d4316d13749bd8662525c2b7c416d39c5d4d8089 (commit) via af7245e9a79d11866aa9c40f8f53291f82dd74b5 (commit) via a6f7c8d9b70daba319d24d930be056618cbad61b (commit) via f1b9521fd6bd46547090efb1de78fa46bf2abfd2 (commit) from cbd0308bc70855a2dd34bda85b9b40a61199678c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 5c599e4f6edd288f4759c9fc2bcf9fe87dee1836 Author: NIIBE Yutaka Date: Fri Nov 25 16:12:26 2016 +0900 scd: Support OpenPGP card V3 for RSA. * scd/app-openpgp.c (struct app_local_s): Remove max_cmd_data and max_rsp_data fields as Extended Capabilities bits are different. (get_cached_data) Use extcap.max_certlen_3. (get_one_do): Don't use exmode=1. (determine_rsa_response): New. (get_public_key, do_genkey): Call determine_rsa_response. (do_sign): Use keyattr[0].rsa.n_bits / 8, instead of max_rsp_data. (do_auth): Use keyattr[2].rsa.n_bits / 8, instead of max_rsp_data. (do_decipher): Likewise with Use keyattr[1].rsa.n_bits / 8. (show_caps): Remove max_cmd_data and max_rsp_data. (app_select_openpgp): Likewise. -- Backport of master commit: b89e63e5c326af71470124b410e6429cbd2b5c43 OpenPGP card V3 had introduced incompatible change in Extended Capabilities bits. We can work around by this change by not using those bits. Signed-off-by: NIIBE Yutaka diff --git a/scd/app-openpgp.c b/scd/app-openpgp.c index 972362c..5983aba 100644 --- a/scd/app-openpgp.c +++ b/scd/app-openpgp.c @@ -182,8 +182,6 @@ struct app_local_s { unsigned int sm_aes128:1; /* Use AES-128 for SM. */ unsigned int max_certlen_3:16; unsigned int max_get_challenge:16; /* Maximum size for get_challenge. */ - unsigned int max_cmd_data:16; /* Maximum data size for a command. */ - unsigned int max_rsp_data:16; /* Maximum size of a response. */ } extcap; /* Flags used to control the application. */ @@ -300,7 +298,7 @@ get_cached_data (app_t app, int tag, } if (try_extlen && app->app_local->cardcap.ext_lc_le) - exmode = app->app_local->extcap.max_rsp_data; + exmode = app->app_local->extcap.max_certlen_3; else exmode = 0; @@ -430,10 +428,7 @@ get_one_do (app_t app, int tag, unsigned char **result, size_t *nbytes, if (app->card_version > 0x0100 && data_objects[i].get_immediate_in_v11) { - if (data_objects[i].try_extlen && app->app_local->cardcap.ext_lc_le) - exmode = app->app_local->extcap.max_rsp_data; - else - exmode = 0; + exmode = 0; rc = iso7816_get_data (app->slot, exmode, tag, &buffer, &buflen); if (rc) { @@ -865,6 +860,22 @@ send_key_attr (ctrl_t ctrl, app_t app, const char *keyword, int number) } +#define RSA_SMALL_SIZE_KEY 1952 +#define RSA_SMALL_SIZE_OP 2048 + +static int +determine_rsa_response (app_t app, int keyno) +{ + int size; + + size = 2 + 3 /* header */ + + 4 /* tag+len */ + app->app_local->keyattr[keyno].n_bits/8 + + 2 /* tag+len */ + app->app_local->keyattr[keyno].e_bits/8; + + return size; +} + + /* Implement the GETATTR command. This is similar to the LEARN command but returns just one value via the status interface. */ static gpg_error_t @@ -1199,10 +1210,11 @@ get_public_key (app_t app, int keyno) int exmode, le_value; /* We may simply read the public key out of these cards. */ - if (app->app_local->cardcap.ext_lc_le) + if (app->app_local->cardcap.ext_lc_le + && app->app_local->keyattr[keyno].n_bits > RSA_SMALL_SIZE_KEY) { exmode = 1; /* Use extended length. */ - le_value = app->app_local->extcap.max_rsp_data; + le_value = determine_rsa_response (app, keyno); } else { @@ -3042,12 +3054,11 @@ do_genkey (app_t app, ctrl_t ctrl, const char *keynostr, unsigned int flags, if (err) goto leave; - /* Test whether we will need extended length mode. (1900 is an - arbitrary length which for sure fits into a short apdu.) */ - if (app->app_local->cardcap.ext_lc_le && keybits > 1900) + /* Test whether we will need extended length mode. */ + if (app->app_local->cardcap.ext_lc_le && keybits > RSA_SMALL_SIZE_KEY) { exmode = 1; /* Use extended length w/o a limit. */ - le_value = app->app_local->extcap.max_rsp_data; + le_value = determine_rsa_response (app, keyno); /* No need to check le_value because it comes from a 16 bit value and thus can't create an overflow on a 32 bit system. */ @@ -3406,10 +3417,11 @@ do_sign (app_t app, const char *keyidstr, int hashalgo, } - if (app->app_local->cardcap.ext_lc_le) + if (app->app_local->cardcap.ext_lc_le + && app->app_local->keyattr[0].n_bits > RSA_SMALL_SIZE_OP) { exmode = 1; /* Use extended length. */ - le_value = app->app_local->extcap.max_rsp_data; + le_value = app->app_local->keyattr[0].n_bits / 8; } else { @@ -3491,10 +3503,11 @@ do_auth (app_t app, const char *keyidstr, { int exmode, le_value; - if (app->app_local->cardcap.ext_lc_le) + if (app->app_local->cardcap.ext_lc_le + && app->app_local->keyattr[2].n_bits > RSA_SMALL_SIZE_OP) { exmode = 1; /* Use extended length. */ - le_value = app->app_local->extcap.max_rsp_data; + le_value = app->app_local->keyattr[2].n_bits / 8; } else { @@ -3607,10 +3620,12 @@ do_decipher (app_t app, const char *keyidstr, padind = -1; /* Already padded. */ } - if (app->app_local->cardcap.ext_lc_le && indatalen > 254 ) + if (app->app_local->cardcap.ext_lc_le + && (indatalen > 254 + || app->app_local->keyattr[1].n_bits > RSA_SMALL_SIZE_OP)) { exmode = 1; /* Extended length w/o a limit. */ - le_value = app->app_local->extcap.max_rsp_data; + le_value = app->app_local->keyattr[1].n_bits / 8; } else if (app->app_local->cardcap.cmd_chaining && indatalen > 254) { @@ -3742,8 +3757,6 @@ show_caps (struct app_local_s *s) if (s->extcap.sm_supported) log_printf (" (%s)", s->extcap.sm_aes128? "AES-128":"3DES"); log_info ("Max-Cert3-Len ..: %u\n", s->extcap.max_certlen_3); - log_info ("Max-Cmd-Data ...: %u\n", s->extcap.max_cmd_data); - log_info ("Max-Rsp-Data ...: %u\n", s->extcap.max_rsp_data); log_info ("Cmd-Chaining ...: %s\n", s->cardcap.cmd_chaining?"yes":"no"); log_info ("Ext-Lc-Le ......: %s\n", s->cardcap.ext_lc_le?"yes":"no"); log_info ("Status Indicator: %02X\n", s->status_indicator); @@ -3971,8 +3984,6 @@ app_select_openpgp (app_t app) app->app_local->extcap.max_get_challenge = (buffer[2] << 8 | buffer[3]); app->app_local->extcap.max_certlen_3 = (buffer[4] << 8 | buffer[5]); - app->app_local->extcap.max_cmd_data = (buffer[6] << 8 | buffer[7]); - app->app_local->extcap.max_rsp_data = (buffer[8] << 8 | buffer[9]); } xfree (relptr); commit bb5a153f9dd9497f58935c2a7026220f3a99cffd Author: NIIBE Yutaka Date: Tue Nov 22 20:53:57 2016 +0900 scd: Fix receive buffer size. * scd/apdu.c (send_le): Fix the size, adding two for status bytes to Le. -- Backport of master commit: 5c2db9dedfe9dbb14ffec24751ca23a69cead94e This is long standing bug. So far, Le was not exact value. Since forthcoming change will introduce exact value of expected length of response data, this change is needed. Signed-off-by: NIIBE Yutaka diff --git a/scd/apdu.c b/scd/apdu.c index 0beee25..97bce79 100644 --- a/scd/apdu.c +++ b/scd/apdu.c @@ -3648,8 +3648,9 @@ send_le (int slot, int class, int ins, int p0, int p1, if (use_extended_length && (le > 256 || le < 0)) { - result_buffer_size = le < 0? 4096 : le; - result_buffer = xtrymalloc (result_buffer_size + 10); + /* Two more bytes are needed for status bytes. */ + result_buffer_size = le < 0? 4096 : (le + 2); + result_buffer = xtrymalloc (result_buffer_size); if (!result_buffer) { xfree (apdu_buffer); commit 3089c76a4a6a4250489a8ea373e5810bc9593654 Author: NIIBE Yutaka Date: Fri Nov 18 08:54:04 2016 +0900 scd: Don't limit to ST-2xxx for PC/SC. * scd/apdu.c (pcsc_vendor_specific_init): Only check vender ID. -- Backport of master commit: b6066ab18a67195817babaf9eccf896c2b3c7b0e Some other products by Cherry works with pinpad, although it only works for smaller keys (RSA 1024). TPDU support is good for larger keys. Signed-off-by: NIIBE Yutaka diff --git a/scd/apdu.c b/scd/apdu.c index 570e150..0beee25 100644 --- a/scd/apdu.c +++ b/scd/apdu.c @@ -1855,8 +1855,12 @@ pcsc_vendor_specific_init (int slot) reader_table[slot].is_spr532 = 1; reader_table[slot].pinpad_varlen_supported = 1; } - else if (vendor == 0x046a && product == 0x003e) /* Cherry ST-2xxx */ + else if (vendor == 0x046a) { + /* Cherry ST-2xxx (product == 0x003e) supports TPDU level + * exchange. Other products which only support short APDU level + * exchange only work with shorter keys like RSA 1024. + */ reader_table[slot].pcsc.pinmax = 15; reader_table[slot].pinpad_varlen_supported = 1; } commit 354f8119bc24c93b3ead367af7ded8dd271feb3c Author: NIIBE Yutaka Date: Mon Nov 14 10:25:43 2016 +0900 scd: Fix status info encoding. * scd/command.c (send_status_info): Do percent plus encoding correctly. -- Backport of master commit: 4ee4d0b02172cf56d9582bb99e32a65c75315b25 Reported-by: David H?rdeman Signed-off-by: NIIBE Yutaka diff --git a/scd/command.c b/scd/command.c index 963cb3e..2c43a3a 100644 --- a/scd/command.c +++ b/scd/command.c @@ -2103,7 +2103,8 @@ send_status_info (ctrl_t ctrl, const char *keyword, ...) } for ( ; valuelen && n < DIM (buf)-2; n++, valuelen--, value++) { - if (*value < ' ' || *value == '+') + if (*value == '+' || *value == '\"' || *value == '%' + || *value < ' ') { sprintf (p, "%%%02X", *value); p += 3; commit 88556386a61f5fa9ce8c5abbe1fd6d66a7723854 Author: NIIBE Yutaka Date: Tue Oct 18 20:40:09 2016 +0900 scd: minor cleanup to merge other works. * scd/iso7816.c (do_generate_keypair): Use const char * for DATA. (iso7816_generate_keypair, iso7816_read_public_key): Likewise. * scd/app-openpgp.c (get_public_key): Follow the change. (do_genkey): Ditto. Use ERR instead of RC. Use u32 for CREATED_AT. -- Backport of master commit: f1845f25dbea79c191427710fa56ed01e63a045b Signed-off-by: NIIBE Yutaka diff --git a/scd/app-openpgp.c b/scd/app-openpgp.c index 59ccd6d..972362c 100644 --- a/scd/app-openpgp.c +++ b/scd/app-openpgp.c @@ -1210,12 +1210,10 @@ get_public_key (app_t app, int keyno) le_value = 256; /* Use legacy value. */ } - err = iso7816_read_public_key - (app->slot, exmode, - (const unsigned char*)(keyno == 0? "\xB6" : - keyno == 1? "\xB8" : "\xA4"), 2, - le_value, - &buffer, &buflen); + err = iso7816_read_public_key (app->slot, exmode, + (keyno == 0? "\xB6" : + keyno == 1? "\xB8" : "\xA4"), + 2, le_value, &buffer, &buflen); if (err) { log_error (_("reading public key failed: %s\n"), gpg_strerror (err)); @@ -2999,13 +2997,13 @@ do_genkey (app_t app, ctrl_t ctrl, const char *keynostr, unsigned int flags, gpg_error_t (*pincb)(void*, const char *, char **), void *pincb_arg) { - int rc; + gpg_error_t err; char numbuf[30]; unsigned char fprbuf[20]; const unsigned char *keydata, *m, *e; unsigned char *buffer = NULL; size_t buflen, keydatalen, mlen, elen; - time_t created_at; + u32 created_at; int keyno = atoi (keynostr) - 1; int force = (flags & 1); time_t start_at; @@ -3027,9 +3025,9 @@ do_genkey (app_t app, ctrl_t ctrl, const char *keynostr, unsigned int flags, app->app_local->pk[keyno].read_done = 0; /* Check whether a key already exists. */ - rc = does_key_exist (app, keyno, 1, force); - if (rc) - return rc; + err = does_key_exist (app, keyno, 1, force); + if (err) + return err; /* Because we send the key parameter back via status lines we need to put a limit on the max. allowed keysize. 2048 bit will @@ -3040,8 +3038,8 @@ do_genkey (app_t app, ctrl_t ctrl, const char *keynostr, unsigned int flags, return gpg_error (GPG_ERR_TOO_LARGE); /* Prepare for key generation by verifying the Admin PIN. */ - rc = verify_chv3 (app, pincb, pincb_arg); - if (rc) + err = verify_chv3 (app, pincb, pincb_arg); + if (err) goto leave; /* Test whether we will need extended length mode. (1900 is an @@ -3062,17 +3060,13 @@ do_genkey (app_t app, ctrl_t ctrl, const char *keynostr, unsigned int flags, log_info (_("please wait while key is being generated ...\n")); start_at = time (NULL); - rc = iso7816_generate_keypair -/* # warning key generation temporary replaced by reading an existing key. */ -/* rc = iso7816_read_public_key */ - (app->slot, exmode, - (const unsigned char*)(keyno == 0? "\xB6" : - keyno == 1? "\xB8" : "\xA4"), 2, - le_value, - &buffer, &buflen); - if (rc) + err = iso7816_generate_keypair (app->slot, exmode, + (keyno == 0? "\xB6" : + keyno == 1? "\xB8" : "\xA4"), + 2, le_value, &buffer, &buflen); + if (err) { - rc = gpg_error (GPG_ERR_CARD); + err = gpg_error (GPG_ERR_CARD); log_error (_("generating key failed\n")); goto leave; } @@ -3082,7 +3076,7 @@ do_genkey (app_t app, ctrl_t ctrl, const char *keynostr, unsigned int flags, keydata = find_tlv (buffer, buflen, 0x7F49, &keydatalen); if (!keydata) { - rc = gpg_error (GPG_ERR_CARD); + err = gpg_error (GPG_ERR_CARD); log_error (_("response does not contain the public key data\n")); goto leave; } @@ -3090,7 +3084,7 @@ do_genkey (app_t app, ctrl_t ctrl, const char *keynostr, unsigned int flags, m = find_tlv (keydata, keydatalen, 0x0081, &mlen); if (!m) { - rc = gpg_error (GPG_ERR_CARD); + err = gpg_error (GPG_ERR_CARD); log_error (_("response does not contain the RSA modulus\n")); goto leave; } @@ -3100,28 +3094,28 @@ do_genkey (app_t app, ctrl_t ctrl, const char *keynostr, unsigned int flags, e = find_tlv (keydata, keydatalen, 0x0082, &elen); if (!e) { - rc = gpg_error (GPG_ERR_CARD); + err = gpg_error (GPG_ERR_CARD); log_error (_("response does not contain the RSA public exponent\n")); goto leave; } /* log_printhex ("RSA e:", e, elen); */ send_key_data (ctrl, "e", e, elen); - created_at = createtime? createtime : gnupg_get_time (); - sprintf (numbuf, "%lu", (unsigned long)created_at); + created_at = (u32)(createtime? createtime : gnupg_get_time ()); + sprintf (numbuf, "%u", created_at); send_status_info (ctrl, "KEY-CREATED-AT", numbuf, (size_t)strlen(numbuf), NULL, 0); - rc = store_fpr (app, keyno, (u32)created_at, + err = store_fpr (app, keyno, (u32)created_at, m, mlen, e, elen, fprbuf, app->card_version); - if (rc) + if (err) goto leave; send_fpr_if_not_null (ctrl, "KEY-FPR", -1, fprbuf); leave: xfree (buffer); - return rc; + return err; } diff --git a/scd/iso7816.c b/scd/iso7816.c index 2a9aa53..f22626f 100644 --- a/scd/iso7816.c +++ b/scd/iso7816.c @@ -603,9 +603,8 @@ iso7816_internal_authenticate (int slot, int extended_mode, returned. In that case a value of -1 uses a large default (e.g. 4096 bytes), a value larger 256 used that value. */ static gpg_error_t -do_generate_keypair (int slot, int extended_mode, int readonly, - const unsigned char *data, size_t datalen, - int le, +do_generate_keypair (int slot, int extended_mode, int read_only, + const char *data, size_t datalen, int le, unsigned char **result, size_t *resultlen) { int sw; @@ -616,8 +615,8 @@ do_generate_keypair (int slot, int extended_mode, int readonly, *resultlen = 0; sw = apdu_send_le (slot, extended_mode, - 0x00, CMD_GENERATE_KEYPAIR, readonly? 0x81:0x80, 0, - datalen, (const char*)data, + 0x00, CMD_GENERATE_KEYPAIR, read_only? 0x81:0x80, 0, + datalen, data, le >= 0 && le < 256? 256:le, result, resultlen); if (sw != SW_SUCCESS) @@ -635,8 +634,8 @@ do_generate_keypair (int slot, int extended_mode, int readonly, gpg_error_t iso7816_generate_keypair (int slot, int extended_mode, - const unsigned char *data, size_t datalen, - int le, + const char *data, size_t datalen, + int le, unsigned char **result, size_t *resultlen) { return do_generate_keypair (slot, extended_mode, 0, @@ -646,8 +645,8 @@ iso7816_generate_keypair (int slot, int extended_mode, gpg_error_t iso7816_read_public_key (int slot, int extended_mode, - const unsigned char *data, size_t datalen, - int le, + const char *data, size_t datalen, + int le, unsigned char **result, size_t *resultlen) { return do_generate_keypair (slot, extended_mode, 1, diff --git a/scd/iso7816.h b/scd/iso7816.h index 4354c72..05fea65 100644 --- a/scd/iso7816.h +++ b/scd/iso7816.h @@ -100,11 +100,11 @@ gpg_error_t iso7816_internal_authenticate (int slot, int extended_mode, int le, unsigned char **result, size_t *resultlen); gpg_error_t iso7816_generate_keypair (int slot, int extended_mode, - const unsigned char *data, size_t datalen, + const char *data, size_t datalen, int le, unsigned char **result, size_t *resultlen); gpg_error_t iso7816_read_public_key (int slot, int extended_mode, - const unsigned char *data, size_t datalen, + const char *data, size_t datalen, int le, unsigned char **result, size_t *resultlen); gpg_error_t iso7816_get_challenge (int slot, commit 68d3e461f67404d1b47dfa7b9efdb6ac2c087bb7 Author: NIIBE Yutaka Date: Sat Sep 3 15:27:30 2016 +0900 scd: Fix an action after card removal. * scd/command.c (update_card_removed): Call apdu_close_reader here. -- Backport of master commit: f9e49c80e706a27d5e30d4b3237ff26367a67130 This is update of the commit 8fe81055762d9c9e6f03fb7853a985c94ef73ac3 It is better apdu_close_reader is called in update_card_removed. The commit 1598a4476466822e7e9c757ac471089d3db4b545 introduced a regression, it doesn't close the reader after removal of the card, while the code before the commit call apdu_close_reader in do_reset. So, this fix. GnuPG-bug-id: 2449 Signed-off-by: NIIBE Yutaka diff --git a/scd/command.c b/scd/command.c index e35579e..963cb3e 100644 --- a/scd/command.c +++ b/scd/command.c @@ -200,6 +200,7 @@ update_card_removed (int slot, int value) if (value) { log_debug ("Removal of a card: %d\n", slot); + apdu_close_reader (slot); application_notify_card_reset (slot); slot_table[slot].slot = -1; } @@ -2315,10 +2316,7 @@ update_reader_status_file (int set_card_removed_flag) /* Set the card removed flag for all current sessions. */ if (ss->any && ss->status == 0 && set_card_removed_flag) - { - apdu_close_reader (ss->slot); - update_card_removed (ss->slot, 1); - } + update_card_removed (ss->slot, 1); ss->any = 1; commit 710d0ce0fd5ee33b1e57f1ae9aedb90c7f7e234d Author: NIIBE Yutaka Date: Fri Sep 2 14:45:26 2016 +0900 scd: Release the card reader after card removal. * scd/command.c (update_reader_status_file): Call apdu_close_reader. -- Backport of master commit: 8fe81055762d9c9e6f03fb7853a985c94ef73ac3 GnuPG-bug-id: 2651 Signed-off-by: NIIBE Yutaka diff --git a/scd/command.c b/scd/command.c index 451a922..e35579e 100644 --- a/scd/command.c +++ b/scd/command.c @@ -2315,7 +2315,10 @@ update_reader_status_file (int set_card_removed_flag) /* Set the card removed flag for all current sessions. */ if (ss->any && ss->status == 0 && set_card_removed_flag) - update_card_removed (idx, 1); + { + apdu_close_reader (ss->slot); + update_card_removed (ss->slot, 1); + } ss->any = 1; commit 5acce7060ca48e6c5e06a3918950c4eb83668fda Author: NIIBE Yutaka Date: Fri Sep 2 13:58:33 2016 +0900 scd: Clean up unused shutdown method. * scd/apdu.c (shutdown_ccid_reader, apdu_shutdown_reader): Remove. (reset_ccid_reader): Don't set shutdown_reader. * scd/ccid-driver.c (ccid_shutdown_reader): Remove. -- Backport of master commit: d1ae7103352fbda2a05f098379cd3043a0ab5566 Signed-off-by: NIIBE Yutaka diff --git a/scd/apdu.c b/scd/apdu.c index 00351c8..570e150 100644 --- a/scd/apdu.c +++ b/scd/apdu.c @@ -98,7 +98,6 @@ struct reader_table_s { int (*connect_card)(int); int (*disconnect_card)(int); int (*close_reader)(int); - int (*shutdown_reader)(int); int (*reset_reader)(int); int (*get_status_reader)(int, unsigned int *); int (*send_apdu_reader)(int,unsigned char *,size_t, @@ -432,7 +431,6 @@ new_reader_slot (void) reader_table[reader].connect_card = NULL; reader_table[reader].disconnect_card = NULL; reader_table[reader].close_reader = NULL; - reader_table[reader].shutdown_reader = NULL; reader_table[reader].reset_reader = NULL; reader_table[reader].get_status_reader = NULL; reader_table[reader].send_apdu_reader = NULL; @@ -2437,14 +2435,6 @@ close_ccid_reader (int slot) static int -shutdown_ccid_reader (int slot) -{ - ccid_shutdown_reader (reader_table[slot].ccid.handle); - return 0; -} - - -static int reset_ccid_reader (int slot) { int err; @@ -2609,7 +2599,6 @@ open_ccid_reader (const char *portstr) } reader_table[slot].close_reader = close_ccid_reader; - reader_table[slot].shutdown_reader = shutdown_ccid_reader; reader_table[slot].reset_reader = reset_ccid_reader; reader_table[slot].get_status_reader = get_status_ccid; reader_table[slot].send_apdu_reader = send_apdu_ccid; @@ -3178,24 +3167,6 @@ apdu_prepare_exit (void) } -/* Shutdown a reader; that is basically the same as a close but keeps - the handle ready for later use. A apdu_reset_reader or apdu_connect - should be used to get it active again. */ -int -apdu_shutdown_reader (int slot) -{ - int sw; - - if (slot < 0 || slot >= MAX_READER || !reader_table[slot].used ) - return SW_HOST_NO_DRIVER; - sw = apdu_disconnect (slot); - if (sw) - return sw; - if (reader_table[slot].shutdown_reader) - return reader_table[slot].shutdown_reader (slot); - return SW_HOST_NOT_SUPPORTED; -} - /* Enumerate all readers and return information on whether this reader is in use. The caller should start with SLOT set to 0 and increment it with each call until an error is returned. */ diff --git a/scd/apdu.h b/scd/apdu.h index 1524f99..ac16ea1 100644 --- a/scd/apdu.h +++ b/scd/apdu.h @@ -92,7 +92,6 @@ int apdu_open_remote_reader (const char *portstr, void *writefnc_value, void (*closefnc) (void *opaque), void *closefnc_value); -int apdu_shutdown_reader (int slot); int apdu_close_reader (int slot); void apdu_prepare_exit (void); int apdu_enum_reader (int slot, int *used); diff --git a/scd/ccid-driver.c b/scd/ccid-driver.c index 95f6c02..07e884c 100644 --- a/scd/ccid-driver.c +++ b/scd/ccid-driver.c @@ -1744,79 +1744,6 @@ do_close_reader (ccid_driver_t handle) } -/* Reset a reader on HANDLE. This is useful in case a reader has been - plugged of and inserted at a different port. By resetting the - handle, the same reader will be get used. Note, that on error the - handle won't get released. - - This does not return an ATR, so ccid_get_atr should be called right - after this one. -*/ -int -ccid_shutdown_reader (ccid_driver_t handle) -{ - int rc = 0; - struct usb_device *dev = NULL; - usb_dev_handle *idev = NULL; - unsigned char *ifcdesc_extra = NULL; - size_t ifcdesc_extra_len; - int ifc_no, ep_bulk_out, ep_bulk_in, ep_intr; - - if (!handle || !handle->rid) - return CCID_DRIVER_ERR_INV_VALUE; - - do_close_reader (handle); - - if (scan_or_find_devices (-1, handle->rid, NULL, &dev, - &ifcdesc_extra, &ifcdesc_extra_len, - &ifc_no, &ep_bulk_out, &ep_bulk_in, &ep_intr, - &idev, NULL) || !idev) - { - DEBUGOUT_1 ("no CCID reader with ID %s\n", handle->rid); - return CCID_DRIVER_ERR_NO_READER; - } - - if (idev) - { - handle->idev = idev; - handle->ifc_no = ifc_no; - handle->ep_bulk_out = ep_bulk_out; - handle->ep_bulk_in = ep_bulk_in; - handle->ep_intr = ep_intr; - - if (parse_ccid_descriptor (handle, ifcdesc_extra, ifcdesc_extra_len)) - { - DEBUGOUT ("device not supported\n"); - rc = CCID_DRIVER_ERR_NO_READER; - goto leave; - } - - rc = usb_claim_interface (idev, ifc_no); - if (rc) - { - DEBUGOUT_1 ("usb_claim_interface failed: %d\n", rc); - rc = CCID_DRIVER_ERR_CARD_IO_ERROR; - goto leave; - } - } - - leave: - free (ifcdesc_extra); - if (rc) - { - if (handle->idev) - usb_close (handle->idev); - handle->idev = NULL; - if (handle->dev_fd != -1) - close (handle->dev_fd); - handle->dev_fd = -1; - } - - return rc; - -} - - int ccid_set_progress_cb (ccid_driver_t handle, void (*cb)(void *, const char *, int, int, int), commit 519c01a0fd6cfc9d4282251e187d45194325c85b Author: NIIBE Yutaka Date: Wed Jul 20 11:35:05 2016 +0900 scd: Fix card removal/reset on multiple contexts. * scd/app.c (application_notify_card_reset): Add message for debug. *scd/command.c (update_card_removed): Call release_application and set SLOT -1 here. (struct server_local_s): Remove app_ctx_marked_for_release. (do_reset): Don't mark release but call release_application here. (open_card): Remove app_ctx_marked_for_release handling. (update_reader_status_file): Don't set SLOT here, so that it can be released the APP by application_notify_card_reset in update_card_removed. -- Backport of master commit: 1598a4476466822e7e9c757ac471089d3db4b545 Signed-off-by: NIIBE Yutaka diff --git a/scd/app.c b/scd/app.c index 0f36409..24ed5b0 100644 --- a/scd/app.c +++ b/scd/app.c @@ -183,8 +183,12 @@ application_notify_card_reset (int slot) /* Release the APP, as it's not reusable any more. */ if (lock_table[slot].app) { + if (lock_table[slot].app->ref_count) + log_bug ("trying to release active context\n"); + deallocate_app (lock_table[slot].app); lock_table[slot].app = NULL; + log_debug ("application has been released\n"); } unlock_reader (slot); diff --git a/scd/command.c b/scd/command.c index 24c51c8..451a922 100644 --- a/scd/command.c +++ b/scd/command.c @@ -118,10 +118,6 @@ struct server_local_s continue operation. */ int card_removed; - /* Flag indicating that the application context needs to be released - at the next opportunity. */ - int app_ctx_marked_for_release; - /* A disconnect command has been sent. */ int disconnect_allowed; @@ -185,14 +181,28 @@ update_card_removed (int slot, int value) return; for (sl=session_list; sl; sl = sl->next_session) - if (sl->ctrl_backlink - && sl->ctrl_backlink->reader_slot == slot) - { - sl->card_removed = value; - } + { + ctrl_t ctrl = sl->ctrl_backlink; + + if (ctrl && ctrl->reader_slot == slot) + { + sl->card_removed = value; + if (value) + { + struct app_ctx_s *app = ctrl->app_ctx; + ctrl->app_ctx = NULL; + release_application (app); + } + } + } + /* Let the card application layer know about the removal. */ if (value) - application_notify_card_reset (slot); + { + log_debug ("Removal of a card: %d\n", slot); + application_notify_card_reset (slot); + slot_table[slot].slot = -1; + } } @@ -288,23 +298,31 @@ do_reset (ctrl_t ctrl, int send_reset) if (!(slot == -1 || (slot >= 0 && slot < DIM(slot_table)))) BUG (); - /* If there is an active application, release it. Tell all other - sessions using the same application to release the - application. */ + /* If there is an active application, release it. */ if (app) { ctrl->app_ctx = NULL; release_application (app); - if (send_reset) + } + + /* Release the same application which is used by other sessions. */ + if (send_reset) + { + struct server_local_s *sl; + + for (sl=session_list; sl; sl = sl->next_session) { - struct server_local_s *sl; + ctrl_t c = sl->ctrl_backlink; - for (sl=session_list; sl; sl = sl->next_session) - if (sl->ctrl_backlink - && sl->ctrl_backlink->reader_slot == slot) - { - sl->app_ctx_marked_for_release = 1; - } + if (c && c != ctrl && c->reader_slot == slot) + { + struct app_ctx_s *app0 = c->app_ctx; + if (app0) + { + c->app_ctx = NULL; + release_application (app0); + } + } } } @@ -444,16 +462,6 @@ open_card (ctrl_t ctrl, const char *apptype) if ( IS_LOCKED (ctrl) ) return gpg_error (GPG_ERR_LOCKED); - /* If the application has been marked for release do it now. We - can't do it immediately in do_reset because the application may - still be in use. */ - if (ctrl->server_local->app_ctx_marked_for_release) - { - ctrl->server_local->app_ctx_marked_for_release = 0; - release_application (ctrl->app_ctx); - ctrl->app_ctx = NULL; - } - /* If we are already initialized for one specific application we need to check that the client didn't requested a specific application different from the one in use before we continue. */ @@ -2009,10 +2017,7 @@ scd_command_handler (ctrl_t ctrl, int fd) /* We open the reader right at startup so that the ticker is able to update the status file. */ - if (ctrl->reader_slot == -1) - { - ctrl->reader_slot = get_reader_slot (); - } + ctrl->reader_slot = get_reader_slot (); /* Command processing loop. */ for (;;) @@ -2230,9 +2235,7 @@ update_reader_status_file (int set_card_removed_flag) if (sw_apdu == SW_HOST_NO_READER) { /* Most likely the _reader_ has been unplugged. */ - application_notify_card_reset (ss->slot); apdu_close_reader (ss->slot); - ss->valid = 0; status = 0; changed = ss->changed; } commit 3b3386a3fd973ed7f388b1356138941c302848f2 Author: NIIBE Yutaka Date: Tue Jul 19 10:53:39 2016 +0900 scd: Fix race conditions for release_application. * scd/command.c (do_reset, cmd_restart): Reset app_ctx before calling release_application. -- Backport of master commit: 0c1fd4e9884ed7c1edd1819762b9e8a77f606ed3 Thanks to Ben Warren for the report. Signed-off-by: NIIBE Yutaka diff --git a/scd/command.c b/scd/command.c index 44f0b21..24c51c8 100644 --- a/scd/command.c +++ b/scd/command.c @@ -283,6 +283,7 @@ static void do_reset (ctrl_t ctrl, int send_reset) { int slot = ctrl->reader_slot; + struct app_ctx_s *app = ctrl->app_ctx; if (!(slot == -1 || (slot >= 0 && slot < DIM(slot_table)))) BUG (); @@ -290,10 +291,10 @@ do_reset (ctrl_t ctrl, int send_reset) /* If there is an active application, release it. Tell all other sessions using the same application to release the application. */ - if (ctrl->app_ctx) + if (app) { - release_application (ctrl->app_ctx); ctrl->app_ctx = NULL; + release_application (app); if (send_reset) { struct server_local_s *sl; @@ -1744,13 +1745,14 @@ static gpg_error_t cmd_restart (assuan_context_t ctx, char *line) { ctrl_t ctrl = assuan_get_pointer (ctx); + struct app_ctx_s *app = ctrl->app_ctx; (void)line; - if (ctrl->app_ctx) + if (app) { - release_application (ctrl->app_ctx); ctrl->app_ctx = NULL; + release_application (app); } if (locked_session && ctrl->server_local == locked_session) { commit f916d5756fae163896715b057a627a5fb58ddd52 Author: Werner Koch Date: Fri Jun 17 08:36:07 2016 +0200 scd: Make option --homedir work. * scd/scdaemon.c (opts): Add --homedir. -- Backport of master commit: def512eb67c8a380f3b873cee0f156deef0b6dda Without that entry the homedir setting won't work. GnuPG-bug-id: 2386 Signed-off-by: Werner Koch diff --git a/scd/scdaemon.c b/scd/scdaemon.c index e133ddc..89b4e0e 100644 --- a/scd/scdaemon.c +++ b/scd/scdaemon.c @@ -150,6 +150,7 @@ static ARGPARSE_OPTS opts[] = { ARGPARSE_s_s (oDisableApplication, "disable-application", "@"), ARGPARSE_s_n (oEnablePinpadVarlen, "enable-pinpad-varlen", N_("use variable length input for pinpad")), + ARGPARSE_s_s (oHomedir, "homedir", "@"), ARGPARSE_end () }; commit 51464a0eadc82c84780fba08a53163cb6e4da2a4 Author: NIIBE Yutaka Date: Mon May 2 15:56:02 2016 +0900 scd: More fix of error return path. * scd/command.c (open_card): Return GPG_ERR_ENODEV on the failure of apdu_connect. -- Backport of master commit: 6677d8b61446eb5760a30a2488c992d6e895a9ed GnuPG-bug-id: 2306 Signed-off-by: NIIBE Yutaka diff --git a/scd/command.c b/scd/command.c index b26bd68..44f0b21 100644 --- a/scd/command.c +++ b/scd/command.c @@ -482,8 +482,8 @@ open_card (ctrl_t ctrl, const char *apptype) else if (sw == SW_HOST_CARD_INACTIVE) err = gpg_error (GPG_ERR_CARD_RESET); else - err = gpg_error (GPG_ERR_CARD); - } + err = gpg_error (GPG_ERR_ENODEV); + } else err = select_application (ctrl, slot, apptype, &ctrl->app_ctx); } commit d87699597f4b47968902324c90beb3f3c51ff1d7 Author: Justus Winter Date: Tue Nov 17 18:05:51 2015 +0100 scd: Improve error handling. * scd/app-openpgp.c (get_public_key): Improve error handling. -- Backport master commit: 6a37b45a7f13cf5d2ae7d6c9cd796a4bd197b80d Found using the Clang Static Analyzer. Signed-off-by: Justus Winter diff --git a/scd/app-openpgp.c b/scd/app-openpgp.c index 291700f..59ccd6d 100644 --- a/scd/app-openpgp.c +++ b/scd/app-openpgp.c @@ -1362,7 +1362,7 @@ get_public_key (app_t app, int keyno) xfree (buffer); xfree (mbuf); xfree (ebuf); - return 0; + return err; } #endif /* GNUPG_MAJOR_VERSION > 1 */ commit d4316d13749bd8662525c2b7c416d39c5d4d8089 Author: NIIBE Yutaka Date: Wed Nov 4 21:07:49 2015 +0900 scd: Fix error handling with libusb-compat library. * scd/ccid-driver.c (bulk_out): Use LIBUSB_ERRNO_NO_SUCH_DEVICE. -- With libusb-compat library, the error is different than original libusb. (The libusb-compat library is used by Fedora.) Backport of master commit: 1e94a672efb8bf66f416bc63bf6670e509a21fe5 diff --git a/scd/ccid-driver.c b/scd/ccid-driver.c index 23b992d..95f6c02 100644 --- a/scd/ccid-driver.c +++ b/scd/ccid-driver.c @@ -1878,6 +1878,11 @@ writen (int fd, const void *buf, size_t nbytes) return 0; } +#if defined(ENXIO) && !defined(LIBUSB_PATH_MAX) && defined(__GNU_LIBRARY__) +#define LIBUSB_ERRNO_NO_SUCH_DEVICE ENXIO /* libusb-compat */ +#elif defined(ENODEV) +#define LIBUSB_ERRNO_NO_SUCH_DEVICE ENODEV /* Original libusb */ +#endif /* Write a MSG of length MSGLEN to the designated bulk out endpoint. Returns 0 on success. */ @@ -1952,26 +1957,26 @@ bulk_out (ccid_driver_t handle, unsigned char *msg, size_t msglen, 5000 /* ms timeout */); if (rc == msglen) return 0; -#ifdef ENODEV - if (rc == -(ENODEV)) +#ifdef LIBUSB_ERRNO_NO_SUCH_DEVICE + if (rc == -(LIBUSB_ERRNO_NO_SUCH_DEVICE)) { /* The Linux libusb returns a negative error value. Catch the most important one. */ - errno = ENODEV; + errno = LIBUSB_ERRNO_NO_SUCH_DEVICE; rc = -1; } -#endif /*ENODEV*/ +#endif /*LIBUSB_ERRNO_NO_SUCH_DEVICE*/ if (rc == -1) { DEBUGOUT_1 ("usb_bulk_write error: %s\n", strerror (errno)); -#ifdef ENODEV - if (errno == ENODEV) +#ifdef LIBUSB_ERRNO_NO_SUCH_DEVICE + if (errno == LIBUSB_ERRNO_NO_SUCH_DEVICE) { handle->enodev_seen = 1; return CCID_DRIVER_ERR_NO_READER; } -#endif /*ENODEV*/ +#endif /*LIBUSB_ERRNO_NO_SUCH_DEVICE*/ } else DEBUGOUT_1 ("usb_bulk_write failed: %d\n", rc); commit af7245e9a79d11866aa9c40f8f53291f82dd74b5 Author: NIIBE Yutaka Date: Mon Sep 28 13:41:59 2015 +0900 scd: Handle error correctly. * scd/apdu.c (apdu_connect): Initialize variables and check an error of apdu_get_status_internal. -- Backport from master commit: 6bb7206e357acfd7276a8f1334c0f0c9cc6ed100 diff --git a/scd/apdu.c b/scd/apdu.c index 30e5ef9..00351c8 100644 --- a/scd/apdu.c +++ b/scd/apdu.c @@ -3216,8 +3216,8 @@ apdu_enum_reader (int slot, int *used) int apdu_connect (int slot) { - int sw; - unsigned int status; + int sw = 0; + unsigned int status = 0; if (slot < 0 || slot >= MAX_READER || !reader_table[slot].used ) return SW_HOST_NO_DRIVER; @@ -3234,15 +3234,15 @@ apdu_connect (int slot) unlock_slot (slot); } } - else - sw = 0; /* We need to call apdu_get_status_internal, so that the last-status machinery gets setup properly even if a card is inserted while scdaemon is fired up and apdu_get_status has not yet been called. Without that we would force a reset of the card with the next call to apdu_get_status. */ - apdu_get_status_internal (slot, 1, 1, &status, NULL); + if (!sw) + sw = apdu_get_status_internal (slot, 1, 1, &status, NULL); + if (sw) ; else if (!(status & APDU_CARD_PRESENT)) commit a6f7c8d9b70daba319d24d930be056618cbad61b Author: NIIBE Yutaka Date: Mon Sep 7 13:09:01 2015 +0900 scd: KEYNO cleanup. * scd/app-openpgp.c (get_public_key, send_keypair_info, do_readkey) (change_keyattr, change_keyattr_from_string, ecc_writekey, do_genkey) (compare_fingerprint, check_against_given_fingerprint): KEYNO starts from 0. -- Backport of master commit: fd689e85423d0d80d725f0315c52d94f0e9766f8 diff --git a/scd/app-openpgp.c b/scd/app-openpgp.c index cb61df1..291700f 100644 --- a/scd/app-openpgp.c +++ b/scd/app-openpgp.c @@ -1162,7 +1162,7 @@ retrieve_key_material (FILE *fp, const char *hexkeyid, the APP handle. On error that field gets cleared. If we already know about the public key we will just return. Note that this does not mean a key is available; this is soley indicated by the - presence of the app->app_local->pk[KEYNO-1].key field. + presence of the app->app_local->pk[KEYNO].key field. Note that GnuPG 1.x does not need this and it would be too time consuming to send it just for the fun of it. However, given that we @@ -1181,9 +1181,8 @@ get_public_key (app_t app, int keyno) char *keybuf = NULL; char *keybuf_p; - if (keyno < 1 || keyno > 3) + if (keyno < 0 || keyno > 2) return gpg_error (GPG_ERR_INV_ID); - keyno--; /* Already cached? */ if (app->app_local->pk[keyno].read_done) @@ -1369,11 +1368,12 @@ get_public_key (app_t app, int keyno) -/* Send the KEYPAIRINFO back. KEYNO needs to be in the range [1,3]. +/* Send the KEYPAIRINFO back. KEY needs to be in the range [1,3]. This is used by the LEARN command. */ static gpg_error_t -send_keypair_info (app_t app, ctrl_t ctrl, int keyno) +send_keypair_info (app_t app, ctrl_t ctrl, int key) { + int keyno = key - 1; gpg_error_t err = 0; /* Note that GnuPG 1.x does not need this and it would be too time consuming to send it just for the fun of it. */ @@ -1386,19 +1386,19 @@ send_keypair_info (app_t app, ctrl_t ctrl, int keyno) if (err) goto leave; - assert (keyno >= 1 && keyno <= 3); - if (!app->app_local->pk[keyno-1].key) + assert (keyno >= 0 && keyno <= 2); + if (!app->app_local->pk[keyno].key) goto leave; /* No such key - ignore. */ - err = keygrip_from_canon_sexp (app->app_local->pk[keyno-1].key, - app->app_local->pk[keyno-1].keylen, + err = keygrip_from_canon_sexp (app->app_local->pk[keyno].key, + app->app_local->pk[keyno].keylen, grip); if (err) goto leave; bin2hex (grip, 20, gripstr); - sprintf (idbuf, "OPENPGP.%d", keyno); + sprintf (idbuf, "OPENPGP.%d", keyno+1); send_status_info (ctrl, "KEYPAIRINFO", gripstr, 40, idbuf, strlen (idbuf), @@ -1461,11 +1461,11 @@ do_readkey (app_t app, const char *keyid, unsigned char **pk, size_t *pklen) unsigned char *buf; if (!strcmp (keyid, "OPENPGP.1")) - keyno = 1; + keyno = 0; else if (!strcmp (keyid, "OPENPGP.2")) - keyno = 2; + keyno = 1; else if (!strcmp (keyid, "OPENPGP.3")) - keyno = 3; + keyno = 2; else return gpg_error (GPG_ERR_INV_ID); @@ -1473,10 +1473,10 @@ do_readkey (app_t app, const char *keyid, unsigned char **pk, size_t *pklen) if (err) return err; - buf = app->app_local->pk[keyno-1].key; + buf = app->app_local->pk[keyno].key; if (!buf) return gpg_error (GPG_ERR_NO_PUBKEY); - *pklen = app->app_local->pk[keyno-1].keylen;; + *pklen = app->app_local->pk[keyno].keylen;; *pk = xtrymalloc (*pklen); if (!*pk) { @@ -2610,14 +2610,18 @@ change_keyattr_from_string (app_t app, happen. */ if (sscanf (string, " --force %d %d %u", &keyno, &algo, &nbits) != 3) err = gpg_error (GPG_ERR_INV_DATA); - else if (keyno < 1 || keyno > 3) - err = gpg_error (GPG_ERR_INV_ID); - else if (algo != PUBKEY_ALGO_RSA) - err = gpg_error (GPG_ERR_PUBKEY_ALGO); - else if (nbits < 1024) - err = gpg_error (GPG_ERR_TOO_SHORT); - else - err = change_keyattr (app, keyno-1, nbits, pincb, pincb_arg); + keyno = keyno - 1; + if (!err) + { + if (keyno < 0 || keyno > 2) + err = gpg_error (GPG_ERR_INV_ID); + else if (algo != PUBKEY_ALGO_RSA) + err = gpg_error (GPG_ERR_PUBKEY_ALGO); + else if (nbits < 1024) + err = gpg_error (GPG_ERR_TOO_SHORT); + else + err = change_keyattr (app, keyno, nbits, pincb, pincb_arg); + } xfree (string); return err; @@ -3002,16 +3006,15 @@ do_genkey (app_t app, ctrl_t ctrl, const char *keynostr, unsigned int flags, unsigned char *buffer = NULL; size_t buflen, keydatalen, mlen, elen; time_t created_at; - int keyno = atoi (keynostr); + int keyno = atoi (keynostr) - 1; int force = (flags & 1); time_t start_at; int exmode; int le_value; unsigned int keybits; - if (keyno < 1 || keyno > 3) + if (keyno < 0 || keyno > 2) return gpg_error (GPG_ERR_INV_ID); - keyno--; /* We flush the cache to increase the traffic before a key generation. This _might_ help a card to gather more entropy. */ @@ -3161,7 +3164,7 @@ compare_fingerprint (app_t app, int keyno, unsigned char *sha1fpr) size_t buflen, n; int rc, i; - assert (keyno >= 1 && keyno <= 3); + assert (keyno >= 0 && keyno <= 2); rc = get_cached_data (app, 0x006E, &buffer, &buflen, 0, 0); if (rc) @@ -3176,7 +3179,7 @@ compare_fingerprint (app_t app, int keyno, unsigned char *sha1fpr) log_error (_("error reading fingerprint DO\n")); return gpg_error (GPG_ERR_GENERAL); } - fpr += (keyno-1)*20; + fpr += keyno*20; for (i=0; i < 20; i++) if (sha1fpr[i] != fpr[i]) { @@ -3195,7 +3198,7 @@ compare_fingerprint (app_t app, int keyno, unsigned char *sha1fpr) gpg has not been updated. If there is no fingerprint we assume that this is okay. */ static gpg_error_t -check_against_given_fingerprint (app_t app, const char *fpr, int keyno) +check_against_given_fingerprint (app_t app, const char *fpr, int key) { unsigned char tmp[20]; const char *s; @@ -3212,7 +3215,7 @@ check_against_given_fingerprint (app_t app, const char *fpr, int keyno) for (s=fpr, n=0; n < 20; s += 2, n++) tmp[n] = xtoi_2 (s); - return compare_fingerprint (app, keyno, tmp); + return compare_fingerprint (app, key-1, tmp); } commit f1b9521fd6bd46547090efb1de78fa46bf2abfd2 Author: NIIBE Yutaka Date: Fri Jul 17 09:34:47 2015 +0900 scd: Use cipher.h for constants. * scd/app-openpgp.c: Include cipher.h. -- Backport from master commit:f5d356fb5bbbd0e05a753612455253e4bc335266 diff --git a/scd/Makefile.am b/scd/Makefile.am index e883180..aa370fa 100644 --- a/scd/Makefile.am +++ b/scd/Makefile.am @@ -25,7 +25,7 @@ endif EXTRA_DIST = ChangeLog-2011 scdaemon-w32info.rc -AM_CPPFLAGS = -I$(top_srcdir)/gl -I$(top_srcdir)/intl -I$(top_srcdir)/common +AM_CPPFLAGS = -I$(top_srcdir)/gl -I$(top_srcdir)/intl -I$(top_srcdir)/common -I$(top_srcdir)/include include $(top_srcdir)/am/cmacros.am diff --git a/scd/app-openpgp.c b/scd/app-openpgp.c index 2e7a9fc..cb61df1 100644 --- a/scd/app-openpgp.c +++ b/scd/app-openpgp.c @@ -66,7 +66,8 @@ #include "iso7816.h" #include "app-common.h" #include "tlv.h" -#include "../include/host2net.h" +#include "host2net.h" +#include "cipher.h" /* A table describing the DOs of the card. */ @@ -854,6 +855,7 @@ send_key_attr (ctrl_t ctrl, app_t app, const char *keyword, int number) assert (number >=0 && number < DIM(app->app_local->keyattr)); /* We only support RSA thus the algo identifier is fixed to 1. */ + /* Note that PUBKEY_ALGO_RSA == 1 */ snprintf (buffer, sizeof buffer, "%d 1 %u %u %d", number+1, app->app_local->keyattr[number].n_bits, @@ -940,7 +942,7 @@ do_getattr (app_t app, ctrl_t ctrl, const char *name) app->app_local->extcap.max_certlen_3, app->app_local->extcap.algo_attr_change, (app->app_local->extcap.sm_supported - ? (app->app_local->extcap.sm_aes128? 7 : 2) + ? (app->app_local->extcap.sm_aes128? CIPHER_ALGO_AES : CIPHER_ALGO_3DES) : 0)); send_status_info (ctrl, table[idx].name, tmp, strlen (tmp), NULL, 0); return 0; @@ -2543,7 +2545,7 @@ change_keyattr (app_t app, int keyno, unsigned int nbits, relptr = get_one_do (app, 0xC1+keyno, &buffer, &buflen, NULL); if (!relptr) return gpg_error (GPG_ERR_CARD); - if (buflen < 6 || buffer[0] != 1) + if (buflen < 6 || buffer[0] != PUBKEY_ALGO_RSA) { /* Attriutes too short or not an RSA key. */ xfree (relptr); @@ -2610,8 +2612,8 @@ change_keyattr_from_string (app_t app, err = gpg_error (GPG_ERR_INV_DATA); else if (keyno < 1 || keyno > 3) err = gpg_error (GPG_ERR_INV_ID); - else if (algo != 1) - err = gpg_error (GPG_ERR_PUBKEY_ALGO); /* Not RSA. */ + else if (algo != PUBKEY_ALGO_RSA) + err = gpg_error (GPG_ERR_PUBKEY_ALGO); else if (nbits < 1024) err = gpg_error (GPG_ERR_TOO_SHORT); else @@ -3833,7 +3835,7 @@ parse_algorithm_attribute (app_t app, int keyno) if (opt.verbose) log_info ("Key-Attr-%s ..: ", desc[keyno]); - if (*buffer == 1 && (buflen == 5 || buflen == 6)) + if (*buffer == PUBKEY_ALGO_RSA && (buflen == 5 || buflen == 6)) { app->app_local->keyattr[keyno].n_bits = (buffer[1]<<8 | buffer[2]); app->app_local->keyattr[keyno].e_bits = (buffer[3]<<8 | buffer[4]); ----------------------------------------------------------------------- Summary of changes: scd/Makefile.am | 2 +- scd/apdu.c | 50 ++++----------- scd/apdu.h | 1 - scd/app-openpgp.c | 188 ++++++++++++++++++++++++++++-------------------------- scd/app.c | 4 ++ scd/ccid-driver.c | 92 ++++---------------------- scd/command.c | 97 +++++++++++++++------------- scd/iso7816.c | 17 +++-- scd/iso7816.h | 4 +- scd/scdaemon.c | 1 + 10 files changed, 192 insertions(+), 264 deletions(-) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Wed Nov 30 11:32:29 2016 From: cvs at cvs.gnupg.org (by Justus Winter) Date: Wed, 30 Nov 2016 11:32:29 +0100 Subject: [git] GnuPG - branch, master, updated. gnupg-2.1.16-41-g3c0569e Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "The GNU Privacy Guard". The branch, master has been updated via 3c0569e99498c7470ebdb639b4c5ae829af92761 (commit) from aa6ab9e0bc67fe9ce5601047e84ea4a875e8eb64 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit 3c0569e99498c7470ebdb639b4c5ae829af92761 Author: Justus Winter Date: Wed Nov 30 11:29:50 2016 +0100 tests: Add test for '--encrypt --multifile'. * tests/openpgp/Makefile.am (XTESTS): Add new test. * tests/openpgp/encrypt-multifile.scm: New file. Signed-off-by: Justus Winter diff --git a/tests/openpgp/Makefile.am b/tests/openpgp/Makefile.am index 9eb69ee..c62f61e 100644 --- a/tests/openpgp/Makefile.am +++ b/tests/openpgp/Makefile.am @@ -52,6 +52,7 @@ XTESTS = \ sigs.scm \ sigs-dsa.scm \ encrypt.scm \ + encrypt-multifile.scm \ encrypt-dsa.scm \ seat.scm \ clearsig.scm \ diff --git a/tests/openpgp/encrypt-multifile.scm b/tests/openpgp/encrypt-multifile.scm new file mode 100755 index 0000000..4b76ff0 --- /dev/null +++ b/tests/openpgp/encrypt-multifile.scm @@ -0,0 +1,39 @@ +#!/usr/bin/env gpgscm + +;; Copyright (C) 2016 g10 Code GmbH +;; +;; This file is part of GnuPG. +;; +;; GnuPG is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 3 of the License, or +;; (at your option) any later version. +;; +;; GnuPG 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 General Public License for more details. +;; +;; You should have received a copy of the GNU General Public License +;; along with this program; if not, see . + +(load (with-path "defs.scm")) +(setup-legacy-environment) + +(define files (append plain-files data-files)) + +(info "Checking encryption of supplied files using --multifile.") + +;; Now encrypt all files. +(call-check `(, at gpg --encrypt --recipient ,usrname2 + --multifile , at files)) + +;; And check if we can decrypt them. +(for-each-p + "Verifying files:" + (lambda (source) + (tr:do + (tr:open (string-append source ".gpg")) + (tr:gpg "" '(--yes)) + (tr:assert-identity source))) + files) ----------------------------------------------------------------------- Summary of changes: tests/openpgp/Makefile.am | 1 + tests/openpgp/{armencrypt.scm => encrypt-multifile.scm} | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) copy tests/openpgp/{armencrypt.scm => encrypt-multifile.scm} (72%) hooks/post-receive -- The GNU Privacy Guard http://git.gnupg.org From cvs at cvs.gnupg.org Wed Nov 30 15:55:29 2016 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Wed, 30 Nov 2016 15:55:29 +0100 Subject: [git] GpgOL - branch, master, updated. gpgol-1.4.0-191-ga0326ff Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG extension for MS Outlook". The branch, master has been updated via a0326ffb755c4a49a259cea3d83831d9ede7d5d9 (commit) via d46db5899b99bae5a82218bfb361b5d8767f380a (commit) via 94c354a0845ba4f1e29e4bc8b9d8fc4e3b8081dc (commit) from 5b34e853a15baba47a8983e5430069a0a37bcb81 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit a0326ffb755c4a49a259cea3d83831d9ede7d5d9 Author: Andre Heinecke Date: Wed Nov 30 15:34:11 2016 +0100 Support sending embedded images(multipart/related) * src/mimemaker.cpp (add_body_and_attachments): New. Common multipart handling for the encrypt / sign functions. * src/mimemaker.cpp (mime_encrypt, do_mime_sign): Use add_body_and_attachments. (is_related): New. Check if we have a multipart/related. (write_attachments): Allow to filter out related attachments. (write_part): Write Content-ID if there is one. * src/mymapitags.h (PR_ATTACH_CONTENT_ID): New. -- This enables multipart/related and multipart/mixed with a multipart/related subpart. diff --git a/src/mimemaker.cpp b/src/mimemaker.cpp index cfc2abb..18bc271 100644 --- a/src/mimemaker.cpp +++ b/src/mimemaker.cpp @@ -846,7 +846,8 @@ utf8_to_rfc2047b (const char *input) retrieved from the body property. */ static int write_part (sink_t sink, const char *data, size_t datalen, - const char *boundary, const char *filename, int is_mapibody) + const char *boundary, const char *filename, int is_mapibody, + const char *content_id = NULL) { int rc; const char *ct; @@ -926,7 +927,14 @@ write_part (sink_t sink, const char *data, size_t datalen, NULL))) return rc; - if (encoded_filename) + if (content_id) + { + if ((rc=write_multistring (sink, + "Content-ID: <", content_id, ">\r\n", + NULL))) + return rc; + } + else if (encoded_filename) if ((rc=write_multistring (sink, "Content-Disposition: attachment;\r\n" "\tfilename=\"", encoded_filename, "\"\r\n", @@ -967,11 +975,13 @@ count_usable_attachments (mapi_attach_item_t *table) } /* Write out all attachments from TABLE separated by BOUNDARY to SINK. - This function needs to be syncronized with count_usable_attachments. */ + This function needs to be syncronized with count_usable_attachments. + If only_related is 1 only include attachments for multipart/related they + are excluded otherwise. */ static int write_attachments (sink_t sink, LPMESSAGE message, mapi_attach_item_t *table, - const char *boundary) + const char *boundary, int only_related) { int idx, rc; char *buffer; @@ -982,6 +992,14 @@ write_attachments (sink_t sink, if (table[idx].attach_type == ATTACHTYPE_UNKNOWN && table[idx].method == ATTACH_BY_VALUE) { + if (only_related && !table[idx].content_id) + { + continue; + } + else if (!only_related && table[idx].content_id) + { + continue; + } buffer = mapi_get_attach (message, 0, table+idx, &buflen); if (!buffer) log_debug ("Attachment at index %d not found\n", idx); @@ -990,7 +1008,7 @@ write_attachments (sink_t sink, if (!buffer) return -1; rc = write_part (sink, buffer, buflen, boundary, - table[idx].filename, 0); + table[idx].filename, 0, table[idx].content_id); if (rc) { log_error ("Write part returned err: %i", rc); @@ -1000,6 +1018,31 @@ write_attachments (sink_t sink, return 0; } +/* Returns 1 if all attachments are related. 2 if there is a + related and a mixed attachment. 0 if there are no other parts*/ +static int +is_related (Mail *mail, mapi_attach_item_t *table) +{ + if (!mail || !mail->is_html_alternative () || !table) + { + return 0; + } + + int related = 0; + int mixed = 0; + for (int idx = 0; !table[idx].end_of_table; idx++) + { + if (table[idx].content_id) + { + related = 1; + } + else + { + mixed = 1; + } + } + return mixed + related; +} /* Delete all attachments from TABLE except for the one we just created */ @@ -1313,6 +1356,98 @@ add_body (Mail *mail, const char *boundary, sink_t sink, return write_boundary (sink, alt_boundary, 1); } +/* Add the body and attachments. Does multipart handling. */ +static int +add_body_and_attachments (sink_t sink, LPMESSAGE message, + mapi_attach_item_t *att_table, Mail *mail, + const char *body, int n_att_usable) +{ + int related = is_related (mail, att_table); + int rc = 0; + char inner_boundary[BOUNDARYSIZE+1]; + char outer_boundary[BOUNDARYSIZE+1]; + + if (((body && n_att_usable) || n_att_usable > 1) && related == 1) + { + /* A body and at least one attachment or more than one attachment */ + generate_boundary (outer_boundary); + if ((rc=write_multistring (sink, + "Content-Type: multipart/related;\r\n", + "\tboundary=\"", outer_boundary, "\"\r\n", + NULL))) + return rc; + } + else if ((body && n_att_usable) || n_att_usable > 1) + { + generate_boundary (outer_boundary); + if ((rc=write_multistring (sink, + "Content-Type: multipart/mixed;\r\n", + "\tboundary=\"", outer_boundary, "\"\r\n", + NULL))) + return rc; + } + else + /* Only one part. */ + *outer_boundary = 0; + + if (*outer_boundary && related == 2) + { + /* We have attachments that are related to the body and unrelated + attachments. So we need another part. */ + if ((rc=write_boundary (sink, outer_boundary, 0))) + { + return rc; + } + generate_boundary (inner_boundary); + if ((rc=write_multistring (sink, + "Content-Type: multipart/related;\r\n", + "\tboundary=\"", inner_boundary, "\"\r\n", + NULL))) + { + return rc; + } + } + else + { + *inner_boundary = 0; + } + + + if ((rc=add_body (mail, *inner_boundary ? inner_boundary : outer_boundary, + sink, body))) + { + log_error ("%s:%s: Adding the body failed.", + SRCNAME, __func__); + return rc; + } + if (!rc && n_att_usable && related) + { + /* Write the related attachments. */ + rc = write_attachments (sink, message, att_table, + *inner_boundary? inner_boundary : + *outer_boundary? outer_boundary : NULL, 1); + if (rc) + { + return rc; + } + /* Close the related part if neccessary.*/ + if (*inner_boundary && (rc=write_boundary (sink, inner_boundary, 1))) + { + return rc; + } + } + + /* Now write the other attachments */ + if (!rc && n_att_usable) + rc = write_attachments (sink, message, att_table, + *outer_boundary? outer_boundary : NULL, 0); + + /* Finish the possible multipart/mixed. */ + if (*outer_boundary && (rc = write_boundary (sink, outer_boundary, 1))) + return rc; + + return rc; +} /* Main body of mime_sign without the the code to delete the original attachments. On success the function returns the current @@ -1333,7 +1468,6 @@ do_mime_sign (LPMESSAGE message, HWND hwnd, protocol_t protocol, struct sink_s hashsinkmem; sink_t hashsink = &hashsinkmem; char boundary[BOUNDARYSIZE+1]; - char inner_boundary[BOUNDARYSIZE+1]; mapi_attach_item_t *att_table = NULL; char *body = NULL; int n_att_usable; @@ -1412,13 +1546,6 @@ do_mime_sign (LPMESSAGE message, HWND hwnd, protocol_t protocol, if ((rc = write_string (sink, top_header))) goto failure; - /* Create the inner boundary if we have a body and at least one - attachment or more than one attachment. */ - if ((body && n_att_usable) || n_att_usable > 1) - generate_boundary (inner_boundary); - else - *inner_boundary = 0; - /* Write the boundary so that it is not included in the hashing. */ if ((rc = write_boundary (sink, boundary, 0))) goto failure; @@ -1428,37 +1555,14 @@ do_mime_sign (LPMESSAGE message, HWND hwnd, protocol_t protocol, hashsink->extrasink = sink; hashsink->writefnc = sink_hashing_write; - /* Note that OL2003 will add an extra line after the multipart - header, thus we do the same to avoid running all through an - IConverterSession first. */ - if (*inner_boundary - && (rc=write_multistring (hashsink, - "Content-Type: multipart/mixed;\r\n", - "\tboundary=\"", inner_boundary, "\"\r\n", - "\r\n", /* <-- extra line */ - NULL))) - goto failure; - - if ((rc=add_body (mail, inner_boundary, hashsink, body))) - { - log_error ("%s:%s: Adding the body failed.", - SRCNAME, __func__); - goto failure; - } - - if (!rc && n_att_usable) - rc = write_attachments (hashsink, message, att_table, - *inner_boundary? inner_boundary : NULL); - if (rc) + /* Add the plaintext */ + if (add_body_and_attachments (hashsink, message, att_table, mail, + body, n_att_usable)) goto failure; xfree (body); body = NULL; - /* Finish the possible multipart/mixed. */ - if (*inner_boundary && (rc = write_boundary (hashsink, inner_boundary, 1))) - goto failure; - /* Here we are ready with the hashing. Flush the filter and wait for the signing process to finish. */ if ((rc = write_buffer (hashsink, NULL, 0))) @@ -1790,7 +1894,6 @@ mime_encrypt (LPMESSAGE message, HWND hwnd, struct sink_s encsinkmem; sink_t encsink = &encsinkmem; char boundary[BOUNDARYSIZE+1]; - char inner_boundary[BOUNDARYSIZE+1]; mapi_attach_item_t *att_table = NULL; char *body = NULL; int n_att_usable; @@ -1861,38 +1964,14 @@ mime_encrypt (LPMESSAGE message, HWND hwnd, encsink->cb_data = filter; encsink->writefnc = sink_encryption_write; - if ((body && n_att_usable) || n_att_usable > 1) - { - /* A body and at least one attachment or more than one attachment */ - generate_boundary (inner_boundary); - if ((rc=write_multistring (encsink, - "Content-Type: multipart/mixed;\r\n", - "\tboundary=\"", inner_boundary, "\"\r\n", - NULL))) - goto failure; - } - else /* Only one part. */ - *inner_boundary = 0; - - if ((rc=add_body (mail, inner_boundary, encsink, body))) - { - log_error ("%s:%s: Adding the body failed.", - SRCNAME, __func__); - goto failure; - } - if (!rc && n_att_usable) - rc = write_attachments (encsink, message, att_table, - *inner_boundary? inner_boundary : NULL); - if (rc) + /* Add the plaintext */ + if (add_body_and_attachments (encsink, message, att_table, mail, + body, n_att_usable)) goto failure; xfree (body); body = NULL; - /* Finish the possible multipart/mixed. */ - if (*inner_boundary && (rc = write_boundary (encsink, inner_boundary, 1))) - goto failure; - /* Flush the encryption sink and wait for the encryption to get ready. */ if ((rc = write_buffer (encsink, NULL, 0))) diff --git a/src/mymapitags.h b/src/mymapitags.h index c2d6e4f..9232c37 100644 --- a/src/mymapitags.h +++ b/src/mymapitags.h @@ -513,6 +513,7 @@ #define PR_ATTACH_MIME_TAG_W PROP_TAG( PT_UNICODE, 0x370E) #define PR_ATTACH_MIME_TAG_A PROP_TAG( PT_STRING8, 0x370E) #define PR_ATTACH_ADDITIONAL_INFO PROP_TAG( PT_BINARY, 0x370F) +#define PR_ATTACH_CONTENT_ID PROP_TAG( PT_UNICODE, 0x3712) #define PR_DISPLAY_TYPE PROP_TAG( PT_LONG, 0x3900) #define PR_TEMPLATEID PROP_TAG( PT_BINARY, 0x3902) #define PR_PRIMARY_CAPABILITY PROP_TAG( PT_BINARY, 0x3904) commit d46db5899b99bae5a82218bfb361b5d8767f380a Author: Andre Heinecke Date: Wed Nov 30 15:30:55 2016 +0100 Add content_id to our attach table * src/common_indep.h (mapi_attach_item_t): Extend with content_id. * src/mapihelp.cpp (get_attach_content_id): New. (mapi_create_attach_table): Use it. (mapi_release_attach_table): Free it. diff --git a/src/common_indep.h b/src/common_indep.h index ec7f026..a5c04f3 100644 --- a/src/common_indep.h +++ b/src/common_indep.h @@ -141,6 +141,9 @@ struct mapi_attach_item_s /* If not NULL the parameters of the content_type. */ const char *content_type_parms; + /* If not NULL the content_id */ + char *content_id; + /* The attachment type from Property GpgOL Attach Type. */ attachtype_t attach_type; }; diff --git a/src/mapihelp.cpp b/src/mapihelp.cpp index 2ebe333..de325c5 100644 --- a/src/mapihelp.cpp +++ b/src/mapihelp.cpp @@ -1996,6 +1996,44 @@ get_attach_filename (LPATTACH obj) return name; } +/* Return the content-id of the attachment OBJ or NULL if it does + not exists. Caller must free. */ +static char * +get_attach_content_id (LPATTACH obj) +{ + HRESULT hr; + LPSPropValue propval = NULL; + char *name; + + hr = HrGetOneProp ((LPMAPIPROP)obj, PR_ATTACH_CONTENT_ID, &propval); + if (FAILED (hr)) + { + if (hr != MAPI_E_NOT_FOUND) + log_error ("%s:%s: error getting attachment's MIME tag: hr=%#lx", + SRCNAME, __func__, hr); + return NULL; + } + switch ( PROP_TYPE (propval->ulPropTag) ) + { + case PT_UNICODE: + name = wchar_to_utf8 (propval->Value.lpszW); + if (!name) + log_debug ("%s:%s: error converting to utf8\n", SRCNAME, __func__); + break; + + case PT_STRING8: + name = xstrdup (propval->Value.lpszA); + break; + + default: + log_debug ("%s:%s: proptag=%#lx not supported\n", + SRCNAME, __func__, propval->ulPropTag); + name = NULL; + break; + } + MAPIFreeBuffer (propval); + return name; +} /* Return the content-type of the attachment OBJ or NULL if it does not exists. Caller must free. */ @@ -2140,6 +2178,7 @@ mapi_create_attach_table (LPMESSAGE message, int fast) table[pos].method = get_attach_method (att); table[pos].filename = fast? NULL : get_attach_filename (att); table[pos].content_type = fast? NULL : get_attach_mime_tag (att); + table[pos].content_id = fast? NULL : get_attach_content_id (att); if (table[pos].content_type) { char *p = strchr (table[pos].content_type, ';'); @@ -2200,6 +2239,7 @@ mapi_release_attach_table (mapi_attach_item_t *table) { xfree (table[pos].filename); xfree (table[pos].content_type); + xfree (table[pos].content_id); } xfree (table); } commit 94c354a0845ba4f1e29e4bc8b9d8fc4e3b8081dc Author: Andre Heinecke Date: Wed Nov 30 15:29:19 2016 +0100 Fix content type detection * src/mimemaker.cpp (infer_content_type): Fix it. -- This never worked because the tolower did not increase the suffix pointer and just filled the buffer with the first letter of the suffix. Now we have c++ we can simplify the tolower. diff --git a/src/mimemaker.cpp b/src/mimemaker.cpp index b7bd1e5..cfc2abb 100644 --- a/src/mimemaker.cpp +++ b/src/mimemaker.cpp @@ -681,24 +681,25 @@ infer_content_type (const char * /*data*/, size_t /*datalen*/, { 0, NULL, NULL } }; int i; - char suffix_buffer[12+1]; - const char *suffix; + std::string suffix; *force_b64 = 0; - suffix = filename? strrchr (filename, '.') : NULL; - if (suffix && strlen (suffix) < sizeof suffix_buffer -1 ) + if (filename) + suffix = strrchr (filename, '.'); + + if (!suffix.empty()) { - suffix++; - for (i=0; i < sizeof suffix_buffer - 1; i++) - suffix_buffer[i] = tolower (*(const unsigned char*)suffix); - suffix_buffer[i] = 0; + suffix.erase(0, 1); + std::transform(suffix.begin(), suffix.end(), suffix.begin(), ::tolower); for (i=0; suffix_table[i].suffix; i++) - if (!strcmp (suffix_table[i].suffix, suffix_buffer)) - { - if (suffix_table[i].b64) - *force_b64 = 1; - return suffix_table[i].ct; - } + { + if (!strcmp (suffix_table[i].suffix, suffix.c_str())) + { + if (suffix_table[i].b64) + *force_b64 = 1; + return suffix_table[i].ct; + } + } } /* Not found via filename, look at the content. */ ----------------------------------------------------------------------- Summary of changes: src/common_indep.h | 3 + src/mapihelp.cpp | 40 +++++++++ src/mimemaker.cpp | 242 +++++++++++++++++++++++++++++++++++------------------ src/mymapitags.h | 1 + 4 files changed, 205 insertions(+), 81 deletions(-) hooks/post-receive -- GnuPG extension for MS Outlook http://git.gnupg.org From cvs at cvs.gnupg.org Wed Nov 30 17:20:14 2016 From: cvs at cvs.gnupg.org (by Andre Heinecke) Date: Wed, 30 Nov 2016 17:20:14 +0100 Subject: [git] GpgOL - branch, master, updated. gpgol-1.4.0-192-gfd987b7 Message-ID: This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "GnuPG extension for MS Outlook". The branch, master has been updated via fd987b7b5500506515b0a9913d9fa304ff35ad6c (commit) from a0326ffb755c4a49a259cea3d83831d9ede7d5d9 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- commit fd987b7b5500506515b0a9913d9fa304ff35ad6c Author: Andre Heinecke Date: Wed Nov 30 17:17:14 2016 +0100 Support multipart/related reading * src/attachment.cpp (Attachment::set_content_id) (Attachment::get_content_id): New. * src/mail.cpp (get_attachment): Return last attachment on -1 pos (fixup_last_attachment): New. Set content id. (add_attachments): Call fixup. * src/oomhelp.h (PR_ATTACH_CONTENT_ID_DASL): New. * src/mimedataprovider.cpp (t2body): Parse content-id. (MimeDataProvider::create_attachment): Set content-id. -- This magically hides the attachment from the attachment list and Outlook shows images in the body. diff --git a/src/attachment.cpp b/src/attachment.cpp index fc528c7..d5961cf 100644 --- a/src/attachment.cpp +++ b/src/attachment.cpp @@ -56,3 +56,15 @@ Attachment::get_data() { return m_data; } + +void +Attachment::set_content_id(const char *cid) +{ + m_cid = cid; +} + +std::string +Attachment::get_content_id() const +{ + return m_cid; +} diff --git a/src/attachment.h b/src/attachment.h index 47c536e..de75935 100644 --- a/src/attachment.h +++ b/src/attachment.h @@ -38,6 +38,10 @@ public: void set_attach_type(attachtype_t type); + /* Content id */ + void set_content_id (const char *cid); + std::string get_content_id() const; + /* get the underlying data structure */ GpgME::Data& get_data(); @@ -45,6 +49,7 @@ private: GpgME::Data m_data; std::string m_utf8DisplayName; attachtype_t m_type; + std::string m_cid; }; #endif // ATTACHMENT_H diff --git a/src/mail.cpp b/src/mail.cpp index 55800fc..950acd3 100644 --- a/src/mail.cpp +++ b/src/mail.cpp @@ -238,8 +238,16 @@ get_attachment (LPDISPATCH mailitem, int pos) return NULL; } - const auto item_str = std::string("Item(") + std::to_string(pos) + ")"; + std::string item_str; int count = get_oom_int (attachments, "Count"); + if (pos > 0) + { + item_str = std::string("Item(") + std::to_string(pos) + ")"; + } + else + { + item_str = std::string("Item(") + std::to_string(count) + ")"; + } if (count < 1) { log_debug ("%s:%s: Invalid attachment count: %i.", @@ -417,6 +425,33 @@ copy_attachment_to_file (std::shared_ptr att, HANDLE hFile) return 0; } +/** Sets some meta data on the last attachment atted. The meta + data is taken from the attachment object. */ +static int +fixup_last_attachment (LPDISPATCH mail, std::shared_ptr attachment) +{ + /* Currently we only set content id */ + if (attachment->get_content_id ().empty()) + { + log_debug ("%s:%s: Content id not found.", + SRCNAME, __func__); + return 0; + } + + LPDISPATCH attach = get_attachment (mail, -1); + if (!attach) + { + log_error ("%s:%s: No attachment.", + SRCNAME, __func__); + return 1; + } + int ret = put_pa_string (attach, + PR_ATTACH_CONTENT_ID_DASL, + attachment->get_content_id ().c_str()); + gpgol_release (attach); + return ret; +} + /** Helper to update the attachments of a mail object in oom. does not modify the underlying mapi structure. */ static int @@ -456,6 +491,8 @@ add_attachments(LPDISPATCH mail, } xfree (wchar_file); xfree (wchar_name); + + err = fixup_last_attachment (mail, att); } return err; } diff --git a/src/mimedataprovider.cpp b/src/mimedataprovider.cpp index bb74bc1..f0273cf 100644 --- a/src/mimedataprovider.cpp +++ b/src/mimedataprovider.cpp @@ -50,6 +50,7 @@ struct mimestruct_item_s unsigned int level; /* Level in the hierarchy of that part. 0 indicates the outer body. */ char *filename; /* Malloced filename or NULL. */ + char *cid; /* Malloced content id or NULL. */ char *charset; /* Malloced charset or NULL. */ char content_type[1]; /* String with the content type. */ }; @@ -174,6 +175,7 @@ t2body (MimeDataProvider *provider, rfc822parse_t msg) int is_text = 0; int is_text_attachment = 0; char *filename = NULL; + char *cid = NULL; char *charset = NULL; /* Figure out the encoding. */ @@ -254,6 +256,14 @@ t2body (MimeDataProvider *provider, rfc822parse_t msg) filename = rfc2047_parse (s); } + /* Parse a Content Id header */ + p = rfc822parse_get_field (msg, "Content-Id", -1, &off); + if (p) + { + cid = xstrdup (p+off); + xfree (p); + } + /* Update our idea of the entire MIME structure. */ { mimestruct_item_t ms; @@ -266,6 +276,7 @@ t2body (MimeDataProvider *provider, rfc822parse_t msg) strcpy (stpcpy (stpcpy (ms->content_type, ctmain), "/"), ctsub); ms->level = ctx->nesting_level; ms->filename = filename; + ms->cid = cid; filename = NULL; ms->charset = charset; charset = NULL; @@ -515,6 +526,7 @@ MimeDataProvider::~MimeDataProvider() mimestruct_item_t tmp = m_mime_ctx->mimestruct->next; xfree (m_mime_ctx->mimestruct->filename); xfree (m_mime_ctx->mimestruct->charset); + xfree (m_mime_ctx->mimestruct->cid); xfree (m_mime_ctx->mimestruct); m_mime_ctx->mimestruct = tmp; } @@ -876,6 +888,10 @@ MimeDataProvider::create_attachment() attach->set_display_name (m_mime_ctx->mimestruct_cur->filename); } } + if (m_mime_ctx->mimestruct_cur && m_mime_ctx->mimestruct_cur->cid) + { + attach->set_content_id (m_mime_ctx->mimestruct_cur->cid); + } m_attachments.push_back (attach); return attach; diff --git a/src/oomhelp.h b/src/oomhelp.h index 1c6aa94..3914f5e 100644 --- a/src/oomhelp.h +++ b/src/oomhelp.h @@ -100,6 +100,8 @@ DEFINE_OLEGUID(IID_IOleWindow, 0x00000114, 0, 0); "http://schemas.microsoft.com/mapi/proptag/0x7FFE000B" #define PR_ATTACH_MIME_TAG_DASL \ "http://schemas.microsoft.com/mapi/proptag/0x370E001F" +#define PR_ATTACH_CONTENT_ID_DASL \ + "http://schemas.microsoft.com/mapi/proptag/0x3712001F" #ifdef __cplusplus extern "C" { #if 0 ----------------------------------------------------------------------- Summary of changes: src/attachment.cpp | 12 ++++++++++++ src/attachment.h | 5 +++++ src/mail.cpp | 39 ++++++++++++++++++++++++++++++++++++++- src/mimedataprovider.cpp | 16 ++++++++++++++++ src/oomhelp.h | 2 ++ 5 files changed, 73 insertions(+), 1 deletion(-) hooks/post-receive -- GnuPG extension for MS Outlook http://git.gnupg.org