diff options
author | Steve French <sfrench@us.ibm.com> | 2005-08-17 15:38:22 -0400 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2005-08-17 15:38:22 -0400 |
commit | 1982c344f1bf08118f7c224958b30c64e162009e (patch) | |
tree | b5268e345010421ca2625b29efc981c187c4df2e /fs/cifs/cifssmb.c | |
parent | a59c658607b63ec7b6c2536597a075ee307b1b4c (diff) |
[CIFS] Ensure that cifs multiplex ids do not collide.
Signed-off-by: Steve French (sfrench@us.ibm.com)
Diffstat (limited to 'fs/cifs/cifssmb.c')
-rw-r--r-- | fs/cifs/cifssmb.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index 1b073546f5d9..930be0927de2 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c | |||
@@ -330,7 +330,7 @@ CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses) | |||
330 | (void **) &pSMB, (void **) &pSMBr); | 330 | (void **) &pSMB, (void **) &pSMBr); |
331 | if (rc) | 331 | if (rc) |
332 | return rc; | 332 | return rc; |
333 | 333 | pSMB->hdr.Mid = GetNextMid(server); | |
334 | pSMB->hdr.Flags2 |= SMBFLG2_UNICODE; | 334 | pSMB->hdr.Flags2 |= SMBFLG2_UNICODE; |
335 | if (extended_security) | 335 | if (extended_security) |
336 | pSMB->hdr.Flags2 |= SMBFLG2_EXT_SEC; | 336 | pSMB->hdr.Flags2 |= SMBFLG2_EXT_SEC; |
@@ -415,15 +415,14 @@ CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses) | |||
415 | if(server->secMode & SECMODE_SIGN_REQUIRED) | 415 | if(server->secMode & SECMODE_SIGN_REQUIRED) |
416 | cERROR(1, | 416 | cERROR(1, |
417 | ("Server requires /proc/fs/cifs/PacketSigningEnabled")); | 417 | ("Server requires /proc/fs/cifs/PacketSigningEnabled")); |
418 | server->secMode &= ~(SECMODE_SIGN_ENABLED | | 418 | server->secMode &= ~(SECMODE_SIGN_ENABLED | SECMODE_SIGN_REQUIRED); |
419 | SECMODE_SIGN_REQUIRED); | ||
420 | } else if(sign_CIFS_PDUs == 1) { | 419 | } else if(sign_CIFS_PDUs == 1) { |
421 | if((server->secMode & SECMODE_SIGN_REQUIRED) == 0) | 420 | if((server->secMode & SECMODE_SIGN_REQUIRED) == 0) |
422 | server->secMode &= ~(SECMODE_SIGN_ENABLED | | 421 | server->secMode &= ~(SECMODE_SIGN_ENABLED | SECMODE_SIGN_REQUIRED); |
423 | SECMODE_SIGN_REQUIRED); | ||
424 | } | 422 | } |
425 | 423 | ||
426 | } | 424 | } |
425 | |||
427 | cifs_buf_release(pSMB); | 426 | cifs_buf_release(pSMB); |
428 | return rc; | 427 | return rc; |
429 | } | 428 | } |
@@ -519,6 +518,8 @@ CIFSSMBLogoff(const int xid, struct cifsSesInfo *ses) | |||
519 | smb_buffer_response = (struct smb_hdr *)pSMB; /* BB removeme BB */ | 518 | smb_buffer_response = (struct smb_hdr *)pSMB; /* BB removeme BB */ |
520 | 519 | ||
521 | if(ses->server) { | 520 | if(ses->server) { |
521 | pSMB->hdr.Mid = GetNextMid(ses->server); | ||
522 | |||
522 | if(ses->server->secMode & | 523 | if(ses->server->secMode & |
523 | (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED)) | 524 | (SECMODE_SIGN_REQUIRED | SECMODE_SIGN_ENABLED)) |
524 | pSMB->hdr.Flags2 |= SMBFLG2_SECURITY_SIGNATURE; | 525 | pSMB->hdr.Flags2 |= SMBFLG2_SECURITY_SIGNATURE; |
@@ -2519,11 +2520,12 @@ findFirstRetry: | |||
2519 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, | 2520 | rc = SendReceive(xid, tcon->ses, (struct smb_hdr *) pSMB, |
2520 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); | 2521 | (struct smb_hdr *) pSMBr, &bytes_returned, 0); |
2521 | 2522 | ||
2522 | if (rc) {/* BB add logic to retry regular search if Unix search | 2523 | if (rc) {/* BB add logic to retry regular search if Unix search rejected unexpectedly by server */ |
2523 | rejected unexpectedly by server */ | ||
2524 | /* BB Add code to handle unsupported level rc */ | 2524 | /* BB Add code to handle unsupported level rc */ |
2525 | cFYI(1, ("Error in FindFirst = %d", rc)); | 2525 | cFYI(1, ("Error in FindFirst = %d", rc)); |
2526 | cifs_buf_release(pSMB); | 2526 | |
2527 | if (pSMB) | ||
2528 | cifs_buf_release(pSMB); | ||
2527 | 2529 | ||
2528 | /* BB eventually could optimize out free and realloc of buf */ | 2530 | /* BB eventually could optimize out free and realloc of buf */ |
2529 | /* for this case */ | 2531 | /* for this case */ |
@@ -2857,7 +2859,10 @@ getDFSRetry: | |||
2857 | (void **) &pSMBr); | 2859 | (void **) &pSMBr); |
2858 | if (rc) | 2860 | if (rc) |
2859 | return rc; | 2861 | return rc; |
2860 | 2862 | ||
2863 | /* server pointer checked in called function, | ||
2864 | but should never be null here anyway */ | ||
2865 | pSMB->hdr.Mid = GetNextMid(ses->server); | ||
2861 | pSMB->hdr.Tid = ses->ipc_tid; | 2866 | pSMB->hdr.Tid = ses->ipc_tid; |
2862 | pSMB->hdr.Uid = ses->Suid; | 2867 | pSMB->hdr.Uid = ses->Suid; |
2863 | if (ses->capabilities & CAP_STATUS32) { | 2868 | if (ses->capabilities & CAP_STATUS32) { |