From b2335fb95f3843170777da7d31851dfea3a0fc82 Mon Sep 17 00:00:00 2001 From: jasoni Date: Wed, 12 Apr 2000 04:22:40 +0000 Subject: [PATCH] Implement linux's setfsuid and getfsuid (from NetBSD) --- sys/compat/linux/linux_misc.c | 34 +++++++++++++++++++++++++++++++- sys/compat/linux/syscalls.master | 6 +++--- 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c index 3f1653cd7b8..4c5a58e46eb 100644 --- a/sys/compat/linux/linux_misc.c +++ b/sys/compat/linux/linux_misc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: linux_misc.c,v 1.26 2000/02/28 13:29:30 jasoni Exp $ */ +/* $OpenBSD: linux_misc.c,v 1.27 2000/04/12 04:22:40 jasoni Exp $ */ /* $NetBSD: linux_misc.c,v 1.27 1996/05/20 01:59:21 fvdl Exp $ */ /* @@ -1440,6 +1440,38 @@ linux_sys_getresuid(p, v, retval) return (copyout(&pc->p_svuid, SCARG(uap, suid), sizeof(uid_t))); } +/* + * We have nonexistent fsuid equal to uid. + * If modification is requested, refuse. + */ +int +linux_sys_setfsuid(p, v, retval) + struct proc *p; + void *v; + register_t *retval; +{ + struct linux_sys_setfsuid_args /* { + syscallarg(uid_t) uid; + } */ *uap = v; + uid_t uid; + + uid = SCARG(uap, uid); + if (p->p_cred->p_ruid != uid) + return sys_nosys(p, v, retval); + else + return (0); +} + +int +linux_sys_getfsuid(p, v, retval) + struct proc *p; + void *v; + register_t *retval; +{ + return sys_getuid(p, v, retval); +} + + int linux_sys_nice(p, v, retval) struct proc *p; diff --git a/sys/compat/linux/syscalls.master b/sys/compat/linux/syscalls.master index 21162ac8a98..932f76f9fa5 100644 --- a/sys/compat/linux/syscalls.master +++ b/sys/compat/linux/syscalls.master @@ -1,4 +1,4 @@ - $OpenBSD: syscalls.master,v 1.21 2000/04/04 05:31:50 jasoni Exp $ + $OpenBSD: syscalls.master,v 1.22 2000/04/12 04:22:40 jasoni Exp $ ; $NetBSD: syscalls.master,v 1.15 1995/12/18 14:35:10 fvdl Exp $ ; @(#)syscalls.master 8.1 (Berkeley) 7/19/93 @@ -225,8 +225,8 @@ 135 UNIMPL sysfs 136 STD { int linux_sys_personality(int per); } 137 UNIMPL afs_syscall -138 UNIMPL setfsuid -139 UNIMPL getfsuid +138 STD { int linux_sys_setfsuid(uid_t uid); } +139 NOARGS { int linux_sys_getfsuid(void); } 140 STD { int linux_sys_llseek(int fd, u_int32_t ohigh, \ u_int32_t olow, caddr_t res, int whence); } 141 STD { int linux_sys_getdents(int fd, void *dirent, \ -- 2.20.1