selinux/policycoreutils/sepolicy
Sven Vermeulen 622ebe0994 Fix KeyError when using sepolicy transition
When calling "sepolicy transition", a KeyError exception occurred:

~# sepolicy transition -s sysadm_t -t portage_t
Traceback (most recent call last):
  File "/usr/bin/sepolicy-2.7", line 465, in <module>
    args.func(args)
  File "/usr/bin/sepolicy-2.7", line 309, in transition
    mytrans.output()
  File "/usr/lib64/python2.7/site-packages/sepolicy/transition.py", line 76, in output
    print self.out(self.source)
  File "/usr/lib64/python2.7/site-packages/sepolicy/transition.py", line 72, in out
    buf+= self.out(x, seen, "%s%s ... " % (header, name))
  File "/usr/lib64/python2.7/site-packages/sepolicy/transition.py", line 67, in out
    for t in self.sdict[name]["map"]:
KeyError: 'map'

By updating the code to first check if the "map" key is known to the dictionary
(and only then executing the mentioned code) this error is no longer prevalent:

~# sepolicy transition -s sysadm_t -t portage_t
sysadm_t @ portage_exec_t --> portage_t
sysadm_t ... dhcpc_t ... initrc_t ... puppet_t @ portage_exec_t --> portage_t
sysadm_t ... dhcpc_t ... initrc_t ... puppet_t ... portage_fetch_t @ portage_exec_t --> portage_t
sysadm_t ... dhcpc_t ... initrc_t ... crond_t @ portage_exec_t --> portage_t
sysadm_t ... dhcpc_t ... initrc_t ... crond_t ... system_cronjob_t @ portage_exec_t --> portage_t

Signed-off-by: Sven Vermeulen <sven.vermeulen@siphos.be>
2013-10-16 15:22:40 -04:00
..
sepolicy Fix KeyError when using sepolicy transition 2013-10-16 15:22:40 -04:00
.gitignore policycoreutils: sepolicy: new command to unite small utilities 2013-02-05 20:14:28 -05:00
common.h policycoreutils: sepolicy: new command to unite small utilities 2013-02-05 20:14:28 -05:00
info.c policycoreutils: sepolicy: new command to unite small utilities 2013-02-05 20:14:28 -05:00
Makefile policycoreutils: Do not include LDFLAGS in CFLAGS when building sepolicy 2013-10-16 15:13:07 -04:00
policy.c policycoreutils: init_policy() takes no arguments 2013-10-16 15:12:46 -04:00
policy.h policycoreutils: sepolicy: new command to unite small utilities 2013-02-05 20:14:28 -05:00
search.c policycoreutils: sepolicy: new command to unite small utilities 2013-02-05 20:14:28 -05:00
sepolicy-bash-completion.sh policycoreutils: sepolicy: new command to unite small utilities 2013-02-05 20:14:28 -05:00
sepolicy-booleans.8 policycoreutils: sepolicy: new command to unite small utilities 2013-02-05 20:14:28 -05:00
sepolicy-communicate.8 policycoreutils: sepolicy: new command to unite small utilities 2013-02-05 20:14:28 -05:00
sepolicy-generate.8 policycoreutils: sepolicy: new command to unite small utilities 2013-02-05 20:14:28 -05:00
sepolicy-interface.8 policycoreutils: sepolicy: new command to unite small utilities 2013-02-05 20:14:28 -05:00
sepolicy-manpage.8 policycoreutils: sepolicy: new command to unite small utilities 2013-02-05 20:14:28 -05:00
sepolicy-network.8 policycoreutils: sepolicy: new command to unite small utilities 2013-02-05 20:14:28 -05:00
sepolicy-transition.8 policycoreutils: sepolicy: new command to unite small utilities 2013-02-05 20:14:28 -05:00
sepolicy.8 policycoreutils: sepolicy: new command to unite small utilities 2013-02-05 20:14:28 -05:00
sepolicy.py policycoreutils: sepolicy: new command to unite small utilities 2013-02-05 20:14:28 -05:00
setup.py policycoreutils: sepolicy: new command to unite small utilities 2013-02-05 20:14:28 -05:00