diff options
author | sos <sos@FreeBSD.org> | 1998-12-30 21:01:34 +0000 |
---|---|---|
committer | sos <sos@FreeBSD.org> | 1998-12-30 21:01:34 +0000 |
commit | 9023a71340e041442bc7e5351146435fc0212755 (patch) | |
tree | 7088adf57739b6010be5797cb2a67da0ce5dbd63 /sys/i386/linux | |
parent | d2eceef5183ba872204bb66335e210aaad821043 (diff) | |
download | FreeBSD-src-9023a71340e041442bc7e5351146435fc0212755.zip FreeBSD-src-9023a71340e041442bc7e5351146435fc0212755.tar.gz |
Commit #2 of
PR: 9235
Submitted by: marcel@scc.nl <Marcel Moolenaar>
Diffstat (limited to 'sys/i386/linux')
-rw-r--r-- | sys/i386/linux/linux_misc.c | 74 | ||||
-rw-r--r-- | sys/i386/linux/linux_proto.h | 12 | ||||
-rw-r--r-- | sys/i386/linux/linux_syscall.h | 6 | ||||
-rw-r--r-- | sys/i386/linux/linux_sysent.c | 6 |
4 files changed, 90 insertions, 8 deletions
diff --git a/sys/i386/linux/linux_misc.c b/sys/i386/linux/linux_misc.c index 2f12f38..3bdc805 100644 --- a/sys/i386/linux/linux_misc.c +++ b/sys/i386/linux/linux_misc.c @@ -25,7 +25,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $Id: linux_misc.c,v 1.48 1998/12/19 02:55:33 julian Exp $ + * $Id: linux_misc.c,v 1.49 1998/12/24 21:21:20 julian Exp $ */ #include <sys/param.h> @@ -1171,3 +1171,75 @@ linux_nice(struct proc *p, struct linux_nice_args *args) return setpriority(p, &bsd_args); } +int +linux_setgroups(p, uap) + struct proc *p; + struct linux_setgroups_args *uap; +{ + struct pcred *pc = p->p_cred; + linux_gid_t linux_gidset[NGROUPS]; + gid_t *bsd_gidset; + int ngrp, error; + + if ((error = suser(pc->pc_ucred, &p->p_acflag))) + return error; + + if (uap->gidsetsize > NGROUPS) + return EINVAL; + + ngrp = uap->gidsetsize; + pc->pc_ucred = crcopy(pc->pc_ucred); + if (ngrp >= 1) { + if ((error = copyin((caddr_t)uap->gidset, + (caddr_t)linux_gidset, + ngrp * sizeof(linux_gid_t)))) + return error; + + pc->pc_ucred->cr_ngroups = ngrp; + + bsd_gidset = pc->pc_ucred->cr_groups; + ngrp--; + while (ngrp >= 0) { + bsd_gidset[ngrp] = linux_gidset[ngrp]; + ngrp--; + } + } + else + pc->pc_ucred->cr_ngroups = 1; + + setsugid(p); + return 0; +} + +int +linux_getgroups(p, uap) + struct proc *p; + struct linux_getgroups_args *uap; +{ + struct pcred *pc = p->p_cred; + linux_gid_t linux_gidset[NGROUPS]; + gid_t *bsd_gidset; + int ngrp, error; + + if ((ngrp = uap->gidsetsize) == 0) { + p->p_retval[0] = pc->pc_ucred->cr_ngroups; + return 0; + } + + if (ngrp < pc->pc_ucred->cr_ngroups) + return EINVAL; + + ngrp = 0; + bsd_gidset = pc->pc_ucred->cr_groups; + while (ngrp < pc->pc_ucred->cr_ngroups) { + linux_gidset[ngrp] = bsd_gidset[ngrp]; + ngrp++; + } + + if ((error = copyout((caddr_t)linux_gidset, (caddr_t)uap->gidset, + ngrp * sizeof(linux_gid_t)))) + return error; + + p->p_retval[0] = ngrp; + return (0); +} diff --git a/sys/i386/linux/linux_proto.h b/sys/i386/linux/linux_proto.h index 0e258c9..cda56c2 100644 --- a/sys/i386/linux/linux_proto.h +++ b/sys/i386/linux/linux_proto.h @@ -2,7 +2,7 @@ * System call prototypes. * * DO NOT EDIT-- this file is automatically generated. - * created from Id: syscalls.master,v 1.15 1998/12/22 08:59:19 sos Exp + * created from Id: syscalls.master,v 1.16 1998/12/30 20:58:28 sos Exp */ #ifndef _LINUX_SYSPROTO_H_ @@ -195,6 +195,14 @@ struct linux_sigsuspend_args { struct linux_sigpending_args { linux_sigset_t * mask; char mask_[PAD_(linux_sigset_t *)]; }; +struct linux_getgroups_args { + u_int gidsetsize; char gidsetsize_[PAD_(u_int)]; + linux_gid_t * gidset; char gidset_[PAD_(linux_gid_t *)]; +}; +struct linux_setgroups_args { + u_int gidsetsize; char gidsetsize_[PAD_(u_int)]; + linux_gid_t * gidset; char gidset_[PAD_(linux_gid_t *)]; +}; struct linux_select_args { struct linux_select_argv * ptr; char ptr_[PAD_(struct linux_select_argv *)]; }; @@ -429,6 +437,8 @@ int linux_siggetmask __P((struct proc *, struct linux_siggetmask_args *)); int linux_sigsetmask __P((struct proc *, struct linux_sigsetmask_args *)); int linux_sigsuspend __P((struct proc *, struct linux_sigsuspend_args *)); int linux_sigpending __P((struct proc *, struct linux_sigpending_args *)); +int linux_getgroups __P((struct proc *, struct linux_getgroups_args *)); +int linux_setgroups __P((struct proc *, struct linux_setgroups_args *)); int linux_select __P((struct proc *, struct linux_select_args *)); int linux_symlink __P((struct proc *, struct linux_symlink_args *)); int linux_readlink __P((struct proc *, struct linux_readlink_args *)); diff --git a/sys/i386/linux/linux_syscall.h b/sys/i386/linux/linux_syscall.h index 028badc..e30d836 100644 --- a/sys/i386/linux/linux_syscall.h +++ b/sys/i386/linux/linux_syscall.h @@ -2,7 +2,7 @@ * System call numbers. * * DO NOT EDIT-- this file is automatically generated. - * created from Id: syscalls.master,v 1.15 1998/12/22 08:59:19 sos Exp + * created from Id: syscalls.master,v 1.16 1998/12/30 20:58:28 sos Exp */ #define LINUX_SYS_linux_setup 0 @@ -85,8 +85,8 @@ #define LINUX_SYS_getrusage 77 #define LINUX_SYS_gettimeofday 78 #define LINUX_SYS_settimeofday 79 -#define LINUX_SYS_getgroups 80 -#define LINUX_SYS_setgroups 81 +#define LINUX_SYS_linux_getgroups 80 +#define LINUX_SYS_linux_setgroups 81 #define LINUX_SYS_linux_select 82 #define LINUX_SYS_linux_symlink 83 #define LINUX_SYS_ostat 84 diff --git a/sys/i386/linux/linux_sysent.c b/sys/i386/linux/linux_sysent.c index 82435e6..a5e8bdb 100644 --- a/sys/i386/linux/linux_sysent.c +++ b/sys/i386/linux/linux_sysent.c @@ -2,7 +2,7 @@ * System call switch table. * * DO NOT EDIT-- this file is automatically generated. - * created from Id: syscalls.master,v 1.15 1998/12/22 08:59:19 sos Exp + * created from Id: syscalls.master,v 1.16 1998/12/30 20:58:28 sos Exp */ #include "opt_compat.h" @@ -94,8 +94,8 @@ struct sysent linux_sysent[] = { { 2, (sy_call_t *)getrusage }, /* 77 = getrusage */ { 2, (sy_call_t *)gettimeofday }, /* 78 = gettimeofday */ { 2, (sy_call_t *)settimeofday }, /* 79 = settimeofday */ - { 2, (sy_call_t *)getgroups }, /* 80 = getgroups */ - { 2, (sy_call_t *)setgroups }, /* 81 = setgroups */ + { 2, (sy_call_t *)linux_getgroups }, /* 80 = linux_getgroups */ + { 2, (sy_call_t *)linux_setgroups }, /* 81 = linux_setgroups */ { 1, (sy_call_t *)linux_select }, /* 82 = linux_select */ { 2, (sy_call_t *)linux_symlink }, /* 83 = linux_symlink */ { 2, (sy_call_t *)ostat }, /* 84 = ostat */ |