Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
Kleopatra
Commits
20653bdc
Commit
20653bdc
authored
Nov 25, 2021
by
Ingo Klöcker
Browse files
Restrict key lookup to OpenPGP if CMS is disabled
GnuPG-bug-id: 5688
parent
27b04b3f
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/commands/lookupcertificatescommand.cpp
View file @
20653bdc
...
...
@@ -15,6 +15,8 @@
#include
"detailscommand.h"
#include
<settings.h>
#include
"view/tabwidget.h"
#include
<Libkleo/Compat>
...
...
@@ -106,6 +108,7 @@ private:
}
private:
GpgME
::
Protocol
protocol
=
GpgME
::
UnknownProtocol
;
QString
query
;
bool
autoStartLookup
=
false
;
QPointer
<
LookupCertificatesDialog
>
dialog
;
...
...
@@ -137,7 +140,9 @@ LookupCertificatesCommand::Private::Private(LookupCertificatesCommand *qq, KeyLi
:
ImportCertificatesCommand
::
Private
(
qq
,
c
),
dialog
()
{
if
(
!
Settings
{}.
cmsEnabled
())
{
protocol
=
GpgME
::
OpenPGP
;
}
}
LookupCertificatesCommand
::
Private
::~
Private
()
...
...
@@ -238,14 +243,18 @@ void LookupCertificatesCommand::Private::slotSearchTextChanged(const QString &st
query
=
str
;
startKeyListJob
(
CMS
,
str
);
if
(
protocol
!=
GpgME
::
OpenPGP
)
{
startKeyListJob
(
CMS
,
str
);
}
const
QRegExp
rx
(
QLatin1String
(
"(?:0x|0X)?[0-9a-fA-F]{6,}"
));
if
(
rx
.
exactMatch
(
query
)
&&
!
str
.
startsWith
(
QLatin1String
(
"0x"
),
Qt
::
CaseInsensitive
))
{
qCDebug
(
KLEOPATRA_LOG
)
<<
"Adding 0x prefix to query"
;
startKeyListJob
(
OpenPGP
,
QStringLiteral
(
"0x"
)
+
str
);
}
else
{
startKeyListJob
(
OpenPGP
,
str
);
if
(
protocol
!=
GpgME
::
CMS
)
{
const
QRegExp
rx
(
QLatin1String
(
"(?:0x|0X)?[0-9a-fA-F]{6,}"
));
if
(
rx
.
exactMatch
(
query
)
&&
!
str
.
startsWith
(
QLatin1String
(
"0x"
),
Qt
::
CaseInsensitive
))
{
qCDebug
(
KLEOPATRA_LOG
)
<<
"Adding 0x prefix to query"
;
startKeyListJob
(
OpenPGP
,
QStringLiteral
(
"0x"
)
+
str
);
}
else
{
startKeyListJob
(
OpenPGP
,
str
);
}
}
}
...
...
@@ -384,7 +393,9 @@ void LookupCertificatesCommand::Private::showResult(QWidget *parent, const KeyLi
bool
LookupCertificatesCommand
::
Private
::
checkConfig
()
const
{
const
bool
ok
=
haveKeyserverConfigured
()
||
haveX509DirectoryServerConfigured
();
const
bool
haveOrDontNeedOpenPGPServer
=
haveKeyserverConfigured
()
||
(
protocol
==
GpgME
::
CMS
);
const
bool
haveOrDontNeedCMSServer
=
haveX509DirectoryServerConfigured
()
||
(
protocol
==
GpgME
::
OpenPGP
);
const
bool
ok
=
haveOrDontNeedOpenPGPServer
||
haveOrDontNeedCMSServer
;
if
(
!
ok
)
information
(
xi18nc
(
"@info"
,
"<para>You do not have any directory servers configured.</para>"
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment