pamd: fix idempotence issue when removing rules (#54105)

pull/54685/head
Łukasz Szczęsny 6 years ago committed by Sam Doran
parent f405d97e1e
commit bcdd1dc951

@ -0,0 +1,2 @@
bugfixes:
- pamd - fix idempotence issue when removing rules

@ -482,7 +482,7 @@ class PamdService(object):
else:
self._head = current_line.next
current_line.next.prev = None
changed += 1
changed += 1
current_line = current_line.next
return changed

@ -349,5 +349,7 @@ session required pam_unix.so"""
def test_remove_rule(self):
self.assertTrue(self.pamd.remove('account', 'required', 'pam_unix.so'))
# Second run should not change anything
self.assertFalse(self.pamd.remove('account', 'required', 'pam_unix.so'))
test_rule = PamdRule('account', 'required', 'pam_unix.so')
self.assertNotIn(str(test_rule), str(self.pamd))

Loading…
Cancel
Save