policycoreutils: gui: polgen: follow symlinks and get the real path to the executable to be confined

Signed-off-by: Eric Paris <eparis@redhat.com>
Acked-by: Dan Walsh <dwalsh@redhat.com>
This commit is contained in:
Dan Walsh 2012-05-20 06:27:12 -04:00 committed by Eric Paris
parent f627d9a8ce
commit ff78e21ef8

View File

@ -1354,9 +1354,11 @@ if __name__ == '__main__':
usage(_("Executable or Name required"))
try:
cmd = os.path.realpath(cmds[0])
if not name:
name = os.path.basename(cmds[0]).replace("-","_")
cmd = cmds[0]
name = os.path.basename(cmd).replace("-","_")
print("Generating Policy for %s named %s" % (cmd, name))
mypolicy = policy(name, setype)
if setype not in USERS + [ SANDBOX ]:
mypolicy.set_program(cmd)