From b91b7cbeeb62cb2ba316918acd0e60a53ed676aa Mon Sep 17 00:00:00 2001
From: Eric Garver <eric@garver.life>
Date: Fri, 26 Jul 2019 13:32:44 -0400
Subject: [PATCH 20/26] fix: direct: removeRules() was mistakenly removing all
rules
Only remove the rules that match the specified criteria (ipv, table,
chain).
Fixes: #385
Fixes: rhbz 1723610
(cherry picked from commit 174005b15059db054b2f8dcf3b35c23fcbaf44ec)
---
src/firewall/server/config.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/firewall/server/config.py b/src/firewall/server/config.py
index e03c4984e058..b1b839da82ea 100644
--- a/src/firewall/server/config.py
+++ b/src/firewall/server/config.py
@@ -1422,7 +1422,9 @@ class FirewallDConfig(slip.dbus.service.Object):
(ipv, table, chain, ))
self.accessCheck(sender)
settings = list(self.getSettings())
- settings[1] = []
+ for rule in settings[1]:
+ if (ipv, table, chain) == (rule[0], rule[1], rule[2]):
+ settings[1].remove(rule)
self.update(tuple(settings))
@dbus_service_method(config.dbus.DBUS_INTERFACE_CONFIG_DIRECT,
--
2.20.1