fix "list index out of range" when allowing inet rules

When adding inet rules in aa-logprof, it crashes with
    IndexError: list index out of range

The reason is that it doesn't display the options if only the raw rule
is available (aka "no abstraction").

This patch checks if options[] is set and otherwise sets selection to
the raw rule.


Acked-by: Steve Beattie <steve@nxnw.org>
This commit is contained in:
Christian Boltz 2014-10-14 21:28:32 +02:00
parent d11055aa0c
commit c613d8a884

View file

@ -1993,7 +1993,10 @@ def ask_the_questions():
q.headers += [_('Socket Type'), sock_type]
elif ans == 'CMD_ALLOW':
selection = options[selected]
if options:
selection = options[selected]
else:
selection = 'network %s %s' % (family, sock_type)
done = True
if re_match_include(selection): # re.search('#include\s+<.+>$', selection):
inc = re_match_include(selection) # re.search('#include\s+<(.+)>$', selection).groups()[0]