mirror of
https://github.com/SELinuxProject/setools
synced 2025-04-17 04:35:28 +00:00
sesearch: Fix static type checking issues.
Signed-off-by: Chris PeBenito <pebenito@ieee.org>
This commit is contained in:
parent
463f6741bb
commit
1830ca6848
41
sesearch
41
sesearch
@ -144,7 +144,7 @@ try:
|
|||||||
p = setools.SELinuxPolicy(args.policy)
|
p = setools.SELinuxPolicy(args.policy)
|
||||||
|
|
||||||
if args.tertypes:
|
if args.tertypes:
|
||||||
q = setools.TERuleQuery(p,
|
terq = setools.TERuleQuery(p,
|
||||||
ruletype=args.tertypes,
|
ruletype=args.tertypes,
|
||||||
source=args.source,
|
source=args.source,
|
||||||
source_indirect=args.source_indirect,
|
source_indirect=args.source_indirect,
|
||||||
@ -164,12 +164,12 @@ try:
|
|||||||
# with an empty string in it (split on empty string)
|
# with an empty string in it (split on empty string)
|
||||||
if args.tclass:
|
if args.tclass:
|
||||||
if args.tclass_regex:
|
if args.tclass_regex:
|
||||||
q.tclass = args.tclass
|
terq.tclass = args.tclass
|
||||||
else:
|
else:
|
||||||
q.tclass = args.tclass.split(",")
|
terq.tclass = args.tclass.split(",")
|
||||||
|
|
||||||
if args.perms:
|
if args.perms:
|
||||||
q.perms = args.perms.split(",")
|
terq.perms = args.perms.split(",")
|
||||||
|
|
||||||
if args.xperms:
|
if args.xperms:
|
||||||
xperms = []
|
xperms = []
|
||||||
@ -183,24 +183,25 @@ try:
|
|||||||
parser.error("Enter an extended permission or extended permission range, e.g. "
|
parser.error("Enter an extended permission or extended permission range, e.g. "
|
||||||
"0x5411 or 0x8800-0x88ff.")
|
"0x5411 or 0x8800-0x88ff.")
|
||||||
|
|
||||||
q.xperms = xperms
|
# https://github.com/python/mypy/issues/220
|
||||||
|
terq.xperms = setools.xperm_str_to_tuple_ranges(xperms) # type: ignore
|
||||||
|
|
||||||
if args.boolean:
|
if args.boolean:
|
||||||
if args.boolean_regex:
|
if args.boolean_regex:
|
||||||
q.boolean = args.boolean
|
terq.boolean = args.boolean
|
||||||
else:
|
else:
|
||||||
if args.policy:
|
if args.policy:
|
||||||
q.boolean = args.boolean.split(",")
|
terq.boolean = args.boolean.split(",")
|
||||||
else:
|
else:
|
||||||
# try to find substitutions for old boolean names
|
# try to find substitutions for old boolean names
|
||||||
q.boolean = map(setools.policyrep.lookup_boolean_name_sub,
|
terq.boolean = map(setools.policyrep.lookup_boolean_name_sub,
|
||||||
args.boolean.split(","))
|
args.boolean.split(","))
|
||||||
|
|
||||||
for r in sorted(q.results()):
|
for te_result in sorted(terq.results()):
|
||||||
print(r)
|
print(te_result)
|
||||||
|
|
||||||
if args.rbacrtypes:
|
if args.rbacrtypes:
|
||||||
q = setools.RBACRuleQuery(p,
|
rbacrq = setools.RBACRuleQuery(p,
|
||||||
ruletype=args.rbacrtypes,
|
ruletype=args.rbacrtypes,
|
||||||
source=args.source,
|
source=args.source,
|
||||||
source_indirect=args.source_indirect,
|
source_indirect=args.source_indirect,
|
||||||
@ -216,15 +217,15 @@ try:
|
|||||||
# with an empty string in it (split on empty string)
|
# with an empty string in it (split on empty string)
|
||||||
if args.tclass:
|
if args.tclass:
|
||||||
if args.tclass_regex:
|
if args.tclass_regex:
|
||||||
q.tclass = args.tclass
|
rbacrq.tclass = args.tclass
|
||||||
else:
|
else:
|
||||||
q.tclass = args.tclass.split(",")
|
rbacrq.tclass = args.tclass.split(",")
|
||||||
|
|
||||||
for r in sorted(q.results()):
|
for rbac_result in sorted(rbacrq.results()):
|
||||||
print(r)
|
print(rbac_result)
|
||||||
|
|
||||||
if args.mlsrtypes:
|
if args.mlsrtypes:
|
||||||
q = setools.MLSRuleQuery(p,
|
mlsrq = setools.MLSRuleQuery(p,
|
||||||
ruletype=args.mlsrtypes,
|
ruletype=args.mlsrtypes,
|
||||||
source=args.source,
|
source=args.source,
|
||||||
source_indirect=args.source_indirect,
|
source_indirect=args.source_indirect,
|
||||||
@ -239,12 +240,12 @@ try:
|
|||||||
# with an empty string in it (split on empty string)
|
# with an empty string in it (split on empty string)
|
||||||
if args.tclass:
|
if args.tclass:
|
||||||
if args.tclass_regex:
|
if args.tclass_regex:
|
||||||
q.tclass = args.tclass
|
mlsrq.tclass = args.tclass
|
||||||
else:
|
else:
|
||||||
q.tclass = args.tclass.split(",")
|
mlsrq.tclass = args.tclass.split(",")
|
||||||
|
|
||||||
for r in sorted(q.results()):
|
for mls_result in sorted(mlsrq.results()):
|
||||||
print(r)
|
print(mls_result)
|
||||||
|
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
if args.debug:
|
if args.debug:
|
||||||
|
Loading…
Reference in New Issue
Block a user