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
Plasma
Plasma Firewall
Commits
8a3fc510
Commit
8a3fc510
authored
Nov 27, 2020
by
Tomaz Canabrava
Browse files
Fix UFW backend with the new Protocol API
parent
ab31a204
Changes
5
Hide whitespace changes
Inline
Side-by-side
kcm/core/firewallclient.cpp
View file @
8a3fc510
...
...
@@ -49,6 +49,17 @@ bool FirewallClient::isTcpAndUdp(int protocolIdx)
return
m_currentBackend
->
isTcpAndUdp
(
protocolIdx
);
}
int
FirewallClient
::
indexOfProtocol
(
const
QString
&
protocol
)
{
const
QStringList
protocolList
=
m_currentBackend
->
knownProtocols
();
for
(
int
i
=
0
;
i
<
m_currentBackend
->
knownProtocols
().
size
();
i
++
)
{
if
(
protocolList
[
i
].
toLower
()
==
protocol
.
toLower
())
{
return
i
;
}
}
return
-
1
;
}
QStringList
FirewallClient
::
knownInterfaces
()
{
QStringList
interface_names
({
i18n
(
"Any"
)});
...
...
kcm/core/firewallclient.h
View file @
8a3fc510
...
...
@@ -59,6 +59,7 @@ public:
Q_INVOKABLE
static
QStringList
knownProtocols
();
Q_INVOKABLE
static
QStringList
knownInterfaces
();
Q_INVOKABLE
static
bool
isTcpAndUdp
(
int
protocolIdx
);
static
int
indexOfProtocol
(
const
QString
&
protocol
);
Q_INVOKABLE
void
refresh
();
...
...
kcm/core/profile.cpp
View file @
8a3fc510
...
...
@@ -149,7 +149,8 @@ void Profile::load(QIODevice *device)
const
auto
action
=
Types
::
toPolicy
(
attr
.
value
(
QLatin1String
(
"action"
)).
toString
());
// TODO: Check that this is ok.
const
auto
protocol
=
FirewallClient
::
knownProtocols
().
indexOf
(
attr
.
value
(
QLatin1String
(
"protocol"
)));
const
auto
protocol
=
FirewallClient
::
indexOfProtocol
(
attr
.
value
(
QLatin1String
(
"protocol"
)).
toString
());
qDebug
()
<<
"Reading protocol from profile:"
<<
protocol
<<
attr
.
value
(
QLatin1String
(
"protocol"
));
const
auto
logType
=
Types
::
toLogging
(
attr
.
value
(
QLatin1String
(
"logtype"
)).
toString
());
...
...
kcm/core/rule.cpp
View file @
8a3fc510
...
...
@@ -182,6 +182,7 @@ Rule::Rule()
QString
Rule
::
fromStr
()
const
{
qDebug
()
<<
"Before Crashing"
<<
m_protocol
;
return
modify
(
m_sourceAddress
,
m_sourcePort
,
m_sourceApplication
,
m_interfaceIn
,
m_protocol
);
}
...
...
kcm/core/rule.h
View file @
8a3fc510
...
...
@@ -10,6 +10,7 @@
#include
<QObject>
#include
<QString>
#include
<QDebug>
#include
"types.h"
...
...
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