Changeset View
Changeset View
Standalone View
Standalone View
sys/compat/linux/linux_uid16.c
Show First 20 Lines • Show All 66 Lines • ▼ Show 20 Lines | |||||
DUMMY(getresuid16); | DUMMY(getresuid16); | ||||
DUMMY(getresgid16); | DUMMY(getresgid16); | ||||
#define CAST_NOCHG(x) ((x == 0xFFFF) ? -1 : x) | #define CAST_NOCHG(x) ((x == 0xFFFF) ? -1 : x) | ||||
int | int | ||||
linux_chown16(struct thread *td, struct linux_chown16_args *args) | linux_chown16(struct thread *td, struct linux_chown16_args *args) | ||||
{ | { | ||||
char *path; | |||||
int error; | |||||
if (!LUSECONVPATH(td) && !SDT_PROBES_ENABLED()) { | return (kern_fchownat(td, AT_FDCWD, args->path, UIO_USERSPACE, | ||||
error = kern_fchownat(td, AT_FDCWD, args->path, UIO_USERSPACE, | CAST_NOCHG(args->uid), CAST_NOCHG(args->gid), 0)); | ||||
CAST_NOCHG(args->uid), CAST_NOCHG(args->gid), 0); | |||||
} else { | |||||
LCONVPATHEXIST(args->path, &path); | |||||
/* | |||||
* The DTrace probes have to be after the LCONVPATHEXIST, as | |||||
* LCONVPATHEXIST may return on its own and we do not want to | |||||
* have a stray entry without the corresponding return. | |||||
*/ | |||||
LIN_SDT_PROBE1(uid16, linux_chown16, conv_path, path); | |||||
error = kern_fchownat(td, AT_FDCWD, path, UIO_SYSSPACE, | |||||
CAST_NOCHG(args->uid), CAST_NOCHG(args->gid), 0); | |||||
LFREEPATH(path); | |||||
} | } | ||||
return (error); | |||||
} | |||||
int | int | ||||
linux_lchown16(struct thread *td, struct linux_lchown16_args *args) | linux_lchown16(struct thread *td, struct linux_lchown16_args *args) | ||||
{ | { | ||||
char *path; | |||||
int error; | |||||
if (!LUSECONVPATH(td) && !SDT_PROBES_ENABLED()) { | return (kern_fchownat(td, AT_FDCWD, args->path, UIO_USERSPACE, | ||||
error = kern_fchownat(td, AT_FDCWD, args->path, UIO_USERSPACE, | CAST_NOCHG(args->uid), CAST_NOCHG(args->gid), AT_SYMLINK_NOFOLLOW)); | ||||
CAST_NOCHG(args->uid), CAST_NOCHG(args->gid), AT_SYMLINK_NOFOLLOW); | |||||
} else { | |||||
LCONVPATHEXIST(args->path, &path); | |||||
/* | |||||
* The DTrace probes have to be after the LCONVPATHEXIST, as | |||||
* LCONVPATHEXIST may return on its own and we do not want to | |||||
* have a stray entry without the corresponding return. | |||||
*/ | |||||
LIN_SDT_PROBE1(uid16, linux_lchown16, conv_path, path); | |||||
error = kern_fchownat(td, AT_FDCWD, path, UIO_SYSSPACE, | |||||
CAST_NOCHG(args->uid), CAST_NOCHG(args->gid), AT_SYMLINK_NOFOLLOW); | |||||
LFREEPATH(path); | |||||
} | |||||
return (error); | |||||
} | } | ||||
int | int | ||||
linux_setgroups16(struct thread *td, struct linux_setgroups16_args *args) | linux_setgroups16(struct thread *td, struct linux_setgroups16_args *args) | ||||
{ | { | ||||
struct ucred *newcred, *oldcred; | struct ucred *newcred, *oldcred; | ||||
l_gid16_t *linux_gidset; | l_gid16_t *linux_gidset; | ||||
gid_t *bsd_gidset; | gid_t *bsd_gidset; | ||||
▲ Show 20 Lines • Show All 220 Lines • Show Last 20 Lines |