patch-1.3.21 linux/fs/smbfs/inode.c

Next file: linux/fs/smbfs/proc.c
Previous file: linux/fs/smbfs/file.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v1.3.20/linux/fs/smbfs/inode.c linux/fs/smbfs/inode.c
@@ -345,13 +345,18 @@
 	if ((error = inode_change_ok(inode, attr)) < 0)
 		return error;
 
-        if (!S_ISREG(inode->i_mode))
-                return -EPERM;
+	if (((attr->ia_valid & ATTR_UID) && 
+	     (attr->ia_uid != SMB_SERVER(inode)->m.uid)))
+		return -EPERM;
 
-        if ((attr->ia_valid & (ATTR_MODE | ATTR_UID | ATTR_GID)) != 0) {
+	if (((attr->ia_valid & ATTR_GID) && 
+	     (attr->ia_uid != SMB_SERVER(inode)->m.gid)))
                 return -EPERM;
-        }
-        
+
+	if (((attr->ia_valid & ATTR_MODE) &&
+	     (attr->ia_mode & ~(S_IFREG | S_IFDIR | S_IRWXU | S_IRWXG | S_IRWXO))))
+		return -EPERM;
+
         if ((attr->ia_valid & ATTR_SIZE) != 0) {
 
                 if ((error = smb_make_open(inode, O_WRONLY)) < 0)

FUNET's LINUX-ADM group, [email protected]
TCL-scripts by Sam Shen, [email protected] with Sam's (original) version
of this