Skip to content

Commit 8345187

Browse files
author
Steve French
committed
[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 <[email protected]>
1 parent 5666c09 commit 8345187

File tree

5 files changed

+17
-11
lines changed

5 files changed

+17
-11
lines changed

fs/cifs/CHANGES

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
Version 1.40
2+
------------
3+
Use fsuid (fsgid) more consistently instead of uid (gid).
4+
15
Version 1.39
26
------------
37
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
711
CIFS Unix Extensions. Fix setfacl/getfacl on bigendian. Timeout negative
812
dentries so files that the client sees as deleted but that later get created
913
on the server will be recognized. Add client side permission check on setattr.
14+
Timeout stuck requests better (where server has never responded or sent corrupt
15+
responses)
1016

1117
Version 1.38
1218
------------

fs/cifs/cifsfs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,5 +99,5 @@ extern ssize_t cifs_getxattr(struct dentry *, const char *, void *, size_t);
9999
extern ssize_t cifs_listxattr(struct dentry *, char *, size_t);
100100
extern int cifs_ioctl (struct inode * inode, struct file * filep,
101101
unsigned int command, unsigned long arg);
102-
#define CIFS_VERSION "1.39"
102+
#define CIFS_VERSION "1.40"
103103
#endif /* _CIFSFS_H */

fs/cifs/dir.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* vfs operations that deal with dentries
55
*
6-
* Copyright (C) International Business Machines Corp., 2002,2003
6+
* Copyright (C) International Business Machines Corp., 2002,2005
77
* Author(s): Steve French ([email protected])
88
*
99
* 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,
200200
(oplock & CIFS_CREATE_ACTION))
201201
if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) {
202202
CIFSSMBUnixSetPerms(xid, pTcon, full_path, mode,
203-
(__u64)current->euid,
204-
(__u64)current->egid,
203+
(__u64)current->fsuid,
204+
(__u64)current->fsgid,
205205
0 /* dev */,
206206
cifs_sb->local_nls,
207207
cifs_sb->mnt_cifs_flags &
@@ -325,7 +325,7 @@ int cifs_mknod(struct inode *inode, struct dentry *direntry, int mode,
325325
else if (pTcon->ses->capabilities & CAP_UNIX) {
326326
if(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) {
327327
rc = CIFSSMBUnixSetPerms(xid, pTcon, full_path,
328-
mode,(__u64)current->euid,(__u64)current->egid,
328+
mode,(__u64)current->fsuid,(__u64)current->fsgid,
329329
device_number, cifs_sb->local_nls,
330330
cifs_sb->mnt_cifs_flags &
331331
CIFS_MOUNT_MAP_SPECIAL_CHR);

fs/cifs/inode.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -750,8 +750,8 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, int mode)
750750
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_SET_UID) {
751751
CIFSSMBUnixSetPerms(xid, pTcon, full_path,
752752
mode,
753-
(__u64)current->euid,
754-
(__u64)current->egid,
753+
(__u64)current->fsuid,
754+
(__u64)current->fsgid,
755755
0 /* dev_t */,
756756
cifs_sb->local_nls,
757757
cifs_sb->mnt_cifs_flags &

fs/cifs/misc.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
* fs/cifs/misc.c
33
*
4-
* Copyright (C) International Business Machines Corp., 2002,2004
4+
* Copyright (C) International Business Machines Corp., 2002,2005
55
* Author(s): Steve French ([email protected])
66
*
77
* 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 */ ,
348348
/* BB Add support for establishing new tCon and SMB Session */
349349
/* with userid/password pairs found on the smb session */
350350
/* for other target tcp/ip addresses BB */
351-
if(current->uid != treeCon->ses->linux_uid) {
352-
cFYI(1,("Multiuser mode and UID did not match tcon uid "));
351+
if(current->fsuid != treeCon->ses->linux_uid) {
352+
cFYI(1,("Multiuser mode and UID did not match tcon uid"));
353353
read_lock(&GlobalSMBSeslock);
354354
list_for_each(temp_item, &GlobalSMBSessionList) {
355355
ses = list_entry(temp_item, struct cifsSesInfo, cifsSessionList);
356-
if(ses->linux_uid == current->uid) {
356+
if(ses->linux_uid == current->fsuid) {
357357
if(ses->server == treeCon->ses->server) {
358358
cFYI(1,("found matching uid substitute right smb_uid"));
359359
buffer->Uid = ses->Suid;

0 commit comments

Comments
 (0)