Update to 1.17.1
Update gpgme to 1.17.1 (fix libqpgpme ABI, #2127553) Prepare for distutils drop in Python 3.12+ (#2135758) Fix tests on 32-bit machines (#2096365) Use SPDX syntax for License field Add option to not build Qt binding (qgpgme)
This commit is contained in:
parent
624f9a13a9
commit
7aed4171dc
@ -0,0 +1,78 @@
|
||||
From 7870fdbfeff47755138136dbd6648b18f6b4fc76 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Ingo=20Kl=C3=B6cker?= <dev@ingo-kloecker.de>
|
||||
Date: Fri, 10 Jun 2022 11:54:03 +0200
|
||||
Subject: [PATCH] qt: Prevent u32 overflow when calculating expiration date
|
||||
|
||||
* lang/qt/src/qgpgmesignkeyjob.cpp (sign_key): Change maxAllowedDate to
|
||||
2106-02-05. Change log-level from warning to debug.
|
||||
* lang/qt/tests/t-various.cpp (TestVarious::testSignKeyWithExpiration):
|
||||
Remove check for warning. Adapt assertion.
|
||||
--
|
||||
|
||||
Capping the expiration date at 2106-02-05 prevents a u32 overflow when
|
||||
adding the number of days until the maximal date to the current time.
|
||||
|
||||
GnuPG-bug-id: 5991
|
||||
---
|
||||
lang/qt/src/qgpgmesignkeyjob.cpp | 6 +++---
|
||||
lang/qt/src/signkeyjob.h | 2 +-
|
||||
lang/qt/tests/t-various.cpp | 4 +---
|
||||
3 files changed, 5 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/lang/qt/src/qgpgmesignkeyjob.cpp b/lang/qt/src/qgpgmesignkeyjob.cpp
|
||||
index 5036a9b9..506d64a1 100644
|
||||
--- a/lang/qt/src/qgpgmesignkeyjob.cpp
|
||||
+++ b/lang/qt/src/qgpgmesignkeyjob.cpp
|
||||
@@ -127,11 +127,11 @@ static QGpgMESignKeyJob::result_type sign_key(Context *ctx, const Key &key, cons
|
||||
|
||||
if (expirationDate.isValid()) {
|
||||
// on 2106-02-07, the Unix time will reach 0xFFFFFFFF; since gpg uses uint32 internally
|
||||
- // for the expiration date clip it at 2106-02-06
|
||||
- static const QDate maxAllowedDate{2106, 2, 6};
|
||||
+ // for the expiration date clip it at 2106-02-05 to avoid problems with negative time zones
|
||||
+ static const QDate maxAllowedDate{2106, 2, 5};
|
||||
const auto clippedExpirationDate = expirationDate <= maxAllowedDate ? expirationDate : maxAllowedDate;
|
||||
if (clippedExpirationDate != expirationDate) {
|
||||
- qCWarning(QGPGME_LOG) << "Expiration of certification has been changed to" << clippedExpirationDate;
|
||||
+ qCDebug(QGPGME_LOG) << "Expiration of certification has been changed to" << clippedExpirationDate;
|
||||
}
|
||||
// use the "days from now" format to specify the expiration date of the certification;
|
||||
// this format is the most appropriate regardless of the local timezone
|
||||
diff --git a/lang/qt/src/signkeyjob.h b/lang/qt/src/signkeyjob.h
|
||||
index f4b3ed8f..d0e90c22 100644
|
||||
--- a/lang/qt/src/signkeyjob.h
|
||||
+++ b/lang/qt/src/signkeyjob.h
|
||||
@@ -149,7 +149,7 @@ public:
|
||||
* Sets the expiration date of the key signature to @a expiration. By default,
|
||||
* key signatures do not expire.
|
||||
*
|
||||
- * Note: Expiration dates after 2106-02-06 will be set to 2106-02-06.
|
||||
+ * Note: Expiration dates after 2106-02-05 will be set to 2106-02-05.
|
||||
*
|
||||
* Not pure virtual for ABI compatibility.
|
||||
**/
|
||||
diff --git a/lang/qt/tests/t-various.cpp b/lang/qt/tests/t-various.cpp
|
||||
index b630350c..18360166 100644
|
||||
--- a/lang/qt/tests/t-various.cpp
|
||||
+++ b/lang/qt/tests/t-various.cpp
|
||||
@@ -328,8 +328,6 @@ private Q_SLOTS:
|
||||
}
|
||||
});
|
||||
|
||||
- QTest::ignoreMessage(QtWarningMsg, "Expiration of certification has been changed to QDate(\"2106-02-06\")");
|
||||
-
|
||||
job->start(target);
|
||||
QSignalSpy spy{this, &TestVarious::asyncDone};
|
||||
QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT));
|
||||
@@ -339,7 +337,7 @@ private Q_SLOTS:
|
||||
const auto keySignature = target.userID(0).signature(target.userID(0).numSignatures() - 1);
|
||||
QVERIFY(!keySignature.neverExpires());
|
||||
const auto expirationDate = QDateTime::fromSecsSinceEpoch(uint_least32_t(keySignature.expirationTime())).date();
|
||||
- QCOMPARE(expirationDate, QDate(2106, 2, 6)); // expiration date is capped at 2106-02-06
|
||||
+ QCOMPARE(expirationDate, QDate(2106, 2, 5)); // expiration date is capped at 2106-02-05
|
||||
}
|
||||
|
||||
void testVersion()
|
||||
--
|
||||
2.37.1
|
||||
|
42
0002-qt-tests-Allow-1-day-offset-for-expiration-date.patch
Normal file
42
0002-qt-tests-Allow-1-day-offset-for-expiration-date.patch
Normal file
@ -0,0 +1,42 @@
|
||||
From fd813f5c3938423137db1fcb02c3c527bd9f58c6 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Ingo=20Kl=C3=B6cker?= <dev@ingo-kloecker.de>
|
||||
Date: Fri, 10 Jun 2022 12:03:39 +0200
|
||||
Subject: [PATCH] qt,tests: Allow 1-day-offset for expiration date
|
||||
|
||||
* lang/qt/tests/t-various.cpp (TestVarious::testSignKeyWithExpiration):
|
||||
Assert that the expiration date is either 2106-02-05 or 2106-02-04.
|
||||
|
||||
--
|
||||
|
||||
This avoids a test failure if the test is run at 00:xx:xx in a location
|
||||
that uses DST.
|
||||
|
||||
GnuPG-bug-id: 5991
|
||||
---
|
||||
lang/qt/tests/t-various.cpp | 10 +++++++++-
|
||||
1 file changed, 9 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/lang/qt/tests/t-various.cpp b/lang/qt/tests/t-various.cpp
|
||||
index 18360166..336ad34e 100644
|
||||
--- a/lang/qt/tests/t-various.cpp
|
||||
+++ b/lang/qt/tests/t-various.cpp
|
||||
@@ -337,7 +337,15 @@ private Q_SLOTS:
|
||||
const auto keySignature = target.userID(0).signature(target.userID(0).numSignatures() - 1);
|
||||
QVERIFY(!keySignature.neverExpires());
|
||||
const auto expirationDate = QDateTime::fromSecsSinceEpoch(uint_least32_t(keySignature.expirationTime())).date();
|
||||
- QCOMPARE(expirationDate, QDate(2106, 2, 5)); // expiration date is capped at 2106-02-05
|
||||
+ // expiration date is capped at 2106-02-05; we also allow 2106-02-04 as expiration date because for locations that use DST
|
||||
+ // the expiration date may be 2106-02-04-23:xx:xx (in local non-DST time) if the current time is 00:xx::xx (in local DST time)
|
||||
+ const auto expectedExpirationRange = std::make_pair(QDate{2106, 2, 4}, QDate{2106, 2, 5});
|
||||
+ QVERIFY2(expirationDate >= expectedExpirationRange.first,
|
||||
+ ("\n Actual : " + expirationDate.toString(Qt::ISODate).toLatin1() +
|
||||
+ "\n Expected: " + expectedExpirationRange.first.toString(Qt::ISODate).toLatin1()).constData());
|
||||
+ QVERIFY2(expirationDate <= expectedExpirationRange.second,
|
||||
+ ("\n Actual : " + expirationDate.toString(Qt::ISODate).toLatin1() +
|
||||
+ "\n Expected: " + expectedExpirationRange.second.toString(Qt::ISODate).toLatin1()).constData());
|
||||
}
|
||||
|
||||
void testVersion()
|
||||
--
|
||||
2.37.1
|
||||
|
@ -0,0 +1,35 @@
|
||||
From c977424a1d39751fc5055131ad3f7819d421dcc8 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Ingo=20Kl=C3=B6cker?= <dev@ingo-kloecker.de>
|
||||
Date: Wed, 17 Aug 2022 14:51:19 +0200
|
||||
Subject: [PATCH] qt: Make sure expiration time is interpreted as unsigned
|
||||
number
|
||||
|
||||
* lang/qt/src/qgpgmeaddexistingsubkeyjob.cpp (add_subkey): Convert
|
||||
expiration time to uint_least32_t.
|
||||
--
|
||||
|
||||
This fixes the corresponding test on 32-bit systems where time_t (the
|
||||
return type of expirationTime()) is a signed 32-bit integer type.
|
||||
|
||||
GnuPG-bug-id: 6137
|
||||
---
|
||||
lang/qt/src/qgpgmeaddexistingsubkeyjob.cpp | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/lang/qt/src/qgpgmeaddexistingsubkeyjob.cpp b/lang/qt/src/qgpgmeaddexistingsubkeyjob.cpp
|
||||
index 32e2c292..b74e7a06 100644
|
||||
--- a/lang/qt/src/qgpgmeaddexistingsubkeyjob.cpp
|
||||
+++ b/lang/qt/src/qgpgmeaddexistingsubkeyjob.cpp
|
||||
@@ -64,7 +64,8 @@ static QGpgMEAddExistingSubkeyJob::result_type add_subkey(Context *ctx, const Ke
|
||||
std::unique_ptr<GpgAddExistingSubkeyEditInteractor> interactor{new GpgAddExistingSubkeyEditInteractor{subkey.keyGrip()}};
|
||||
|
||||
if (!subkey.neverExpires()) {
|
||||
- const auto expiry = QDateTime::fromSecsSinceEpoch(subkey.expirationTime(), Qt::UTC).toString(u"yyyyMMdd'T'hhmmss").toStdString();
|
||||
+ const auto expiry = QDateTime::fromSecsSinceEpoch(uint_least32_t(subkey.expirationTime()),
|
||||
+ Qt::UTC).toString(u"yyyyMMdd'T'hhmmss").toStdString();
|
||||
interactor->setExpiry(expiry);
|
||||
}
|
||||
|
||||
--
|
||||
2.37.1
|
||||
|
@ -0,0 +1,51 @@
|
||||
From 81d4b7f2d7077297d76af5728949d8f2bdff8cd5 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Ingo=20Kl=C3=B6cker?= <dev@ingo-kloecker.de>
|
||||
Date: Wed, 17 Aug 2022 14:56:13 +0200
|
||||
Subject: [PATCH] qt,tests: Log the actual error code if the assertion fails
|
||||
|
||||
* lang/qt/tests/t-addexistingsubkey.cpp (
|
||||
AddExistingSubkeyJobTest::testAddExistingSubkeyAsync,
|
||||
AddExistingSubkeyJobTest::testAddExistingSubkeySync,
|
||||
AddExistingSubkeyJobTest::testAddExistingSubkeyWithExpiration): Use
|
||||
QCOMPARE instead of QVERIFY for asserting equality.
|
||||
--
|
||||
|
||||
GnuPG-bug-id: 6137
|
||||
---
|
||||
lang/qt/tests/t-addexistingsubkey.cpp | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/lang/qt/tests/t-addexistingsubkey.cpp b/lang/qt/tests/t-addexistingsubkey.cpp
|
||||
index 589c90bf..2e654cec 100644
|
||||
--- a/lang/qt/tests/t-addexistingsubkey.cpp
|
||||
+++ b/lang/qt/tests/t-addexistingsubkey.cpp
|
||||
@@ -168,7 +168,7 @@ private Q_SLOTS:
|
||||
QSignalSpy spy (this, SIGNAL(asyncDone()));
|
||||
QVERIFY(spy.wait(QSIGNALSPY_TIMEOUT));
|
||||
|
||||
- QVERIFY(result.code() == GPG_ERR_NO_ERROR);
|
||||
+ QCOMPARE(result.code(), static_cast<int>(GPG_ERR_NO_ERROR));
|
||||
key.update();
|
||||
QCOMPARE(key.numSubkeys(), 3u);
|
||||
}
|
||||
@@ -190,7 +190,7 @@ private Q_SLOTS:
|
||||
|
||||
const auto result = job->exec(key, sourceSubkey);
|
||||
|
||||
- QVERIFY(result.code() == GPG_ERR_NO_ERROR);
|
||||
+ QCOMPARE(result.code(), static_cast<int>(GPG_ERR_NO_ERROR));
|
||||
key.update();
|
||||
QCOMPARE(key.numSubkeys(), 3u);
|
||||
QCOMPARE(key.subkey(2).expirationTime(), 0);
|
||||
@@ -213,7 +213,7 @@ private Q_SLOTS:
|
||||
|
||||
const auto result = job->exec(key, sourceSubkey);
|
||||
|
||||
- QVERIFY(result.code() == GPG_ERR_NO_ERROR);
|
||||
+ QCOMPARE(result.code(), static_cast<int>(GPG_ERR_NO_ERROR));
|
||||
key.update();
|
||||
QCOMPARE(key.numSubkeys(), 3u);
|
||||
|
||||
--
|
||||
2.37.1
|
||||
|
@ -0,0 +1,159 @@
|
||||
From f2b48de26b8f8c48c293423eda712831544924f6 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Ingo=20Kl=C3=B6cker?= <dev@ingo-kloecker.de>
|
||||
Date: Wed, 17 Aug 2022 15:22:29 +0200
|
||||
Subject: [PATCH] qt,tests: Make sure expiration time is interpreted as
|
||||
unsigned number
|
||||
|
||||
* lang/qt/tests/t-addexistingsubkey.cpp,
|
||||
lang/qt/tests/t-changeexpiryjob.cpp: Convert expiration time to
|
||||
uint_least32_t.
|
||||
--
|
||||
|
||||
This doesn't change the outcome of the tests (they also pass without
|
||||
this change because of the expiration dates of the test keys), but it's
|
||||
still good practise to treat the expiration time as an unsigned number
|
||||
if the assertions check that the expiration time is in some range.
|
||||
|
||||
GnuPG-bug-id: 6137
|
||||
---
|
||||
lang/qt/tests/t-addexistingsubkey.cpp | 6 +++---
|
||||
lang/qt/tests/t-changeexpiryjob.cpp | 26 +++++++++++++-------------
|
||||
2 files changed, 16 insertions(+), 16 deletions(-)
|
||||
|
||||
diff --git a/lang/qt/tests/t-addexistingsubkey.cpp b/lang/qt/tests/t-addexistingsubkey.cpp
|
||||
index 2e654cec..87eadf43 100644
|
||||
--- a/lang/qt/tests/t-addexistingsubkey.cpp
|
||||
+++ b/lang/qt/tests/t-addexistingsubkey.cpp
|
||||
@@ -222,9 +222,9 @@ private Q_SLOTS:
|
||||
// several times
|
||||
const auto allowedDeltaTSeconds = 1;
|
||||
const auto expectedExpirationRange = std::make_pair(
|
||||
- sourceSubkey.expirationTime() - allowedDeltaTSeconds,
|
||||
- sourceSubkey.expirationTime() + allowedDeltaTSeconds);
|
||||
- const auto actualExpiration = key.subkey(2).expirationTime();
|
||||
+ uint_least32_t(sourceSubkey.expirationTime()) - allowedDeltaTSeconds,
|
||||
+ uint_least32_t(sourceSubkey.expirationTime()) + allowedDeltaTSeconds);
|
||||
+ const auto actualExpiration = uint_least32_t(key.subkey(2).expirationTime());
|
||||
QVERIFY2(actualExpiration >= expectedExpirationRange.first,
|
||||
("actual: " + std::to_string(actualExpiration) +
|
||||
"; expected: " + std::to_string(expectedExpirationRange.first)).c_str());
|
||||
diff --git a/lang/qt/tests/t-changeexpiryjob.cpp b/lang/qt/tests/t-changeexpiryjob.cpp
|
||||
index 090002f3..3da74d46 100644
|
||||
--- a/lang/qt/tests/t-changeexpiryjob.cpp
|
||||
+++ b/lang/qt/tests/t-changeexpiryjob.cpp
|
||||
@@ -70,7 +70,7 @@ private Q_SLOTS:
|
||||
QVERIFY(!key.isNull());
|
||||
QVERIFY(!key.subkey(0).isNull());
|
||||
QVERIFY(!key.subkey(1).isNull());
|
||||
- const auto subkeyExpiration = key.subkey(1).expirationTime();
|
||||
+ const auto subkeyExpiration = uint_least32_t(key.subkey(1).expirationTime());
|
||||
|
||||
{
|
||||
// Create the job
|
||||
@@ -101,7 +101,7 @@ private Q_SLOTS:
|
||||
newExpirationDate.toSecsSinceEpoch() - 10,
|
||||
QDateTime::currentDateTime().addDays(1).toSecsSinceEpoch());
|
||||
{
|
||||
- const auto actualExpiration = key.subkey(0).expirationTime();
|
||||
+ const auto actualExpiration = uint_least32_t(key.subkey(0).expirationTime());
|
||||
QVERIFY2(actualExpiration >= expectedExpirationRange.first,
|
||||
("actual: " + std::to_string(actualExpiration) +
|
||||
"; expected: " + std::to_string(expectedExpirationRange.first)).c_str());
|
||||
@@ -110,7 +110,7 @@ private Q_SLOTS:
|
||||
"; expected: " + std::to_string(expectedExpirationRange.second)).c_str());
|
||||
}
|
||||
{
|
||||
- const auto actualExpiration = key.subkey(1).expirationTime();
|
||||
+ const auto actualExpiration = uint_least32_t(key.subkey(1).expirationTime());
|
||||
QCOMPARE(actualExpiration, subkeyExpiration); // unchanged
|
||||
}
|
||||
}
|
||||
@@ -133,7 +133,7 @@ private Q_SLOTS:
|
||||
QVERIFY(!key.isNull());
|
||||
QVERIFY(!key.subkey(0).isNull());
|
||||
QVERIFY(!key.subkey(1).isNull());
|
||||
- const auto primaryKeyExpiration = key.subkey(0).expirationTime();
|
||||
+ const auto primaryKeyExpiration = uint_least32_t(key.subkey(0).expirationTime());
|
||||
|
||||
{
|
||||
// Create the job
|
||||
@@ -164,11 +164,11 @@ private Q_SLOTS:
|
||||
newExpirationDate.toSecsSinceEpoch() - 10,
|
||||
QDateTime::currentDateTime().addDays(2).toSecsSinceEpoch());
|
||||
{
|
||||
- const auto actualExpiration = key.subkey(0).expirationTime();
|
||||
+ const auto actualExpiration = uint_least32_t(key.subkey(0).expirationTime());
|
||||
QCOMPARE(actualExpiration, primaryKeyExpiration); // unchanged
|
||||
}
|
||||
{
|
||||
- const auto actualExpiration = key.subkey(1).expirationTime();
|
||||
+ const auto actualExpiration = uint_least32_t(key.subkey(1).expirationTime());
|
||||
QVERIFY2(actualExpiration >= expectedExpirationRange.first,
|
||||
("actual: " + std::to_string(actualExpiration) +
|
||||
"; expected: " + std::to_string(expectedExpirationRange.first)).c_str());
|
||||
@@ -196,7 +196,7 @@ private Q_SLOTS:
|
||||
QVERIFY(!key.isNull());
|
||||
QVERIFY(!key.subkey(0).isNull());
|
||||
QVERIFY(!key.subkey(1).isNull());
|
||||
- const auto subkeyExpiration = key.subkey(1).expirationTime();
|
||||
+ const auto subkeyExpiration = uint_least32_t(key.subkey(1).expirationTime());
|
||||
|
||||
{
|
||||
// Create the job
|
||||
@@ -228,7 +228,7 @@ private Q_SLOTS:
|
||||
newExpirationDate.toSecsSinceEpoch() - 10,
|
||||
QDateTime::currentDateTime().addDays(3).toSecsSinceEpoch());
|
||||
{
|
||||
- const auto actualExpiration = key.subkey(0).expirationTime();
|
||||
+ const auto actualExpiration = uint_least32_t(key.subkey(0).expirationTime());
|
||||
QVERIFY2(actualExpiration >= expectedExpirationRange.first,
|
||||
("actual: " + std::to_string(actualExpiration) +
|
||||
"; expected: " + std::to_string(expectedExpirationRange.first)).c_str());
|
||||
@@ -237,7 +237,7 @@ private Q_SLOTS:
|
||||
"; expected: " + std::to_string(expectedExpirationRange.second)).c_str());
|
||||
}
|
||||
{
|
||||
- const auto actualExpiration = key.subkey(1).expirationTime();
|
||||
+ const auto actualExpiration = uint_least32_t(key.subkey(1).expirationTime());
|
||||
QCOMPARE(actualExpiration, subkeyExpiration); // unchanged
|
||||
}
|
||||
}
|
||||
@@ -291,7 +291,7 @@ private Q_SLOTS:
|
||||
newExpirationDate.toSecsSinceEpoch() - 10,
|
||||
QDateTime::currentDateTime().addDays(4).toSecsSinceEpoch());
|
||||
{
|
||||
- const auto actualExpiration = key.subkey(0).expirationTime();
|
||||
+ const auto actualExpiration = uint_least32_t(key.subkey(0).expirationTime());
|
||||
QVERIFY2(actualExpiration >= expectedExpirationRange.first,
|
||||
("actual: " + std::to_string(actualExpiration) +
|
||||
"; expected: " + std::to_string(expectedExpirationRange.first)).c_str());
|
||||
@@ -300,7 +300,7 @@ private Q_SLOTS:
|
||||
"; expected: " + std::to_string(expectedExpirationRange.second)).c_str());
|
||||
}
|
||||
{
|
||||
- const auto actualExpiration = key.subkey(1).expirationTime();
|
||||
+ const auto actualExpiration = uint_least32_t(key.subkey(1).expirationTime());
|
||||
QVERIFY2(actualExpiration >= expectedExpirationRange.first,
|
||||
("actual: " + std::to_string(actualExpiration) +
|
||||
"; expected: " + std::to_string(expectedExpirationRange.first)).c_str());
|
||||
@@ -359,7 +359,7 @@ private Q_SLOTS:
|
||||
newExpirationDate.toSecsSinceEpoch() - 10,
|
||||
QDateTime::currentDateTime().addDays(5).toSecsSinceEpoch());
|
||||
{
|
||||
- const auto actualExpiration = key.subkey(0).expirationTime();
|
||||
+ const auto actualExpiration = uint_least32_t(key.subkey(0).expirationTime());
|
||||
QVERIFY2(actualExpiration >= expectedExpirationRange.first,
|
||||
("actual: " + std::to_string(actualExpiration) +
|
||||
"; expected: " + std::to_string(expectedExpirationRange.first)).c_str());
|
||||
@@ -368,7 +368,7 @@ private Q_SLOTS:
|
||||
"; expected: " + std::to_string(expectedExpirationRange.second)).c_str());
|
||||
}
|
||||
{
|
||||
- const auto actualExpiration = key.subkey(1).expirationTime();
|
||||
+ const auto actualExpiration = uint_least32_t(key.subkey(1).expirationTime());
|
||||
QVERIFY2(actualExpiration >= expectedExpirationRange.first,
|
||||
("actual: " + std::to_string(actualExpiration) +
|
||||
"; expected: " + std::to_string(expectedExpirationRange.first)).c_str());
|
||||
--
|
||||
2.37.1
|
||||
|
75
0006-qt-tests-Make-test-pass-on-32-bit-systems.patch
Normal file
75
0006-qt-tests-Make-test-pass-on-32-bit-systems.patch
Normal file
@ -0,0 +1,75 @@
|
||||
From 2e7a61b898fccc1c20000b79dee83cd980901fa9 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Ingo=20Kl=C3=B6cker?= <dev@ingo-kloecker.de>
|
||||
Date: Thu, 18 Aug 2022 10:55:09 +0200
|
||||
Subject: [PATCH] qt,tests: Make test pass on 32-bit systems
|
||||
|
||||
* lang/qt/tests/t-addexistingsubkey.cpp
|
||||
(AddExistingSubkeyJobTest::testAddExistingSubkeyWithExpiration): Handle
|
||||
negative expiration date.
|
||||
--
|
||||
|
||||
On 32-bit systems the expiration date of the test key overflows. This
|
||||
will cause the AddExistingSubkeyJob to fail. We expect it to fail with
|
||||
an "invalid time" error.
|
||||
|
||||
GnuPG-bug-id: 6137
|
||||
---
|
||||
lang/qt/tests/t-addexistingsubkey.cpp | 42 +++++++++++++++------------
|
||||
1 file changed, 24 insertions(+), 18 deletions(-)
|
||||
|
||||
diff --git a/lang/qt/tests/t-addexistingsubkey.cpp b/lang/qt/tests/t-addexistingsubkey.cpp
|
||||
index 87eadf43..c0eee57b 100644
|
||||
--- a/lang/qt/tests/t-addexistingsubkey.cpp
|
||||
+++ b/lang/qt/tests/t-addexistingsubkey.cpp
|
||||
@@ -213,24 +213,30 @@ private Q_SLOTS:
|
||||
|
||||
const auto result = job->exec(key, sourceSubkey);
|
||||
|
||||
- QCOMPARE(result.code(), static_cast<int>(GPG_ERR_NO_ERROR));
|
||||
- key.update();
|
||||
- QCOMPARE(key.numSubkeys(), 3u);
|
||||
-
|
||||
- // allow 1 second different expiration because gpg calculates with
|
||||
- // expiration as difference to current time and takes current time
|
||||
- // several times
|
||||
- const auto allowedDeltaTSeconds = 1;
|
||||
- const auto expectedExpirationRange = std::make_pair(
|
||||
- uint_least32_t(sourceSubkey.expirationTime()) - allowedDeltaTSeconds,
|
||||
- uint_least32_t(sourceSubkey.expirationTime()) + allowedDeltaTSeconds);
|
||||
- const auto actualExpiration = uint_least32_t(key.subkey(2).expirationTime());
|
||||
- QVERIFY2(actualExpiration >= expectedExpirationRange.first,
|
||||
- ("actual: " + std::to_string(actualExpiration) +
|
||||
- "; expected: " + std::to_string(expectedExpirationRange.first)).c_str());
|
||||
- QVERIFY2(actualExpiration <= expectedExpirationRange.second,
|
||||
- ("actual: " + std::to_string(actualExpiration) +
|
||||
- "; expected: " + std::to_string(expectedExpirationRange.second)).c_str());
|
||||
+ if (sourceSubkey.expirationTime() > 0) {
|
||||
+ QCOMPARE(result.code(), static_cast<int>(GPG_ERR_NO_ERROR));
|
||||
+ key.update();
|
||||
+ QCOMPARE(key.numSubkeys(), 3u);
|
||||
+
|
||||
+ // allow 1 second different expiration because gpg calculates with
|
||||
+ // expiration as difference to current time and takes current time
|
||||
+ // several times
|
||||
+ const auto allowedDeltaTSeconds = 1;
|
||||
+ const auto expectedExpirationRange = std::make_pair(
|
||||
+ uint_least32_t(sourceSubkey.expirationTime()) - allowedDeltaTSeconds,
|
||||
+ uint_least32_t(sourceSubkey.expirationTime()) + allowedDeltaTSeconds);
|
||||
+ const auto actualExpiration = uint_least32_t(key.subkey(2).expirationTime());
|
||||
+ QVERIFY2(actualExpiration >= expectedExpirationRange.first,
|
||||
+ ("actual: " + std::to_string(actualExpiration) +
|
||||
+ "; expected: " + std::to_string(expectedExpirationRange.first)).c_str());
|
||||
+ QVERIFY2(actualExpiration <= expectedExpirationRange.second,
|
||||
+ ("actual: " + std::to_string(actualExpiration) +
|
||||
+ "; expected: " + std::to_string(expectedExpirationRange.second)).c_str());
|
||||
+ } else {
|
||||
+ // on 32-bit systems the expiration date of the test key overflows;
|
||||
+ // in this case we expect an appropriate error code
|
||||
+ QCOMPARE(result.code(), static_cast<int>(GPG_ERR_INV_TIME));
|
||||
+ }
|
||||
}
|
||||
|
||||
private:
|
||||
--
|
||||
2.37.1
|
||||
|
@ -0,0 +1,43 @@
|
||||
From 2fa5c80aeba4528b3bdf41ec5740e7db5d4b6d2b Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Ingo=20Kl=C3=B6cker?= <dev@ingo-kloecker.de>
|
||||
Date: Thu, 18 Aug 2022 10:43:19 +0200
|
||||
Subject: [PATCH] cpp: Fix handling of "no key" or "invalid time" situations
|
||||
|
||||
* lang/cpp/src/gpgaddexistingsubkeyeditinteractor.cpp
|
||||
(GpgAddExistingSubkeyEditInteractor::Private::nextState): Fix inverted
|
||||
logic of string comparisons.
|
||||
--
|
||||
|
||||
This fixes the problem that the interactor didn't return the proper
|
||||
error code if gpg didn't accept the key grip or the expiration date.
|
||||
|
||||
GnuPG-bug-id: 6137
|
||||
---
|
||||
lang/cpp/src/gpgaddexistingsubkeyeditinteractor.cpp | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/lang/cpp/src/gpgaddexistingsubkeyeditinteractor.cpp b/lang/cpp/src/gpgaddexistingsubkeyeditinteractor.cpp
|
||||
index 547e613d..8eec7460 100644
|
||||
--- a/lang/cpp/src/gpgaddexistingsubkeyeditinteractor.cpp
|
||||
+++ b/lang/cpp/src/gpgaddexistingsubkeyeditinteractor.cpp
|
||||
@@ -136,7 +136,7 @@ unsigned int GpgAddExistingSubkeyEditInteractor::Private::nextState(unsigned int
|
||||
strcmp(args, "keygen.flags") == 0) {
|
||||
return FLAGS;
|
||||
} else if (status == GPGME_STATUS_GET_LINE &&
|
||||
- strcmp(args, "keygen.keygrip")) {
|
||||
+ strcmp(args, "keygen.keygrip") == 0) {
|
||||
err = NO_KEY_ERROR;
|
||||
return ERROR;
|
||||
}
|
||||
@@ -157,7 +157,7 @@ unsigned int GpgAddExistingSubkeyEditInteractor::Private::nextState(unsigned int
|
||||
strcmp(args, "keyedit.prompt") == 0) {
|
||||
return QUIT;
|
||||
} else if (status == GPGME_STATUS_GET_LINE &&
|
||||
- strcmp(args, "keygen.valid")) {
|
||||
+ strcmp(args, "keygen.valid") == 0) {
|
||||
err = INV_TIME_ERROR;
|
||||
return ERROR;
|
||||
}
|
||||
--
|
||||
2.37.1
|
||||
|
37
gpgme.spec
37
gpgme.spec
@ -1,15 +1,16 @@
|
||||
%bcond_with check
|
||||
%bcond check 1
|
||||
%bcond qt 1
|
||||
|
||||
%global gnupg2_min_ver 2.2.24
|
||||
%global libgpg_error_min_ver 1.36
|
||||
|
||||
Name: gpgme
|
||||
Summary: GnuPG Made Easy - high level crypto API
|
||||
Version: 1.17.0
|
||||
Release: %autorelease -b3
|
||||
Version: 1.17.1
|
||||
Release: %autorelease
|
||||
|
||||
# MIT: src/cJSON.{c,h} (used by gpgme-json)
|
||||
License: LGPLv2+ and MIT
|
||||
License: LGPL-2.1-or-later AND MIT
|
||||
URL: https://gnupg.org/related_software/gpgme/
|
||||
Source0: https://gnupg.org/ftp/gcrypt/gpgme/gpgme-%{version}.tar.bz2
|
||||
Source2: gpgme-multilib.h
|
||||
@ -22,6 +23,17 @@ Patch1002: gpgme-1.3.2-largefile.patch
|
||||
# Let's fix stupid AX_PYTHON_DEVEL
|
||||
Patch1003: 0001-fix-stupid-ax_python_devel.patch
|
||||
|
||||
## upstream patches dealing with date and time overflow on 32-bit machines
|
||||
# Before gpgme 1.18.0
|
||||
Patch2001: 0001-qt-Prevent-u32-overflow-when-calculating-expiration.patch
|
||||
Patch2002: 0002-qt-tests-Allow-1-day-offset-for-expiration-date.patch
|
||||
# After gpgme 1.18.0
|
||||
Patch2003: 0003-qt-Make-sure-expiration-time-is-interpreted-as-unsigned.patch
|
||||
Patch2004: 0004-qt-tests-Log-the-actual-error-code-if-the-assertion-fails.patch
|
||||
Patch2005: 0005-qt-tests-Make-sure-expiration-time-is-interpreted-as-unsigned.patch
|
||||
Patch2006: 0006-qt-tests-Make-test-pass-on-32-bit-systems.patch
|
||||
Patch2007: 0007-cpp-Fix-handling-of-no-key-or-invalid-time-situation.patch
|
||||
|
||||
#BuildRequires: autoconf
|
||||
#BuildRequires: automake
|
||||
BuildRequires: make
|
||||
@ -84,6 +96,7 @@ BuildRequires: cmake
|
||||
%description -n %{name}pp-devel
|
||||
%{summary}
|
||||
|
||||
%if %{with qt}
|
||||
%package -n q%{name}
|
||||
Summary: Qt API bindings/wrapper for GPGME
|
||||
Requires: %{name}pp%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}
|
||||
@ -104,11 +117,13 @@ BuildRequires: cmake
|
||||
|
||||
%description -n q%{name}-devel
|
||||
%{summary}.
|
||||
%endif
|
||||
|
||||
%package -n python3-gpg
|
||||
Summary: %{name} bindings for Python 3
|
||||
%{?python_provide:%python_provide python3-gpg}
|
||||
BuildRequires: python3-devel
|
||||
# Needed since Python 3.12+ drops distutils
|
||||
BuildRequires: python3-setuptools
|
||||
Requires: %{name}%{?_isa} = %{?epoch:%{epoch}:}%{version}-%{release}
|
||||
Obsoletes: platform-python-gpg < %{version}-%{release}
|
||||
|
||||
@ -140,7 +155,7 @@ export CXXFLAGS='%{optflags} -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'
|
||||
export CFLAGS="$(echo ${CFLAGS} | tr '\n\\' ' ')"
|
||||
export CXXFLAGS="$(echo ${CXXFLAGS} | tr '\n\\' ' ')"
|
||||
|
||||
%configure --disable-static --disable-silent-rules --enable-languages=cpp,qt,python
|
||||
%configure --disable-static --disable-silent-rules --enable-languages=cpp,%{?with_qt:qt,}python
|
||||
%make_build
|
||||
|
||||
%install
|
||||
@ -165,7 +180,9 @@ install -m644 -p -D %{SOURCE2} %{buildroot}%{_includedir}/gpgme.h
|
||||
chrpath -d %{buildroot}%{_bindir}/%{name}-tool
|
||||
chrpath -d %{buildroot}%{_bindir}/%{name}-json
|
||||
chrpath -d %{buildroot}%{_libdir}/lib%{name}pp.so*
|
||||
%if %{with qt}
|
||||
chrpath -d %{buildroot}%{_libdir}/libq%{name}.so*
|
||||
%endif
|
||||
|
||||
# autofoo installs useless stuff for uninstall
|
||||
rm -vf %{buildroot}%{python2_sitelib}/gpg/install_files.txt
|
||||
@ -204,20 +221,26 @@ make check
|
||||
%{_libdir}/lib%{name}pp.so
|
||||
%{_libdir}/cmake/Gpgmepp/
|
||||
|
||||
%if %{with qt}
|
||||
%files -n q%{name}
|
||||
%doc lang/qt/README
|
||||
%{_libdir}/libq%{name}.so.7*
|
||||
%{_libdir}/libq%{name}.so.15*
|
||||
|
||||
%files -n q%{name}-devel
|
||||
%{_includedir}/q%{name}/
|
||||
%{_includedir}/QGpgME/
|
||||
%{_libdir}/libq%{name}.so
|
||||
%{_libdir}/cmake/QGpgme/
|
||||
%endif
|
||||
|
||||
%files -n python3-gpg
|
||||
%doc lang/python/README
|
||||
%if 0%{?python3_version_nodots} < 311
|
||||
%{python3_sitearch}/gpg-*.egg-info
|
||||
%{python3_sitearch}/gpg/
|
||||
%else
|
||||
%{python3_sitearch}/gpg-*.egg/
|
||||
%endif
|
||||
|
||||
%changelog
|
||||
%autochangelog
|
||||
|
2
sources
2
sources
@ -1 +1 @@
|
||||
SHA512 (gpgme-1.17.0.tar.bz2) = 7ab379c6be2031ff24334a636e596f01c9d491627b695cc6cce7a361e78c6054b7891c521f07becea3c5da10c58043c1acffbba6058bbbfaa515241d75dd6c46
|
||||
SHA512 (gpgme-1.17.1.tar.bz2) = e6399c3de1e430e38f2692bf5ec0c02ecb36ea3dbb56ff29dc3a438a5be4900a77a0559dc5b673dc1ffbff5e7f589e548e19176b2644fe8f63e00c6b9181b920
|
||||
|
Loading…
Reference in New Issue
Block a user