aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/cifs')
-rw-r--r--fs/cifs/cifssmb.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index 1a3776322c71..e63961086752 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -539,6 +539,20 @@ decode_lanman_negprot_rsp(struct TCP_Server_Info *server, NEGOTIATE_RSP *pSMBr,
539} 539}
540#endif 540#endif
541 541
542static bool
543should_set_ext_sec_flag(unsigned int secFlags)
544{
545 if ((secFlags & CIFSSEC_MUST_KRB5) == CIFSSEC_MUST_KRB5)
546 return true;
547 else if ((secFlags & CIFSSEC_AUTH_MASK) == CIFSSEC_MAY_KRB5)
548 return true;
549 else if ((secFlags & CIFSSEC_MUST_NTLMSSP) == CIFSSEC_MUST_NTLMSSP)
550 return true;
551 else if ((secFlags & CIFSSEC_AUTH_MASK) == CIFSSEC_MAY_NTLMSSP)
552 return true;
553 return false;
554}
555
542int 556int
543CIFSSMBNegotiate(const unsigned int xid, struct cifs_ses *ses) 557CIFSSMBNegotiate(const unsigned int xid, struct cifs_ses *ses)
544{ 558{
@@ -572,15 +586,8 @@ CIFSSMBNegotiate(const unsigned int xid, struct cifs_ses *ses)
572 pSMB->hdr.Mid = get_next_mid(server); 586 pSMB->hdr.Mid = get_next_mid(server);
573 pSMB->hdr.Flags2 |= (SMBFLG2_UNICODE | SMBFLG2_ERR_STATUS); 587 pSMB->hdr.Flags2 |= (SMBFLG2_UNICODE | SMBFLG2_ERR_STATUS);
574 588
575 if ((secFlags & CIFSSEC_MUST_KRB5) == CIFSSEC_MUST_KRB5) 589 if (should_set_ext_sec_flag(secFlags)) {
576 pSMB->hdr.Flags2 |= SMBFLG2_EXT_SEC; 590 cifs_dbg(FYI, "Requesting extended security.");
577 else if ((secFlags & CIFSSEC_AUTH_MASK) == CIFSSEC_MAY_KRB5) {
578 cifs_dbg(FYI, "Kerberos only mechanism, enable extended security\n");
579 pSMB->hdr.Flags2 |= SMBFLG2_EXT_SEC;
580 } else if ((secFlags & CIFSSEC_MUST_NTLMSSP) == CIFSSEC_MUST_NTLMSSP)
581 pSMB->hdr.Flags2 |= SMBFLG2_EXT_SEC;
582 else if ((secFlags & CIFSSEC_AUTH_MASK) == CIFSSEC_MAY_NTLMSSP) {
583 cifs_dbg(FYI, "NTLMSSP only mechanism, enable extended security\n");
584 pSMB->hdr.Flags2 |= SMBFLG2_EXT_SEC; 591 pSMB->hdr.Flags2 |= SMBFLG2_EXT_SEC;
585 } 592 }
586 593