|
@@ -4214,10 +4214,9 @@ UnixQPathInfoRetry:
|
|
/* xid, tcon, searchName and codepage are input parms, rest are returned */
|
|
/* xid, tcon, searchName and codepage are input parms, rest are returned */
|
|
int
|
|
int
|
|
CIFSFindFirst(const unsigned int xid, struct cifs_tcon *tcon,
|
|
CIFSFindFirst(const unsigned int xid, struct cifs_tcon *tcon,
|
|
- const char *searchName,
|
|
|
|
- const struct nls_table *nls_codepage,
|
|
|
|
|
|
+ const char *searchName, struct cifs_sb_info *cifs_sb,
|
|
__u16 *pnetfid, __u16 search_flags,
|
|
__u16 *pnetfid, __u16 search_flags,
|
|
- struct cifs_search_info *psrch_inf, int remap, const char dirsep)
|
|
|
|
|
|
+ struct cifs_search_info *psrch_inf, bool msearch)
|
|
{
|
|
{
|
|
/* level 257 SMB_ */
|
|
/* level 257 SMB_ */
|
|
TRANSACTION2_FFIRST_REQ *pSMB = NULL;
|
|
TRANSACTION2_FFIRST_REQ *pSMB = NULL;
|
|
@@ -4225,8 +4224,9 @@ CIFSFindFirst(const unsigned int xid, struct cifs_tcon *tcon,
|
|
T2_FFIRST_RSP_PARMS *parms;
|
|
T2_FFIRST_RSP_PARMS *parms;
|
|
int rc = 0;
|
|
int rc = 0;
|
|
int bytes_returned = 0;
|
|
int bytes_returned = 0;
|
|
- int name_len;
|
|
|
|
|
|
+ int name_len, remap;
|
|
__u16 params, byte_count;
|
|
__u16 params, byte_count;
|
|
|
|
+ struct nls_table *nls_codepage;
|
|
|
|
|
|
cFYI(1, "In FindFirst for %s", searchName);
|
|
cFYI(1, "In FindFirst for %s", searchName);
|
|
|
|
|
|
@@ -4236,6 +4236,9 @@ findFirstRetry:
|
|
if (rc)
|
|
if (rc)
|
|
return rc;
|
|
return rc;
|
|
|
|
|
|
|
|
+ nls_codepage = cifs_sb->local_nls;
|
|
|
|
+ remap = cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR;
|
|
|
|
+
|
|
if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
|
|
if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
|
|
name_len =
|
|
name_len =
|
|
cifsConvertToUTF16((__le16 *) pSMB->FileName, searchName,
|
|
cifsConvertToUTF16((__le16 *) pSMB->FileName, searchName,
|
|
@@ -4244,24 +4247,29 @@ findFirstRetry:
|
|
it got remapped to 0xF03A as if it were part of the
|
|
it got remapped to 0xF03A as if it were part of the
|
|
directory name instead of a wildcard */
|
|
directory name instead of a wildcard */
|
|
name_len *= 2;
|
|
name_len *= 2;
|
|
- pSMB->FileName[name_len] = dirsep;
|
|
|
|
- pSMB->FileName[name_len+1] = 0;
|
|
|
|
- pSMB->FileName[name_len+2] = '*';
|
|
|
|
- pSMB->FileName[name_len+3] = 0;
|
|
|
|
- name_len += 4; /* now the trailing null */
|
|
|
|
- pSMB->FileName[name_len] = 0; /* null terminate just in case */
|
|
|
|
- pSMB->FileName[name_len+1] = 0;
|
|
|
|
- name_len += 2;
|
|
|
|
|
|
+ if (msearch) {
|
|
|
|
+ pSMB->FileName[name_len] = CIFS_DIR_SEP(cifs_sb);
|
|
|
|
+ pSMB->FileName[name_len+1] = 0;
|
|
|
|
+ pSMB->FileName[name_len+2] = '*';
|
|
|
|
+ pSMB->FileName[name_len+3] = 0;
|
|
|
|
+ name_len += 4; /* now the trailing null */
|
|
|
|
+ /* null terminate just in case */
|
|
|
|
+ pSMB->FileName[name_len] = 0;
|
|
|
|
+ pSMB->FileName[name_len+1] = 0;
|
|
|
|
+ name_len += 2;
|
|
|
|
+ }
|
|
} else { /* BB add check for overrun of SMB buf BB */
|
|
} else { /* BB add check for overrun of SMB buf BB */
|
|
name_len = strnlen(searchName, PATH_MAX);
|
|
name_len = strnlen(searchName, PATH_MAX);
|
|
/* BB fix here and in unicode clause above ie
|
|
/* BB fix here and in unicode clause above ie
|
|
if (name_len > buffersize-header)
|
|
if (name_len > buffersize-header)
|
|
free buffer exit; BB */
|
|
free buffer exit; BB */
|
|
strncpy(pSMB->FileName, searchName, name_len);
|
|
strncpy(pSMB->FileName, searchName, name_len);
|
|
- pSMB->FileName[name_len] = dirsep;
|
|
|
|
- pSMB->FileName[name_len+1] = '*';
|
|
|
|
- pSMB->FileName[name_len+2] = 0;
|
|
|
|
- name_len += 3;
|
|
|
|
|
|
+ if (msearch) {
|
|
|
|
+ pSMB->FileName[name_len] = CIFS_DIR_SEP(cifs_sb);
|
|
|
|
+ pSMB->FileName[name_len+1] = '*';
|
|
|
|
+ pSMB->FileName[name_len+2] = 0;
|
|
|
|
+ name_len += 3;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
params = 12 + name_len /* includes null */ ;
|
|
params = 12 + name_len /* includes null */ ;
|
|
@@ -4349,7 +4357,8 @@ findFirstRetry:
|
|
psrch_inf->last_entry = psrch_inf->srch_entries_start +
|
|
psrch_inf->last_entry = psrch_inf->srch_entries_start +
|
|
lnoff;
|
|
lnoff;
|
|
|
|
|
|
- *pnetfid = parms->SearchHandle;
|
|
|
|
|
|
+ if (pnetfid)
|
|
|
|
+ *pnetfid = parms->SearchHandle;
|
|
} else {
|
|
} else {
|
|
cifs_buf_release(pSMB);
|
|
cifs_buf_release(pSMB);
|
|
}
|
|
}
|