aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/cifssmb.c
diff options
context:
space:
mode:
authorPavel Shilovsky <pshilovsky@samba.org>2012-05-25 06:40:22 -0400
committerPavel Shilovsky <pshilovsky@samba.org>2012-07-24 13:55:04 -0400
commit68889f269b16a11866f4ec71e8177bdd0c184a3f (patch)
tree1593220a714a14fbc49502dbfa1b7402a6ab4914 /fs/cifs/cifssmb.c
parentaf4281dc22f1eb8a9503b53330ca02f57db68b25 (diff)
CIFS: Move is_path_accessible to ops struct
Signed-off-by: Pavel Shilovsky <pshilovsky@samba.org> Signed-off-by: Steve French <smfrench@gmail.com>
Diffstat (limited to 'fs/cifs/cifssmb.c')
-rw-r--r--fs/cifs/cifssmb.c60
1 files changed, 30 insertions, 30 deletions
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index af859c325db1..84a53380e124 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -3853,10 +3853,10 @@ setCifsAclRetry:
3853 3853
3854/* Legacy Query Path Information call for lookup to old servers such 3854/* Legacy Query Path Information call for lookup to old servers such
3855 as Win9x/WinME */ 3855 as Win9x/WinME */
3856int SMBQueryInformation(const unsigned int xid, struct cifs_tcon *tcon, 3856int
3857 const unsigned char *searchName, 3857SMBQueryInformation(const unsigned int xid, struct cifs_tcon *tcon,
3858 FILE_ALL_INFO *pFinfo, 3858 const char *search_name, FILE_ALL_INFO *data,
3859 const struct nls_table *nls_codepage, int remap) 3859 const struct nls_table *nls_codepage, int remap)
3860{ 3860{
3861 QUERY_INFORMATION_REQ *pSMB; 3861 QUERY_INFORMATION_REQ *pSMB;
3862 QUERY_INFORMATION_RSP *pSMBr; 3862 QUERY_INFORMATION_RSP *pSMBr;
@@ -3864,7 +3864,7 @@ int SMBQueryInformation(const unsigned int xid, struct cifs_tcon *tcon,
3864 int bytes_returned; 3864 int bytes_returned;
3865 int name_len; 3865 int name_len;
3866 3866
3867 cFYI(1, "In SMBQPath path %s", searchName); 3867 cFYI(1, "In SMBQPath path %s", search_name);
3868QInfRetry: 3868QInfRetry:
3869 rc = smb_init(SMB_COM_QUERY_INFORMATION, 0, tcon, (void **) &pSMB, 3869 rc = smb_init(SMB_COM_QUERY_INFORMATION, 0, tcon, (void **) &pSMB,
3870 (void **) &pSMBr); 3870 (void **) &pSMBr);
@@ -3874,14 +3874,14 @@ QInfRetry:
3874 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 3874 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
3875 name_len = 3875 name_len =
3876 cifsConvertToUTF16((__le16 *) pSMB->FileName, 3876 cifsConvertToUTF16((__le16 *) pSMB->FileName,
3877 searchName, PATH_MAX, nls_codepage, 3877 search_name, PATH_MAX, nls_codepage,
3878 remap); 3878 remap);
3879 name_len++; /* trailing null */ 3879 name_len++; /* trailing null */
3880 name_len *= 2; 3880 name_len *= 2;
3881 } else { 3881 } else {
3882 name_len = strnlen(searchName, PATH_MAX); 3882 name_len = strnlen(search_name, PATH_MAX);
3883 name_len++; /* trailing null */ 3883 name_len++; /* trailing null */
3884 strncpy(pSMB->FileName, searchName, name_len); 3884 strncpy(pSMB->FileName, search_name, name_len);
3885 } 3885 }
3886 pSMB->BufferFormat = 0x04; 3886 pSMB->BufferFormat = 0x04;
3887 name_len++; /* account for buffer type byte */ 3887 name_len++; /* account for buffer type byte */
@@ -3892,23 +3892,23 @@ QInfRetry:
3892 (struct smb_hdr *) pSMBr, &bytes_returned, 0); 3892 (struct smb_hdr *) pSMBr, &bytes_returned, 0);
3893 if (rc) { 3893 if (rc) {
3894 cFYI(1, "Send error in QueryInfo = %d", rc); 3894 cFYI(1, "Send error in QueryInfo = %d", rc);
3895 } else if (pFinfo) { 3895 } else if (data) {
3896 struct timespec ts; 3896 struct timespec ts;
3897 __u32 time = le32_to_cpu(pSMBr->last_write_time); 3897 __u32 time = le32_to_cpu(pSMBr->last_write_time);
3898 3898
3899 /* decode response */ 3899 /* decode response */
3900 /* BB FIXME - add time zone adjustment BB */ 3900 /* BB FIXME - add time zone adjustment BB */
3901 memset(pFinfo, 0, sizeof(FILE_ALL_INFO)); 3901 memset(data, 0, sizeof(FILE_ALL_INFO));
3902 ts.tv_nsec = 0; 3902 ts.tv_nsec = 0;
3903 ts.tv_sec = time; 3903 ts.tv_sec = time;
3904 /* decode time fields */ 3904 /* decode time fields */
3905 pFinfo->ChangeTime = cpu_to_le64(cifs_UnixTimeToNT(ts)); 3905 data->ChangeTime = cpu_to_le64(cifs_UnixTimeToNT(ts));
3906 pFinfo->LastWriteTime = pFinfo->ChangeTime; 3906 data->LastWriteTime = data->ChangeTime;
3907 pFinfo->LastAccessTime = 0; 3907 data->LastAccessTime = 0;
3908 pFinfo->AllocationSize = 3908 data->AllocationSize =
3909 cpu_to_le64(le32_to_cpu(pSMBr->size)); 3909 cpu_to_le64(le32_to_cpu(pSMBr->size));
3910 pFinfo->EndOfFile = pFinfo->AllocationSize; 3910 data->EndOfFile = data->AllocationSize;
3911 pFinfo->Attributes = 3911 data->Attributes =
3912 cpu_to_le32(le16_to_cpu(pSMBr->attr)); 3912 cpu_to_le32(le16_to_cpu(pSMBr->attr));
3913 } else 3913 } else
3914 rc = -EIO; /* bad buffer passed in */ 3914 rc = -EIO; /* bad buffer passed in */
@@ -3990,12 +3990,11 @@ QFileInfoRetry:
3990 3990
3991int 3991int
3992CIFSSMBQPathInfo(const unsigned int xid, struct cifs_tcon *tcon, 3992CIFSSMBQPathInfo(const unsigned int xid, struct cifs_tcon *tcon,
3993 const unsigned char *searchName, 3993 const char *search_name, FILE_ALL_INFO *data,
3994 FILE_ALL_INFO *pFindData,
3995 int legacy /* old style infolevel */, 3994 int legacy /* old style infolevel */,
3996 const struct nls_table *nls_codepage, int remap) 3995 const struct nls_table *nls_codepage, int remap)
3997{ 3996{
3998/* level 263 SMB_QUERY_FILE_ALL_INFO */ 3997 /* level 263 SMB_QUERY_FILE_ALL_INFO */
3999 TRANSACTION2_QPI_REQ *pSMB = NULL; 3998 TRANSACTION2_QPI_REQ *pSMB = NULL;
4000 TRANSACTION2_QPI_RSP *pSMBr = NULL; 3999 TRANSACTION2_QPI_RSP *pSMBr = NULL;
4001 int rc = 0; 4000 int rc = 0;
@@ -4003,7 +4002,7 @@ CIFSSMBQPathInfo(const unsigned int xid, struct cifs_tcon *tcon,
4003 int name_len; 4002 int name_len;
4004 __u16 params, byte_count; 4003 __u16 params, byte_count;
4005 4004
4006/* cFYI(1, "In QPathInfo path %s", searchName); */ 4005 /* cFYI(1, "In QPathInfo path %s", search_name); */
4007QPathInfoRetry: 4006QPathInfoRetry:
4008 rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB, 4007 rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB,
4009 (void **) &pSMBr); 4008 (void **) &pSMBr);
@@ -4012,14 +4011,14 @@ QPathInfoRetry:
4012 4011
4013 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 4012 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
4014 name_len = 4013 name_len =
4015 cifsConvertToUTF16((__le16 *) pSMB->FileName, searchName, 4014 cifsConvertToUTF16((__le16 *) pSMB->FileName, search_name,
4016 PATH_MAX, nls_codepage, remap); 4015 PATH_MAX, nls_codepage, remap);
4017 name_len++; /* trailing null */ 4016 name_len++; /* trailing null */
4018 name_len *= 2; 4017 name_len *= 2;
4019 } else { /* BB improve the check for buffer overruns BB */ 4018 } else { /* BB improve the check for buffer overruns BB */
4020 name_len = strnlen(searchName, PATH_MAX); 4019 name_len = strnlen(search_name, PATH_MAX);
4021 name_len++; /* trailing null */ 4020 name_len++; /* trailing null */
4022 strncpy(pSMB->FileName, searchName, name_len); 4021 strncpy(pSMB->FileName, search_name, name_len);
4023 } 4022 }
4024 4023
4025 params = 2 /* level */ + 4 /* reserved */ + name_len /* includes NUL */; 4024 params = 2 /* level */ + 4 /* reserved */ + name_len /* includes NUL */;
@@ -4064,20 +4063,21 @@ QPathInfoRetry:
4064 else if (legacy && get_bcc(&pSMBr->hdr) < 24) 4063 else if (legacy && get_bcc(&pSMBr->hdr) < 24)
4065 rc = -EIO; /* 24 or 26 expected but we do not read 4064 rc = -EIO; /* 24 or 26 expected but we do not read
4066 last field */ 4065 last field */
4067 else if (pFindData) { 4066 else if (data) {
4068 int size; 4067 int size;
4069 __u16 data_offset = le16_to_cpu(pSMBr->t2.DataOffset); 4068 __u16 data_offset = le16_to_cpu(pSMBr->t2.DataOffset);
4070 4069
4071 /* On legacy responses we do not read the last field, 4070 /*
4072 EAsize, fortunately since it varies by subdialect and 4071 * On legacy responses we do not read the last field,
4073 also note it differs on Set vs. Get, ie two bytes or 4 4072 * EAsize, fortunately since it varies by subdialect and
4074 bytes depending but we don't care here */ 4073 * also note it differs on Set vs Get, ie two bytes or 4
4074 * bytes depending but we don't care here.
4075 */
4075 if (legacy) 4076 if (legacy)
4076 size = sizeof(FILE_INFO_STANDARD); 4077 size = sizeof(FILE_INFO_STANDARD);
4077 else 4078 else
4078 size = sizeof(FILE_ALL_INFO); 4079 size = sizeof(FILE_ALL_INFO);
4079 memcpy((char *) pFindData, 4080 memcpy((char *) data, (char *) &pSMBr->hdr.Protocol +
4080 (char *) &pSMBr->hdr.Protocol +
4081 data_offset, size); 4081 data_offset, size);
4082 } else 4082 } else
4083 rc = -ENOMEM; 4083 rc = -ENOMEM;