mirror of
https://bitbucket.org/smil3y/kde-workspace.git
synced 2025-02-24 10:52:51 +00:00
kfirewall: fix inbound traffic rules generation
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
328f3e0943
commit
9646435134
1 changed files with 7 additions and 2 deletions
|
@ -35,9 +35,11 @@ static QByteArray rulesForParameters(const QVariantMap ¶meters, const bool a
|
||||||
const QByteArray actionvalue = rulesettingsmap.value(QString::fromLatin1("action")).toByteArray();
|
const QByteArray actionvalue = rulesettingsmap.value(QString::fromLatin1("action")).toByteArray();
|
||||||
// qDebug() << Q_FUNC_INFO << trafficvalue << addressvalue << portvalue << actionvalue;
|
// qDebug() << Q_FUNC_INFO << trafficvalue << addressvalue << portvalue << actionvalue;
|
||||||
|
|
||||||
|
bool isinbound = false;
|
||||||
QByteArray iptablestraffic = trafficvalue.toUpper();
|
QByteArray iptablestraffic = trafficvalue.toUpper();
|
||||||
if (iptablestraffic == "INBOUND") {
|
if (iptablestraffic == "INBOUND") {
|
||||||
iptablestraffic = "INPUT";
|
iptablestraffic = "INPUT";
|
||||||
|
isinbound = true;
|
||||||
} else {
|
} else {
|
||||||
iptablestraffic = "OUTPUT";
|
iptablestraffic = "OUTPUT";
|
||||||
}
|
}
|
||||||
|
@ -56,8 +58,11 @@ static QByteArray rulesForParameters(const QVariantMap ¶meters, const bool a
|
||||||
iptablesruledata.append(" -p tcp --dport ");
|
iptablesruledata.append(" -p tcp --dport ");
|
||||||
iptablesruledata.append(QByteArray::number(portvalue));
|
iptablesruledata.append(QByteArray::number(portvalue));
|
||||||
}
|
}
|
||||||
iptablesruledata.append(" -m owner --uid-owner ");
|
if (!isinbound) {
|
||||||
iptablesruledata.append(uservalue);
|
// NOTE: only output can be user-bound
|
||||||
|
iptablesruledata.append(" -m owner --uid-owner ");
|
||||||
|
iptablesruledata.append(uservalue);
|
||||||
|
}
|
||||||
iptablesruledata.append(" -j ");
|
iptablesruledata.append(" -j ");
|
||||||
iptablesruledata.append(actionvalue.toUpper());
|
iptablesruledata.append(actionvalue.toUpper());
|
||||||
iptablesruledata.append("\n");
|
iptablesruledata.append("\n");
|
||||||
|
|
Loading…
Add table
Reference in a new issue