Commit e9bb7c41 authored by Ingo Klöcker's avatar Ingo Klöcker
Browse files

Fix normalization of addresses of encryption key overrides

GnuPG-bug-id: 5283
parent 442c1236
......@@ -132,12 +132,12 @@ private Q_SLOTS:
testKey("sender-mixed@example.net", CMS).primaryFingerprint());
}
void test_override_sender_openpgp()
void test_overrides_openpgp()
{
const QString override = testKey("prefer-openpgp@example.net", OpenPGP).primaryFingerprint();
KeyResolverCore resolver(/*encrypt=*/ true, /*sign=*/ true);
resolver.setSender(QStringLiteral("sender-mixed@example.net"));
resolver.setOverrideKeys({{OpenPGP, {{QStringLiteral("sender-mixed@example.net"), {override}}}}});
resolver.setOverrideKeys({{OpenPGP, {{QStringLiteral("Needs to be normalized <sender-mixed@example.net>"), {override}}}}});
const bool success = resolver.resolve();
......@@ -147,13 +147,13 @@ private Q_SLOTS:
QCOMPARE(resolver.encryptionKeys().value(OpenPGP).value("sender-mixed@example.net")[0].primaryFingerprint(), override);
}
void test_override_sender_smime()
void test_overrides_smime()
{
const QString override = testKey("prefer-smime@example.net", CMS).primaryFingerprint();
KeyResolverCore resolver(/*encrypt=*/ true, /*sign=*/ true);
resolver.setPreferredProtocol(CMS);
resolver.setSender(QStringLiteral("sender-mixed@example.net"));
resolver.setOverrideKeys({{CMS, {{QStringLiteral("sender-mixed@example.net"), {override}}}}});
resolver.setOverrideKeys({{CMS, {{QStringLiteral("Needs to be normalized <sender-mixed@example.net>"), {override}}}}});
const bool success = resolver.resolve();
......
......@@ -190,7 +190,7 @@ void KeyResolverCore::Private::setOverrideKeys(const QMap<Protocol, QMap<QString
const auto normalized = QString::fromUtf8(
UserID::addrSpecFromString (addr.toUtf8().constData()).c_str());
const auto fingerprints = overrides[fmt][addr];
normalizedOverrides.insert(addr, fingerprints);
normalizedOverrides.insert(normalized, fingerprints);
}
mOverrides.insert(fmt, normalizedOverrides);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment