projects
/
unix-history
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
new terminal driver
[unix-history]
/
usr
/
src
/
sys
/
kern
/
vfs_syscalls.c
diff --git
a/usr/src/sys/kern/vfs_syscalls.c
b/usr/src/sys/kern/vfs_syscalls.c
index
2d2d27a
..
a5e4d5d
100644
(file)
--- a/
usr/src/sys/kern/vfs_syscalls.c
+++ b/
usr/src/sys/kern/vfs_syscalls.c
@@
-1,9
+1,9
@@
/*
/*
- * Copyright (c) 1982 Regents of the University of California.
+ * Copyright (c) 1982
, 1986
Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*
- * @(#)vfs_syscalls.c
6.22
(Berkeley) %G%
+ * @(#)vfs_syscalls.c
7.3
(Berkeley) %G%
*/
#include "param.h"
*/
#include "param.h"
@@
-601,7
+601,7
@@
chown()
int gid;
} *uap = (struct a *)u.u_ap;
int gid;
} *uap = (struct a *)u.u_ap;
- if (
!suser() ||
(ip = owner(uap->fname, NOFOLLOW)) == NULL)
+ if ((ip = owner(uap->fname, NOFOLLOW)) == NULL)
return;
u.u_error = chown1(ip, uap->uid, uap->gid);
iput(ip);
return;
u.u_error = chown1(ip, uap->uid, uap->gid);
iput(ip);
@@
-624,8
+624,6
@@
fchown()
if (fp == NULL)
return;
ip = (struct inode *)fp->f_data;
if (fp == NULL)
return;
ip = (struct inode *)fp->f_data;
- if (!suser())
- return;
ILOCK(ip);
u.u_error = chown1(ip, uap->uid, uap->gid);
IUNLOCK(ip);
ILOCK(ip);
u.u_error = chown1(ip, uap->uid, uap->gid);
IUNLOCK(ip);
@@
-649,6
+647,10
@@
chown1(ip, uid, gid)
uid = ip->i_uid;
if (gid == -1)
gid = ip->i_gid;
uid = ip->i_uid;
if (gid == -1)
gid = ip->i_gid;
+ if (uid != ip->i_uid && !suser())
+ return (u.u_error);
+ if (gid != ip->i_gid && !groupmember((gid_t)gid) && !suser())
+ return (u.u_error);
#ifdef QUOTA
if (ip->i_uid == uid) /* this just speeds things a little */
change = 0;
#ifdef QUOTA
if (ip->i_uid == uid) /* this just speeds things a little */
change = 0;
@@
-713,7
+715,7
@@
truncate()
{
struct a {
char *fname;
{
struct a {
char *fname;
-
u_long
length;
+
off_t
length;
} *uap = (struct a *)u.u_ap;
struct inode *ip;
register struct nameidata *ndp = &u.u_nd;
} *uap = (struct a *)u.u_ap;
struct inode *ip;
register struct nameidata *ndp = &u.u_nd;
@@
-730,7
+732,7
@@
truncate()
u.u_error = EISDIR;
goto bad;
}
u.u_error = EISDIR;
goto bad;
}
- itrunc(ip, uap->length);
+ itrunc(ip,
(u_long)
uap->length);
bad:
iput(ip);
}
bad:
iput(ip);
}
@@
-742,7
+744,7
@@
ftruncate()
{
struct a {
int fd;
{
struct a {
int fd;
-
u_long
length;
+
off_t
length;
} *uap = (struct a *)u.u_ap;
struct inode *ip;
struct file *fp;
} *uap = (struct a *)u.u_ap;
struct inode *ip;
struct file *fp;
@@
-756,7
+758,7
@@
ftruncate()
}
ip = (struct inode *)fp->f_data;
ILOCK(ip);
}
ip = (struct inode *)fp->f_data;
ILOCK(ip);
- itrunc(ip, uap->length);
+ itrunc(ip,
(u_long)
uap->length);
IUNLOCK(ip);
}
IUNLOCK(ip);
}
@@
-776,6
+778,8
@@
fsync()
return;
ip = (struct inode *)fp->f_data;
ILOCK(ip);
return;
ip = (struct inode *)fp->f_data;
ILOCK(ip);
+ if (fp->f_flag&FWRITE)
+ ip->i_flag |= ICHG;
syncip(ip);
IUNLOCK(ip);
}
syncip(ip);
IUNLOCK(ip);
}
@@
-1109,7
+1113,7
@@
maknode(mode, ndp)
ip->i_nlink = 1;
ip->i_uid = u.u_uid;
ip->i_gid = pdir->i_gid;
ip->i_nlink = 1;
ip->i_uid = u.u_uid;
ip->i_gid = pdir->i_gid;
- if (ip->i_mode & ISGID && !groupmember(ip->i_gid))
+ if (ip->i_mode & ISGID && !groupmember(ip->i_gid)
&& !suser()
)
ip->i_mode &= ~ISGID;
#ifdef QUOTA
ip->i_dquot = inoquota(ip);
ip->i_mode &= ~ISGID;
#ifdef QUOTA
ip->i_dquot = inoquota(ip);