Commit e8340964 authored by Steve French's avatar Steve French Committed by Steve French

Relax requested CIFS permissions on open to simply request GENERIC_READ and...

Relax requested CIFS permissions on open to simply request GENERIC_READ and GENERIC_WRITE (instead of GENERIC_ALL which
can unnecessarily conflict with share permissions by asking implicitly for take ownership and other unneeded flags)
parent 07f4e656
...@@ -125,7 +125,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode, ...@@ -125,7 +125,7 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
int rc = -ENOENT; int rc = -ENOENT;
int xid; int xid;
int oplock = 0; int oplock = 0;
int desiredAccess = GENERIC_ALL; int desiredAccess = GENERIC_READ | GENERIC_WRITE;
__u16 fileHandle; __u16 fileHandle;
struct cifs_sb_info *cifs_sb; struct cifs_sb_info *cifs_sb;
struct cifsTconInfo *pTcon; struct cifsTconInfo *pTcon;
...@@ -150,8 +150,12 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode, ...@@ -150,8 +150,12 @@ cifs_create(struct inode *inode, struct dentry *direntry, int mode,
desiredAccess = GENERIC_READ; desiredAccess = GENERIC_READ;
else if ((nd->intent.open.flags & O_ACCMODE) == O_WRONLY) else if ((nd->intent.open.flags & O_ACCMODE) == O_WRONLY)
desiredAccess = GENERIC_WRITE; desiredAccess = GENERIC_WRITE;
else if ((nd->intent.open.flags & O_ACCMODE) == O_RDWR) else if ((nd->intent.open.flags & O_ACCMODE) == O_RDWR) {
desiredAccess = GENERIC_ALL; /* GENERIC_ALL is too much permission to request */
/* can cause unnecessary access denied on create */
/* desiredAccess = GENERIC_ALL; */
desiredAccess = GENERIC_READ | GENERIC_WRITE;
}
if((nd->intent.open.flags & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL)) if((nd->intent.open.flags & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL))
disposition = FILE_CREATE; disposition = FILE_CREATE;
......
...@@ -87,8 +87,12 @@ cifs_open(struct inode *inode, struct file *file) ...@@ -87,8 +87,12 @@ cifs_open(struct inode *inode, struct file *file)
desiredAccess = GENERIC_READ; desiredAccess = GENERIC_READ;
else if ((file->f_flags & O_ACCMODE) == O_WRONLY) else if ((file->f_flags & O_ACCMODE) == O_WRONLY)
desiredAccess = GENERIC_WRITE; desiredAccess = GENERIC_WRITE;
else if ((file->f_flags & O_ACCMODE) == O_RDWR) else if ((file->f_flags & O_ACCMODE) == O_RDWR) {
desiredAccess = GENERIC_ALL; /* GENERIC_ALL is too much permission to request */
/* can cause unnecessary access denied on create */
/* desiredAccess = GENERIC_ALL; */
desiredAccess = GENERIC_READ | GENERIC_WRITE;
}
/********************************************************************* /*********************************************************************
* open flag mapping table: * open flag mapping table:
...@@ -262,8 +266,12 @@ static int cifs_reopen_file(struct inode *inode, struct file *file) ...@@ -262,8 +266,12 @@ static int cifs_reopen_file(struct inode *inode, struct file *file)
desiredAccess = GENERIC_READ; desiredAccess = GENERIC_READ;
else if ((file->f_flags & O_ACCMODE) == O_WRONLY) else if ((file->f_flags & O_ACCMODE) == O_WRONLY)
desiredAccess = GENERIC_WRITE; desiredAccess = GENERIC_WRITE;
else if ((file->f_flags & O_ACCMODE) == O_RDWR) else if ((file->f_flags & O_ACCMODE) == O_RDWR) {
desiredAccess = GENERIC_ALL; /* GENERIC_ALL is too much permission to request */
/* can cause unnecessary access denied on create */
/* desiredAccess = GENERIC_ALL; */
desiredAccess = GENERIC_READ | GENERIC_WRITE;
}
if (oplockEnabled) if (oplockEnabled)
oplock = REQ_OPLOCK; oplock = REQ_OPLOCK;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment