diff --git a/setools/policyrep/terule.py b/setools/policyrep/terule.py index f1e39c3..fd5b1e1 100644 --- a/setools/policyrep/terule.py +++ b/setools/policyrep/terule.py @@ -182,9 +182,9 @@ class ioctlSet(set): for _, i in itertools.groupby(perms, key=lambda k, c=itertools.count(): k - next(c)): group = list(i) if len(group) > 1: - shortlist.append("0x{0:04x}-0x{1:04x}".format(group[0], group[-1])) + shortlist.append("{0:#06x}-{1:#06x}".format(group[0], group[-1])) else: - shortlist.append("0x{0:04x}".format(group[0])) + shortlist.append("{0:#06x}".format(group[0])) if not spec: return " ".join(shortlist) diff --git a/setools/terulequery.py b/setools/terulequery.py index 0af6b70..a2d59ae 100644 --- a/setools/terulequery.py +++ b/setools/terulequery.py @@ -107,14 +107,13 @@ class TERuleQuery(mixins.MatchObjClass, mixins.MatchPermission, query.PolicyQuer for low, high in value: if not (0 <= low <= 0xffff): - raise ValueError("{0:04x} is not a valid ioctl.".format(low)) + raise ValueError("{0:#07x} is not a valid ioctl.".format(low)) if not (0 <= high <= 0xffff): - raise ValueError("{0:04x} is not a valid ioctl.".format(high)) + raise ValueError("{0:#07x} is not a valid ioctl.".format(high)) if high < low: - raise ValueError("0x{0:04x}-0x{1:04x} is not a valid ioctl range.". - format(low, high)) + high, low = low, high pending_xperms.update(i for i in range(low, high+1))