mirror of
https://gitlab.com/apparmor/apparmor.git
synced 2025-03-04 16:35:02 +01:00
working commit prior to writer code alterations
This commit is contained in:
parent
6ce67f3cbe
commit
457604014f
4 changed files with 20 additions and 15 deletions
|
@ -1422,7 +1422,7 @@ def ask_the_questions():
|
|||
q = hasher()
|
||||
|
||||
if newincludes:
|
||||
options += map(lambda inc: '#include <%s>' %inc, sorted(set(newincludes)))
|
||||
options += list(map(lambda inc: '#include <%s>' %inc, sorted(set(newincludes))))
|
||||
|
||||
if options:
|
||||
options.append('capability %s' % capability)
|
||||
|
@ -1470,8 +1470,10 @@ def ask_the_questions():
|
|||
_('Severity'), severity]
|
||||
|
||||
if ans == 'CMD_ALLOW':
|
||||
selection = options[selected]
|
||||
match = re_match_include(selection) #re.search('^#include\s+<(.+)>$', selection)
|
||||
selection = ''
|
||||
if options:
|
||||
selection = options[selected]
|
||||
match = re_match_include(selection)
|
||||
if match:
|
||||
deleted = False
|
||||
inc = match #.groups()[0]
|
||||
|
@ -1595,7 +1597,7 @@ def ask_the_questions():
|
|||
newincludes.append(incname)
|
||||
# Add new includes to the options
|
||||
if newincludes:
|
||||
options += map(lambda s: '#include <%s>' % s, sorted(set(newincludes)))
|
||||
options += list(map(lambda s: '#include <%s>' % s, sorted(set(newincludes))))
|
||||
# We should have literal the path in options list too
|
||||
options.append(path)
|
||||
# Add any the globs matching path from logprof
|
||||
|
@ -1853,7 +1855,7 @@ def ask_the_questions():
|
|||
newincludes = match_net_includes(aa[profile][hat], family, sock_type)
|
||||
q = hasher()
|
||||
if newincludes:
|
||||
options += map(lambda s: '#include <%s>'%s, sorted(set(newincludes)))
|
||||
options += list(map(lambda s: '#include <%s>'%s, sorted(set(newincludes))))
|
||||
if options:
|
||||
options.append('network %s %s' % (family, sock_type))
|
||||
q['options'] = options
|
||||
|
@ -2171,7 +2173,7 @@ def save_profiles():
|
|||
while ans != 'CMD_SAVE_CHANGES':
|
||||
ans, arg = UI_PromptUser(q)
|
||||
if ans == 'CMD_VIEW_CHANGES':
|
||||
which = changed.keys()[arg]
|
||||
which = list(changed.keys())[arg]
|
||||
oldprofile = serialize_profile(original_aa[which], which, '')
|
||||
newprofile = serialize_profile(aa[which], which, '')
|
||||
|
||||
|
@ -3099,11 +3101,11 @@ def write_piece(profile_data, depth, name, nhat, write_flags):
|
|||
if not profile_data[hat]['external'] and not profile_data[hat]['declared']:
|
||||
data.append('')
|
||||
if profile_data[hat]['profile']:
|
||||
data += map(str, write_header(profile_data[hat], depth+1, hat, True, write_flags))
|
||||
data += list(map(str, write_header(profile_data[hat], depth+1, hat, True, write_flags)))
|
||||
else:
|
||||
data += map(str, write_header(profile_data[hat], depth+1, '^'+hat, True, write_flags))
|
||||
data += list(map(str, write_header(profile_data[hat], depth+1, '^'+hat, True, write_flags)))
|
||||
|
||||
data += map(str, write_rules(profile_data[hat], depth+2))
|
||||
data += list(map(str, write_rules(profile_data[hat], depth+2)))
|
||||
|
||||
data.append('%s}' %pre2)
|
||||
|
||||
|
@ -3113,7 +3115,7 @@ def write_piece(profile_data, depth, name, nhat, write_flags):
|
|||
for hat in list(filter(lambda x: x != name, sorted(profile_data.keys()))):
|
||||
if name == nhat and profile_data[hat].get('external', False):
|
||||
data.append('')
|
||||
data += map(lambda x: ' %s' %x, write_piece(profile_data, depth-1, name, nhat, write_flags))
|
||||
data += list(map(lambda x: ' %s' %x, write_piece(profile_data, depth-1, name, nhat, write_flags)))
|
||||
data.append(' }')
|
||||
|
||||
return data
|
||||
|
|
|
@ -277,6 +277,8 @@ def py2_parser(filename):
|
|||
# entries being indented deeper hence simple lstrip() is not appropriate
|
||||
if line[:2] == ' ':
|
||||
line = line[2:]
|
||||
elif line[0] == '\t':
|
||||
line = line[1:]
|
||||
f_out.write(line)
|
||||
f_out.flush()
|
||||
return tmp
|
|
@ -50,7 +50,7 @@ class ReadLog:
|
|||
if self.next_log_entry:
|
||||
sys.stderr.out('A log entry already present: %s' % self.next_log_entry)
|
||||
self.next_log_entry = self.LOG.readline()
|
||||
while not (self.RE_LOG_v2_6_syslog.search(self.next_log_entry) or self.RE_LOG_v2_6_audit.search(self.next_log_entry)): #or re.search(self.logmark, self.next_log_entry)):
|
||||
while not (self.RE_LOG_v2_6_syslog.search(self.next_log_entry) or self.RE_LOG_v2_6_audit.search(self.next_log_entry)) or (self.logmark and re.search(self.logmark, self.next_log_entry)):
|
||||
self.next_log_entry = self.LOG.readline()
|
||||
if not self.next_log_entry:
|
||||
break
|
||||
|
@ -316,8 +316,9 @@ class ReadLog:
|
|||
self.debug_logger.debug('UNHANDLED: %s' % e)
|
||||
|
||||
def read_log(self, logmark):
|
||||
self.logmark = logmark
|
||||
seenmark = True
|
||||
if logmark:
|
||||
if self.logmark:
|
||||
seenmark = False
|
||||
#last = None
|
||||
#event_type = None
|
||||
|
@ -331,7 +332,7 @@ class ReadLog:
|
|||
while line:
|
||||
line = line.strip()
|
||||
self.debug_logger.debug('read_log: %s' % line)
|
||||
if logmark in line:
|
||||
if self.logmark in line:
|
||||
seenmark = True
|
||||
|
||||
self.debug_logger.debug('read_log: seenmark = %s' %seenmark)
|
||||
|
@ -344,7 +345,7 @@ class ReadLog:
|
|||
self.add_event_to_tree(event)
|
||||
line = self.get_next_log_entry()
|
||||
self.LOG.close()
|
||||
logmark = ''
|
||||
self.logmark = ''
|
||||
return self.log
|
||||
|
||||
def op_type(self, operation):
|
||||
|
|
|
@ -261,7 +261,7 @@ def UI_LongMessage(title, message):
|
|||
ypath, yarg = GetDataFromYast()
|
||||
|
||||
def confirm_and_finish():
|
||||
sys.stdout.stdout('FINISHING\n')
|
||||
sys.stdout.write('FINISHING..\n')
|
||||
sys.exit(0)
|
||||
|
||||
def Text_PromptUser(question):
|
||||
|
|
Loading…
Add table
Reference in a new issue