Fix wrong usage of write_prof_data in serialize_profile_from_old_profile()

write_prof_data[hat] is correct (it only contains one profile, see bug 1528139),
write_prof_data[profile][hat] is not and returns an empty (sub)hasher.

This affects RE_PROFILE_START and RE_PROFILE_BARE_FILE_ENTRY.


Acked-by: Kshitij Gupta <kgupta8592@gmail.com> for trunk, 2.9 and 2.10
This commit is contained in:
Christian Boltz 2016-03-01 21:24:10 +01:00
parent 4ae6ad03ba
commit 125dc5fd18

View file

@ -3672,7 +3672,7 @@ def serialize_profile_from_old_profile(profile_data, name, options):
if RE_PROFILE_START.search(line):
(profile, hat, attachment, flags, in_contained_hat, correct) = serialize_parse_profile_start(
line, prof_filename, None, profile, hat, write_prof_data[profile][hat]['profile'], write_prof_data[profile][hat]['external'], correct)
line, prof_filename, None, profile, hat, write_prof_data[hat]['profile'], write_prof_data[hat]['external'], correct)
if not write_prof_data[hat]['name'] == profile:
correct = False
@ -3908,7 +3908,7 @@ def serialize_profile_from_old_profile(profile_data, name, options):
if matches[0]:
audit = mode
path_rule = write_prof_data[profile][hat][allow]['path'][ALL]
path_rule = write_prof_data[hat][allow]['path'][ALL]
if path_rule.get('mode', set()) & mode and \
(not audit or path_rule.get('audit', set()) & audit) and \
path_rule.get('file_prefix', set()):