aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/cifssmb.c
diff options
context:
space:
mode:
authorSteve French <smfrench@austin.rr.com>2005-04-29 01:41:06 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-29 01:41:06 -0400
commit737b758c965a9b223ac1243ab38d9e507ac86c64 (patch)
tree9dcdaf3b573a2a27d0d43c1477a18867b144e5f4 /fs/cifs/cifssmb.c
parent6c91d362f1e1ebbd4513adb68fc79d552c11e2c0 (diff)
[PATCH] cifs: character mapping of special characters (part 3 of 3)
Signed-off-by: Steve French (sfrench@us.ibm.com) Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/cifs/cifssmb.c')
-rw-r--r--fs/cifs/cifssmb.c226
1 files changed, 108 insertions, 118 deletions
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index 237e3bf94bfe..f7c4914c3dd9 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -538,8 +538,8 @@ CIFSSMBLogoff(const int xid, struct cifsSesInfo *ses)
538} 538}
539 539
540int 540int
541CIFSSMBDelFile(const int xid, struct cifsTconInfo *tcon, 541CIFSSMBDelFile(const int xid, struct cifsTconInfo *tcon, const char *fileName,
542 const char *fileName, const struct nls_table *nls_codepage) 542 const struct nls_table *nls_codepage, int remap)
543{ 543{
544 DELETE_FILE_REQ *pSMB = NULL; 544 DELETE_FILE_REQ *pSMB = NULL;
545 DELETE_FILE_RSP *pSMBr = NULL; 545 DELETE_FILE_RSP *pSMBr = NULL;
@@ -555,9 +555,8 @@ DelFileRetry:
555 555
556 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 556 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
557 name_len = 557 name_len =
558 cifs_strtoUCS((wchar_t *) pSMB->fileName, fileName, PATH_MAX 558 cifsConvertToUCS((__u16 *) pSMB->fileName, fileName,
559 /* find define for this maxpathcomponent */ 559 PATH_MAX, nls_codepage, remap);
560 , nls_codepage);
561 name_len++; /* trailing null */ 560 name_len++; /* trailing null */
562 name_len *= 2; 561 name_len *= 2;
563 } else { /* BB improve the check for buffer overruns BB */ 562 } else { /* BB improve the check for buffer overruns BB */
@@ -589,8 +588,8 @@ DelFileRetry:
589} 588}
590 589
591int 590int
592CIFSSMBRmDir(const int xid, struct cifsTconInfo *tcon, 591CIFSSMBRmDir(const int xid, struct cifsTconInfo *tcon, const char *dirName,
593 const char *dirName, const struct nls_table *nls_codepage) 592 const struct nls_table *nls_codepage, int remap)
594{ 593{
595 DELETE_DIRECTORY_REQ *pSMB = NULL; 594 DELETE_DIRECTORY_REQ *pSMB = NULL;
596 DELETE_DIRECTORY_RSP *pSMBr = NULL; 595 DELETE_DIRECTORY_RSP *pSMBr = NULL;
@@ -606,9 +605,8 @@ RmDirRetry:
606 return rc; 605 return rc;
607 606
608 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 607 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
609 name_len = cifs_strtoUCS((wchar_t *) pSMB->DirName, dirName, PATH_MAX 608 name_len = cifsConvertToUCS((__le16 *) pSMB->DirName, dirName,
610 /* find define for this maxpathcomponent */ 609 PATH_MAX, nls_codepage, remap);
611 , nls_codepage);
612 name_len++; /* trailing null */ 610 name_len++; /* trailing null */
613 name_len *= 2; 611 name_len *= 2;
614 } else { /* BB improve the check for buffer overruns BB */ 612 } else { /* BB improve the check for buffer overruns BB */
@@ -639,7 +637,7 @@ RmDirRetry:
639 637
640int 638int
641CIFSSMBMkDir(const int xid, struct cifsTconInfo *tcon, 639CIFSSMBMkDir(const int xid, struct cifsTconInfo *tcon,
642 const char *name, const struct nls_table *nls_codepage) 640 const char *name, const struct nls_table *nls_codepage, int remap)
643{ 641{
644 int rc = 0; 642 int rc = 0;
645 CREATE_DIRECTORY_REQ *pSMB = NULL; 643 CREATE_DIRECTORY_REQ *pSMB = NULL;
@@ -655,9 +653,8 @@ MkDirRetry:
655 return rc; 653 return rc;
656 654
657 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 655 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
658 name_len = cifs_strtoUCS((wchar_t *) pSMB->DirName, name, PATH_MAX 656 name_len = cifsConvertToUCS((__u16 *) pSMB->DirName, name,
659 /* find define for this maxpathcomponent */ 657 PATH_MAX, nls_codepage, remap);
660 , nls_codepage);
661 name_len++; /* trailing null */ 658 name_len++; /* trailing null */
662 name_len *= 2; 659 name_len *= 2;
663 } else { /* BB improve the check for buffer overruns BB */ 660 } else { /* BB improve the check for buffer overruns BB */
@@ -690,7 +687,7 @@ CIFSSMBOpen(const int xid, struct cifsTconInfo *tcon,
690 const char *fileName, const int openDisposition, 687 const char *fileName, const int openDisposition,
691 const int access_flags, const int create_options, __u16 * netfid, 688 const int access_flags, const int create_options, __u16 * netfid,
692 int *pOplock, FILE_ALL_INFO * pfile_info, 689 int *pOplock, FILE_ALL_INFO * pfile_info,
693 const struct nls_table *nls_codepage) 690 const struct nls_table *nls_codepage, int remap)
694{ 691{
695 int rc = -EACCES; 692 int rc = -EACCES;
696 OPEN_REQ *pSMB = NULL; 693 OPEN_REQ *pSMB = NULL;
@@ -710,10 +707,8 @@ openRetry:
710 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 707 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
711 count = 1; /* account for one byte pad to word boundary */ 708 count = 1; /* account for one byte pad to word boundary */
712 name_len = 709 name_len =
713 cifs_strtoUCS((wchar_t *) (pSMB->fileName + 1), 710 cifsConvertToUCS((__u16 *) (pSMB->fileName + 1),
714 fileName, PATH_MAX 711 fileName, PATH_MAX, nls_codepage, remap);
715 /* find define for this maxpathcomponent */
716 , nls_codepage);
717 name_len++; /* trailing null */ 712 name_len++; /* trailing null */
718 name_len *= 2; 713 name_len *= 2;
719 pSMB->NameLength = cpu_to_le16(name_len); 714 pSMB->NameLength = cpu_to_le16(name_len);
@@ -1108,7 +1103,7 @@ CIFSSMBClose(const int xid, struct cifsTconInfo *tcon, int smb_file_id)
1108int 1103int
1109CIFSSMBRename(const int xid, struct cifsTconInfo *tcon, 1104CIFSSMBRename(const int xid, struct cifsTconInfo *tcon,
1110 const char *fromName, const char *toName, 1105 const char *fromName, const char *toName,
1111 const struct nls_table *nls_codepage) 1106 const struct nls_table *nls_codepage, int remap)
1112{ 1107{
1113 int rc = 0; 1108 int rc = 0;
1114 RENAME_REQ *pSMB = NULL; 1109 RENAME_REQ *pSMB = NULL;
@@ -1131,18 +1126,16 @@ renameRetry:
1131 1126
1132 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 1127 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
1133 name_len = 1128 name_len =
1134 cifs_strtoUCS((wchar_t *) pSMB->OldFileName, fromName, PATH_MAX 1129 cifsConvertToUCS((__u16 *) pSMB->OldFileName, fromName,
1135 /* find define for this maxpathcomponent */ 1130 PATH_MAX, nls_codepage, remap);
1136 , nls_codepage);
1137 name_len++; /* trailing null */ 1131 name_len++; /* trailing null */
1138 name_len *= 2; 1132 name_len *= 2;
1139 pSMB->OldFileName[name_len] = 0x04; /* pad */ 1133 pSMB->OldFileName[name_len] = 0x04; /* pad */
1140 /* protocol requires ASCII signature byte on Unicode string */ 1134 /* protocol requires ASCII signature byte on Unicode string */
1141 pSMB->OldFileName[name_len + 1] = 0x00; 1135 pSMB->OldFileName[name_len + 1] = 0x00;
1142 name_len2 = 1136 name_len2 =
1143 cifs_strtoUCS((wchar_t *) & pSMB-> 1137 cifsConvertToUCS((__u16 *) &pSMB->OldFileName[name_len + 2],
1144 OldFileName[name_len + 2], toName, PATH_MAX, 1138 toName, PATH_MAX, nls_codepage, remap);
1145 nls_codepage);
1146 name_len2 += 1 /* trailing null */ + 1 /* Signature word */ ; 1139 name_len2 += 1 /* trailing null */ + 1 /* Signature word */ ;
1147 name_len2 *= 2; /* convert to bytes */ 1140 name_len2 *= 2; /* convert to bytes */
1148 } else { /* BB improve the check for buffer overruns BB */ 1141 } else { /* BB improve the check for buffer overruns BB */
@@ -1182,7 +1175,8 @@ renameRetry:
1182} 1175}
1183 1176
1184int CIFSSMBRenameOpenFile(const int xid,struct cifsTconInfo *pTcon, 1177int CIFSSMBRenameOpenFile(const int xid,struct cifsTconInfo *pTcon,
1185 int netfid, char * target_name, const struct nls_table * nls_codepage) 1178 int netfid, char * target_name,
1179 const struct nls_table * nls_codepage, int remap)
1186{ 1180{
1187 struct smb_com_transaction2_sfi_req *pSMB = NULL; 1181 struct smb_com_transaction2_sfi_req *pSMB = NULL;
1188 struct smb_com_transaction2_sfi_rsp *pSMBr = NULL; 1182 struct smb_com_transaction2_sfi_rsp *pSMBr = NULL;
@@ -1227,9 +1221,11 @@ int CIFSSMBRenameOpenFile(const int xid,struct cifsTconInfo *pTcon,
1227 /* unicode only call */ 1221 /* unicode only call */
1228 if(target_name == NULL) { 1222 if(target_name == NULL) {
1229 sprintf(dummy_string,"cifs%x",pSMB->hdr.Mid); 1223 sprintf(dummy_string,"cifs%x",pSMB->hdr.Mid);
1230 len_of_str = cifs_strtoUCS((wchar_t *) rename_info->target_name, dummy_string, 24, nls_codepage); 1224 len_of_str = cifsConvertToUCS((__u16 *)rename_info->target_name,
1225 dummy_string, 24, nls_codepage, remap);
1231 } else { 1226 } else {
1232 len_of_str = cifs_strtoUCS((wchar_t *) rename_info->target_name, target_name, PATH_MAX, nls_codepage); 1227 len_of_str = cifsConvertToUCS((__u16 *)rename_info->target_name,
1228 target_name, PATH_MAX, nls_codepage, remap);
1233 } 1229 }
1234 rename_info->target_name_len = cpu_to_le32(2 * len_of_str); 1230 rename_info->target_name_len = cpu_to_le32(2 * len_of_str);
1235 count = 12 /* sizeof(struct set_file_rename) */ + (2 * len_of_str) + 2; 1231 count = 12 /* sizeof(struct set_file_rename) */ + (2 * len_of_str) + 2;
@@ -1263,7 +1259,7 @@ int CIFSSMBRenameOpenFile(const int xid,struct cifsTconInfo *pTcon,
1263int 1259int
1264CIFSSMBCopy(const int xid, struct cifsTconInfo *tcon, const char * fromName, 1260CIFSSMBCopy(const int xid, struct cifsTconInfo *tcon, const char * fromName,
1265 const __u16 target_tid, const char *toName, const int flags, 1261 const __u16 target_tid, const char *toName, const int flags,
1266 const struct nls_table *nls_codepage) 1262 const struct nls_table *nls_codepage, int remap)
1267{ 1263{
1268 int rc = 0; 1264 int rc = 0;
1269 COPY_REQ *pSMB = NULL; 1265 COPY_REQ *pSMB = NULL;
@@ -1285,18 +1281,16 @@ copyRetry:
1285 pSMB->Flags = cpu_to_le16(flags & COPY_TREE); 1281 pSMB->Flags = cpu_to_le16(flags & COPY_TREE);
1286 1282
1287 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 1283 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
1288 name_len = cifs_strtoUCS((wchar_t *) pSMB->OldFileName, 1284 name_len = cifsConvertToUCS((__u16 *) pSMB->OldFileName,
1289 fromName, 1285 fromName, PATH_MAX, nls_codepage,
1290 PATH_MAX /* find define for this maxpathcomponent */, 1286 remap);
1291 nls_codepage);
1292 name_len++; /* trailing null */ 1287 name_len++; /* trailing null */
1293 name_len *= 2; 1288 name_len *= 2;
1294 pSMB->OldFileName[name_len] = 0x04; /* pad */ 1289 pSMB->OldFileName[name_len] = 0x04; /* pad */
1295 /* protocol requires ASCII signature byte on Unicode string */ 1290 /* protocol requires ASCII signature byte on Unicode string */
1296 pSMB->OldFileName[name_len + 1] = 0x00; 1291 pSMB->OldFileName[name_len + 1] = 0x00;
1297 name_len2 = cifs_strtoUCS((wchar_t *) & pSMB-> 1292 name_len2 = cifsConvertToUCS((__u16 *)&pSMB->OldFileName[name_len + 2],
1298 OldFileName[name_len + 2], toName, PATH_MAX, 1293 toName, PATH_MAX, nls_codepage, remap);
1299 nls_codepage);
1300 name_len2 += 1 /* trailing null */ + 1 /* Signature word */ ; 1294 name_len2 += 1 /* trailing null */ + 1 /* Signature word */ ;
1301 name_len2 *= 2; /* convert to bytes */ 1295 name_len2 *= 2; /* convert to bytes */
1302 } else { /* BB improve the check for buffer overruns BB */ 1296 } else { /* BB improve the check for buffer overruns BB */
@@ -1425,7 +1419,7 @@ createSymLinkRetry:
1425int 1419int
1426CIFSUnixCreateHardLink(const int xid, struct cifsTconInfo *tcon, 1420CIFSUnixCreateHardLink(const int xid, struct cifsTconInfo *tcon,
1427 const char *fromName, const char *toName, 1421 const char *fromName, const char *toName,
1428 const struct nls_table *nls_codepage) 1422 const struct nls_table *nls_codepage, int remap)
1429{ 1423{
1430 TRANSACTION2_SPI_REQ *pSMB = NULL; 1424 TRANSACTION2_SPI_REQ *pSMB = NULL;
1431 TRANSACTION2_SPI_RSP *pSMBr = NULL; 1425 TRANSACTION2_SPI_RSP *pSMBr = NULL;
@@ -1444,9 +1438,8 @@ createHardLinkRetry:
1444 return rc; 1438 return rc;
1445 1439
1446 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 1440 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
1447 name_len = cifs_strtoUCS((wchar_t *) pSMB->FileName, toName, PATH_MAX 1441 name_len = cifsConvertToUCS((__u16 *) pSMB->FileName, toName,
1448 /* find define for this maxpathcomponent */ 1442 PATH_MAX, nls_codepage, remap);
1449 , nls_codepage);
1450 name_len++; /* trailing null */ 1443 name_len++; /* trailing null */
1451 name_len *= 2; 1444 name_len *= 2;
1452 1445
@@ -1468,9 +1461,8 @@ createHardLinkRetry:
1468 data_offset = (char *) (&pSMB->hdr.Protocol) + offset; 1461 data_offset = (char *) (&pSMB->hdr.Protocol) + offset;
1469 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 1462 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
1470 name_len_target = 1463 name_len_target =
1471 cifs_strtoUCS((wchar_t *) data_offset, fromName, PATH_MAX 1464 cifsConvertToUCS((__u16 *) data_offset, fromName, PATH_MAX,
1472 /* find define for this maxpathcomponent */ 1465 nls_codepage, remap);
1473 , nls_codepage);
1474 name_len_target++; /* trailing null */ 1466 name_len_target++; /* trailing null */
1475 name_len_target *= 2; 1467 name_len_target *= 2;
1476 } else { /* BB improve the check for buffer overruns BB */ 1468 } else { /* BB improve the check for buffer overruns BB */
@@ -1512,7 +1504,7 @@ createHardLinkRetry:
1512int 1504int
1513CIFSCreateHardLink(const int xid, struct cifsTconInfo *tcon, 1505CIFSCreateHardLink(const int xid, struct cifsTconInfo *tcon,
1514 const char *fromName, const char *toName, 1506 const char *fromName, const char *toName,
1515 const struct nls_table *nls_codepage) 1507 const struct nls_table *nls_codepage, int remap)
1516{ 1508{
1517 int rc = 0; 1509 int rc = 0;
1518 NT_RENAME_REQ *pSMB = NULL; 1510 NT_RENAME_REQ *pSMB = NULL;
@@ -1539,17 +1531,15 @@ winCreateHardLinkRetry:
1539 1531
1540 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 1532 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
1541 name_len = 1533 name_len =
1542 cifs_strtoUCS((wchar_t *) pSMB->OldFileName, fromName, PATH_MAX 1534 cifsConvertToUCS((__u16 *) pSMB->OldFileName, fromName,
1543 /* find define for this maxpathcomponent */ 1535 PATH_MAX, nls_codepage, remap);
1544 , nls_codepage);
1545 name_len++; /* trailing null */ 1536 name_len++; /* trailing null */
1546 name_len *= 2; 1537 name_len *= 2;
1547 pSMB->OldFileName[name_len] = 0; /* pad */ 1538 pSMB->OldFileName[name_len] = 0; /* pad */
1548 pSMB->OldFileName[name_len + 1] = 0x04; 1539 pSMB->OldFileName[name_len + 1] = 0x04;
1549 name_len2 = 1540 name_len2 =
1550 cifs_strtoUCS((wchar_t *) & pSMB-> 1541 cifsConvertToUCS((__u16 *)&pSMB->OldFileName[name_len + 2],
1551 OldFileName[name_len + 2], toName, PATH_MAX, 1542 toName, PATH_MAX, nls_codepage, remap);
1552 nls_codepage);
1553 name_len2 += 1 /* trailing null */ + 1 /* Signature word */ ; 1543 name_len2 += 1 /* trailing null */ + 1 /* Signature word */ ;
1554 name_len2 *= 2; /* convert to bytes */ 1544 name_len2 *= 2; /* convert to bytes */
1555 } else { /* BB improve the check for buffer overruns BB */ 1545 } else { /* BB improve the check for buffer overruns BB */
@@ -1659,6 +1649,7 @@ querySymLinkRetry:
1659 name_len = UniStrnlen((wchar_t *) ((char *) 1649 name_len = UniStrnlen((wchar_t *) ((char *)
1660 &pSMBr->hdr.Protocol +data_offset), 1650 &pSMBr->hdr.Protocol +data_offset),
1661 min_t(const int, buflen,count) / 2); 1651 min_t(const int, buflen,count) / 2);
1652 /* BB FIXME investigate remapping reserved chars here */
1662 cifs_strfromUCS_le(symlinkinfo, 1653 cifs_strfromUCS_le(symlinkinfo,
1663 (wchar_t *) ((char *)&pSMBr->hdr.Protocol + 1654 (wchar_t *) ((char *)&pSMBr->hdr.Protocol +
1664 data_offset), 1655 data_offset),
@@ -1793,7 +1784,8 @@ static void cifs_convert_ace(posix_acl_xattr_entry * ace, struct cifs_posix_ace
1793} 1784}
1794 1785
1795/* Convert ACL from CIFS POSIX wire format to local Linux POSIX ACL xattr */ 1786/* Convert ACL from CIFS POSIX wire format to local Linux POSIX ACL xattr */
1796static int cifs_copy_posix_acl(char * trgt,char * src, const int buflen,const int acl_type,const int size_of_data_area) 1787static int cifs_copy_posix_acl(char * trgt,char * src, const int buflen,
1788 const int acl_type,const int size_of_data_area)
1797{ 1789{
1798 int size = 0; 1790 int size = 0;
1799 int i; 1791 int i;
@@ -1912,7 +1904,7 @@ int
1912CIFSSMBGetPosixACL(const int xid, struct cifsTconInfo *tcon, 1904CIFSSMBGetPosixACL(const int xid, struct cifsTconInfo *tcon,
1913 const unsigned char *searchName, 1905 const unsigned char *searchName,
1914 char *acl_inf, const int buflen, const int acl_type, 1906 char *acl_inf, const int buflen, const int acl_type,
1915 const struct nls_table *nls_codepage) 1907 const struct nls_table *nls_codepage, int remap)
1916{ 1908{
1917/* SMB_QUERY_POSIX_ACL */ 1909/* SMB_QUERY_POSIX_ACL */
1918 TRANSACTION2_QPI_REQ *pSMB = NULL; 1910 TRANSACTION2_QPI_REQ *pSMB = NULL;
@@ -1932,8 +1924,8 @@ queryAclRetry:
1932 1924
1933 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 1925 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
1934 name_len = 1926 name_len =
1935 cifs_strtoUCS((wchar_t *) pSMB->FileName, searchName, PATH_MAX 1927 cifsConvertToUCS((__u16 *) pSMB->FileName, searchName,
1936 , nls_codepage); 1928 PATH_MAX, nls_codepage, remap);
1937 name_len++; /* trailing null */ 1929 name_len++; /* trailing null */
1938 name_len *= 2; 1930 name_len *= 2;
1939 pSMB->FileName[name_len] = 0; 1931 pSMB->FileName[name_len] = 0;
@@ -1997,8 +1989,9 @@ queryAclRetry:
1997int 1989int
1998CIFSSMBSetPosixACL(const int xid, struct cifsTconInfo *tcon, 1990CIFSSMBSetPosixACL(const int xid, struct cifsTconInfo *tcon,
1999 const unsigned char *fileName, 1991 const unsigned char *fileName,
2000 const char *local_acl, const int buflen, const int acl_type, 1992 const char *local_acl, const int buflen,
2001 const struct nls_table *nls_codepage) 1993 const int acl_type,
1994 const struct nls_table *nls_codepage, int remap)
2002{ 1995{
2003 struct smb_com_transaction2_spi_req *pSMB = NULL; 1996 struct smb_com_transaction2_spi_req *pSMB = NULL;
2004 struct smb_com_transaction2_spi_rsp *pSMBr = NULL; 1997 struct smb_com_transaction2_spi_rsp *pSMBr = NULL;
@@ -2016,8 +2009,8 @@ setAclRetry:
2016 return rc; 2009 return rc;
2017 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 2010 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
2018 name_len = 2011 name_len =
2019 cifs_strtoUCS((wchar_t *) pSMB->FileName, fileName, PATH_MAX 2012 cifsConvertToUCS((__u16 *) pSMB->FileName, fileName,
2020 , nls_codepage); 2013 PATH_MAX, nls_codepage, remap);
2021 name_len++; /* trailing null */ 2014 name_len++; /* trailing null */
2022 name_len *= 2; 2015 name_len *= 2;
2023 } else { /* BB improve the check for buffer overruns BB */ 2016 } else { /* BB improve the check for buffer overruns BB */
@@ -2161,7 +2154,7 @@ int
2161CIFSSMBQPathInfo(const int xid, struct cifsTconInfo *tcon, 2154CIFSSMBQPathInfo(const int xid, struct cifsTconInfo *tcon,
2162 const unsigned char *searchName, 2155 const unsigned char *searchName,
2163 FILE_ALL_INFO * pFindData, 2156 FILE_ALL_INFO * pFindData,
2164 const struct nls_table *nls_codepage) 2157 const struct nls_table *nls_codepage, int remap)
2165{ 2158{
2166/* level 263 SMB_QUERY_FILE_ALL_INFO */ 2159/* level 263 SMB_QUERY_FILE_ALL_INFO */
2167 TRANSACTION2_QPI_REQ *pSMB = NULL; 2160 TRANSACTION2_QPI_REQ *pSMB = NULL;
@@ -2180,9 +2173,8 @@ QPathInfoRetry:
2180 2173
2181 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 2174 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
2182 name_len = 2175 name_len =
2183 cifs_strtoUCS((wchar_t *) pSMB->FileName, searchName, PATH_MAX 2176 cifsConvertToUCS((__u16 *) pSMB->FileName, searchName,
2184 /* find define for this maxpathcomponent */ 2177 PATH_MAX, nls_codepage, remap);
2185 , nls_codepage);
2186 name_len++; /* trailing null */ 2178 name_len++; /* trailing null */
2187 name_len *= 2; 2179 name_len *= 2;
2188 } else { /* BB improve the check for buffer overruns BB */ 2180 } else { /* BB improve the check for buffer overruns BB */
@@ -2243,7 +2235,7 @@ int
2243CIFSSMBUnixQPathInfo(const int xid, struct cifsTconInfo *tcon, 2235CIFSSMBUnixQPathInfo(const int xid, struct cifsTconInfo *tcon,
2244 const unsigned char *searchName, 2236 const unsigned char *searchName,
2245 FILE_UNIX_BASIC_INFO * pFindData, 2237 FILE_UNIX_BASIC_INFO * pFindData,
2246 const struct nls_table *nls_codepage) 2238 const struct nls_table *nls_codepage, int remap)
2247{ 2239{
2248/* SMB_QUERY_FILE_UNIX_BASIC */ 2240/* SMB_QUERY_FILE_UNIX_BASIC */
2249 TRANSACTION2_QPI_REQ *pSMB = NULL; 2241 TRANSACTION2_QPI_REQ *pSMB = NULL;
@@ -2262,9 +2254,8 @@ UnixQPathInfoRetry:
2262 2254
2263 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 2255 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
2264 name_len = 2256 name_len =
2265 cifs_strtoUCS((wchar_t *) pSMB->FileName, searchName, PATH_MAX 2257 cifsConvertToUCS((__u16 *) pSMB->FileName, searchName,
2266 /* find define for this maxpathcomponent */ 2258 PATH_MAX, nls_codepage, remap);
2267 , nls_codepage);
2268 name_len++; /* trailing null */ 2259 name_len++; /* trailing null */
2269 name_len *= 2; 2260 name_len *= 2;
2270 } else { /* BB improve the check for buffer overruns BB */ 2261 } else { /* BB improve the check for buffer overruns BB */
@@ -2344,7 +2335,7 @@ findUniqueRetry:
2344 2335
2345 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 2336 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
2346 name_len = 2337 name_len =
2347 cifs_strtoUCS((wchar_t *) pSMB->FileName, searchName, PATH_MAX 2338 cifsConvertToUCS((wchar_t *) pSMB->FileName, searchName, PATH_MAX
2348 /* find define for this maxpathcomponent */ 2339 /* find define for this maxpathcomponent */
2349 , nls_codepage); 2340 , nls_codepage);
2350 name_len++; /* trailing null */ 2341 name_len++; /* trailing null */
@@ -2408,7 +2399,7 @@ CIFSFindFirst(const int xid, struct cifsTconInfo *tcon,
2408 const char *searchName, 2399 const char *searchName,
2409 const struct nls_table *nls_codepage, 2400 const struct nls_table *nls_codepage,
2410 __u16 * pnetfid, 2401 __u16 * pnetfid,
2411 struct cifs_search_info * psrch_inf) 2402 struct cifs_search_info * psrch_inf, int remap)
2412{ 2403{
2413/* level 257 SMB_ */ 2404/* level 257 SMB_ */
2414 TRANSACTION2_FFIRST_REQ *pSMB = NULL; 2405 TRANSACTION2_FFIRST_REQ *pSMB = NULL;
@@ -2419,7 +2410,7 @@ CIFSFindFirst(const int xid, struct cifsTconInfo *tcon,
2419 int name_len; 2410 int name_len;
2420 __u16 params, byte_count; 2411 __u16 params, byte_count;
2421 2412
2422 cFYI(1, ("In FindFirst")); 2413 cFYI(1, ("In FindFirst for %s",searchName));
2423 2414
2424findFirstRetry: 2415findFirstRetry:
2425 rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB, 2416 rc = smb_init(SMB_COM_TRANSACTION2, 15, tcon, (void **) &pSMB,
@@ -2429,12 +2420,20 @@ findFirstRetry:
2429 2420
2430 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 2421 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
2431 name_len = 2422 name_len =
2432 cifs_strtoUCS((wchar_t *) pSMB->FileName,searchName, 2423 cifsConvertToUCS((__u16 *) pSMB->FileName,searchName,
2433 PATH_MAX, nls_codepage); 2424 PATH_MAX, nls_codepage, remap);
2434 name_len++; /* trailing null */ 2425 /* We can not add the asterik earlier in case
2426 it got remapped to 0xF03A as if it were part of the
2427 directory name instead of a wildcard */
2435 name_len *= 2; 2428 name_len *= 2;
2429 pSMB->FileName[name_len] = '\\';
2430 pSMB->FileName[name_len+1] = 0;
2431 pSMB->FileName[name_len+2] = '*';
2432 pSMB->FileName[name_len+3] = 0;
2433 name_len += 4; /* now the trailing null */
2436 pSMB->FileName[name_len] = 0; /* null terminate just in case */ 2434 pSMB->FileName[name_len] = 0; /* null terminate just in case */
2437 pSMB->FileName[name_len+1] = 0; 2435 pSMB->FileName[name_len+1] = 0;
2436 name_len += 2;
2438 } else { /* BB add check for overrun of SMB buf BB */ 2437 } else { /* BB add check for overrun of SMB buf BB */
2439 name_len = strnlen(searchName, PATH_MAX); 2438 name_len = strnlen(searchName, PATH_MAX);
2440 name_len++; /* trailing null */ 2439 name_len++; /* trailing null */
@@ -2691,7 +2690,7 @@ int
2691CIFSGetSrvInodeNumber(const int xid, struct cifsTconInfo *tcon, 2690CIFSGetSrvInodeNumber(const int xid, struct cifsTconInfo *tcon,
2692 const unsigned char *searchName, 2691 const unsigned char *searchName,
2693 __u64 * inode_number, 2692 __u64 * inode_number,
2694 const struct nls_table *nls_codepage) 2693 const struct nls_table *nls_codepage, int remap)
2695{ 2694{
2696 int rc = 0; 2695 int rc = 0;
2697 TRANSACTION2_QPI_REQ *pSMB = NULL; 2696 TRANSACTION2_QPI_REQ *pSMB = NULL;
@@ -2712,8 +2711,8 @@ GetInodeNumberRetry:
2712 2711
2713 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 2712 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
2714 name_len = 2713 name_len =
2715 cifs_strtoUCS((wchar_t *) pSMB->FileName, searchName, 2714 cifsConvertToUCS((__u16 *) pSMB->FileName, searchName,
2716 PATH_MAX,nls_codepage); 2715 PATH_MAX,nls_codepage, remap);
2717 name_len++; /* trailing null */ 2716 name_len++; /* trailing null */
2718 name_len *= 2; 2717 name_len *= 2;
2719 } else { /* BB improve the check for buffer overruns BB */ 2718 } else { /* BB improve the check for buffer overruns BB */
@@ -2787,7 +2786,7 @@ CIFSGetDFSRefer(const int xid, struct cifsSesInfo *ses,
2787 const unsigned char *searchName, 2786 const unsigned char *searchName,
2788 unsigned char **targetUNCs, 2787 unsigned char **targetUNCs,
2789 unsigned int *number_of_UNC_in_array, 2788 unsigned int *number_of_UNC_in_array,
2790 const struct nls_table *nls_codepage) 2789 const struct nls_table *nls_codepage, int remap)
2791{ 2790{
2792/* TRANS2_GET_DFS_REFERRAL */ 2791/* TRANS2_GET_DFS_REFERRAL */
2793 TRANSACTION2_GET_DFS_REFER_REQ *pSMB = NULL; 2792 TRANSACTION2_GET_DFS_REFER_REQ *pSMB = NULL;
@@ -2823,10 +2822,8 @@ getDFSRetry:
2823 if (ses->capabilities & CAP_UNICODE) { 2822 if (ses->capabilities & CAP_UNICODE) {
2824 pSMB->hdr.Flags2 |= SMBFLG2_UNICODE; 2823 pSMB->hdr.Flags2 |= SMBFLG2_UNICODE;
2825 name_len = 2824 name_len =
2826 cifs_strtoUCS((wchar_t *) pSMB->RequestFileName, 2825 cifsConvertToUCS((__u16 *) pSMB->RequestFileName,
2827 searchName, PATH_MAX 2826 searchName, PATH_MAX, nls_codepage, remap);
2828 /* find define for this maxpathcomponent */
2829 , nls_codepage);
2830 name_len++; /* trailing null */ 2827 name_len++; /* trailing null */
2831 name_len *= 2; 2828 name_len *= 2;
2832 } else { /* BB improve the check for buffer overruns BB */ 2829 } else { /* BB improve the check for buffer overruns BB */
@@ -2954,8 +2951,7 @@ GetDFSRefExit:
2954} 2951}
2955 2952
2956int 2953int
2957CIFSSMBQFSInfo(const int xid, struct cifsTconInfo *tcon, 2954CIFSSMBQFSInfo(const int xid, struct cifsTconInfo *tcon, struct kstatfs *FSData)
2958 struct kstatfs *FSData, const struct nls_table *nls_codepage)
2959{ 2955{
2960/* level 0x103 SMB_QUERY_FILE_SYSTEM_INFO */ 2956/* level 0x103 SMB_QUERY_FILE_SYSTEM_INFO */
2961 TRANSACTION2_QFSI_REQ *pSMB = NULL; 2957 TRANSACTION2_QFSI_REQ *pSMB = NULL;
@@ -3038,8 +3034,7 @@ QFSInfoRetry:
3038} 3034}
3039 3035
3040int 3036int
3041CIFSSMBQFSAttributeInfo(const int xid, struct cifsTconInfo *tcon, 3037CIFSSMBQFSAttributeInfo(const int xid, struct cifsTconInfo *tcon)
3042 const struct nls_table *nls_codepage)
3043{ 3038{
3044/* level 0x105 SMB_QUERY_FILE_SYSTEM_INFO */ 3039/* level 0x105 SMB_QUERY_FILE_SYSTEM_INFO */
3045 TRANSACTION2_QFSI_REQ *pSMB = NULL; 3040 TRANSACTION2_QFSI_REQ *pSMB = NULL;
@@ -3107,8 +3102,7 @@ QFSAttributeRetry:
3107} 3102}
3108 3103
3109int 3104int
3110CIFSSMBQFSDeviceInfo(const int xid, struct cifsTconInfo *tcon, 3105CIFSSMBQFSDeviceInfo(const int xid, struct cifsTconInfo *tcon)
3111 const struct nls_table *nls_codepage)
3112{ 3106{
3113/* level 0x104 SMB_QUERY_FILE_SYSTEM_INFO */ 3107/* level 0x104 SMB_QUERY_FILE_SYSTEM_INFO */
3114 TRANSACTION2_QFSI_REQ *pSMB = NULL; 3108 TRANSACTION2_QFSI_REQ *pSMB = NULL;
@@ -3161,8 +3155,8 @@ QFSDeviceRetry:
3161 else { 3155 else {
3162 __u16 data_offset = le16_to_cpu(pSMBr->t2.DataOffset); 3156 __u16 data_offset = le16_to_cpu(pSMBr->t2.DataOffset);
3163 response_data = 3157 response_data =
3164 (FILE_SYSTEM_DEVICE_INFO 3158 (FILE_SYSTEM_DEVICE_INFO *)
3165 *) (((char *) &pSMBr->hdr.Protocol) + 3159 (((char *) &pSMBr->hdr.Protocol) +
3166 data_offset); 3160 data_offset);
3167 memcpy(&tcon->fsDevInfo, response_data, 3161 memcpy(&tcon->fsDevInfo, response_data,
3168 sizeof (FILE_SYSTEM_DEVICE_INFO)); 3162 sizeof (FILE_SYSTEM_DEVICE_INFO));
@@ -3177,8 +3171,7 @@ QFSDeviceRetry:
3177} 3171}
3178 3172
3179int 3173int
3180CIFSSMBQFSUnixInfo(const int xid, struct cifsTconInfo *tcon, 3174CIFSSMBQFSUnixInfo(const int xid, struct cifsTconInfo *tcon)
3181 const struct nls_table *nls_codepage)
3182{ 3175{
3183/* level 0x200 SMB_QUERY_CIFS_UNIX_INFO */ 3176/* level 0x200 SMB_QUERY_CIFS_UNIX_INFO */
3184 TRANSACTION2_QFSI_REQ *pSMB = NULL; 3177 TRANSACTION2_QFSI_REQ *pSMB = NULL;
@@ -3249,7 +3242,7 @@ QFSUnixRetry:
3249 3242
3250int 3243int
3251CIFSSMBQFSPosixInfo(const int xid, struct cifsTconInfo *tcon, 3244CIFSSMBQFSPosixInfo(const int xid, struct cifsTconInfo *tcon,
3252 struct kstatfs *FSData, const struct nls_table *nls_codepage) 3245 struct kstatfs *FSData)
3253{ 3246{
3254/* level 0x201 SMB_QUERY_CIFS_POSIX_INFO */ 3247/* level 0x201 SMB_QUERY_CIFS_POSIX_INFO */
3255 TRANSACTION2_QFSI_REQ *pSMB = NULL; 3248 TRANSACTION2_QFSI_REQ *pSMB = NULL;
@@ -3341,7 +3334,8 @@ QFSPosixRetry:
3341 3334
3342int 3335int
3343CIFSSMBSetEOF(const int xid, struct cifsTconInfo *tcon, const char *fileName, 3336CIFSSMBSetEOF(const int xid, struct cifsTconInfo *tcon, const char *fileName,
3344 __u64 size, int SetAllocation, const struct nls_table *nls_codepage) 3337 __u64 size, int SetAllocation,
3338 const struct nls_table *nls_codepage, int remap)
3345{ 3339{
3346 struct smb_com_transaction2_spi_req *pSMB = NULL; 3340 struct smb_com_transaction2_spi_req *pSMB = NULL;
3347 struct smb_com_transaction2_spi_rsp *pSMBr = NULL; 3341 struct smb_com_transaction2_spi_rsp *pSMBr = NULL;
@@ -3360,9 +3354,8 @@ SetEOFRetry:
3360 3354
3361 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 3355 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
3362 name_len = 3356 name_len =
3363 cifs_strtoUCS((wchar_t *) pSMB->FileName, fileName, PATH_MAX 3357 cifsConvertToUCS((__u16 *) pSMB->FileName, fileName,
3364 /* find define for this maxpathcomponent */ 3358 PATH_MAX, nls_codepage, remap);
3365 , nls_codepage);
3366 name_len++; /* trailing null */ 3359 name_len++; /* trailing null */
3367 name_len *= 2; 3360 name_len *= 2;
3368 } else { /* BB improve the check for buffer overruns BB */ 3361 } else { /* BB improve the check for buffer overruns BB */
@@ -3595,7 +3588,7 @@ CIFSSMBSetFileTimes(const int xid, struct cifsTconInfo *tcon, const FILE_BASIC_I
3595int 3588int
3596CIFSSMBSetTimes(const int xid, struct cifsTconInfo *tcon, const char *fileName, 3589CIFSSMBSetTimes(const int xid, struct cifsTconInfo *tcon, const char *fileName,
3597 const FILE_BASIC_INFO * data, 3590 const FILE_BASIC_INFO * data,
3598 const struct nls_table *nls_codepage) 3591 const struct nls_table *nls_codepage, int remap)
3599{ 3592{
3600 TRANSACTION2_SPI_REQ *pSMB = NULL; 3593 TRANSACTION2_SPI_REQ *pSMB = NULL;
3601 TRANSACTION2_SPI_RSP *pSMBr = NULL; 3594 TRANSACTION2_SPI_RSP *pSMBr = NULL;
@@ -3615,9 +3608,8 @@ SetTimesRetry:
3615 3608
3616 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 3609 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
3617 name_len = 3610 name_len =
3618 cifs_strtoUCS((wchar_t *) pSMB->FileName, fileName, PATH_MAX 3611 cifsConvertToUCS((__u16 *) pSMB->FileName, fileName,
3619 /* find define for this maxpathcomponent */ 3612 PATH_MAX, nls_codepage, remap);
3620 , nls_codepage);
3621 name_len++; /* trailing null */ 3613 name_len++; /* trailing null */
3622 name_len *= 2; 3614 name_len *= 2;
3623 } else { /* BB improve the check for buffer overruns BB */ 3615 } else { /* BB improve the check for buffer overruns BB */
@@ -3697,7 +3689,7 @@ SetAttrLgcyRetry:
3697 3689
3698 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 3690 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
3699 name_len = 3691 name_len =
3700 cifs_strtoUCS((wchar_t *) pSMB->fileName, fileName, 3692 ConvertToUCS((wchar_t *) pSMB->fileName, fileName,
3701 PATH_MAX, nls_codepage); 3693 PATH_MAX, nls_codepage);
3702 name_len++; /* trailing null */ 3694 name_len++; /* trailing null */
3703 name_len *= 2; 3695 name_len *= 2;
@@ -3727,8 +3719,9 @@ SetAttrLgcyRetry:
3727 3719
3728int 3720int
3729CIFSSMBUnixSetPerms(const int xid, struct cifsTconInfo *tcon, 3721CIFSSMBUnixSetPerms(const int xid, struct cifsTconInfo *tcon,
3730 char *fileName, __u64 mode, __u64 uid, __u64 gid, 3722 char *fileName, __u64 mode, __u64 uid, __u64 gid,
3731 dev_t device, const struct nls_table *nls_codepage) 3723 dev_t device, const struct nls_table *nls_codepage,
3724 int remap)
3732{ 3725{
3733 TRANSACTION2_SPI_REQ *pSMB = NULL; 3726 TRANSACTION2_SPI_REQ *pSMB = NULL;
3734 TRANSACTION2_SPI_RSP *pSMBr = NULL; 3727 TRANSACTION2_SPI_RSP *pSMBr = NULL;
@@ -3747,9 +3740,8 @@ setPermsRetry:
3747 3740
3748 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 3741 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
3749 name_len = 3742 name_len =
3750 cifs_strtoUCS((wchar_t *) pSMB->FileName, fileName, PATH_MAX 3743 cifsConvertToUCS((__u16 *) pSMB->FileName, fileName,
3751 /* find define for this maxpathcomponent */ 3744 PATH_MAX, nls_codepage, remap);
3752 , nls_codepage);
3753 name_len++; /* trailing null */ 3745 name_len++; /* trailing null */
3754 name_len *= 2; 3746 name_len *= 2;
3755 } else { /* BB improve the check for buffer overruns BB */ 3747 } else { /* BB improve the check for buffer overruns BB */
@@ -3872,7 +3864,7 @@ ssize_t
3872CIFSSMBQAllEAs(const int xid, struct cifsTconInfo *tcon, 3864CIFSSMBQAllEAs(const int xid, struct cifsTconInfo *tcon,
3873 const unsigned char *searchName, 3865 const unsigned char *searchName,
3874 char * EAData, size_t buf_size, 3866 char * EAData, size_t buf_size,
3875 const struct nls_table *nls_codepage) 3867 const struct nls_table *nls_codepage, int remap)
3876{ 3868{
3877 /* BB assumes one setup word */ 3869 /* BB assumes one setup word */
3878 TRANSACTION2_QPI_REQ *pSMB = NULL; 3870 TRANSACTION2_QPI_REQ *pSMB = NULL;
@@ -3893,9 +3885,8 @@ QAllEAsRetry:
3893 3885
3894 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 3886 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
3895 name_len = 3887 name_len =
3896 cifs_strtoUCS((wchar_t *) pSMB->FileName, searchName, PATH_MAX 3888 cifsConvertToUCS((wchar_t *) pSMB->FileName, searchName,
3897 /* find define for this maxpathcomponent */ 3889 PATH_MAX, nls_codepage, remap);
3898 , nls_codepage);
3899 name_len++; /* trailing null */ 3890 name_len++; /* trailing null */
3900 name_len *= 2; 3891 name_len *= 2;
3901 } else { /* BB improve the check for buffer overruns BB */ 3892 } else { /* BB improve the check for buffer overruns BB */
@@ -4017,7 +4008,7 @@ QAllEAsRetry:
4017ssize_t CIFSSMBQueryEA(const int xid,struct cifsTconInfo * tcon, 4008ssize_t CIFSSMBQueryEA(const int xid,struct cifsTconInfo * tcon,
4018 const unsigned char * searchName,const unsigned char * ea_name, 4009 const unsigned char * searchName,const unsigned char * ea_name,
4019 unsigned char * ea_value, size_t buf_size, 4010 unsigned char * ea_value, size_t buf_size,
4020 const struct nls_table *nls_codepage) 4011 const struct nls_table *nls_codepage, int remap)
4021{ 4012{
4022 TRANSACTION2_QPI_REQ *pSMB = NULL; 4013 TRANSACTION2_QPI_REQ *pSMB = NULL;
4023 TRANSACTION2_QPI_RSP *pSMBr = NULL; 4014 TRANSACTION2_QPI_RSP *pSMBr = NULL;
@@ -4037,9 +4028,8 @@ QEARetry:
4037 4028
4038 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 4029 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
4039 name_len = 4030 name_len =
4040 cifs_strtoUCS((wchar_t *) pSMB->FileName, searchName, PATH_MAX 4031 cifsConvertToUCS((__u16 *) pSMB->FileName, searchName,
4041 /* find define for this maxpathcomponent */ 4032 PATH_MAX, nls_codepage, remap);
4042 , nls_codepage);
4043 name_len++; /* trailing null */ 4033 name_len++; /* trailing null */
4044 name_len *= 2; 4034 name_len *= 2;
4045 } else { /* BB improve the check for buffer overruns BB */ 4035 } else { /* BB improve the check for buffer overruns BB */
@@ -4165,7 +4155,8 @@ QEARetry:
4165int 4155int
4166CIFSSMBSetEA(const int xid, struct cifsTconInfo *tcon, const char *fileName, 4156CIFSSMBSetEA(const int xid, struct cifsTconInfo *tcon, const char *fileName,
4167 const char * ea_name, const void * ea_value, 4157 const char * ea_name, const void * ea_value,
4168 const __u16 ea_value_len, const struct nls_table *nls_codepage) 4158 const __u16 ea_value_len, const struct nls_table *nls_codepage,
4159 int remap)
4169{ 4160{
4170 struct smb_com_transaction2_spi_req *pSMB = NULL; 4161 struct smb_com_transaction2_spi_req *pSMB = NULL;
4171 struct smb_com_transaction2_spi_rsp *pSMBr = NULL; 4162 struct smb_com_transaction2_spi_rsp *pSMBr = NULL;
@@ -4184,9 +4175,8 @@ SetEARetry:
4184 4175
4185 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) { 4176 if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
4186 name_len = 4177 name_len =
4187 cifs_strtoUCS((wchar_t *) pSMB->FileName, fileName, PATH_MAX 4178 cifsConvertToUCS((__u16 *) pSMB->FileName, fileName,
4188 /* find define for this maxpathcomponent */ 4179 PATH_MAX, nls_codepage, remap);
4189 , nls_codepage);
4190 name_len++; /* trailing null */ 4180 name_len++; /* trailing null */
4191 name_len *= 2; 4181 name_len *= 2;
4192 } else { /* BB improve the check for buffer overruns BB */ 4182 } else { /* BB improve the check for buffer overruns BB */