Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/kern_prot.c
Show First 20 Lines • Show All 1,212 Lines • ▼ Show 20 Lines | if (uap->egid) | ||||
error2 = copyout(&cred->cr_groups[0], | error2 = copyout(&cred->cr_groups[0], | ||||
uap->egid, sizeof(cred->cr_groups[0])); | uap->egid, sizeof(cred->cr_groups[0])); | ||||
if (uap->sgid) | if (uap->sgid) | ||||
error3 = copyout(&cred->cr_svgid, | error3 = copyout(&cred->cr_svgid, | ||||
uap->sgid, sizeof(cred->cr_svgid)); | uap->sgid, sizeof(cred->cr_svgid)); | ||||
return (error1 ? error1 : error2 ? error2 : error3); | return (error1 ? error1 : error2 ? error2 : error3); | ||||
} | } | ||||
int | |||||
kern_issetugid(struct proc *p) | |||||
{ | |||||
/* | |||||
* Note: OpenBSD sets a P_SUGIDEXEC flag set at execve() time, | |||||
* we use P_SUGID because we consider changing the owners as | |||||
* "tainting" as well. | |||||
* This is significant for procs that start as root and "become" | |||||
* a user without an exec - programs cannot know *everything* | |||||
* that libc *might* have put in their data segment. | |||||
*/ | |||||
return ((p->p_flag & P_SUGID) != 0); | |||||
kib: != 0 | |||||
} | |||||
#ifndef _SYS_SYSPROTO_H_ | #ifndef _SYS_SYSPROTO_H_ | ||||
struct issetugid_args { | struct issetugid_args { | ||||
int dummy; | int dummy; | ||||
}; | }; | ||||
#endif | #endif | ||||
/* ARGSUSED */ | /* ARGSUSED */ | ||||
int | int | ||||
sys_issetugid(struct thread *td, struct issetugid_args *uap) | sys_issetugid(struct thread *td, struct issetugid_args *uap) | ||||
{ | { | ||||
struct proc *p = td->td_proc; | struct proc *p = td->td_proc; | ||||
/* | td->td_retval[0] = kern_issetugid(p); | ||||
* Note: OpenBSD sets a P_SUGIDEXEC flag set at execve() time, | |||||
* we use P_SUGID because we consider changing the owners as | |||||
* "tainting" as well. | |||||
* This is significant for procs that start as root and "become" | |||||
* a user without an exec - programs cannot know *everything* | |||||
* that libc *might* have put in their data segment. | |||||
*/ | |||||
td->td_retval[0] = (p->p_flag & P_SUGID) ? 1 : 0; | |||||
return (0); | return (0); | ||||
} | } | ||||
int | int | ||||
sys___setugid(struct thread *td, struct __setugid_args *uap) | sys___setugid(struct thread *td, struct __setugid_args *uap) | ||||
{ | { | ||||
#ifdef REGRESSION | #ifdef REGRESSION | ||||
struct proc *p; | struct proc *p; | ||||
▲ Show 20 Lines • Show All 1,036 Lines • Show Last 20 Lines |
!= 0