1919#include "include/path.h"
2020#include "include/policy.h"
2121
22- struct file_perms nullperms ;
23-
2422static u32 map_mask_to_chr_mask (u32 mask )
2523{
2624 u32 m = mask & PERMS_CHRS_MASK ;
@@ -92,7 +90,7 @@ static void file_audit_cb(struct audit_buffer *ab, void *va)
9290 *
9391 * Returns: %0 or error on failure
9492 */
95- int aa_audit_file (struct aa_profile * profile , struct file_perms * perms ,
93+ int aa_audit_file (struct aa_profile * profile , struct aa_perms * perms ,
9694 const char * op , u32 request , const char * name ,
9795 const char * target , kuid_t ouid , const char * info , int error )
9896{
@@ -170,7 +168,7 @@ static u32 map_old_perms(u32 old)
170168}
171169
172170/**
173- * compute_perms - convert dfa compressed perms to internal perms
171+ * aa_compute_fperms - convert dfa compressed perms to internal perms
174172 * @dfa: dfa to compute perms for (NOT NULL)
175173 * @state: state in dfa
176174 * @cond: conditions to consider (NOT NULL)
@@ -180,17 +178,21 @@ static u32 map_old_perms(u32 old)
180178 *
181179 * Returns: computed permission set
182180 */
183- static struct file_perms compute_perms (struct aa_dfa * dfa , unsigned int state ,
184- struct path_cond * cond )
181+ struct aa_perms aa_compute_fperms (struct aa_dfa * dfa , unsigned int state ,
182+ struct path_cond * cond )
185183{
186- struct file_perms perms ;
184+ struct aa_perms perms ;
187185
188186 /* FIXME: change over to new dfa format
189187 * currently file perms are encoded in the dfa, new format
190188 * splits the permissions from the dfa. This mapping can be
191189 * done at profile load
192190 */
193- perms .kill = 0 ;
191+ perms .deny = 0 ;
192+ perms .kill = perms .stop = 0 ;
193+ perms .complain = perms .cond = 0 ;
194+ perms .hide = 0 ;
195+ perms .prompt = 0 ;
194196
195197 if (uid_eq (current_fsuid (), cond -> uid )) {
196198 perms .allow = map_old_perms (dfa_user_allow (dfa , state ));
@@ -226,16 +228,11 @@ static struct file_perms compute_perms(struct aa_dfa *dfa, unsigned int state,
226228 */
227229unsigned int aa_str_perms (struct aa_dfa * dfa , unsigned int start ,
228230 const char * name , struct path_cond * cond ,
229- struct file_perms * perms )
231+ struct aa_perms * perms )
230232{
231233 unsigned int state ;
232- if (!dfa ) {
233- * perms = nullperms ;
234- return DFA_NOMATCH ;
235- }
236-
237234 state = aa_dfa_match (dfa , start , name );
238- * perms = compute_perms (dfa , state , cond );
235+ * perms = aa_compute_fperms (dfa , state , cond );
239236
240237 return state ;
241238}
@@ -269,7 +266,7 @@ int aa_path_perm(const char *op, struct aa_profile *profile,
269266 struct path_cond * cond )
270267{
271268 char * buffer = NULL ;
272- struct file_perms perms = {};
269+ struct aa_perms perms = {};
273270 const char * name , * info = NULL ;
274271 int error ;
275272
@@ -348,7 +345,7 @@ int aa_path_link(struct aa_profile *profile, struct dentry *old_dentry,
348345 };
349346 char * buffer = NULL , * buffer2 = NULL ;
350347 const char * lname , * tname = NULL , * info = NULL ;
351- struct file_perms lperms , perms ;
348+ struct aa_perms lperms , perms ;
352349 u32 request = AA_MAY_LINK ;
353350 unsigned int state ;
354351 int error ;
0 commit comments