Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys it is not an error if the kernel needs to clear the setuid/



details:   https://anonhg.NetBSD.org/src/rev/73d896e63c78
branches:  trunk
changeset: 778869:73d896e63c78
user:      christos <christos%NetBSD.org@localhost>
date:      Tue Apr 17 19:15:15 2012 +0000

description:
it is not an error if the kernel needs to clear the setuid/
setgid bit on write/chown/chgrp

diffstat:

 sys/kern/vfs_syscalls.c           |  14 ++++++--------
 sys/ufs/chfs/chfs_vnops.c         |  12 +++++-------
 sys/ufs/ext2fs/ext2fs_readwrite.c |  14 ++++++--------
 sys/ufs/ufs/ufs_readwrite.c       |  14 ++++++--------
 4 files changed, 23 insertions(+), 31 deletions(-)

diffs (148 lines):

diff -r 896f3160cac6 -r 73d896e63c78 sys/kern/vfs_syscalls.c
--- a/sys/kern/vfs_syscalls.c   Tue Apr 17 15:34:51 2012 +0000
+++ b/sys/kern/vfs_syscalls.c   Tue Apr 17 19:15:15 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_syscalls.c,v 1.450 2012/03/13 18:40:56 elad Exp $  */
+/*     $NetBSD: vfs_syscalls.c,v 1.451 2012/04/17 19:15:15 christos Exp $      */
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.450 2012/03/13 18:40:56 elad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.451 2012/04/17 19:15:15 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_fileassoc.h"
@@ -3360,15 +3360,13 @@
                 * group-id settings intact in that case.
                 */
                if (vattr.va_mode & S_ISUID) {
-                       error = kauth_authorize_vnode(l->l_cred,
-                           KAUTH_VNODE_RETAIN_SUID, vp, NULL, EPERM);
-                       if (error)
+                       if (kauth_authorize_vnode(l->l_cred,
+                           KAUTH_VNODE_RETAIN_SUID, vp, NULL, EPERM) != 0)
                                newmode &= ~S_ISUID;
                }
                if (vattr.va_mode & S_ISGID) {
-                       error = kauth_authorize_vnode(l->l_cred,
-                           KAUTH_VNODE_RETAIN_SGID, vp, NULL, EPERM);
-                       if (error)
+                       if (kauth_authorize_vnode(l->l_cred,
+                           KAUTH_VNODE_RETAIN_SGID, vp, NULL, EPERM) != 0)
                                newmode &= ~S_ISGID;
                }
        } else {
diff -r 896f3160cac6 -r 73d896e63c78 sys/ufs/chfs/chfs_vnops.c
--- a/sys/ufs/chfs/chfs_vnops.c Tue Apr 17 15:34:51 2012 +0000
+++ b/sys/ufs/chfs/chfs_vnops.c Tue Apr 17 19:15:15 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: chfs_vnops.c,v 1.4 2012/04/12 15:31:01 ttoth Exp $     */
+/*     $NetBSD: chfs_vnops.c,v 1.5 2012/04/17 19:15:16 christos Exp $  */
 
 /*-
  * Copyright (c) 2010 Department of Software Engineering,
@@ -969,16 +969,14 @@
        ip->iflag |= IN_CHANGE | IN_UPDATE;
        if (resid > uio->uio_resid && ap->a_cred) {
                if (ip->mode & ISUID) {
-                       error = kauth_authorize_vnode(ap->a_cred, KAUTH_VNODE_RETAIN_SUID, vp,
-                           NULL, EPERM);
-                       if (error)
+                       if (kauth_authorize_vnode(ap->a_cred,
+                           KAUTH_VNODE_RETAIN_SUID, vp, NULL, EPERM) != 0)
                                ip->mode &= ~ISUID;
                }
 
                if (ip->mode & ISGID) {
-                       error = kauth_authorize_vnode(ap->a_cred, KAUTH_VNODE_RETAIN_SGID, vp,
-                           NULL, EPERM);
-                       if (error)
+                       if (kauth_authorize_vnode(ap->a_cred,
+                           KAUTH_VNODE_RETAIN_SGID, vp, NULL, EPERM) != 0)
                                ip->mode &= ~ISGID;
                }
        }
diff -r 896f3160cac6 -r 73d896e63c78 sys/ufs/ext2fs/ext2fs_readwrite.c
--- a/sys/ufs/ext2fs/ext2fs_readwrite.c Tue Apr 17 15:34:51 2012 +0000
+++ b/sys/ufs/ext2fs/ext2fs_readwrite.c Tue Apr 17 19:15:15 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ext2fs_readwrite.c,v 1.59 2012/03/13 18:41:03 elad Exp $       */
+/*     $NetBSD: ext2fs_readwrite.c,v 1.60 2012/04/17 19:15:16 christos Exp $   */
 
 /*-
  * Copyright (c) 1993
@@ -60,7 +60,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ext2fs_readwrite.c,v 1.59 2012/03/13 18:41:03 elad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ext2fs_readwrite.c,v 1.60 2012/04/17 19:15:16 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -378,16 +378,14 @@
                ip->i_flag |= IN_ACCESS;
        if (resid > uio->uio_resid && ap->a_cred) {
                if (ip->i_e2fs_mode & ISUID) {
-                       error = kauth_authorize_vnode(ap->a_cred, KAUTH_VNODE_RETAIN_SUID, vp,
-                           NULL, EPERM);
-                       if (error)
+                       if (kauth_authorize_vnode(ap->a_cred,
+                           KAUTH_VNODE_RETAIN_SUID, vp, NULL, EPERM) != 0)
                                ip->i_e2fs_mode &= ISUID;
                }
 
                if (ip->i_e2fs_mode & ISGID) {
-                       error = kauth_authorize_vnode(ap->a_cred, KAUTH_VNODE_RETAIN_SGID, vp,
-                           NULL, EPERM);
-                       if (error)
+                       if (kauth_authorize_vnode(ap->a_cred,
+                           KAUTH_VNODE_RETAIN_SGID, vp, NULL, EPERM) != 0)
                                ip->i_e2fs_mode &= ~ISGID;
                }
        }
diff -r 896f3160cac6 -r 73d896e63c78 sys/ufs/ufs/ufs_readwrite.c
--- a/sys/ufs/ufs/ufs_readwrite.c       Tue Apr 17 15:34:51 2012 +0000
+++ b/sys/ufs/ufs/ufs_readwrite.c       Tue Apr 17 19:15:15 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ufs_readwrite.c,v 1.102 2012/03/13 18:41:14 elad Exp $ */
+/*     $NetBSD: ufs_readwrite.c,v 1.103 2012/04/17 19:15:16 christos Exp $     */
 
 /*-
  * Copyright (c) 1993
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(1, "$NetBSD: ufs_readwrite.c,v 1.102 2012/03/13 18:41:14 elad Exp $");
+__KERNEL_RCSID(1, "$NetBSD: ufs_readwrite.c,v 1.103 2012/04/17 19:15:16 christos Exp $");
 
 #ifdef LFS_READWRITE
 #define        FS                      struct lfs
@@ -512,18 +512,16 @@
                ip->i_flag |= IN_ACCESS;
        if (resid > uio->uio_resid && ap->a_cred) {
                if (ip->i_mode & ISUID) {
-                       error = kauth_authorize_vnode(ap->a_cred, KAUTH_VNODE_RETAIN_SUID, vp,
-                           NULL, EPERM);
-                       if (error) {
+                       if (kauth_authorize_vnode(ap->a_cred,
+                           KAUTH_VNODE_RETAIN_SUID, vp, NULL, EPERM) != 0) {
                                ip->i_mode &= ~ISUID;
                                DIP_ASSIGN(ip, mode, ip->i_mode);
                        }
                }
 
                if (ip->i_mode & ISGID) {
-                       error = kauth_authorize_vnode(ap->a_cred, KAUTH_VNODE_RETAIN_SGID, vp,
-                           NULL, EPERM);
-                       if (error) {
+                       if (kauth_authorize_vnode(ap->a_cred,
+                           KAUTH_VNODE_RETAIN_SGID, vp, NULL, EPERM) != 0) {
                                ip->i_mode &= ~ISGID;
                                DIP_ASSIGN(ip, mode, ip->i_mode);
                        }



Home | Main Index | Thread Index | Old Index