Commit 733f99ac authored by Al Viro's avatar Al Viro Committed by Linus Torvalds

[PATCH] new cifs endianness bugs

* missing cpu_to_le64() for ChangeTime (introduced by
    [CIFS] Legacy time handling for Win9x and OS/2 part 1)
* missing le16_to_cpu() for DialectIndex (introduced by
    [CIFS] Do not send newer QFSInfo to legacy servers which can not support it)
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 645408d1
...@@ -399,6 +399,7 @@ CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses) ...@@ -399,6 +399,7 @@ CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses)
struct TCP_Server_Info * server; struct TCP_Server_Info * server;
u16 count; u16 count;
unsigned int secFlags; unsigned int secFlags;
u16 dialect;
if(ses->server) if(ses->server)
server = ses->server; server = ses->server;
...@@ -438,9 +439,10 @@ CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses) ...@@ -438,9 +439,10 @@ CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses)
if (rc != 0) if (rc != 0)
goto neg_err_exit; goto neg_err_exit;
cFYI(1,("Dialect: %d", pSMBr->DialectIndex)); dialect = le16_to_cpu(pSMBr->DialectIndex);
cFYI(1,("Dialect: %d", dialect));
/* Check wct = 1 error case */ /* Check wct = 1 error case */
if((pSMBr->hdr.WordCount < 13) || (pSMBr->DialectIndex == BAD_PROT)) { if((pSMBr->hdr.WordCount < 13) || (dialect == BAD_PROT)) {
/* core returns wct = 1, but we do not ask for core - otherwise /* core returns wct = 1, but we do not ask for core - otherwise
small wct just comes when dialect index is -1 indicating we small wct just comes when dialect index is -1 indicating we
could not negotiate a common dialect */ could not negotiate a common dialect */
...@@ -448,8 +450,8 @@ CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses) ...@@ -448,8 +450,8 @@ CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses)
goto neg_err_exit; goto neg_err_exit;
#ifdef CONFIG_CIFS_WEAK_PW_HASH #ifdef CONFIG_CIFS_WEAK_PW_HASH
} else if((pSMBr->hdr.WordCount == 13) } else if((pSMBr->hdr.WordCount == 13)
&& ((pSMBr->DialectIndex == LANMAN_PROT) && ((dialect == LANMAN_PROT)
|| (pSMBr->DialectIndex == LANMAN2_PROT))) { || (dialect == LANMAN2_PROT))) {
__s16 tmp; __s16 tmp;
struct lanman_neg_rsp * rsp = (struct lanman_neg_rsp *)pSMBr; struct lanman_neg_rsp * rsp = (struct lanman_neg_rsp *)pSMBr;
...@@ -2943,7 +2945,7 @@ int SMBQueryInformation(const int xid, struct cifsTconInfo *tcon, ...@@ -2943,7 +2945,7 @@ int SMBQueryInformation(const int xid, struct cifsTconInfo *tcon,
ts.tv_nsec = 0; ts.tv_nsec = 0;
ts.tv_sec = time; ts.tv_sec = time;
/* decode time fields */ /* decode time fields */
pFinfo->ChangeTime = cifs_UnixTimeToNT(ts); pFinfo->ChangeTime = cpu_to_le64(cifs_UnixTimeToNT(ts));
pFinfo->LastWriteTime = pFinfo->ChangeTime; pFinfo->LastWriteTime = pFinfo->ChangeTime;
pFinfo->LastAccessTime = 0; pFinfo->LastAccessTime = 0;
pFinfo->AllocationSize = pFinfo->AllocationSize =
......
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