Commit 613b3b3f authored by Steve French's avatar Steve French

Merge bk://linux.bkbits.net/linux-2.5

into hostme.bitkeeper.com:/ua/repos/c/cifs/linux-2.5cifs
parents 5ba15264 39c13f08
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 */
...@@ -49,7 +49,7 @@ extern int SendReceive(const unsigned int /* xid */ , struct cifsSesInfo *, ...@@ -49,7 +49,7 @@ extern int SendReceive(const unsigned int /* xid */ , struct cifsSesInfo *,
extern int checkSMBhdr(struct smb_hdr *smb, __u16 mid); extern int checkSMBhdr(struct smb_hdr *smb, __u16 mid);
extern int checkSMB(struct smb_hdr *smb, __u16 mid, int length); extern int checkSMB(struct smb_hdr *smb, __u16 mid, int length);
extern int is_valid_oplock_break(struct smb_hdr *smb); extern int is_valid_oplock_break(struct smb_hdr *smb);
extern int smbCalcSize(struct smb_hdr *ptr); extern unsigned int smbCalcSize(struct smb_hdr *ptr);
extern int decode_negTokenInit(unsigned char *security_blob, int length, extern int decode_negTokenInit(unsigned char *security_blob, int length,
enum securityEnum *secType); enum securityEnum *secType);
extern int map_smb_to_linux_error(struct smb_hdr *smb); extern int map_smb_to_linux_error(struct smb_hdr *smb);
......
...@@ -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;
...@@ -136,8 +136,8 @@ cifs_reconnect(struct TCP_Server_Info *server) ...@@ -136,8 +136,8 @@ cifs_reconnect(struct TCP_Server_Info *server)
int int
cifs_demultiplex_thread(struct TCP_Server_Info *server) cifs_demultiplex_thread(struct TCP_Server_Info *server)
{ {
int length, total_read; int length;
unsigned int pdu_length; unsigned int pdu_length, total_read;
struct smb_hdr *smb_buffer = NULL; struct smb_hdr *smb_buffer = NULL;
struct msghdr smb_msg; struct msghdr smb_msg;
mm_segment_t temp_fs; mm_segment_t temp_fs;
...@@ -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,15 +224,18 @@ cifs_get_inode_info(struct inode **pinode, ...@@ -224,15 +224,18 @@ 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));
/* set default mode. will override for dirs below */
inode->i_mode = cifs_sb->mnt_file_mode;
if (findData.Attributes & ATTR_REPARSE) { if (findData.Attributes & ATTR_REPARSE) {
/* Can IFLNK be set as it basically is on windows with IFREG or IFDIR? */ /* 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;
...@@ -250,7 +253,10 @@ cifs_get_inode_info(struct inode **pinode, ...@@ -250,7 +253,10 @@ 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 "));
......
...@@ -274,12 +274,12 @@ checkSMB(struct smb_hdr *smb, __u16 mid, int length) ...@@ -274,12 +274,12 @@ checkSMB(struct smb_hdr *smb, __u16 mid, int length)
cFYI(0, cFYI(0,
("Entering checkSMB with Length: %x, smb_buf_length: %x ", ("Entering checkSMB with Length: %x, smb_buf_length: %x ",
length, ntohl(smb->smb_buf_length))); length, ntohl(smb->smb_buf_length)));
if ((length < 2 + sizeof (struct smb_hdr)) if (((unsigned int)length < 2 + sizeof (struct smb_hdr))
|| (4 + ntohl(smb->smb_buf_length) > || (4 + ntohl(smb->smb_buf_length) >
CIFS_MAX_MSGSIZE + MAX_CIFS_HDR_SIZE)) { CIFS_MAX_MSGSIZE + MAX_CIFS_HDR_SIZE)) {
if (length < 2 + sizeof (struct smb_hdr)) { if ((unsigned int)length < 2 + sizeof (struct smb_hdr)) {
cERROR(1, ("Length less than 2 + sizeof smb_hdr ")); cERROR(1, ("Length less than 2 + sizeof smb_hdr "));
if ((length >= sizeof (struct smb_hdr) - 1) if (((unsigned int)length >= sizeof (struct smb_hdr) - 1)
&& (smb->Status.CifsError != 0)) && (smb->Status.CifsError != 0))
return 0; /* some error cases do not return wct and bcc */ return 0; /* some error cases do not return wct and bcc */
...@@ -298,7 +298,7 @@ checkSMB(struct smb_hdr *smb, __u16 mid, int length) ...@@ -298,7 +298,7 @@ checkSMB(struct smb_hdr *smb, __u16 mid, int length)
return 1; return 1;
if ((4 + ntohl(smb->smb_buf_length) != smbCalcSize(smb)) if ((4 + ntohl(smb->smb_buf_length) != smbCalcSize(smb))
|| (4 + ntohl(smb->smb_buf_length) != length)) { || (4 + ntohl(smb->smb_buf_length) != (unsigned int)length)) {
return 0; return 0;
} else { } else {
cERROR(1, ("smbCalcSize %x ", smbCalcSize(smb))); cERROR(1, ("smbCalcSize %x ", smbCalcSize(smb)));
......
...@@ -791,7 +791,7 @@ ntstatus_to_dos(__u32 ntstatus, __u8 * eclass, __u16 * ecode) ...@@ -791,7 +791,7 @@ ntstatus_to_dos(__u32 ntstatus, __u8 * eclass, __u16 * ecode)
int int
map_smb_to_linux_error(struct smb_hdr *smb) map_smb_to_linux_error(struct smb_hdr *smb)
{ {
int i; unsigned int i;
int rc = -EIO; /* if transport error smb error may not be set */ int rc = -EIO; /* if transport error smb error may not be set */
__u8 smberrclass; __u8 smberrclass;
__u16 smberrcode; __u16 smberrcode;
...@@ -859,10 +859,10 @@ map_smb_to_linux_error(struct smb_hdr *smb) ...@@ -859,10 +859,10 @@ map_smb_to_linux_error(struct smb_hdr *smb)
* calculate the size of the SMB message based on the fixed header * calculate the size of the SMB message based on the fixed header
* portion, the number of word parameters and the data portion of the message * portion, the number of word parameters and the data portion of the message
*/ */
int unsigned int
smbCalcSize(struct smb_hdr *ptr) smbCalcSize(struct smb_hdr *ptr)
{ {
return (sizeof (struct smb_hdr) + (int) (2 * ptr->WordCount) + return (sizeof (struct smb_hdr) + (2 * ptr->WordCount) +
BCC(ptr)); BCC(ptr));
} }
......
...@@ -186,7 +186,7 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses, ...@@ -186,7 +186,7 @@ SendReceive(const unsigned int xid, struct cifsSesInfo *ses,
int *pbytes_returned, const int long_op) int *pbytes_returned, const int long_op)
{ {
int rc = 0; int rc = 0;
int receive_len; unsigned int receive_len;
long timeout; long timeout;
struct mid_q_entry *midQ; struct mid_q_entry *midQ;
......
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