ufs_chown and ufs_chmod now take cred pointers
authorKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Wed, 22 Apr 1992 02:14:07 +0000 (18:14 -0800)
committerKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Wed, 22 Apr 1992 02:14:07 +0000 (18:14 -0800)
SCCS-vsn: sys/ufs/ffs/ufs_extern.h 7.5
SCCS-vsn: sys/ufs/ufs/ufs_extern.h 7.5
SCCS-vsn: sys/ufs/ffs/ufs_vnops.c 7.84
SCCS-vsn: sys/ufs/ufs/ufs_vnops.c 7.84

usr/src/sys/ufs/ffs/ufs_extern.h
usr/src/sys/ufs/ffs/ufs_vnops.c
usr/src/sys/ufs/ufs/ufs_extern.h
usr/src/sys/ufs/ufs/ufs_vnops.c

index d907897..74a6ff5 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)ufs_extern.h        7.4 (Berkeley) %G%
+ *     @(#)ufs_extern.h        7.5 (Berkeley) %G%
  */
 
 struct buf;
  */
 
 struct buf;
@@ -35,8 +35,9 @@ int    ufs_access __P((struct vnode *, int, struct ucred *, struct proc *));
 int     ufs_advlock __P((struct vnode *, caddr_t, int, struct flock *, int));
 void    ufs_bufstats __P((void));
 int     ufs_checkpath __P((struct inode *, struct inode *, struct ucred *));
 int     ufs_advlock __P((struct vnode *, caddr_t, int, struct flock *, int));
 void    ufs_bufstats __P((void));
 int     ufs_checkpath __P((struct inode *, struct inode *, struct ucred *));
-int     ufs_chmod __P((struct vnode *, int, struct proc *));
-int     ufs_chown __P((struct vnode *, u_int, u_int, struct proc *));
+int     ufs_chmod __P((struct vnode *, int, struct ucred *, struct proc *));
+int     ufs_chown
+           __P((struct vnode *, u_int, u_int, struct ucred *, struct proc *));
 int     ufs_close __P((struct vnode *, int, struct ucred *, struct proc *));
 int     ufs_create __P((struct vnode *, struct vnode **,
                         struct componentname *, struct vattr *));
 int     ufs_close __P((struct vnode *, int, struct ucred *, struct proc *));
 int     ufs_create __P((struct vnode *, struct vnode **,
                         struct componentname *, struct vattr *));
index 7e2ea76..1905d54 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)ufs_vnops.c 7.83 (Berkeley) %G%
+ *     @(#)ufs_vnops.c 7.84 (Berkeley) %G%
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
@@ -30,8 +30,9 @@
 #include <ufs/ufs/ufsmount.h>
 #include <ufs/ufs/ufs_extern.h>
 
 #include <ufs/ufs/ufsmount.h>
 #include <ufs/ufs/ufs_extern.h>
 
-int ufs_chmod __P((struct vnode *, int, struct proc *));
-int ufs_chown __P((struct vnode *, u_int, u_int, struct proc *));
+int ufs_chmod __P((struct vnode *, int, struct ucred *, struct proc *));
+int ufs_chown
+       __P((struct vnode *, u_int, u_int, struct ucred *, struct proc *));
 
 #ifdef _NOQUAD
 #define        SETHIGH(q, h)   (q).val[_QUAD_HIGHWORD] = (h)
 
 #ifdef _NOQUAD
 #define        SETHIGH(q, h)   (q).val[_QUAD_HIGHWORD] = (h)
@@ -283,7 +284,7 @@ ufs_setattr(vp, vap, cred, p)
         * Go through the fields and update iff not VNOVAL.
         */
        if (vap->va_uid != (u_short)VNOVAL || vap->va_gid != (u_short)VNOVAL)
         * Go through the fields and update iff not VNOVAL.
         */
        if (vap->va_uid != (u_short)VNOVAL || vap->va_gid != (u_short)VNOVAL)
-               if (error = ufs_chown(vp, vap->va_uid, vap->va_gid, p))
+               if (error = ufs_chown(vp, vap->va_uid, vap->va_gid, cred, p))
                        return (error);
        if (vap->va_size != VNOVAL) {
                if (vp->v_type == VDIR)
                        return (error);
        if (vap->va_size != VNOVAL) {
                if (vp->v_type == VDIR)
@@ -306,7 +307,7 @@ ufs_setattr(vp, vap, cred, p)
        }
        error = 0;
        if (vap->va_mode != (u_short)VNOVAL)
        }
        error = 0;
        if (vap->va_mode != (u_short)VNOVAL)
-               error = ufs_chmod(vp, (int)vap->va_mode, p);
+               error = ufs_chmod(vp, (int)vap->va_mode, cred, p);
        if (vap->va_flags != VNOVAL) {
                if (cred->cr_uid != ip->i_uid &&
                    (error = suser(cred, &p->p_acflag)))
        if (vap->va_flags != VNOVAL) {
                if (cred->cr_uid != ip->i_uid &&
                    (error = suser(cred, &p->p_acflag)))
@@ -327,12 +328,12 @@ ufs_setattr(vp, vap, cred, p)
  * Inode must be locked before calling.
  */
 static int
  * Inode must be locked before calling.
  */
 static int
-ufs_chmod(vp, mode, p)
+ufs_chmod(vp, mode, cred, p)
        register struct vnode *vp;
        register int mode;
        register struct vnode *vp;
        register int mode;
+       register struct ucred *cred;
        struct proc *p;
 {
        struct proc *p;
 {
-       register struct ucred *cred = p->p_ucred;
        register struct inode *ip = VTOI(vp);
        int error;
 
        register struct inode *ip = VTOI(vp);
        int error;
 
@@ -358,14 +359,14 @@ ufs_chmod(vp, mode, p)
  * inode must be locked prior to call.
  */
 static int
  * inode must be locked prior to call.
  */
 static int
-ufs_chown(vp, uid, gid, p)
+ufs_chown(vp, uid, gid, cred, p)
        register struct vnode *vp;
        u_int uid;
        u_int gid;
        register struct vnode *vp;
        u_int uid;
        u_int gid;
+       struct ucred *cred;
        struct proc *p;
 {
        register struct inode *ip = VTOI(vp);
        struct proc *p;
 {
        register struct inode *ip = VTOI(vp);
-       register struct ucred *cred = p->p_ucred;
        uid_t ouid;
        gid_t ogid;
        int error = 0;
        uid_t ouid;
        gid_t ogid;
        int error = 0;
index d907897..74a6ff5 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)ufs_extern.h        7.4 (Berkeley) %G%
+ *     @(#)ufs_extern.h        7.5 (Berkeley) %G%
  */
 
 struct buf;
  */
 
 struct buf;
@@ -35,8 +35,9 @@ int    ufs_access __P((struct vnode *, int, struct ucred *, struct proc *));
 int     ufs_advlock __P((struct vnode *, caddr_t, int, struct flock *, int));
 void    ufs_bufstats __P((void));
 int     ufs_checkpath __P((struct inode *, struct inode *, struct ucred *));
 int     ufs_advlock __P((struct vnode *, caddr_t, int, struct flock *, int));
 void    ufs_bufstats __P((void));
 int     ufs_checkpath __P((struct inode *, struct inode *, struct ucred *));
-int     ufs_chmod __P((struct vnode *, int, struct proc *));
-int     ufs_chown __P((struct vnode *, u_int, u_int, struct proc *));
+int     ufs_chmod __P((struct vnode *, int, struct ucred *, struct proc *));
+int     ufs_chown
+           __P((struct vnode *, u_int, u_int, struct ucred *, struct proc *));
 int     ufs_close __P((struct vnode *, int, struct ucred *, struct proc *));
 int     ufs_create __P((struct vnode *, struct vnode **,
                         struct componentname *, struct vattr *));
 int     ufs_close __P((struct vnode *, int, struct ucred *, struct proc *));
 int     ufs_create __P((struct vnode *, struct vnode **,
                         struct componentname *, struct vattr *));
index 7e2ea76..1905d54 100644 (file)
@@ -4,7 +4,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)ufs_vnops.c 7.83 (Berkeley) %G%
+ *     @(#)ufs_vnops.c 7.84 (Berkeley) %G%
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
@@ -30,8 +30,9 @@
 #include <ufs/ufs/ufsmount.h>
 #include <ufs/ufs/ufs_extern.h>
 
 #include <ufs/ufs/ufsmount.h>
 #include <ufs/ufs/ufs_extern.h>
 
-int ufs_chmod __P((struct vnode *, int, struct proc *));
-int ufs_chown __P((struct vnode *, u_int, u_int, struct proc *));
+int ufs_chmod __P((struct vnode *, int, struct ucred *, struct proc *));
+int ufs_chown
+       __P((struct vnode *, u_int, u_int, struct ucred *, struct proc *));
 
 #ifdef _NOQUAD
 #define        SETHIGH(q, h)   (q).val[_QUAD_HIGHWORD] = (h)
 
 #ifdef _NOQUAD
 #define        SETHIGH(q, h)   (q).val[_QUAD_HIGHWORD] = (h)
@@ -283,7 +284,7 @@ ufs_setattr(vp, vap, cred, p)
         * Go through the fields and update iff not VNOVAL.
         */
        if (vap->va_uid != (u_short)VNOVAL || vap->va_gid != (u_short)VNOVAL)
         * Go through the fields and update iff not VNOVAL.
         */
        if (vap->va_uid != (u_short)VNOVAL || vap->va_gid != (u_short)VNOVAL)
-               if (error = ufs_chown(vp, vap->va_uid, vap->va_gid, p))
+               if (error = ufs_chown(vp, vap->va_uid, vap->va_gid, cred, p))
                        return (error);
        if (vap->va_size != VNOVAL) {
                if (vp->v_type == VDIR)
                        return (error);
        if (vap->va_size != VNOVAL) {
                if (vp->v_type == VDIR)
@@ -306,7 +307,7 @@ ufs_setattr(vp, vap, cred, p)
        }
        error = 0;
        if (vap->va_mode != (u_short)VNOVAL)
        }
        error = 0;
        if (vap->va_mode != (u_short)VNOVAL)
-               error = ufs_chmod(vp, (int)vap->va_mode, p);
+               error = ufs_chmod(vp, (int)vap->va_mode, cred, p);
        if (vap->va_flags != VNOVAL) {
                if (cred->cr_uid != ip->i_uid &&
                    (error = suser(cred, &p->p_acflag)))
        if (vap->va_flags != VNOVAL) {
                if (cred->cr_uid != ip->i_uid &&
                    (error = suser(cred, &p->p_acflag)))
@@ -327,12 +328,12 @@ ufs_setattr(vp, vap, cred, p)
  * Inode must be locked before calling.
  */
 static int
  * Inode must be locked before calling.
  */
 static int
-ufs_chmod(vp, mode, p)
+ufs_chmod(vp, mode, cred, p)
        register struct vnode *vp;
        register int mode;
        register struct vnode *vp;
        register int mode;
+       register struct ucred *cred;
        struct proc *p;
 {
        struct proc *p;
 {
-       register struct ucred *cred = p->p_ucred;
        register struct inode *ip = VTOI(vp);
        int error;
 
        register struct inode *ip = VTOI(vp);
        int error;
 
@@ -358,14 +359,14 @@ ufs_chmod(vp, mode, p)
  * inode must be locked prior to call.
  */
 static int
  * inode must be locked prior to call.
  */
 static int
-ufs_chown(vp, uid, gid, p)
+ufs_chown(vp, uid, gid, cred, p)
        register struct vnode *vp;
        u_int uid;
        u_int gid;
        register struct vnode *vp;
        u_int uid;
        u_int gid;
+       struct ucred *cred;
        struct proc *p;
 {
        register struct inode *ip = VTOI(vp);
        struct proc *p;
 {
        register struct inode *ip = VTOI(vp);
-       register struct ucred *cred = p->p_ucred;
        uid_t ouid;
        gid_t ogid;
        int error = 0;
        uid_t ouid;
        gid_t ogid;
        int error = 0;