Change suser_xxx() to suser() where it applies.
This commit is contained in:
parent
645ea8a194
commit
8dcac09a03
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)cons.c 7.2 (Berkeley) 5/9/91
|
||||
* $Id: cons.c,v 1.3 1998/12/09 02:26:45 eivind Exp $
|
||||
* $Id: cons.c,v 1.4 1999/04/27 11:13:16 phk Exp $
|
||||
*/
|
||||
|
||||
#include "opt_devfs.h"
|
||||
@ -368,7 +368,7 @@ cnioctl(dev, cmd, data, flag, p)
|
||||
* output from the "virtual" console.
|
||||
*/
|
||||
if (cmd == TIOCCONS && constty) {
|
||||
error = suser_xxx(p->p_ucred, (u_short *) NULL);
|
||||
error = suser(p);
|
||||
if (error)
|
||||
return (error);
|
||||
constty = NULL;
|
||||
|
@ -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.54 1999/04/19 14:14:14 peter Exp $
|
||||
* $Id: linux_misc.c,v 1.55 1999/04/27 11:15:32 phk Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -1134,7 +1134,7 @@ linux_setgroups(p, uap)
|
||||
gid_t *bsd_gidset;
|
||||
int ngrp, error;
|
||||
|
||||
if ((error = suser_xxx(pc->pc_ucred, &p->p_acflag)))
|
||||
if ((error = suser(p)))
|
||||
return error;
|
||||
|
||||
if (uap->gidsetsize > NGROUPS)
|
||||
|
@ -37,7 +37,7 @@
|
||||
*
|
||||
* @(#)procfs_mem.c 8.5 (Berkeley) 6/15/94
|
||||
*
|
||||
* $Id: procfs_mem.c,v 1.35 1998/10/28 13:37:00 dg Exp $
|
||||
* $Id: procfs_mem.c,v 1.36 1999/04/27 11:16:37 phk Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -331,11 +331,12 @@ int procfs_kmemaccess(curp)
|
||||
struct ucred *cred;
|
||||
|
||||
cred = curp->p_cred->pc_ucred;
|
||||
if (suser_xxx(cred, &curp->p_acflag))
|
||||
if (suser(curp))
|
||||
return 1;
|
||||
|
||||
|
||||
/* XXX: Why isn't this done with file-perms ??? */
|
||||
for (i = 0; i < cred->cr_ngroups; i++)
|
||||
if (cred->cr_groups[i] == KMEM_GROUP)
|
||||
if (cred->cr_groups[i] == KMEM_GROUP)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)cons.c 7.2 (Berkeley) 5/9/91
|
||||
* $Id: cons.c,v 1.61 1999/01/07 14:14:11 yokota Exp $
|
||||
* $Id: cons.c,v 1.62 1999/04/27 11:14:29 phk Exp $
|
||||
*/
|
||||
|
||||
#include "opt_devfs.h"
|
||||
@ -358,7 +358,7 @@ cnioctl(dev, cmd, data, flag, p)
|
||||
* output from the "virtual" console.
|
||||
*/
|
||||
if (cmd == TIOCCONS && constty) {
|
||||
error = suser_xxx(p->p_ucred, (u_short *) NULL);
|
||||
error = suser(p);
|
||||
if (error)
|
||||
return (error);
|
||||
constty = NULL;
|
||||
|
@ -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.54 1999/04/19 14:14:14 peter Exp $
|
||||
* $Id: linux_misc.c,v 1.55 1999/04/27 11:15:32 phk Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -1134,7 +1134,7 @@ linux_setgroups(p, uap)
|
||||
gid_t *bsd_gidset;
|
||||
int ngrp, error;
|
||||
|
||||
if ((error = suser_xxx(pc->pc_ucred, &p->p_acflag)))
|
||||
if ((error = suser(p)))
|
||||
return error;
|
||||
|
||||
if (uap->gidsetsize > NGROUPS)
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)kern_prot.c 8.6 (Berkeley) 1/21/94
|
||||
* $Id: kern_prot.c,v 1.44 1999/01/28 00:57:47 dillon Exp $
|
||||
* $Id: kern_prot.c,v 1.45 1999/04/27 11:16:01 phk Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -395,7 +395,7 @@ setuid(p, uap)
|
||||
#ifdef POSIX_APPENDIX_B_4_2_2 /* Use BSD-compat clause from B.4.2.2 */
|
||||
uid != pc->pc_ucred->cr_uid && /* allow setuid(geteuid()) */
|
||||
#endif
|
||||
(error = suser_xxx(pc->pc_ucred, &p->p_acflag)))
|
||||
(error = suser(p)))
|
||||
return (error);
|
||||
|
||||
#ifdef _POSIX_SAVED_IDS
|
||||
@ -407,7 +407,7 @@ setuid(p, uap)
|
||||
#ifdef POSIX_APPENDIX_B_4_2_2 /* Use the clause from B.4.2.2 */
|
||||
uid == pc->pc_ucred->cr_uid ||
|
||||
#endif
|
||||
suser_xxx(pc->pc_ucred, &p->p_acflag) == 0) /* we are using privs */
|
||||
suser(p) == 0) /* we are using privs */
|
||||
#endif
|
||||
{
|
||||
/*
|
||||
@ -467,7 +467,7 @@ seteuid(p, uap)
|
||||
euid = uap->euid;
|
||||
if (euid != pc->p_ruid && /* allow seteuid(getuid()) */
|
||||
euid != pc->p_svuid && /* allow seteuid(saved uid) */
|
||||
(error = suser_xxx(pc->pc_ucred, &p->p_acflag)))
|
||||
(error = suser(p)))
|
||||
return (error);
|
||||
/*
|
||||
* Everything's okay, do it. Copy credentials so other references do
|
||||
@ -515,7 +515,7 @@ setgid(p, uap)
|
||||
#ifdef POSIX_APPENDIX_B_4_2_2 /* Use BSD-compat clause from B.4.2.2 */
|
||||
gid != pc->pc_ucred->cr_groups[0] && /* allow setgid(getegid()) */
|
||||
#endif
|
||||
(error = suser_xxx(pc->pc_ucred, &p->p_acflag)))
|
||||
(error = suser(p)))
|
||||
return (error);
|
||||
|
||||
#ifdef _POSIX_SAVED_IDS
|
||||
@ -527,7 +527,7 @@ setgid(p, uap)
|
||||
#ifdef POSIX_APPENDIX_B_4_2_2 /* use the clause from B.4.2.2 */
|
||||
gid == pc->pc_ucred->cr_groups[0] ||
|
||||
#endif
|
||||
suser_xxx(pc->pc_ucred, &p->p_acflag) == 0) /* we are using privs */
|
||||
suser(p) == 0) /* we are using privs */
|
||||
#endif
|
||||
{
|
||||
/*
|
||||
@ -579,7 +579,7 @@ setegid(p, uap)
|
||||
egid = uap->egid;
|
||||
if (egid != pc->p_rgid && /* allow setegid(getgid()) */
|
||||
egid != pc->p_svgid && /* allow setegid(saved gid) */
|
||||
(error = suser_xxx(pc->pc_ucred, &p->p_acflag)))
|
||||
(error = suser(p)))
|
||||
return (error);
|
||||
if (pc->pc_ucred->cr_groups[0] != egid) {
|
||||
pc->pc_ucred = crcopy(pc->pc_ucred);
|
||||
@ -605,7 +605,7 @@ setgroups(p, uap)
|
||||
register u_int ngrp;
|
||||
int error;
|
||||
|
||||
if ((error = suser_xxx(pc->pc_ucred, &p->p_acflag)))
|
||||
if ((error = suser(p)))
|
||||
return (error);
|
||||
ngrp = uap->gidsetsize;
|
||||
if (ngrp > NGROUPS)
|
||||
@ -654,7 +654,7 @@ setreuid(p, uap)
|
||||
if (((ruid != (uid_t)-1 && ruid != pc->p_ruid && ruid != pc->p_svuid) ||
|
||||
(euid != (uid_t)-1 && euid != pc->pc_ucred->cr_uid &&
|
||||
euid != pc->p_ruid && euid != pc->p_svuid)) &&
|
||||
(error = suser_xxx(pc->pc_ucred, &p->p_acflag)) != 0)
|
||||
(error = suser(p)) != 0)
|
||||
return (error);
|
||||
|
||||
if (euid != (uid_t)-1 && pc->pc_ucred->cr_uid != euid) {
|
||||
@ -697,7 +697,7 @@ setregid(p, uap)
|
||||
if (((rgid != (gid_t)-1 && rgid != pc->p_rgid && rgid != pc->p_svgid) ||
|
||||
(egid != (gid_t)-1 && egid != pc->pc_ucred->cr_groups[0] &&
|
||||
egid != pc->p_rgid && egid != pc->p_svgid)) &&
|
||||
(error = suser_xxx(pc->pc_ucred, &p->p_acflag)) != 0)
|
||||
(error = suser(p)) != 0)
|
||||
return (error);
|
||||
|
||||
if (egid != (gid_t)-1 && pc->pc_ucred->cr_groups[0] != egid) {
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)kern_resource.c 8.5 (Berkeley) 1/21/94
|
||||
* $Id: kern_resource.c,v 1.45 1999/03/13 19:46:12 bde Exp $
|
||||
* $Id: kern_resource.c,v 1.46 1999/04/27 11:16:02 phk Exp $
|
||||
*/
|
||||
|
||||
#include "opt_compat.h"
|
||||
@ -202,7 +202,7 @@ donice(curp, chgp, n)
|
||||
n = PRIO_MAX;
|
||||
if (n < PRIO_MIN)
|
||||
n = PRIO_MIN;
|
||||
if (n < chgp->p_nice && suser_xxx(pcred->pc_ucred, &curp->p_acflag))
|
||||
if (n < chgp->p_nice && suser(curp))
|
||||
return (EACCES);
|
||||
chgp->p_nice = n;
|
||||
(void)resetpriority(chgp);
|
||||
@ -254,7 +254,7 @@ rtprio(curp, uap)
|
||||
pcred->p_ruid != p->p_ucred->cr_uid)
|
||||
return (EPERM);
|
||||
/* disallow setting rtprio in most cases if not superuser */
|
||||
if (suser_xxx(pcred->pc_ucred, &curp->p_acflag)) {
|
||||
if (suser(curp)) {
|
||||
/* can't set someone else's */
|
||||
if (uap->pid)
|
||||
return (EPERM);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: sysv_ipc.c,v 1.9 1999/01/30 12:21:48 phk Exp $ */
|
||||
/* $Id: sysv_ipc.c,v 1.10 1999/04/27 11:16:15 phk Exp $ */
|
||||
/* $NetBSD: sysv_ipc.c,v 1.7 1994/06/29 06:33:11 cgd Exp $ */
|
||||
|
||||
/*
|
||||
@ -35,25 +35,24 @@
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/ipc.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/ucred.h>
|
||||
|
||||
#if defined(SYSVSEM) || defined(SYSVSHM) || defined(SYSVMSG)
|
||||
|
||||
/*
|
||||
* Check for ipc permission
|
||||
*
|
||||
* XXX: Should pass proc argument so that we can pass
|
||||
* XXX: proc->p_acflag to suser_xxx()
|
||||
*/
|
||||
|
||||
int
|
||||
ipcperm(cred, perm, mode)
|
||||
struct ucred *cred;
|
||||
ipcperm(p, perm, mode)
|
||||
struct proc *p;
|
||||
struct ipc_perm *perm;
|
||||
int mode;
|
||||
{
|
||||
struct ucred *cred = p->p_ucred;
|
||||
|
||||
if (suser_xxx(cred, (u_short *)NULL))
|
||||
if (suser(p))
|
||||
return (0);
|
||||
|
||||
/* Check for user match. */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: sysv_msg.c,v 1.20 1999/04/21 13:30:01 sada Exp $ */
|
||||
/* $Id: sysv_msg.c,v 1.21 1999/04/27 11:16:16 phk Exp $ */
|
||||
|
||||
/*
|
||||
* Implementation of SVID messages
|
||||
@ -178,7 +178,6 @@ msgctl(p, uap)
|
||||
int msqid = uap->msqid;
|
||||
int cmd = uap->cmd;
|
||||
struct msqid_ds *user_msqptr = uap->buf;
|
||||
struct ucred *cred = p->p_ucred;
|
||||
int rval, eval;
|
||||
struct msqid_ds msqbuf;
|
||||
register struct msqid_ds *msqptr;
|
||||
@ -220,7 +219,7 @@ msgctl(p, uap)
|
||||
case IPC_RMID:
|
||||
{
|
||||
struct msg *msghdr;
|
||||
if ((eval = ipcperm(cred, &msqptr->msg_perm, IPC_M)))
|
||||
if ((eval = ipcperm(p, &msqptr->msg_perm, IPC_M)))
|
||||
return(eval);
|
||||
/* Free the message headers */
|
||||
msghdr = msqptr->msg_first;
|
||||
@ -248,12 +247,12 @@ msgctl(p, uap)
|
||||
break;
|
||||
|
||||
case IPC_SET:
|
||||
if ((eval = ipcperm(cred, &msqptr->msg_perm, IPC_M)))
|
||||
if ((eval = ipcperm(p, &msqptr->msg_perm, IPC_M)))
|
||||
return(eval);
|
||||
if ((eval = copyin(user_msqptr, &msqbuf, sizeof(msqbuf))) != 0)
|
||||
return(eval);
|
||||
if (msqbuf.msg_qbytes > msqptr->msg_qbytes) {
|
||||
eval = suser_xxx(cred, &p->p_acflag);
|
||||
eval = suser(p);
|
||||
if (eval)
|
||||
return(eval);
|
||||
}
|
||||
@ -279,7 +278,7 @@ msgctl(p, uap)
|
||||
break;
|
||||
|
||||
case IPC_STAT:
|
||||
if ((eval = ipcperm(cred, &msqptr->msg_perm, IPC_R))) {
|
||||
if ((eval = ipcperm(p, &msqptr->msg_perm, IPC_R))) {
|
||||
#ifdef MSG_DEBUG_OK
|
||||
printf("requester doesn't have read access\n");
|
||||
#endif
|
||||
@ -340,7 +339,7 @@ msgget(p, uap)
|
||||
#endif
|
||||
return(EEXIST);
|
||||
}
|
||||
if ((eval = ipcperm(cred, &msqptr->msg_perm, msgflg & 0700 ))) {
|
||||
if ((eval = ipcperm(p, &msqptr->msg_perm, msgflg & 0700 ))) {
|
||||
#ifdef MSG_DEBUG_OK
|
||||
printf("requester doesn't have 0%o access\n",
|
||||
msgflg & 0700);
|
||||
@ -426,7 +425,6 @@ msgsnd(p, uap)
|
||||
size_t msgsz = uap->msgsz;
|
||||
int msgflg = uap->msgflg;
|
||||
int segs_needed, eval;
|
||||
struct ucred *cred = p->p_ucred;
|
||||
register struct msqid_ds *msqptr;
|
||||
register struct msg *msghdr;
|
||||
short next;
|
||||
@ -460,7 +458,7 @@ msgsnd(p, uap)
|
||||
return(EINVAL);
|
||||
}
|
||||
|
||||
if ((eval = ipcperm(cred, &msqptr->msg_perm, IPC_W))) {
|
||||
if ((eval = ipcperm(p, &msqptr->msg_perm, IPC_W))) {
|
||||
#ifdef MSG_DEBUG_OK
|
||||
printf("requester doesn't have write access\n");
|
||||
#endif
|
||||
@ -763,7 +761,6 @@ msgrcv(p, uap)
|
||||
long msgtyp = uap->msgtyp;
|
||||
int msgflg = uap->msgflg;
|
||||
size_t len;
|
||||
struct ucred *cred = p->p_ucred;
|
||||
register struct msqid_ds *msqptr;
|
||||
register struct msg *msghdr;
|
||||
int eval;
|
||||
@ -798,7 +795,7 @@ msgrcv(p, uap)
|
||||
return(EINVAL);
|
||||
}
|
||||
|
||||
if ((eval = ipcperm(cred, &msqptr->msg_perm, IPC_R))) {
|
||||
if ((eval = ipcperm(p, &msqptr->msg_perm, IPC_R))) {
|
||||
#ifdef MSG_DEBUG_OK
|
||||
printf("requester doesn't have read access\n");
|
||||
#endif
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: sysv_sem.c,v 1.21 1998/03/30 09:50:41 phk Exp $ */
|
||||
/* $Id: sysv_sem.c,v 1.22 1998/12/14 08:34:55 dillon Exp $ */
|
||||
|
||||
/*
|
||||
* Implementation of SVID semaphores
|
||||
@ -359,7 +359,7 @@ __semctl(p, uap)
|
||||
|
||||
switch (cmd) {
|
||||
case IPC_RMID:
|
||||
if ((eval = ipcperm(cred, &semaptr->sem_perm, IPC_M)))
|
||||
if ((eval = ipcperm(p, &semaptr->sem_perm, IPC_M)))
|
||||
return(eval);
|
||||
semaptr->sem_perm.cuid = cred->cr_uid;
|
||||
semaptr->sem_perm.uid = cred->cr_uid;
|
||||
@ -377,7 +377,7 @@ __semctl(p, uap)
|
||||
break;
|
||||
|
||||
case IPC_SET:
|
||||
if ((eval = ipcperm(cred, &semaptr->sem_perm, IPC_M)))
|
||||
if ((eval = ipcperm(p, &semaptr->sem_perm, IPC_M)))
|
||||
return(eval);
|
||||
if ((eval = copyin(arg, &real_arg, sizeof(real_arg))) != 0)
|
||||
return(eval);
|
||||
@ -392,7 +392,7 @@ __semctl(p, uap)
|
||||
break;
|
||||
|
||||
case IPC_STAT:
|
||||
if ((eval = ipcperm(cred, &semaptr->sem_perm, IPC_R)))
|
||||
if ((eval = ipcperm(p, &semaptr->sem_perm, IPC_R)))
|
||||
return(eval);
|
||||
if ((eval = copyin(arg, &real_arg, sizeof(real_arg))) != 0)
|
||||
return(eval);
|
||||
@ -401,7 +401,7 @@ __semctl(p, uap)
|
||||
break;
|
||||
|
||||
case GETNCNT:
|
||||
if ((eval = ipcperm(cred, &semaptr->sem_perm, IPC_R)))
|
||||
if ((eval = ipcperm(p, &semaptr->sem_perm, IPC_R)))
|
||||
return(eval);
|
||||
if (semnum < 0 || semnum >= semaptr->sem_nsems)
|
||||
return(EINVAL);
|
||||
@ -409,7 +409,7 @@ __semctl(p, uap)
|
||||
break;
|
||||
|
||||
case GETPID:
|
||||
if ((eval = ipcperm(cred, &semaptr->sem_perm, IPC_R)))
|
||||
if ((eval = ipcperm(p, &semaptr->sem_perm, IPC_R)))
|
||||
return(eval);
|
||||
if (semnum < 0 || semnum >= semaptr->sem_nsems)
|
||||
return(EINVAL);
|
||||
@ -417,7 +417,7 @@ __semctl(p, uap)
|
||||
break;
|
||||
|
||||
case GETVAL:
|
||||
if ((eval = ipcperm(cred, &semaptr->sem_perm, IPC_R)))
|
||||
if ((eval = ipcperm(p, &semaptr->sem_perm, IPC_R)))
|
||||
return(eval);
|
||||
if (semnum < 0 || semnum >= semaptr->sem_nsems)
|
||||
return(EINVAL);
|
||||
@ -425,7 +425,7 @@ __semctl(p, uap)
|
||||
break;
|
||||
|
||||
case GETALL:
|
||||
if ((eval = ipcperm(cred, &semaptr->sem_perm, IPC_R)))
|
||||
if ((eval = ipcperm(p, &semaptr->sem_perm, IPC_R)))
|
||||
return(eval);
|
||||
if ((eval = copyin(arg, &real_arg, sizeof(real_arg))) != 0)
|
||||
return(eval);
|
||||
@ -438,7 +438,7 @@ __semctl(p, uap)
|
||||
break;
|
||||
|
||||
case GETZCNT:
|
||||
if ((eval = ipcperm(cred, &semaptr->sem_perm, IPC_R)))
|
||||
if ((eval = ipcperm(p, &semaptr->sem_perm, IPC_R)))
|
||||
return(eval);
|
||||
if (semnum < 0 || semnum >= semaptr->sem_nsems)
|
||||
return(EINVAL);
|
||||
@ -446,7 +446,7 @@ __semctl(p, uap)
|
||||
break;
|
||||
|
||||
case SETVAL:
|
||||
if ((eval = ipcperm(cred, &semaptr->sem_perm, IPC_W)))
|
||||
if ((eval = ipcperm(p, &semaptr->sem_perm, IPC_W)))
|
||||
return(eval);
|
||||
if (semnum < 0 || semnum >= semaptr->sem_nsems)
|
||||
return(EINVAL);
|
||||
@ -458,7 +458,7 @@ __semctl(p, uap)
|
||||
break;
|
||||
|
||||
case SETALL:
|
||||
if ((eval = ipcperm(cred, &semaptr->sem_perm, IPC_W)))
|
||||
if ((eval = ipcperm(p, &semaptr->sem_perm, IPC_W)))
|
||||
return(eval);
|
||||
if ((eval = copyin(arg, &real_arg, sizeof(real_arg))) != 0)
|
||||
return(eval);
|
||||
@ -515,7 +515,7 @@ semget(p, uap)
|
||||
#ifdef SEM_DEBUG
|
||||
printf("found public key\n");
|
||||
#endif
|
||||
if ((eval = ipcperm(cred, &sema[semid].sem_perm,
|
||||
if ((eval = ipcperm(p, &sema[semid].sem_perm,
|
||||
semflg & 0700)))
|
||||
return(eval);
|
||||
if (nsems > 0 && sema[semid].sem_nsems < nsems) {
|
||||
@ -616,7 +616,6 @@ semop(p, uap)
|
||||
register struct sembuf *sopptr;
|
||||
register struct sem *semptr;
|
||||
struct sem_undo *suptr = NULL;
|
||||
struct ucred *cred = p->p_ucred;
|
||||
int i, j, eval;
|
||||
int do_wakeup, do_undos;
|
||||
|
||||
@ -635,7 +634,7 @@ semop(p, uap)
|
||||
if (semaptr->sem_perm.seq != IPCID_TO_SEQ(uap->semid))
|
||||
return(EINVAL);
|
||||
|
||||
if ((eval = ipcperm(cred, &semaptr->sem_perm, IPC_W))) {
|
||||
if ((eval = ipcperm(p, &semaptr->sem_perm, IPC_W))) {
|
||||
#ifdef SEM_DEBUG
|
||||
printf("eval = %d from ipaccess\n", eval);
|
||||
#endif
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: sysv_shm.c,v 1.39 1998/10/13 08:24:40 dg Exp $ */
|
||||
/* $Id: sysv_shm.c,v 1.40 1999/01/21 08:29:04 dillon Exp $ */
|
||||
/* $NetBSD: sysv_shm.c,v 1.23 1994/07/04 23:25:12 glass Exp $ */
|
||||
|
||||
/*
|
||||
@ -220,7 +220,6 @@ shmat(p, uap)
|
||||
struct shmat_args *uap;
|
||||
{
|
||||
int error, i, flags;
|
||||
struct ucred *cred = p->p_ucred;
|
||||
struct shmid_ds *shmseg;
|
||||
struct shmmap_state *shmmap_s = NULL;
|
||||
struct shm_handle *shm_handle;
|
||||
@ -240,7 +239,7 @@ shmat(p, uap)
|
||||
shmseg = shm_find_segment_by_shmid(uap->shmid);
|
||||
if (shmseg == NULL)
|
||||
return EINVAL;
|
||||
error = ipcperm(cred, &shmseg->shm_perm,
|
||||
error = ipcperm(p, &shmseg->shm_perm,
|
||||
(uap->shmflg & SHM_RDONLY) ? IPC_R : IPC_R|IPC_W);
|
||||
if (error)
|
||||
return error;
|
||||
@ -313,7 +312,6 @@ oshmctl(p, uap)
|
||||
{
|
||||
#ifdef COMPAT_43
|
||||
int error;
|
||||
struct ucred *cred = p->p_ucred;
|
||||
struct shmid_ds *shmseg;
|
||||
struct oshmid_ds outbuf;
|
||||
|
||||
@ -322,7 +320,7 @@ oshmctl(p, uap)
|
||||
return EINVAL;
|
||||
switch (uap->cmd) {
|
||||
case IPC_STAT:
|
||||
error = ipcperm(cred, &shmseg->shm_perm, IPC_R);
|
||||
error = ipcperm(p, &shmseg->shm_perm, IPC_R);
|
||||
if (error)
|
||||
return error;
|
||||
outbuf.shm_perm = shmseg->shm_perm;
|
||||
@ -362,7 +360,6 @@ shmctl(p, uap)
|
||||
struct shmctl_args *uap;
|
||||
{
|
||||
int error;
|
||||
struct ucred *cred = p->p_ucred;
|
||||
struct shmid_ds inbuf;
|
||||
struct shmid_ds *shmseg;
|
||||
|
||||
@ -371,7 +368,7 @@ shmctl(p, uap)
|
||||
return EINVAL;
|
||||
switch (uap->cmd) {
|
||||
case IPC_STAT:
|
||||
error = ipcperm(cred, &shmseg->shm_perm, IPC_R);
|
||||
error = ipcperm(p, &shmseg->shm_perm, IPC_R);
|
||||
if (error)
|
||||
return error;
|
||||
error = copyout((caddr_t)shmseg, uap->buf, sizeof(inbuf));
|
||||
@ -379,7 +376,7 @@ shmctl(p, uap)
|
||||
return error;
|
||||
break;
|
||||
case IPC_SET:
|
||||
error = ipcperm(cred, &shmseg->shm_perm, IPC_M);
|
||||
error = ipcperm(p, &shmseg->shm_perm, IPC_M);
|
||||
if (error)
|
||||
return error;
|
||||
error = copyin(uap->buf, (caddr_t)&inbuf, sizeof(inbuf));
|
||||
@ -393,7 +390,7 @@ shmctl(p, uap)
|
||||
shmseg->shm_ctime = time_second;
|
||||
break;
|
||||
case IPC_RMID:
|
||||
error = ipcperm(cred, &shmseg->shm_perm, IPC_M);
|
||||
error = ipcperm(p, &shmseg->shm_perm, IPC_M);
|
||||
if (error)
|
||||
return error;
|
||||
shmseg->shm_perm.key = IPC_PRIVATE;
|
||||
@ -429,7 +426,6 @@ shmget_existing(p, uap, mode, segnum)
|
||||
int segnum;
|
||||
{
|
||||
struct shmid_ds *shmseg;
|
||||
struct ucred *cred = p->p_ucred;
|
||||
int error;
|
||||
|
||||
shmseg = &shmsegs[segnum];
|
||||
@ -445,7 +441,7 @@ shmget_existing(p, uap, mode, segnum)
|
||||
return error;
|
||||
return EAGAIN;
|
||||
}
|
||||
error = ipcperm(cred, &shmseg->shm_perm, mode);
|
||||
error = ipcperm(p, &shmseg->shm_perm, mode);
|
||||
if (error)
|
||||
return error;
|
||||
if (uap->size && uap->size > shmseg->shm_segsz)
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)cons.c 7.2 (Berkeley) 5/9/91
|
||||
* $Id: cons.c,v 1.61 1999/01/07 14:14:11 yokota Exp $
|
||||
* $Id: cons.c,v 1.62 1999/04/27 11:14:29 phk Exp $
|
||||
*/
|
||||
|
||||
#include "opt_devfs.h"
|
||||
@ -358,7 +358,7 @@ cnioctl(dev, cmd, data, flag, p)
|
||||
* output from the "virtual" console.
|
||||
*/
|
||||
if (cmd == TIOCCONS && constty) {
|
||||
error = suser_xxx(p->p_ucred, (u_short *) NULL);
|
||||
error = suser(p);
|
||||
if (error)
|
||||
return (error);
|
||||
constty = NULL;
|
||||
|
@ -37,7 +37,7 @@
|
||||
*
|
||||
* @(#)procfs_mem.c 8.5 (Berkeley) 6/15/94
|
||||
*
|
||||
* $Id: procfs_mem.c,v 1.35 1998/10/28 13:37:00 dg Exp $
|
||||
* $Id: procfs_mem.c,v 1.36 1999/04/27 11:16:37 phk Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -331,11 +331,12 @@ int procfs_kmemaccess(curp)
|
||||
struct ucred *cred;
|
||||
|
||||
cred = curp->p_cred->pc_ucred;
|
||||
if (suser_xxx(cred, &curp->p_acflag))
|
||||
if (suser(curp))
|
||||
return 1;
|
||||
|
||||
|
||||
/* XXX: Why isn't this done with file-perms ??? */
|
||||
for (i = 0; i < cred->cr_ngroups; i++)
|
||||
if (cred->cr_groups[i] == KMEM_GROUP)
|
||||
if (cred->cr_groups[i] == KMEM_GROUP)
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
|
@ -252,7 +252,7 @@ at_pcbsetaddr(struct ddpcb *ddp, struct sockaddr *addr, struct proc *p)
|
||||
return( EINVAL );
|
||||
}
|
||||
if ( sat->sat_port < ATPORT_RESERVED &&
|
||||
suser_xxx( p->p_ucred, &p->p_acflag ) ) {
|
||||
suser(p) ) {
|
||||
return( EACCES );
|
||||
}
|
||||
}
|
||||
|
@ -252,7 +252,7 @@ at_pcbsetaddr(struct ddpcb *ddp, struct sockaddr *addr, struct proc *p)
|
||||
return( EINVAL );
|
||||
}
|
||||
if ( sat->sat_port < ATPORT_RESERVED &&
|
||||
suser_xxx( p->p_ucred, &p->p_acflag ) ) {
|
||||
suser(p) ) {
|
||||
return( EACCES );
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)ipc.h 8.4 (Berkeley) 2/19/95
|
||||
* $Id: ipc.h,v 1.11 1998/02/01 20:08:37 bde Exp $
|
||||
* $Id: ipc.h,v 1.12 1998/02/25 02:17:46 bde Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -82,9 +82,9 @@ struct ipc_perm {
|
||||
#define IPCID_TO_SEQ(id) (((id) >> 16) & 0xffff)
|
||||
#define IXSEQ_TO_IPCID(ix,perm) (((perm.seq) << 16) | (ix & 0xffff))
|
||||
|
||||
struct ucred;
|
||||
struct proc;
|
||||
|
||||
int ipcperm __P((struct ucred *, struct ipc_perm *, int));
|
||||
int ipcperm __P((struct proc *, struct ipc_perm *, int));
|
||||
#else /* ! KERNEL */
|
||||
|
||||
/* XXX doesn't really belong here, but has been historical practice in SysV. */
|
||||
|
Loading…
Reference in New Issue
Block a user