Changeset View
Changeset View
Standalone View
Standalone View
head/sys/ufs/ffs/ffs_vnops.c
Show First 20 Lines • Show All 899 Lines • ▼ Show 20 Lines | /* XXX is uio->uio_offset the right thing here? */ | ||||
/* | /* | ||||
* If we successfully wrote any data, and we are not the superuser | * If we successfully wrote any data, and we are not the superuser | ||||
* we clear the setuid and setgid bits as a precaution against | * we clear the setuid and setgid bits as a precaution against | ||||
* tampering. | * tampering. | ||||
*/ | */ | ||||
if ((ip->i_mode & (ISUID | ISGID)) && resid > uio->uio_resid && | if ((ip->i_mode & (ISUID | ISGID)) && resid > uio->uio_resid && | ||||
ap->a_cred) { | ap->a_cred) { | ||||
if (priv_check_cred(ap->a_cred, PRIV_VFS_RETAINSUGID)) { | if (priv_check_cred(ap->a_cred, PRIV_VFS_RETAINSUGID)) { | ||||
ip->i_mode &= ~(ISUID | ISGID); | vn_seqc_write_begin(vp); | ||||
UFS_INODE_SET_MODE(ip, ip->i_mode & ~(ISUID | ISGID)); | |||||
DIP_SET(ip, i_mode, ip->i_mode); | DIP_SET(ip, i_mode, ip->i_mode); | ||||
vn_seqc_write_end(vp); | |||||
} | } | ||||
} | } | ||||
if (error) { | if (error) { | ||||
if (ioflag & IO_UNIT) { | if (ioflag & IO_UNIT) { | ||||
(void)ffs_truncate(vp, osize, | (void)ffs_truncate(vp, osize, | ||||
IO_NORMAL | (ioflag & IO_SYNC), ap->a_cred); | IO_NORMAL | (ioflag & IO_SYNC), ap->a_cred); | ||||
uio->uio_offset -= resid - uio->uio_resid; | uio->uio_offset -= resid - uio->uio_resid; | ||||
uio->uio_resid = resid; | uio->uio_resid = resid; | ||||
▲ Show 20 Lines • Show All 229 Lines • ▼ Show 20 Lines | #endif | ||||
} | } | ||||
/* | /* | ||||
* If we successfully wrote any data, and we are not the superuser | * If we successfully wrote any data, and we are not the superuser | ||||
* we clear the setuid and setgid bits as a precaution against | * we clear the setuid and setgid bits as a precaution against | ||||
* tampering. | * tampering. | ||||
*/ | */ | ||||
if ((ip->i_mode & (ISUID | ISGID)) && resid > uio->uio_resid && ucred) { | if ((ip->i_mode & (ISUID | ISGID)) && resid > uio->uio_resid && ucred) { | ||||
if (priv_check_cred(ucred, PRIV_VFS_RETAINSUGID)) { | if (priv_check_cred(ucred, PRIV_VFS_RETAINSUGID)) { | ||||
ip->i_mode &= ~(ISUID | ISGID); | vn_seqc_write_begin(vp); | ||||
UFS_INODE_SET_MODE(ip, ip->i_mode & ~(ISUID | ISGID)); | |||||
dp->di_mode = ip->i_mode; | dp->di_mode = ip->i_mode; | ||||
vn_seqc_write_end(vp); | |||||
} | } | ||||
} | } | ||||
if (error) { | if (error) { | ||||
if (ioflag & IO_UNIT) { | if (ioflag & IO_UNIT) { | ||||
(void)ffs_truncate(vp, osize, | (void)ffs_truncate(vp, osize, | ||||
IO_EXT | (ioflag&IO_SYNC), ucred); | IO_EXT | (ioflag&IO_SYNC), ucred); | ||||
uio->uio_offset -= resid - uio->uio_resid; | uio->uio_offset -= resid - uio->uio_resid; | ||||
uio->uio_resid = resid; | uio->uio_resid = resid; | ||||
▲ Show 20 Lines • Show All 661 Lines • Show Last 20 Lines |