Lines Matching refs:old
147 static bool id_permitted_for_cred(const struct cred *old, kid_t new_id, enum setid_type new_type) in id_permitted_for_cred() argument
153 if (uid_eq(new_id.uid, old->uid) || uid_eq(new_id.uid, old->euid) || in id_permitted_for_cred()
154 uid_eq(new_id.uid, old->suid)) in id_permitted_for_cred()
157 if (gid_eq(new_id.gid, old->gid) || gid_eq(new_id.gid, old->egid) || in id_permitted_for_cred()
158 gid_eq(new_id.gid, old->sgid)) in id_permitted_for_cred()
168 setid_policy_lookup((kid_t){.uid = old->uid}, new_id, new_type) != SIDPOL_CONSTRAINED; in id_permitted_for_cred()
173 __kuid_val(old->uid), __kuid_val(old->euid), in id_permitted_for_cred()
174 __kuid_val(old->suid), __kuid_val(new_id.uid)); in id_permitted_for_cred()
177 __kgid_val(old->gid), __kgid_val(old->egid), in id_permitted_for_cred()
178 __kgid_val(old->sgid), __kgid_val(new_id.gid)); in id_permitted_for_cred()
191 const struct cred *old, in safesetid_task_fix_setuid() argument
196 if (setid_policy_lookup((kid_t){.uid = old->uid}, INVALID_ID, UID) == SIDPOL_DEFAULT) in safesetid_task_fix_setuid()
199 if (id_permitted_for_cred(old, (kid_t){.uid = new->uid}, UID) && in safesetid_task_fix_setuid()
200 id_permitted_for_cred(old, (kid_t){.uid = new->euid}, UID) && in safesetid_task_fix_setuid()
201 id_permitted_for_cred(old, (kid_t){.uid = new->suid}, UID) && in safesetid_task_fix_setuid()
202 id_permitted_for_cred(old, (kid_t){.uid = new->fsuid}, UID)) in safesetid_task_fix_setuid()
215 const struct cred *old, in safesetid_task_fix_setgid() argument
220 if (setid_policy_lookup((kid_t){.gid = old->gid}, INVALID_ID, GID) == SIDPOL_DEFAULT) in safesetid_task_fix_setgid()
223 if (id_permitted_for_cred(old, (kid_t){.gid = new->gid}, GID) && in safesetid_task_fix_setgid()
224 id_permitted_for_cred(old, (kid_t){.gid = new->egid}, GID) && in safesetid_task_fix_setgid()
225 id_permitted_for_cred(old, (kid_t){.gid = new->sgid}, GID) && in safesetid_task_fix_setgid()
226 id_permitted_for_cred(old, (kid_t){.gid = new->fsgid}, GID)) in safesetid_task_fix_setgid()
238 static int safesetid_task_fix_setgroups(struct cred *new, const struct cred *old) in safesetid_task_fix_setgroups() argument
243 if (setid_policy_lookup((kid_t){.gid = old->gid}, INVALID_ID, GID) == SIDPOL_DEFAULT) in safesetid_task_fix_setgroups()
248 if (!id_permitted_for_cred(old, (kid_t){.gid = new->group_info->gid[i]}, GID)) { in safesetid_task_fix_setgroups()