Commit 9ea873f1 authored by Steve French's avatar Steve French Committed by Steve French

Do not generate warning on ro (read only) cifs mount option

parent 1a1af55f
Version 0.79
------------
Fix mount options for ro (readonly) ,uid, gid and file and directory mode.
Version 0.78
------------
Fix errors displayed on failed mounts to be more understandable.
Fixed various incorrect or misleading smb to posix error code mappings.
Version 0.77 Version 0.77
------------ ------------
Fix display of NTFS DFS junctions to display as symlinks. Fix display of NTFS DFS junctions to display as symlinks.
......
...@@ -24,5 +24,9 @@ struct cifs_sb_info { ...@@ -24,5 +24,9 @@ struct cifs_sb_info {
struct nls_table *local_nls; struct nls_table *local_nls;
unsigned int rsize; unsigned int rsize;
unsigned int wsize; unsigned int wsize;
uid_t mnt_uid;
gid_t mnt_gid;
mode_t mnt_file_mode;
mode_t mnt_dir_mode;
}; };
#endif /* _CIFS_FS_SB_H */ #endif /* _CIFS_FS_SB_H */
...@@ -53,7 +53,7 @@ struct smb_vol { ...@@ -53,7 +53,7 @@ struct smb_vol {
char *UNC; char *UNC;
char *UNCip; char *UNCip;
uid_t linux_uid; uid_t linux_uid;
uid_t linux_gid; gid_t linux_gid;
mode_t file_mode; mode_t file_mode;
mode_t dir_mode; mode_t dir_mode;
int rw; int rw;
...@@ -351,6 +351,10 @@ parse_mount_options(char *options, const char *devname, struct smb_vol *vol) ...@@ -351,6 +351,10 @@ parse_mount_options(char *options, const char *devname, struct smb_vol *vol)
memset(vol,0,sizeof(struct smb_vol)); memset(vol,0,sizeof(struct smb_vol));
vol->linux_uid = current->uid; /* current->euid instead? */ vol->linux_uid = current->uid; /* current->euid instead? */
vol->linux_gid = current->gid; vol->linux_gid = current->gid;
vol->dir_mode = S_IRWXUGO;
/* 2767 perms indicate mandatory locking support */
vol->file_mode = S_IALLUGO & ~(S_ISUID | S_IXGRP);
vol->rw = TRUE; vol->rw = TRUE;
if (!options) if (!options)
...@@ -466,6 +470,8 @@ parse_mount_options(char *options, const char *devname, struct smb_vol *vol) ...@@ -466,6 +470,8 @@ parse_mount_options(char *options, const char *devname, struct smb_vol *vol)
/* ignore */ /* ignore */
} else if (strnicmp(data, "rw", 2) == 0) { } else if (strnicmp(data, "rw", 2) == 0) {
vol->rw = TRUE; vol->rw = TRUE;
} else if (strnicmp(data, "ro", 2) == 0) {
vol->rw = FALSE;
} else } else
printk(KERN_WARNING "CIFS: Unknown mount option %s\n",data); printk(KERN_WARNING "CIFS: Unknown mount option %s\n",data);
} }
...@@ -929,8 +935,11 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, ...@@ -929,8 +935,11 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
cifs_sb->rsize = PAGE_CACHE_SIZE; cifs_sb->rsize = PAGE_CACHE_SIZE;
cERROR(1,("Attempt to set readsize for mount to less than one page (4096)")); cERROR(1,("Attempt to set readsize for mount to less than one page (4096)"));
} }
cifs_sb->mnt_uid = volume_info.linux_uid;
cifs_sb->mnt_gid = volume_info.linux_gid;
cifs_sb->mnt_file_mode = volume_info.file_mode;
cifs_sb->mnt_dir_mode = volume_info.dir_mode;
cFYI(1,("file mode: 0x%x dir mode: 0x%x",cifs_sb->mnt_file_mode,cifs_sb->mnt_dir_mode));
tcon = tcon =
find_unc(sin_server.sin_addr.s_addr, volume_info.UNC, find_unc(sin_server.sin_addr.s_addr, volume_info.UNC,
volume_info.username); volume_info.username);
......
...@@ -877,6 +877,8 @@ fill_in_inode(struct inode *tmp_inode, ...@@ -877,6 +877,8 @@ fill_in_inode(struct inode *tmp_inode,
FILE_DIRECTORY_INFO * pfindData, int *pobject_type) FILE_DIRECTORY_INFO * pfindData, int *pobject_type)
{ {
struct cifsInodeInfo *cifsInfo = CIFS_I(tmp_inode); struct cifsInodeInfo *cifsInfo = CIFS_I(tmp_inode);
struct cifs_sb_info *cifs_sb = CIFS_SB(tmp_inode->i_sb);
pfindData->ExtFileAttributes = pfindData->ExtFileAttributes =
le32_to_cpu(pfindData->ExtFileAttributes); le32_to_cpu(pfindData->ExtFileAttributes);
pfindData->AllocationSize = le64_to_cpu(pfindData->AllocationSize); pfindData->AllocationSize = le64_to_cpu(pfindData->AllocationSize);
...@@ -894,7 +896,13 @@ fill_in_inode(struct inode *tmp_inode, ...@@ -894,7 +896,13 @@ fill_in_inode(struct inode *tmp_inode,
cifs_NTtimeToUnix(le64_to_cpu(pfindData->ChangeTime)); cifs_NTtimeToUnix(le64_to_cpu(pfindData->ChangeTime));
/* treat dos attribute of read-only as read-only mode bit e.g. 555? */ /* treat dos attribute of read-only as read-only mode bit e.g. 555? */
/* 2767 perms - indicate mandatory locking */ /* 2767 perms - indicate mandatory locking */
tmp_inode->i_mode = S_IALLUGO & ~(S_ISUID | S_IXGRP); /* BB fill in uid and gid here? with help from winbind?
or retrieve from NTFS stream extended attribute */
tmp_inode->i_uid = cifs_sb->mnt_uid;
tmp_inode->i_gid = cifs_sb->mnt_gid;
/* set default mode. will override for dirs below */
tmp_inode->i_mode = cifs_sb->mnt_file_mode;
cFYI(0, cFYI(0,
("CIFS FFIRST: Attributes came in as 0x%x", ("CIFS FFIRST: Attributes came in as 0x%x",
pfindData->ExtFileAttributes)); pfindData->ExtFileAttributes));
...@@ -905,7 +913,7 @@ fill_in_inode(struct inode *tmp_inode, ...@@ -905,7 +913,7 @@ fill_in_inode(struct inode *tmp_inode,
} else if (pfindData->ExtFileAttributes & ATTR_DIRECTORY) { } else if (pfindData->ExtFileAttributes & ATTR_DIRECTORY) {
*pobject_type = DT_DIR; *pobject_type = DT_DIR;
/* override default perms since we do not lock dirs */ /* override default perms since we do not lock dirs */
tmp_inode->i_mode = S_IRWXUGO; tmp_inode->i_mode = cifs_sb->mnt_dir_mode;
tmp_inode->i_mode |= S_IFDIR; tmp_inode->i_mode |= S_IFDIR;
} else { } else {
*pobject_type = DT_REG; *pobject_type = DT_REG;
......
...@@ -224,16 +224,19 @@ cifs_get_inode_info(struct inode **pinode, ...@@ -224,16 +224,19 @@ cifs_get_inode_info(struct inode **pinode,
cifs_NTtimeToUnix(le64_to_cpu(findData.LastWriteTime)); cifs_NTtimeToUnix(le64_to_cpu(findData.LastWriteTime));
inode->i_ctime = inode->i_ctime =
cifs_NTtimeToUnix(le64_to_cpu(findData.ChangeTime)); cifs_NTtimeToUnix(le64_to_cpu(findData.ChangeTime));
inode->i_mode = S_IALLUGO & ~(S_ISUID | S_IXGRP); /* 2767 perms indicate mandatory locking - will override for dirs later */
cFYI(0, cFYI(0,
(" Attributes came in as 0x%x ", findData.Attributes)); (" Attributes came in as 0x%x ", findData.Attributes));
if (findData.Attributes & ATTR_REPARSE) {
/* Can IFLNK be set as it basically is on windows with IFREG or IFDIR? */ /* set default mode. will override for dirs below */
inode->i_mode = cifs_sb->mnt_file_mode;
if (findData.Attributes & ATTR_REPARSE) {
/* Can IFLNK be set as it basically is on windows with IFREG or IFDIR? */
inode->i_mode |= S_IFLNK; inode->i_mode |= S_IFLNK;
} else if (findData.Attributes & ATTR_DIRECTORY) { } else if (findData.Attributes & ATTR_DIRECTORY) {
/* override default perms since we do not do byte range locking on dirs */ /* override default perms since we do not do byte range locking on dirs */
inode->i_mode = S_IRWXUGO; inode->i_mode = cifs_sb->mnt_dir_mode;
inode->i_mode |= S_IFDIR; inode->i_mode |= S_IFDIR;
} else { } else {
inode->i_mode |= S_IFREG; inode->i_mode |= S_IFREG;
/* treat the dos attribute of read-only as read-only mode e.g. 555 */ /* treat the dos attribute of read-only as read-only mode e.g. 555 */
...@@ -250,8 +253,11 @@ cifs_get_inode_info(struct inode **pinode, ...@@ -250,8 +253,11 @@ cifs_get_inode_info(struct inode **pinode,
(unsigned long) inode->i_size, inode->i_blocks)); (unsigned long) inode->i_size, inode->i_blocks));
inode->i_nlink = le32_to_cpu(findData.NumberOfLinks); inode->i_nlink = le32_to_cpu(findData.NumberOfLinks);
/* BB fill in uid and gid here? with help from winbind? */ /* BB fill in uid and gid here? with help from winbind?
or retrieve from NTFS stream extended attribute */
inode->i_uid = cifs_sb->mnt_uid;
inode->i_gid = cifs_sb->mnt_gid;
if (S_ISREG(inode->i_mode)) { if (S_ISREG(inode->i_mode)) {
cFYI(1, (" File inode ")); cFYI(1, (" File inode "));
inode->i_op = &cifs_file_inode_ops; inode->i_op = &cifs_file_inode_ops;
......
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