diff options
author | Steve French <sfrench@us.ibm.com> | 2007-10-04 16:05:09 -0400 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2007-10-04 16:05:09 -0400 |
commit | a013689ddb2a4ba5f0452c053c0bf00bafb686f1 (patch) | |
tree | daffe3644ed321b602a1f6a4e97dc6c6ef329dfb /fs/cifs/cifssmb.c | |
parent | d12fd121afd4f87cbc7675f8f6b651d649534f15 (diff) |
[CIFS] Fix cifsd so shuts down when signing fails during mount
Fixes two problems:
1) we dropped down to negotiating lanman if we did not recognize the
mechanism (krb5 e.g.)
2) we did not stop cifsd (thus will fail when doing rmod cifs with
slab free errors) when we fail tcon but have a bad session (which is
the case in which signing is required but we don't allow signing on
the client)
It also turns on extended security flag in the header when passing
"sec=krb5" on mount command (although kerberos support is not done of
course)
Acked-by: Jeff Layton <jlayton@redhat.com>
CC: Shaggy <shaggy@us.ibm.com>
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, 20 insertions, 3 deletions
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index 90b8f8d64d6e..fda8b2490263 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c | |||
@@ -438,8 +438,13 @@ CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses) | |||
438 | 438 | ||
439 | pSMB->hdr.Mid = GetNextMid(server); | 439 | pSMB->hdr.Mid = GetNextMid(server); |
440 | pSMB->hdr.Flags2 |= (SMBFLG2_UNICODE | SMBFLG2_ERR_STATUS); | 440 | pSMB->hdr.Flags2 |= (SMBFLG2_UNICODE | SMBFLG2_ERR_STATUS); |
441 | |||
441 | if ((secFlags & CIFSSEC_MUST_KRB5) == CIFSSEC_MUST_KRB5) | 442 | if ((secFlags & CIFSSEC_MUST_KRB5) == CIFSSEC_MUST_KRB5) |
442 | pSMB->hdr.Flags2 |= SMBFLG2_EXT_SEC; | 443 | pSMB->hdr.Flags2 |= SMBFLG2_EXT_SEC; |
444 | else if ((secFlags & CIFSSEC_AUTH_MASK) == CIFSSEC_MAY_KRB5) { | ||
445 | cFYI(1, ("Kerberos only mechanism, enable extended security")); | ||
446 | pSMB->hdr.Flags2 |= SMBFLG2_EXT_SEC; | ||
447 | } | ||
443 | 448 | ||
444 | count = 0; | 449 | count = 0; |
445 | for (i = 0; i < CIFS_NUM_PROT; i++) { | 450 | for (i = 0; i < CIFS_NUM_PROT; i++) { |
@@ -573,7 +578,20 @@ CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses) | |||
573 | server->secType = NTLM; | 578 | server->secType = NTLM; |
574 | else if (secFlags & CIFSSEC_MAY_NTLMV2) | 579 | else if (secFlags & CIFSSEC_MAY_NTLMV2) |
575 | server->secType = NTLMv2; | 580 | server->secType = NTLMv2; |
576 | /* else krb5 ... any others ... */ | 581 | else if (secFlags & CIFSSEC_MAY_KRB5) |
582 | server->secType = Kerberos; | ||
583 | else if (secFlags & CIFSSEC_MAY_LANMAN) | ||
584 | server->secType = LANMAN; | ||
585 | /* #ifdef CONFIG_CIFS_EXPERIMENTAL | ||
586 | else if (secFlags & CIFSSEC_MAY_PLNTXT) | ||
587 | server->secType = ?? | ||
588 | #endif */ | ||
589 | else { | ||
590 | rc = -EOPNOTSUPP; | ||
591 | cERROR(1, ("Invalid security type")); | ||
592 | goto neg_err_exit; | ||
593 | } | ||
594 | /* else ... any others ...? */ | ||
577 | 595 | ||
578 | /* one byte, so no need to convert this or EncryptionKeyLen from | 596 | /* one byte, so no need to convert this or EncryptionKeyLen from |
579 | little endian */ | 597 | little endian */ |
@@ -3089,8 +3107,7 @@ CIFSSMBGetCIFSACL(const int xid, struct cifsTconInfo *tcon, __u16 fid, | |||
3089 | goto qsec_out; | 3107 | goto qsec_out; |
3090 | pSMBr = (struct smb_com_ntransact_rsp *)iov[0].iov_base; | 3108 | pSMBr = (struct smb_com_ntransact_rsp *)iov[0].iov_base; |
3091 | 3109 | ||
3092 | cERROR(1, ("smb %p parm %p data %p", | 3110 | cFYI(1, ("smb %p parm %p data %p", pSMBr, parm, psec_desc)); |
3093 | pSMBr, parm, psec_desc)); /* BB removeme BB */ | ||
3094 | 3111 | ||
3095 | if (le32_to_cpu(pSMBr->ParameterCount) != 4) { | 3112 | if (le32_to_cpu(pSMBr->ParameterCount) != 4) { |
3096 | rc = -EIO; /* bad smb */ | 3113 | rc = -EIO; /* bad smb */ |