Commit d918ada2 authored by John Johansen's avatar John Johansen Committed by Tim Gardner

Revert "UBUNTU: SAUCE: apparmor: Fix: query label file permission"

BugLink: http://bugs.launchpad.net/bugs/1379535

This reverts commit 07e05b2781aa973f95f31d7cb7789a986ddc9583.
Signed-off-by: default avatarTim Gardner <tim.gardner@canonical.com>
parent 0640a0d9
...@@ -250,27 +250,17 @@ static ssize_t query_label(char *buf, size_t buf_len, ...@@ -250,27 +250,17 @@ static ssize_t query_label(char *buf, size_t buf_len,
dfa = profile->file.dfa; dfa = profile->file.dfa;
state = aa_dfa_match_len(dfa, profile->file.start, state = aa_dfa_match_len(dfa, profile->file.start,
match_str + 1, match_len - 1); match_str + 1, match_len - 1);
aa_perms_clear(&tmp);
if (state) {
struct file_perms fperms = { };
struct path_cond cond = { };
fperms = aa_compute_fperms(dfa, state, &cond);
tmp.allow = fperms.allow;
tmp.audit = fperms.audit;
tmp.quiet = fperms.quiet;
tmp.kill = fperms.kill;
}
} else if (profile->policy.dfa) { } else if (profile->policy.dfa) {
if (!PROFILE_MEDIATES_SAFE(profile, *match_str)) if (!PROFILE_MEDIATES_SAFE(profile, *match_str))
continue; /* no change to current perms */ continue; /* no change to current perms */
dfa = profile->policy.dfa; dfa = profile->policy.dfa;
state = aa_dfa_match_len(dfa, profile->policy.start[0], state = aa_dfa_match_len(dfa, profile->policy.start[0],
match_str, match_len); match_str, match_len);
if (state)
aa_compute_perms(dfa, state, &tmp);
else
aa_perms_clear(&tmp);
} }
if (state)
aa_compute_perms(dfa, state, &tmp);
else
aa_perms_clear(&tmp);
aa_apply_modes_to_perms(profile, &tmp); aa_apply_modes_to_perms(profile, &tmp);
aa_perms_accum_raw(&perms, &tmp); aa_perms_accum_raw(&perms, &tmp);
} }
......
...@@ -208,7 +208,7 @@ static u32 map_old_perms(u32 old) ...@@ -208,7 +208,7 @@ static u32 map_old_perms(u32 old)
} }
/** /**
* aa_compute_fperms - convert dfa compressed perms to internal perms * compute_perms - convert dfa compressed perms to internal perms
* @dfa: dfa to compute perms for (NOT NULL) * @dfa: dfa to compute perms for (NOT NULL)
* @state: state in dfa * @state: state in dfa
* @cond: conditions to consider (NOT NULL) * @cond: conditions to consider (NOT NULL)
...@@ -218,8 +218,8 @@ static u32 map_old_perms(u32 old) ...@@ -218,8 +218,8 @@ static u32 map_old_perms(u32 old)
* *
* Returns: computed permission set * Returns: computed permission set
*/ */
struct file_perms aa_compute_fperms(struct aa_dfa *dfa, unsigned int state, static struct file_perms compute_perms(struct aa_dfa *dfa, unsigned int state,
struct path_cond *cond) struct path_cond *cond)
{ {
struct file_perms perms; struct file_perms perms;
...@@ -273,7 +273,7 @@ unsigned int aa_str_perms(struct aa_dfa *dfa, unsigned int start, ...@@ -273,7 +273,7 @@ unsigned int aa_str_perms(struct aa_dfa *dfa, unsigned int start,
} }
state = aa_dfa_match(dfa, start, name); state = aa_dfa_match(dfa, start, name);
*perms = aa_compute_fperms(dfa, state, cond); *perms = compute_perms(dfa, state, cond);
return state; return state;
} }
......
...@@ -204,8 +204,6 @@ struct aa_file_rules { ...@@ -204,8 +204,6 @@ struct aa_file_rules {
/* TODO: add delegate table */ /* TODO: add delegate table */
}; };
struct file_perms aa_compute_fperms(struct aa_dfa *dfa, unsigned int state,
struct path_cond *cond);
unsigned int aa_str_perms(struct aa_dfa *dfa, unsigned int start, unsigned int aa_str_perms(struct aa_dfa *dfa, unsigned int start,
const char *name, struct path_cond *cond, const char *name, struct path_cond *cond,
struct file_perms *perms); struct file_perms *perms);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment