mirror of
https://bitbucket.org/smil3y/kde-workspace.git
synced 2025-02-24 02:42:50 +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();
|
||||
// qDebug() << Q_FUNC_INFO << trafficvalue << addressvalue << portvalue << actionvalue;
|
||||
|
||||
bool isinbound = false;
|
||||
QByteArray iptablestraffic = trafficvalue.toUpper();
|
||||
if (iptablestraffic == "INBOUND") {
|
||||
iptablestraffic = "INPUT";
|
||||
isinbound = true;
|
||||
} else {
|
||||
iptablestraffic = "OUTPUT";
|
||||
}
|
||||
|
@ -56,8 +58,11 @@ static QByteArray rulesForParameters(const QVariantMap ¶meters, const bool a
|
|||
iptablesruledata.append(" -p tcp --dport ");
|
||||
iptablesruledata.append(QByteArray::number(portvalue));
|
||||
}
|
||||
iptablesruledata.append(" -m owner --uid-owner ");
|
||||
iptablesruledata.append(uservalue);
|
||||
if (!isinbound) {
|
||||
// NOTE: only output can be user-bound
|
||||
iptablesruledata.append(" -m owner --uid-owner ");
|
||||
iptablesruledata.append(uservalue);
|
||||
}
|
||||
iptablesruledata.append(" -j ");
|
||||
iptablesruledata.append(actionvalue.toUpper());
|
||||
iptablesruledata.append("\n");
|
||||
|
|
Loading…
Add table
Reference in a new issue