Skip to content

Commit

Permalink
Update allowlist.c
Browse files Browse the repository at this point in the history
  • Loading branch information
mlm-games authored Sep 22, 2024
1 parent 734798e commit 87a7abf
Showing 1 changed file with 9 additions and 16 deletions.
25 changes: 9 additions & 16 deletions kernel/allowlist.c
Original file line number Diff line number Diff line change
Expand Up @@ -119,25 +119,18 @@ static void ksu_grant_root_to_shell()
}
#endif

bool ksu_get_app_profile(struct app_profile *profile)
struct app_profile *ksu_get_app_profile(uid_t uid)
{
struct perm_data *p = NULL;
struct list_head *pos = NULL;
bool found = false;
struct perm_data *p = NULL;
struct list_head *pos = NULL;

list_for_each (pos, &allow_list) {
p = list_entry(pos, struct perm_data, list);
bool uid_match = profile->current_uid == p->profile.current_uid;
if (uid_match) {
// found it, override it with ours
memcpy(profile, &p->profile, sizeof(*profile));
found = true;
goto exit;
}
}
list_for_each(pos, &allow_list) {
p = list_entry(pos, struct perm_data, list);
if (uid == p->profile.current_uid)
return &p->profile;
}

exit:
return found;
return NULL;
}

static inline bool forbid_system_uid(uid_t uid) {
Expand Down

0 comments on commit 87a7abf

Please sign in to comment.