aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/connect.c
diff options
context:
space:
mode:
authorSteve French <sfrench@us.ibm.com>2005-09-22 19:32:06 -0400
committerSteve French <sfrench@us.ibm.com>2005-09-22 19:32:06 -0400
commit70ca734a14366b634224a1e4586d43b36b65ab67 (patch)
treebad9c511f846baebc18d0f5190bbe5fde5ae0dd1 /fs/cifs/connect.c
parent2096243885ee34b78cb57ce835e07c8536a67d2a (diff)
[CIFS] Various minor bigendian fixes and sparse level 2 warning message fixes
Most important of these fixes mapchars on bigendian and a few statfs fields Signed-off-by: Shaggy (shaggy@austin.ibm.com) Signed-off-by: Steve French (sfrench@us.ibm.com)
Diffstat (limited to 'fs/cifs/connect.c')
-rw-r--r--fs/cifs/connect.c38
1 files changed, 25 insertions, 13 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 196976049c00..e27e5ad8b591 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -303,12 +303,12 @@ static int coalesce_t2(struct smb_hdr * psecond, struct smb_hdr *pTargetSMB)
303 byte_count += total_in_buf2; 303 byte_count += total_in_buf2;
304 BCC_LE(pTargetSMB) = cpu_to_le16(byte_count); 304 BCC_LE(pTargetSMB) = cpu_to_le16(byte_count);
305 305
306 byte_count = be32_to_cpu(pTargetSMB->smb_buf_length); 306 byte_count = pTargetSMB->smb_buf_length;
307 byte_count += total_in_buf2; 307 byte_count += total_in_buf2;
308 308
309 /* BB also add check that we are not beyond maximum buffer size */ 309 /* BB also add check that we are not beyond maximum buffer size */
310 310
311 pTargetSMB->smb_buf_length = cpu_to_be32(byte_count); 311 pTargetSMB->smb_buf_length = byte_count;
312 312
313 if(remaining == total_in_buf2) { 313 if(remaining == total_in_buf2) {
314 cFYI(1,("found the last secondary response")); 314 cFYI(1,("found the last secondary response"));
@@ -333,7 +333,7 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
333 struct cifsSesInfo *ses; 333 struct cifsSesInfo *ses;
334 struct task_struct *task_to_wake = NULL; 334 struct task_struct *task_to_wake = NULL;
335 struct mid_q_entry *mid_entry; 335 struct mid_q_entry *mid_entry;
336 char *temp; 336 char temp;
337 int isLargeBuf = FALSE; 337 int isLargeBuf = FALSE;
338 int isMultiRsp; 338 int isMultiRsp;
339 int reconnect; 339 int reconnect;
@@ -435,22 +435,32 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
435 continue; 435 continue;
436 } 436 }
437 437
438 /* the right amount was read from socket - 4 bytes */ 438 /* The right amount was read from socket - 4 bytes */
439 /* so we can now interpret the length field */
439 440
441 /* the first byte big endian of the length field,
442 is actually not part of the length but the type
443 with the most common, zero, as regular data */
444 temp = *((char *) smb_buffer);
445
446 /* Note that FC 1001 length is big endian on the wire,
447 but we convert it here so it is always manipulated
448 as host byte order */
440 pdu_length = ntohl(smb_buffer->smb_buf_length); 449 pdu_length = ntohl(smb_buffer->smb_buf_length);
441 cFYI(1,("rfc1002 length(big endian)0x%x)", pdu_length+4)); 450 smb_buffer->smb_buf_length = pdu_length;
451
452 cFYI(1,("rfc1002 length 0x%x)", pdu_length+4));
442 453
443 temp = (char *) smb_buffer; 454 if (temp == (char) RFC1002_SESSION_KEEP_ALIVE) {
444 if (temp[0] == (char) RFC1002_SESSION_KEEP_ALIVE) {
445 continue; 455 continue;
446 } else if (temp[0] == (char)RFC1002_POSITIVE_SESSION_RESPONSE) { 456 } else if (temp == (char)RFC1002_POSITIVE_SESSION_RESPONSE) {
447 cFYI(1,("Good RFC 1002 session rsp")); 457 cFYI(1,("Good RFC 1002 session rsp"));
448 continue; 458 continue;
449 } else if (temp[0] == (char)RFC1002_NEGATIVE_SESSION_RESPONSE) { 459 } else if (temp == (char)RFC1002_NEGATIVE_SESSION_RESPONSE) {
450 /* we get this from Windows 98 instead of 460 /* we get this from Windows 98 instead of
451 an error on SMB negprot response */ 461 an error on SMB negprot response */
452 cFYI(1,("Negative RFC1002 Session Response Error 0x%x)", 462 cFYI(1,("Negative RFC1002 Session Response Error 0x%x)",
453 temp[4])); 463 pdu_length));
454 if(server->tcpStatus == CifsNew) { 464 if(server->tcpStatus == CifsNew) {
455 /* if nack on negprot (rather than 465 /* if nack on negprot (rather than
456 ret of smb negprot error) reconnecting 466 ret of smb negprot error) reconnecting
@@ -472,9 +482,10 @@ cifs_demultiplex_thread(struct TCP_Server_Info *server)
472 wake_up(&server->response_q); 482 wake_up(&server->response_q);
473 continue; 483 continue;
474 } 484 }
475 } else if (temp[0] != (char) 0) { 485 } else if (temp != (char) 0) {
476 cERROR(1,("Unknown RFC 1002 frame")); 486 cERROR(1,("Unknown RFC 1002 frame"));
477 cifs_dump_mem(" Received Data: ", temp, length); 487 cifs_dump_mem(" Received Data: ", (char *)smb_buffer,
488 length);
478 cifs_reconnect(server); 489 cifs_reconnect(server);
479 csocket = server->ssocket; 490 csocket = server->ssocket;
480 continue; 491 continue;
@@ -609,7 +620,8 @@ multi_t2_fnd:
609 } else if ((is_valid_oplock_break(smb_buffer) == FALSE) 620 } else if ((is_valid_oplock_break(smb_buffer) == FALSE)
610 && (isMultiRsp == FALSE)) { 621 && (isMultiRsp == FALSE)) {
611 cERROR(1, ("No task to wake, unknown frame rcvd!")); 622 cERROR(1, ("No task to wake, unknown frame rcvd!"));
612 cifs_dump_mem("Received Data is: ",temp,sizeof(struct smb_hdr)); 623 cifs_dump_mem("Received Data is: ",(char *)smb_buffer,
624 sizeof(struct smb_hdr));
613 } 625 }
614 } /* end while !EXITING */ 626 } /* end while !EXITING */
615 627