| Server IP : 162.144.4.212 / Your IP : 216.73.216.108 Web Server : Apache System : Linux gator2125.hostgator.com 5.14.0-162.23.1.9991722448259.nf.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jul 31 18:11:45 UTC 2024 x86_64 User : cozeellc ( 2980) PHP Version : 8.3.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /usr/lib64/python3.9/site-packages/setools/diff/ |
Upload File : |
# Copyright 2016, Tresys Technology, LLC
#
# SPDX-License-Identifier: LGPL-2.1-only
#
from .descriptors import DiffResultDescriptor
from .difference import Difference, SymbolWrapper
class PolCapsDifference(Difference):
"""Determine the difference in polcaps between two policies."""
added_polcaps = DiffResultDescriptor("diff_polcaps")
removed_polcaps = DiffResultDescriptor("diff_polcaps")
def diff_polcaps(self) -> None:
"""Generate the difference in polcaps between the policies."""
self.log.info("Generating policy cap differences from {0.left_policy} to {0.right_policy}".
format(self))
self.added_polcaps, self.removed_polcaps, _ = self._set_diff(
(SymbolWrapper(n) for n in self.left_policy.polcaps()),
(SymbolWrapper(n) for n in self.right_policy.polcaps()))
#
# Internal functions
#
def _reset_diff(self) -> None:
"""Reset diff results on policy changes."""
self.log.debug("Resetting policy capability differences")
self.added_polcaps = None
self.removed_polcaps = None