From 83451879ab213e152c6fe5c743f257ba58d7acd1 Mon Sep 17 00:00:00 2001 From: Steve French Date: Thu, 1 Dec 2005 17:12:59 -0800 Subject: [CIFS] Use fsuid (fsgid) more consistently instead of uid/gid in assembling smb requests when setuids and Linux protocol extensions enabled and in checking more matching sessions in multiuser mount mode. Pointed out by Shaggy. Signed-off-by: Steve French --- fs/cifs/CHANGES | 6 ++++++ fs/cifs/cifsfs.h | 2 +- fs/cifs/dir.c | 8 ++++---- fs/cifs/inode.c | 4 ++-- fs/cifs/misc.c | 8 ++++---- 5 files changed, 17 insertions(+), 11 deletions(-) diff --git a/fs/cifs/CHANGES b/fs/cifs/CHANGES index 943ef9b82244e..8bef2f3a41302 100644 --- a/fs/cifs/CHANGES +++ b/fs/cifs/CHANGES @@ -1,3 +1,7 @@ +Version 1.40 +------------ +Use fsuid (fsgid) more consistently instead of uid (gid). + Version 1.39 ------------ Defer close of a file handle slightly if pending writes depend on that handle @@ -7,6 +11,8 @@ Fix SFU style symlinks and mknod needed for servers which do not support the CIFS Unix Extensions. Fix setfacl/getfacl on bigendian. Timeout negative dentries so files that the client sees as deleted but that later get created on the server will be recognized. Add client side permission check on setattr. +Timeout stuck requests better (where server has never responded or sent corrupt +responses) Version 1.38 ------------ diff --git a/fs/cifs/cifsfs.h b/fs/cifs/cifsfs.h index 9ec40e0e54fc4..821a8eb225596 100644 --- a/fs/cifs/cifsfs.h +++ b/fs/cifs/cifsfs.h @@ -99,5 +99,5 @@ extern ssize_t cifs_getxattr(struct dentry *, const char *, void *, size_t); extern ssize_t cifs_listxattr(struct dentry *, char *, size_t); extern int cifs_ioctl (struct inode * inode, struct file * filep, unsigned int command, unsigned long arg); -#define CIFS_VERSION "1.39" +#define CIFS_VERSION "1.40" #endif /* _CIFSFS_H */ diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c index 32cc96cafa3eb..fed55e3c53dfa 100644 --- a/fs/cifs/dir.c +++ b/fs/cifs/dir.c @@ -3,7 +3,7 @@ * * vfs operations that deal with dentries * - * Copyright (C) International Business Machines Corp., 2002,2003 + * Copyright (C) International Business Machines Corp., 2002,2005 * Author(s): Steve French (sfrench@us.ibm.com) * * This library is free software; you can redistribute it and/or modify @@ -200,8 +200,8 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode, (oplock & CIFS_CREATE_ACTION)) if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) { CIFSSMBUnixSetPerms(xid, pTcon, full_path, mode, - (__u64)current->euid, - (__u64)current->egid, + (__u64)current->fsuid, + (__u64)current->fsgid, 0 /* dev */, cifs_sb->local_nls, cifs_sb->mnt_cifs_flags & @@ -325,7 +325,7 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, int mode, else if (pTcon->ses->capabilities & CAP_UNIX) { if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) { rc = CIFSSMBUnixSetPerms(xid, pTcon, full_path, - mode,(__u64)current->euid,(__u64)current->egid, + mode,(__u64)current->fsuid,(__u64)current->fsgid, device_number, cifs_sb->local_nls, cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c index 411c1f7f84da6..d1e9957574365 100644 --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c @@ -750,8 +750,8 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode) if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) { CIFSSMBUnixSetPerms(xid, pTcon, full_path, mode, - (__u64)current->euid, - (__u64)current->egid, + (__u64)current->fsuid, + (__u64)current->fsgid, 0 /* dev_t */, cifs_sb->local_nls, cifs_sb->mnt_cifs_flags & diff --git a/fs/cifs/misc.c b/fs/cifs/misc.c index 94baf6c8ecbda..9af37f864688f 100644 --- a/fs/cifs/misc.c +++ b/fs/cifs/misc.c @@ -1,7 +1,7 @@ /* * fs/cifs/misc.c * - * Copyright (C) International Business Machines Corp., 2002,2004 + * Copyright (C) International Business Machines Corp., 2002,2005 * Author(s): Steve French (sfrench@us.ibm.com) * * This library is free software; you can redistribute it and/or modify @@ -348,12 +348,12 @@ header_assemble(struct smb_hdr *buffer, char smb_command /* command */ , /* BB Add support for establishing new tCon and SMB Session */ /* with userid/password pairs found on the smb session */ /* for other target tcp/ip addresses BB */ - if(current->uid != treeCon->ses->linux_uid) { - cFYI(1,("Multiuser mode and UID did not match tcon uid ")); + if(current->fsuid != treeCon->ses->linux_uid) { + cFYI(1,("Multiuser mode and UID did not match tcon uid")); read_lock(&GlobalSMBSeslock); list_for_each(temp_item, &GlobalSMBSessionList) { ses = list_entry(temp_item, struct cifsSesInfo, cifsSessionList); - if(ses->linux_uid == current->uid) { + if(ses->linux_uid == current->fsuid) { if(ses->server == treeCon->ses->server) { cFYI(1,("found matching uid substitute right smb_uid")); buffer->Uid = ses->Suid; -- cgit 1.2.3-korg