PERFORCE change 110129 for review
Todd Miller
millert at FreeBSD.org
Thu Nov 16 21:32:40 UTC 2006
http://perforce.freebsd.org/chv.cgi?CH=110129
Change 110129 by millert at millert_macbook on 2006/11/16 21:31:41
Add missing call to mac_vnode_check_truncate() for F_SETSIZE fcntl.
Affected files ...
.. //depot/projects/trustedbsd/sedarwin8/darwin/xnu/bsd/kern/kern_descrip.c#8 edit
Differences ...
==== //depot/projects/trustedbsd/sedarwin8/darwin/xnu/bsd/kern/kern_descrip.c#8 (text+ko) ====
@@ -677,26 +677,35 @@
if (error)
goto outdrop;
+ vp = (struct vnode *)fp->f_data;
+ error = vnode_getwithref(vp);
+ if (error)
+ goto outdrop;
+
+#ifdef MAC
+ error = mac_vnode_check_truncate(proc_ucred(p),
+ vfs_context_ucred(&context), vp);
+ if (error) {
+ (void)vnode_put(vp);
+ goto outdrop;
+ }
+#endif
/*
* Make sure that we are root. Growing a file
* without zero filling the data is a security hole
* root would have access anyway so we'll allow it
*/
-
if (!is_suser()) {
error = EACCES;
- goto outdrop;
- }
- vp = (struct vnode *)fp->f_data;
-
- if ( (error = vnode_getwithref(vp)) == 0 ) {
- /*
+ } else {
+ /*
* set the file size
*/
- error = vnode_setsize(vp, offset, IO_NOZEROFILL, &context);
+ error = vnode_setsize(vp, offset, IO_NOZEROFILL,
+ &context);
+ }
- (void)vnode_put(vp);
- }
+ (void)vnode_put(vp);
goto outdrop;
case F_RDAHEAD:
More information about the trustedbsd-cvs
mailing list