InfoFlowAnalysis: change set_perm_map() to only take map objects.

Remove this handling from the analysis code.  It now expects a permission
map to be passed in, and won't handle a string.
This commit is contained in:
Chris PeBenito 2015-03-26 11:05:19 -04:00
parent c224995eeb
commit cb18f4c21f
2 changed files with 4 additions and 11 deletions

View File

@ -78,8 +78,8 @@ else:
try:
p = setools.SELinuxPolicy(args.policy)
g = setools.infoflow.InfoFlowAnalysis(
p, args.map, minweight=args.min_weight, exclude=args.exclude)
m = setools.permmap.PermissionMap(args.map)
g = setools.infoflow.InfoFlowAnalysis(p, m, minweight=args.min_weight, exclude=args.exclude)
if args.shortest_path or args.all_paths:
try:

View File

@ -73,19 +73,12 @@ class InfoFlowAnalysis(object):
Set the permission map used for the information flow analysis.
Parameter:
perm_map The permission map or path to the permission map file.
perm_map The permission map.
Exceptions:
TypeError The map is not a file path or permission map object.
"""
if not isinstance(perm_map, (str, permmap.PermissionMap)):
raise TypeError(
"Permission map must be an object or a path to a file.")
if isinstance(perm_map, str):
self.perm_map = permmap.PermissionMap(perm_map)
else:
self.perm_map = perm_map
self.perm_map = perm_map
self.rebuildgraph = True
self.rebuildsubgraph = True