[CIFS] Cleanup sparse warnings for unicode little endian casts
Following Shaggy's suggestion, do a better job on the unicode string handling routines in cifs in specifying that the wchar_t are really little endian widechars (__le16). Signed-off-by: Steve French <sfrench@us.ibm.com>
This commit is contained in:
parent
8b94bcb923
commit
e89dc92096
|
@ -1,7 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* fs/cifs/cifs_unicode.c
|
* fs/cifs/cifs_unicode.c
|
||||||
*
|
*
|
||||||
* Copyright (c) International Business Machines Corp., 2000,2002
|
* Copyright (c) International Business Machines Corp., 2000,2005
|
||||||
* Modified by Steve French (sfrench@us.ibm.com)
|
* Modified by Steve French (sfrench@us.ibm.com)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
@ -31,7 +31,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
cifs_strfromUCS_le(char *to, const wchar_t * from, /* LITTLE ENDIAN */
|
cifs_strfromUCS_le(char *to, const __le16 * from,
|
||||||
int len, const struct nls_table *codepage)
|
int len, const struct nls_table *codepage)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -60,25 +60,26 @@ cifs_strfromUCS_le(char *to, const wchar_t * from, /* LITTLE ENDIAN */
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
cifs_strtoUCS(wchar_t * to, const char *from, int len,
|
cifs_strtoUCS(__le16 * to, const char *from, int len,
|
||||||
const struct nls_table *codepage)
|
const struct nls_table *codepage)
|
||||||
{
|
{
|
||||||
int charlen;
|
int charlen;
|
||||||
int i;
|
int i;
|
||||||
|
wchar_t * wchar_to = (wchar_t *)to; /* needed to quiet sparse */
|
||||||
|
|
||||||
for (i = 0; len && *from; i++, from += charlen, len -= charlen) {
|
for (i = 0; len && *from; i++, from += charlen, len -= charlen) {
|
||||||
|
|
||||||
/* works for 2.4.0 kernel or later */
|
/* works for 2.4.0 kernel or later */
|
||||||
charlen = codepage->char2uni(from, len, &to[i]);
|
charlen = codepage->char2uni(from, len, &wchar_to[i]);
|
||||||
if (charlen < 1) {
|
if (charlen < 1) {
|
||||||
cERROR(1,
|
cERROR(1,
|
||||||
("cifs_strtoUCS: char2uni returned %d",
|
("cifs_strtoUCS: char2uni returned %d",
|
||||||
charlen));
|
charlen));
|
||||||
/* A question mark */
|
/* A question mark */
|
||||||
to[i] = (wchar_t)cpu_to_le16(0x003f);
|
to[i] = cpu_to_le16(0x003f);
|
||||||
charlen = 1;
|
charlen = 1;
|
||||||
} else
|
} else
|
||||||
to[i] = (wchar_t)cpu_to_le16(to[i]);
|
to[i] = cpu_to_le16(wchar_to[i]);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
* Convert a unicode character to upper or lower case using
|
* Convert a unicode character to upper or lower case using
|
||||||
* compressed tables.
|
* compressed tables.
|
||||||
*
|
*
|
||||||
* Copyright (c) International Business Machines Corp., 2000,2002
|
* Copyright (c) International Business Machines Corp., 2000,2005555555555555555555555555555555555555555555555555555555
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -59,8 +59,8 @@ extern struct UniCaseRange UniLowerRange[];
|
||||||
#endif /* UNIUPR_NOLOWER */
|
#endif /* UNIUPR_NOLOWER */
|
||||||
|
|
||||||
#ifdef __KERNEL__
|
#ifdef __KERNEL__
|
||||||
int cifs_strfromUCS_le(char *, const wchar_t *, int, const struct nls_table *);
|
int cifs_strfromUCS_le(char *, const __le16 *, int, const struct nls_table *);
|
||||||
int cifs_strtoUCS(wchar_t *, const char *, int, const struct nls_table *);
|
int cifs_strtoUCS(__le16 *, const char *, int, const struct nls_table *);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -149,7 +149,7 @@ int CalcNTLMv2_partial_mac_key(struct cifsSesInfo * ses, struct nls_table * nls_
|
||||||
char temp_hash[16];
|
char temp_hash[16];
|
||||||
struct HMACMD5Context ctx;
|
struct HMACMD5Context ctx;
|
||||||
char * ucase_buf;
|
char * ucase_buf;
|
||||||
wchar_t * unicode_buf;
|
__le16 * unicode_buf;
|
||||||
unsigned int i,user_name_len,dom_name_len;
|
unsigned int i,user_name_len,dom_name_len;
|
||||||
|
|
||||||
if(ses == NULL)
|
if(ses == NULL)
|
||||||
|
|
|
@ -1553,7 +1553,7 @@ createSymLinkRetry:
|
||||||
|
|
||||||
if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
|
if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
|
||||||
name_len =
|
name_len =
|
||||||
cifs_strtoUCS((wchar_t *) pSMB->FileName, fromName, PATH_MAX
|
cifs_strtoUCS((__le16 *) pSMB->FileName, fromName, PATH_MAX
|
||||||
/* find define for this maxpathcomponent */
|
/* find define for this maxpathcomponent */
|
||||||
, nls_codepage);
|
, nls_codepage);
|
||||||
name_len++; /* trailing null */
|
name_len++; /* trailing null */
|
||||||
|
@ -1577,7 +1577,7 @@ createSymLinkRetry:
|
||||||
data_offset = (char *) (&pSMB->hdr.Protocol) + offset;
|
data_offset = (char *) (&pSMB->hdr.Protocol) + offset;
|
||||||
if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
|
if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
|
||||||
name_len_target =
|
name_len_target =
|
||||||
cifs_strtoUCS((wchar_t *) data_offset, toName, PATH_MAX
|
cifs_strtoUCS((__le16 *) data_offset, toName, PATH_MAX
|
||||||
/* find define for this maxpathcomponent */
|
/* find define for this maxpathcomponent */
|
||||||
, nls_codepage);
|
, nls_codepage);
|
||||||
name_len_target++; /* trailing null */
|
name_len_target++; /* trailing null */
|
||||||
|
@ -1803,7 +1803,7 @@ querySymLinkRetry:
|
||||||
|
|
||||||
if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
|
if (pSMB->hdr.Flags2 & SMBFLG2_UNICODE) {
|
||||||
name_len =
|
name_len =
|
||||||
cifs_strtoUCS((wchar_t *) pSMB->FileName, searchName, PATH_MAX
|
cifs_strtoUCS((__le16 *) pSMB->FileName, searchName, PATH_MAX
|
||||||
/* find define for this maxpathcomponent */
|
/* find define for this maxpathcomponent */
|
||||||
, nls_codepage);
|
, nls_codepage);
|
||||||
name_len++; /* trailing null */
|
name_len++; /* trailing null */
|
||||||
|
@ -1860,7 +1860,7 @@ querySymLinkRetry:
|
||||||
min_t(const int, buflen,count) / 2);
|
min_t(const int, buflen,count) / 2);
|
||||||
/* BB FIXME investigate remapping reserved chars here */
|
/* BB FIXME investigate remapping reserved chars here */
|
||||||
cifs_strfromUCS_le(symlinkinfo,
|
cifs_strfromUCS_le(symlinkinfo,
|
||||||
(wchar_t *) ((char *)&pSMBr->hdr.Protocol +
|
(__le16 *) ((char *)&pSMBr->hdr.Protocol +
|
||||||
data_offset),
|
data_offset),
|
||||||
name_len, nls_codepage);
|
name_len, nls_codepage);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1951,7 +1951,7 @@ CIFSSMBQueryReparseLinkInfo(const int xid, struct cifsTconInfo *tcon,
|
||||||
reparse_buf->TargetNameOffset),
|
reparse_buf->TargetNameOffset),
|
||||||
min(buflen/2, reparse_buf->TargetNameLen / 2));
|
min(buflen/2, reparse_buf->TargetNameLen / 2));
|
||||||
cifs_strfromUCS_le(symlinkinfo,
|
cifs_strfromUCS_le(symlinkinfo,
|
||||||
(wchar_t *) (reparse_buf->LinkNamesBuf +
|
(__le16 *) (reparse_buf->LinkNamesBuf +
|
||||||
reparse_buf->TargetNameOffset),
|
reparse_buf->TargetNameOffset),
|
||||||
name_len, nls_codepage);
|
name_len, nls_codepage);
|
||||||
} else { /* ASCII names */
|
} else { /* ASCII names */
|
||||||
|
@ -3203,7 +3203,7 @@ getDFSRetry:
|
||||||
temp = ((char *)referrals) + le16_to_cpu(referrals->DfsPathOffset);
|
temp = ((char *)referrals) + le16_to_cpu(referrals->DfsPathOffset);
|
||||||
if (pSMBr->hdr.Flags2 & SMBFLG2_UNICODE) {
|
if (pSMBr->hdr.Flags2 & SMBFLG2_UNICODE) {
|
||||||
cifs_strfromUCS_le(*targetUNCs,
|
cifs_strfromUCS_le(*targetUNCs,
|
||||||
(wchar_t *) temp, name_len, nls_codepage);
|
(__le16 *) temp, name_len, nls_codepage);
|
||||||
} else {
|
} else {
|
||||||
strncpy(*targetUNCs,temp,name_len);
|
strncpy(*targetUNCs,temp,name_len);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1986,32 +1986,32 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses,
|
||||||
bytes_returned = 0; /* skill null user */
|
bytes_returned = 0; /* skill null user */
|
||||||
else
|
else
|
||||||
bytes_returned =
|
bytes_returned =
|
||||||
cifs_strtoUCS((wchar_t *) bcc_ptr, user, 100,
|
cifs_strtoUCS((__le16 *) bcc_ptr, user, 100,
|
||||||
nls_codepage);
|
nls_codepage);
|
||||||
/* convert number of 16 bit words to bytes */
|
/* convert number of 16 bit words to bytes */
|
||||||
bcc_ptr += 2 * bytes_returned;
|
bcc_ptr += 2 * bytes_returned;
|
||||||
bcc_ptr += 2; /* trailing null */
|
bcc_ptr += 2; /* trailing null */
|
||||||
if (domain == NULL)
|
if (domain == NULL)
|
||||||
bytes_returned =
|
bytes_returned =
|
||||||
cifs_strtoUCS((wchar_t *) bcc_ptr,
|
cifs_strtoUCS((__le16 *) bcc_ptr,
|
||||||
"CIFS_LINUX_DOM", 32, nls_codepage);
|
"CIFS_LINUX_DOM", 32, nls_codepage);
|
||||||
else
|
else
|
||||||
bytes_returned =
|
bytes_returned =
|
||||||
cifs_strtoUCS((wchar_t *) bcc_ptr, domain, 64,
|
cifs_strtoUCS((__le16 *) bcc_ptr, domain, 64,
|
||||||
nls_codepage);
|
nls_codepage);
|
||||||
bcc_ptr += 2 * bytes_returned;
|
bcc_ptr += 2 * bytes_returned;
|
||||||
bcc_ptr += 2;
|
bcc_ptr += 2;
|
||||||
bytes_returned =
|
bytes_returned =
|
||||||
cifs_strtoUCS((wchar_t *) bcc_ptr, "Linux version ",
|
cifs_strtoUCS((__le16 *) bcc_ptr, "Linux version ",
|
||||||
32, nls_codepage);
|
32, nls_codepage);
|
||||||
bcc_ptr += 2 * bytes_returned;
|
bcc_ptr += 2 * bytes_returned;
|
||||||
bytes_returned =
|
bytes_returned =
|
||||||
cifs_strtoUCS((wchar_t *) bcc_ptr, system_utsname.release,
|
cifs_strtoUCS((__le16 *) bcc_ptr, system_utsname.release,
|
||||||
32, nls_codepage);
|
32, nls_codepage);
|
||||||
bcc_ptr += 2 * bytes_returned;
|
bcc_ptr += 2 * bytes_returned;
|
||||||
bcc_ptr += 2;
|
bcc_ptr += 2;
|
||||||
bytes_returned =
|
bytes_returned =
|
||||||
cifs_strtoUCS((wchar_t *) bcc_ptr, CIFS_NETWORK_OPSYS,
|
cifs_strtoUCS((__le16 *) bcc_ptr, CIFS_NETWORK_OPSYS,
|
||||||
64, nls_codepage);
|
64, nls_codepage);
|
||||||
bcc_ptr += 2 * bytes_returned;
|
bcc_ptr += 2 * bytes_returned;
|
||||||
bcc_ptr += 2;
|
bcc_ptr += 2;
|
||||||
|
@ -2081,7 +2081,7 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses,
|
||||||
if(ses->serverOS == NULL)
|
if(ses->serverOS == NULL)
|
||||||
goto sesssetup_nomem;
|
goto sesssetup_nomem;
|
||||||
cifs_strfromUCS_le(ses->serverOS,
|
cifs_strfromUCS_le(ses->serverOS,
|
||||||
(wchar_t *)bcc_ptr, len,nls_codepage);
|
(__le16 *)bcc_ptr, len,nls_codepage);
|
||||||
bcc_ptr += 2 * (len + 1);
|
bcc_ptr += 2 * (len + 1);
|
||||||
remaining_words -= len + 1;
|
remaining_words -= len + 1;
|
||||||
ses->serverOS[2 * len] = 0;
|
ses->serverOS[2 * len] = 0;
|
||||||
|
@ -2093,7 +2093,7 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses,
|
||||||
if(ses->serverNOS == NULL)
|
if(ses->serverNOS == NULL)
|
||||||
goto sesssetup_nomem;
|
goto sesssetup_nomem;
|
||||||
cifs_strfromUCS_le(ses->serverNOS,
|
cifs_strfromUCS_le(ses->serverNOS,
|
||||||
(wchar_t *)bcc_ptr,len,nls_codepage);
|
(__le16 *)bcc_ptr,len,nls_codepage);
|
||||||
bcc_ptr += 2 * (len + 1);
|
bcc_ptr += 2 * (len + 1);
|
||||||
ses->serverNOS[2 * len] = 0;
|
ses->serverNOS[2 * len] = 0;
|
||||||
ses->serverNOS[1 + (2 * len)] = 0;
|
ses->serverNOS[1 + (2 * len)] = 0;
|
||||||
|
@ -2111,7 +2111,7 @@ CIFSSessSetup(unsigned int xid, struct cifsSesInfo *ses,
|
||||||
if(ses->serverDomain == NULL)
|
if(ses->serverDomain == NULL)
|
||||||
goto sesssetup_nomem;
|
goto sesssetup_nomem;
|
||||||
cifs_strfromUCS_le(ses->serverDomain,
|
cifs_strfromUCS_le(ses->serverDomain,
|
||||||
(wchar_t *)bcc_ptr,len,nls_codepage);
|
(__le16 *)bcc_ptr,len,nls_codepage);
|
||||||
bcc_ptr += 2 * (len + 1);
|
bcc_ptr += 2 * (len + 1);
|
||||||
ses->serverDomain[2*len] = 0;
|
ses->serverDomain[2*len] = 0;
|
||||||
ses->serverDomain[1+(2*len)] = 0;
|
ses->serverDomain[1+(2*len)] = 0;
|
||||||
|
@ -2255,30 +2255,30 @@ CIFSSpnegoSessSetup(unsigned int xid, struct cifsSesInfo *ses,
|
||||||
bcc_ptr++;
|
bcc_ptr++;
|
||||||
}
|
}
|
||||||
bytes_returned =
|
bytes_returned =
|
||||||
cifs_strtoUCS((wchar_t *) bcc_ptr, user, 100, nls_codepage);
|
cifs_strtoUCS((__le16 *) bcc_ptr, user, 100, nls_codepage);
|
||||||
bcc_ptr += 2 * bytes_returned; /* convert num of 16 bit words to bytes */
|
bcc_ptr += 2 * bytes_returned; /* convert num of 16 bit words to bytes */
|
||||||
bcc_ptr += 2; /* trailing null */
|
bcc_ptr += 2; /* trailing null */
|
||||||
if (domain == NULL)
|
if (domain == NULL)
|
||||||
bytes_returned =
|
bytes_returned =
|
||||||
cifs_strtoUCS((wchar_t *) bcc_ptr,
|
cifs_strtoUCS((__le16 *) bcc_ptr,
|
||||||
"CIFS_LINUX_DOM", 32, nls_codepage);
|
"CIFS_LINUX_DOM", 32, nls_codepage);
|
||||||
else
|
else
|
||||||
bytes_returned =
|
bytes_returned =
|
||||||
cifs_strtoUCS((wchar_t *) bcc_ptr, domain, 64,
|
cifs_strtoUCS((__le16 *) bcc_ptr, domain, 64,
|
||||||
nls_codepage);
|
nls_codepage);
|
||||||
bcc_ptr += 2 * bytes_returned;
|
bcc_ptr += 2 * bytes_returned;
|
||||||
bcc_ptr += 2;
|
bcc_ptr += 2;
|
||||||
bytes_returned =
|
bytes_returned =
|
||||||
cifs_strtoUCS((wchar_t *) bcc_ptr, "Linux version ",
|
cifs_strtoUCS((__le16 *) bcc_ptr, "Linux version ",
|
||||||
32, nls_codepage);
|
32, nls_codepage);
|
||||||
bcc_ptr += 2 * bytes_returned;
|
bcc_ptr += 2 * bytes_returned;
|
||||||
bytes_returned =
|
bytes_returned =
|
||||||
cifs_strtoUCS((wchar_t *) bcc_ptr, system_utsname.release, 32,
|
cifs_strtoUCS((__le16 *) bcc_ptr, system_utsname.release, 32,
|
||||||
nls_codepage);
|
nls_codepage);
|
||||||
bcc_ptr += 2 * bytes_returned;
|
bcc_ptr += 2 * bytes_returned;
|
||||||
bcc_ptr += 2;
|
bcc_ptr += 2;
|
||||||
bytes_returned =
|
bytes_returned =
|
||||||
cifs_strtoUCS((wchar_t *) bcc_ptr, CIFS_NETWORK_OPSYS,
|
cifs_strtoUCS((__le16 *) bcc_ptr, CIFS_NETWORK_OPSYS,
|
||||||
64, nls_codepage);
|
64, nls_codepage);
|
||||||
bcc_ptr += 2 * bytes_returned;
|
bcc_ptr += 2 * bytes_returned;
|
||||||
bcc_ptr += 2;
|
bcc_ptr += 2;
|
||||||
|
@ -2357,7 +2357,7 @@ CIFSSpnegoSessSetup(unsigned int xid, struct cifsSesInfo *ses,
|
||||||
ses->serverOS =
|
ses->serverOS =
|
||||||
kzalloc(2 * (len + 1), GFP_KERNEL);
|
kzalloc(2 * (len + 1), GFP_KERNEL);
|
||||||
cifs_strfromUCS_le(ses->serverOS,
|
cifs_strfromUCS_le(ses->serverOS,
|
||||||
(wchar_t *)
|
(__le16 *)
|
||||||
bcc_ptr, len,
|
bcc_ptr, len,
|
||||||
nls_codepage);
|
nls_codepage);
|
||||||
bcc_ptr += 2 * (len + 1);
|
bcc_ptr += 2 * (len + 1);
|
||||||
|
@ -2372,7 +2372,7 @@ CIFSSpnegoSessSetup(unsigned int xid, struct cifsSesInfo *ses,
|
||||||
kzalloc(2 * (len + 1),
|
kzalloc(2 * (len + 1),
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
cifs_strfromUCS_le(ses->serverNOS,
|
cifs_strfromUCS_le(ses->serverNOS,
|
||||||
(wchar_t *)bcc_ptr,
|
(__le16 *)bcc_ptr,
|
||||||
len,
|
len,
|
||||||
nls_codepage);
|
nls_codepage);
|
||||||
bcc_ptr += 2 * (len + 1);
|
bcc_ptr += 2 * (len + 1);
|
||||||
|
@ -2384,9 +2384,8 @@ CIFSSpnegoSessSetup(unsigned int xid, struct cifsSesInfo *ses,
|
||||||
/* last string is not always null terminated (for e.g. for Windows XP & 2000) */
|
/* last string is not always null terminated (for e.g. for Windows XP & 2000) */
|
||||||
ses->serverDomain = kzalloc(2*(len+1),GFP_KERNEL);
|
ses->serverDomain = kzalloc(2*(len+1),GFP_KERNEL);
|
||||||
cifs_strfromUCS_le(ses->serverDomain,
|
cifs_strfromUCS_le(ses->serverDomain,
|
||||||
(wchar_t *)bcc_ptr,
|
(__le16 *)bcc_ptr,
|
||||||
len,
|
len, nls_codepage);
|
||||||
nls_codepage);
|
|
||||||
bcc_ptr += 2*(len+1);
|
bcc_ptr += 2*(len+1);
|
||||||
ses->serverDomain[2*len] = 0;
|
ses->serverDomain[2*len] = 0;
|
||||||
ses->serverDomain[1+(2*len)] = 0;
|
ses->serverDomain[1+(2*len)] = 0;
|
||||||
|
@ -2560,16 +2559,16 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid,
|
||||||
}
|
}
|
||||||
|
|
||||||
bytes_returned =
|
bytes_returned =
|
||||||
cifs_strtoUCS((wchar_t *) bcc_ptr, "Linux version ",
|
cifs_strtoUCS((__le16 *) bcc_ptr, "Linux version ",
|
||||||
32, nls_codepage);
|
32, nls_codepage);
|
||||||
bcc_ptr += 2 * bytes_returned;
|
bcc_ptr += 2 * bytes_returned;
|
||||||
bytes_returned =
|
bytes_returned =
|
||||||
cifs_strtoUCS((wchar_t *) bcc_ptr, system_utsname.release, 32,
|
cifs_strtoUCS((__le16 *) bcc_ptr, system_utsname.release, 32,
|
||||||
nls_codepage);
|
nls_codepage);
|
||||||
bcc_ptr += 2 * bytes_returned;
|
bcc_ptr += 2 * bytes_returned;
|
||||||
bcc_ptr += 2; /* null terminate Linux version */
|
bcc_ptr += 2; /* null terminate Linux version */
|
||||||
bytes_returned =
|
bytes_returned =
|
||||||
cifs_strtoUCS((wchar_t *) bcc_ptr, CIFS_NETWORK_OPSYS,
|
cifs_strtoUCS((__le16 *) bcc_ptr, CIFS_NETWORK_OPSYS,
|
||||||
64, nls_codepage);
|
64, nls_codepage);
|
||||||
bcc_ptr += 2 * bytes_returned;
|
bcc_ptr += 2 * bytes_returned;
|
||||||
*(bcc_ptr + 1) = 0;
|
*(bcc_ptr + 1) = 0;
|
||||||
|
@ -2673,7 +2672,7 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid,
|
||||||
ses->serverOS =
|
ses->serverOS =
|
||||||
kzalloc(2 * (len + 1), GFP_KERNEL);
|
kzalloc(2 * (len + 1), GFP_KERNEL);
|
||||||
cifs_strfromUCS_le(ses->serverOS,
|
cifs_strfromUCS_le(ses->serverOS,
|
||||||
(wchar_t *)
|
(__le16 *)
|
||||||
bcc_ptr, len,
|
bcc_ptr, len,
|
||||||
nls_codepage);
|
nls_codepage);
|
||||||
bcc_ptr += 2 * (len + 1);
|
bcc_ptr += 2 * (len + 1);
|
||||||
|
@ -2690,7 +2689,7 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid,
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
cifs_strfromUCS_le(ses->
|
cifs_strfromUCS_le(ses->
|
||||||
serverNOS,
|
serverNOS,
|
||||||
(wchar_t *)
|
(__le16 *)
|
||||||
bcc_ptr,
|
bcc_ptr,
|
||||||
len,
|
len,
|
||||||
nls_codepage);
|
nls_codepage);
|
||||||
|
@ -2708,23 +2707,15 @@ CIFSNTLMSSPNegotiateSessSetup(unsigned int xid,
|
||||||
1),
|
1),
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
cifs_strfromUCS_le
|
cifs_strfromUCS_le
|
||||||
(ses->
|
(ses->serverDomain,
|
||||||
serverDomain,
|
(__le16 *)bcc_ptr,
|
||||||
(wchar_t *)
|
len, nls_codepage);
|
||||||
bcc_ptr, len,
|
|
||||||
nls_codepage);
|
|
||||||
bcc_ptr +=
|
bcc_ptr +=
|
||||||
2 * (len + 1);
|
2 * (len + 1);
|
||||||
ses->
|
ses->serverDomain[2*len]
|
||||||
serverDomain[2
|
|
||||||
* len]
|
|
||||||
= 0;
|
= 0;
|
||||||
ses->
|
ses->serverDomain
|
||||||
serverDomain[1
|
[1 + (2 * len)]
|
||||||
+
|
|
||||||
(2
|
|
||||||
*
|
|
||||||
len)]
|
|
||||||
= 0;
|
= 0;
|
||||||
} /* else no more room so create dummy domain string */
|
} /* else no more room so create dummy domain string */
|
||||||
else
|
else
|
||||||
|
@ -2903,7 +2894,7 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses,
|
||||||
SecurityBlob->DomainName.MaximumLength = 0;
|
SecurityBlob->DomainName.MaximumLength = 0;
|
||||||
} else {
|
} else {
|
||||||
__u16 len =
|
__u16 len =
|
||||||
cifs_strtoUCS((wchar_t *) bcc_ptr, domain, 64,
|
cifs_strtoUCS((__le16 *) bcc_ptr, domain, 64,
|
||||||
nls_codepage);
|
nls_codepage);
|
||||||
len *= 2;
|
len *= 2;
|
||||||
SecurityBlob->DomainName.MaximumLength =
|
SecurityBlob->DomainName.MaximumLength =
|
||||||
|
@ -2921,7 +2912,7 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses,
|
||||||
SecurityBlob->UserName.MaximumLength = 0;
|
SecurityBlob->UserName.MaximumLength = 0;
|
||||||
} else {
|
} else {
|
||||||
__u16 len =
|
__u16 len =
|
||||||
cifs_strtoUCS((wchar_t *) bcc_ptr, user, 64,
|
cifs_strtoUCS((__le16 *) bcc_ptr, user, 64,
|
||||||
nls_codepage);
|
nls_codepage);
|
||||||
len *= 2;
|
len *= 2;
|
||||||
SecurityBlob->UserName.MaximumLength =
|
SecurityBlob->UserName.MaximumLength =
|
||||||
|
@ -2934,7 +2925,7 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses,
|
||||||
cpu_to_le16(len);
|
cpu_to_le16(len);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* SecurityBlob->WorkstationName.Length = cifs_strtoUCS((wchar_t *) bcc_ptr, "AMACHINE",64, nls_codepage);
|
/* SecurityBlob->WorkstationName.Length = cifs_strtoUCS((__le16 *) bcc_ptr, "AMACHINE",64, nls_codepage);
|
||||||
SecurityBlob->WorkstationName.Length *= 2;
|
SecurityBlob->WorkstationName.Length *= 2;
|
||||||
SecurityBlob->WorkstationName.MaximumLength = cpu_to_le16(SecurityBlob->WorkstationName.Length);
|
SecurityBlob->WorkstationName.MaximumLength = cpu_to_le16(SecurityBlob->WorkstationName.Length);
|
||||||
SecurityBlob->WorkstationName.Buffer = cpu_to_le32(SecurityBlobLength);
|
SecurityBlob->WorkstationName.Buffer = cpu_to_le32(SecurityBlobLength);
|
||||||
|
@ -2947,16 +2938,16 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses,
|
||||||
bcc_ptr++;
|
bcc_ptr++;
|
||||||
}
|
}
|
||||||
bytes_returned =
|
bytes_returned =
|
||||||
cifs_strtoUCS((wchar_t *) bcc_ptr, "Linux version ",
|
cifs_strtoUCS((__le16 *) bcc_ptr, "Linux version ",
|
||||||
32, nls_codepage);
|
32, nls_codepage);
|
||||||
bcc_ptr += 2 * bytes_returned;
|
bcc_ptr += 2 * bytes_returned;
|
||||||
bytes_returned =
|
bytes_returned =
|
||||||
cifs_strtoUCS((wchar_t *) bcc_ptr, system_utsname.release, 32,
|
cifs_strtoUCS((__le16 *) bcc_ptr, system_utsname.release, 32,
|
||||||
nls_codepage);
|
nls_codepage);
|
||||||
bcc_ptr += 2 * bytes_returned;
|
bcc_ptr += 2 * bytes_returned;
|
||||||
bcc_ptr += 2; /* null term version string */
|
bcc_ptr += 2; /* null term version string */
|
||||||
bytes_returned =
|
bytes_returned =
|
||||||
cifs_strtoUCS((wchar_t *) bcc_ptr, CIFS_NETWORK_OPSYS,
|
cifs_strtoUCS((__le16 *) bcc_ptr, CIFS_NETWORK_OPSYS,
|
||||||
64, nls_codepage);
|
64, nls_codepage);
|
||||||
bcc_ptr += 2 * bytes_returned;
|
bcc_ptr += 2 * bytes_returned;
|
||||||
*(bcc_ptr + 1) = 0;
|
*(bcc_ptr + 1) = 0;
|
||||||
|
@ -3069,7 +3060,7 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses,
|
||||||
ses->serverOS =
|
ses->serverOS =
|
||||||
kzalloc(2 * (len + 1), GFP_KERNEL);
|
kzalloc(2 * (len + 1), GFP_KERNEL);
|
||||||
cifs_strfromUCS_le(ses->serverOS,
|
cifs_strfromUCS_le(ses->serverOS,
|
||||||
(wchar_t *)
|
(__le16 *)
|
||||||
bcc_ptr, len,
|
bcc_ptr, len,
|
||||||
nls_codepage);
|
nls_codepage);
|
||||||
bcc_ptr += 2 * (len + 1);
|
bcc_ptr += 2 * (len + 1);
|
||||||
|
@ -3086,7 +3077,7 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses,
|
||||||
GFP_KERNEL);
|
GFP_KERNEL);
|
||||||
cifs_strfromUCS_le(ses->
|
cifs_strfromUCS_le(ses->
|
||||||
serverNOS,
|
serverNOS,
|
||||||
(wchar_t *)
|
(__le16 *)
|
||||||
bcc_ptr,
|
bcc_ptr,
|
||||||
len,
|
len,
|
||||||
nls_codepage);
|
nls_codepage);
|
||||||
|
@ -3105,7 +3096,7 @@ CIFSNTLMSSPAuthSessSetup(unsigned int xid, struct cifsSesInfo *ses,
|
||||||
cifs_strfromUCS_le
|
cifs_strfromUCS_le
|
||||||
(ses->
|
(ses->
|
||||||
serverDomain,
|
serverDomain,
|
||||||
(wchar_t *)
|
(__le16 *)
|
||||||
bcc_ptr, len,
|
bcc_ptr, len,
|
||||||
nls_codepage);
|
nls_codepage);
|
||||||
bcc_ptr +=
|
bcc_ptr +=
|
||||||
|
@ -3227,7 +3218,7 @@ CIFSTCon(unsigned int xid, struct cifsSesInfo *ses,
|
||||||
if (ses->capabilities & CAP_UNICODE) {
|
if (ses->capabilities & CAP_UNICODE) {
|
||||||
smb_buffer->Flags2 |= SMBFLG2_UNICODE;
|
smb_buffer->Flags2 |= SMBFLG2_UNICODE;
|
||||||
length =
|
length =
|
||||||
cifs_strtoUCS((wchar_t *) bcc_ptr, tree, 100, nls_codepage);
|
cifs_strtoUCS((__le16 *) bcc_ptr, tree, 100, nls_codepage);
|
||||||
bcc_ptr += 2 * length; /* convert num of 16 bit words to bytes */
|
bcc_ptr += 2 * length; /* convert num of 16 bit words to bytes */
|
||||||
bcc_ptr += 2; /* skip trailing null */
|
bcc_ptr += 2; /* skip trailing null */
|
||||||
} else { /* ASCII */
|
} else { /* ASCII */
|
||||||
|
@ -3263,7 +3254,7 @@ CIFSTCon(unsigned int xid, struct cifsSesInfo *ses,
|
||||||
tcon->nativeFileSystem =
|
tcon->nativeFileSystem =
|
||||||
kzalloc(length + 2, GFP_KERNEL);
|
kzalloc(length + 2, GFP_KERNEL);
|
||||||
cifs_strfromUCS_le(tcon->nativeFileSystem,
|
cifs_strfromUCS_le(tcon->nativeFileSystem,
|
||||||
(wchar_t *) bcc_ptr,
|
(__le16 *) bcc_ptr,
|
||||||
length, nls_codepage);
|
length, nls_codepage);
|
||||||
bcc_ptr += 2 * length;
|
bcc_ptr += 2 * length;
|
||||||
bcc_ptr[0] = 0; /* null terminate the string */
|
bcc_ptr[0] = 0; /* null terminate the string */
|
||||||
|
|
|
@ -678,7 +678,7 @@ cifsConvertToUCS(__le16 * target, const char *source, int maxlen,
|
||||||
__u16 temp;
|
__u16 temp;
|
||||||
|
|
||||||
if(!mapChars)
|
if(!mapChars)
|
||||||
return cifs_strtoUCS((wchar_t *) target, source, PATH_MAX, cp);
|
return cifs_strtoUCS(target, source, PATH_MAX, cp);
|
||||||
|
|
||||||
for(i = 0, j = 0; i < maxlen; j++) {
|
for(i = 0, j = 0; i < maxlen; j++) {
|
||||||
src_char = source[i];
|
src_char = source[i];
|
||||||
|
|
|
@ -705,7 +705,7 @@ static int cifs_get_name_from_search_buf(struct qstr *pqst,
|
||||||
(__le16 *)filename, len/2, nlt);
|
(__le16 *)filename, len/2, nlt);
|
||||||
else
|
else
|
||||||
pqst->len = cifs_strfromUCS_le((char *)pqst->name,
|
pqst->len = cifs_strfromUCS_le((char *)pqst->name,
|
||||||
(wchar_t *)filename,len/2,nlt);
|
(__le16 *)filename,len/2,nlt);
|
||||||
} else {
|
} else {
|
||||||
pqst->name = filename;
|
pqst->name = filename;
|
||||||
pqst->len = len;
|
pqst->len = len;
|
||||||
|
|
Loading…
Reference in New Issue