aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2013-05-26 07:00:59 -0400
committerSteve French <smfrench@gmail.com>2013-06-24 02:56:42 -0400
commite598d1d8fb512c7a4d86c729cdca30e87fe7cfc9 (patch)
treeb55b7af7d1e6a701aee449239df1fe9f7f38ee50 /fs/cifs
parent515d82ffd0fe4a87d872c655a6e19a318770ea0c (diff)
cifs: track the flavor of the NEGOTIATE reponse
Track what sort of NEGOTIATE response we get from the server, as that will govern what sort of authentication types this socket will support. There are three possibilities: LANMAN: server sent legacy LANMAN-type response UNENCAP: server sent a newer-style response, but extended security bit wasn't set. This socket will only support unencapsulated auth types. EXTENDED: server sent a newer-style response with the extended security bit set. This is necessary to support krb5 and ntlmssp auth types. Signed-off-by: Jeff Layton <jlayton@redhat.com> Reviewed-by: Pavel Shilovsky <piastry@etersoft.ru> Signed-off-by: Steve French <smfrench@gmail.com>
Diffstat (limited to 'fs/cifs')
-rw-r--r--fs/cifs/cifsglob.h4
-rw-r--r--fs/cifs/cifssmb.c15
-rw-r--r--fs/cifs/smb2pdu.c2
3 files changed, 16 insertions, 5 deletions
diff --git a/fs/cifs/cifsglob.h b/fs/cifs/cifsglob.h
index 9f8dc3da5f3b..82ba4b974894 100644
--- a/fs/cifs/cifsglob.h
+++ b/fs/cifs/cifsglob.h
@@ -541,6 +541,10 @@ struct TCP_Server_Info {
541 struct session_key session_key; 541 struct session_key session_key;
542 unsigned long lstrp; /* when we got last response from this server */ 542 unsigned long lstrp; /* when we got last response from this server */
543 struct cifs_secmech secmech; /* crypto sec mech functs, descriptors */ 543 struct cifs_secmech secmech; /* crypto sec mech functs, descriptors */
544#define CIFS_NEGFLAVOR_LANMAN 0 /* wct == 13, LANMAN */
545#define CIFS_NEGFLAVOR_UNENCAP 1 /* wct == 17, but no ext_sec */
546#define CIFS_NEGFLAVOR_EXTENDED 2 /* wct == 17, ext_sec bit set */
547 char negflavor; /* NEGOTIATE response flavor */
544 /* extended security flavors that server supports */ 548 /* extended security flavors that server supports */
545 bool sec_ntlmssp; /* supports NTLMSSP */ 549 bool sec_ntlmssp; /* supports NTLMSSP */
546 bool sec_kerberosu2u; /* supports U2U Kerberos */ 550 bool sec_kerberosu2u; /* supports U2U Kerberos */
diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c
index e63961086752..80ca6886a816 100644
--- a/fs/cifs/cifssmb.c
+++ b/fs/cifs/cifssmb.c
@@ -615,6 +615,7 @@ CIFSSMBNegotiate(const unsigned int xid, struct cifs_ses *ses)
615 rc = -EOPNOTSUPP; 615 rc = -EOPNOTSUPP;
616 goto neg_err_exit; 616 goto neg_err_exit;
617 } else if (pSMBr->hdr.WordCount == 13) { 617 } else if (pSMBr->hdr.WordCount == 13) {
618 server->negflavor = CIFS_NEGFLAVOR_LANMAN;
618 rc = decode_lanman_negprot_rsp(server, pSMBr, secFlags); 619 rc = decode_lanman_negprot_rsp(server, pSMBr, secFlags);
619 goto signing_check; 620 goto signing_check;
620 } else if (pSMBr->hdr.WordCount != 17) { 621 } else if (pSMBr->hdr.WordCount != 17) {
@@ -666,17 +667,21 @@ CIFSSMBNegotiate(const unsigned int xid, struct cifs_ses *ses)
666 server->timeAdj = (int)(__s16)le16_to_cpu(pSMBr->ServerTimeZone); 667 server->timeAdj = (int)(__s16)le16_to_cpu(pSMBr->ServerTimeZone);
667 server->timeAdj *= 60; 668 server->timeAdj *= 60;
668 669
669 if (pSMBr->EncryptionKeyLength == CIFS_CRYPTO_KEY_SIZE) 670 if (pSMBr->EncryptionKeyLength == CIFS_CRYPTO_KEY_SIZE) {
671 server->negflavor = CIFS_NEGFLAVOR_UNENCAP;
670 memcpy(ses->server->cryptkey, pSMBr->u.EncryptionKey, 672 memcpy(ses->server->cryptkey, pSMBr->u.EncryptionKey,
671 CIFS_CRYPTO_KEY_SIZE); 673 CIFS_CRYPTO_KEY_SIZE);
672 else if ((pSMBr->hdr.Flags2 & SMBFLG2_EXT_SEC || 674 } else if ((pSMBr->hdr.Flags2 & SMBFLG2_EXT_SEC ||
673 server->capabilities & CAP_EXTENDED_SECURITY) && 675 server->capabilities & CAP_EXTENDED_SECURITY) &&
674 (pSMBr->EncryptionKeyLength == 0)) 676 (pSMBr->EncryptionKeyLength == 0)) {
677 server->negflavor = CIFS_NEGFLAVOR_EXTENDED;
675 rc = decode_ext_sec_blob(server, pSMBr); 678 rc = decode_ext_sec_blob(server, pSMBr);
676 else if (server->sec_mode & SECMODE_PW_ENCRYPT) 679 } else if (server->sec_mode & SECMODE_PW_ENCRYPT) {
677 rc = -EIO; /* no crypt key only if plain text pwd */ 680 rc = -EIO; /* no crypt key only if plain text pwd */
678 else 681 } else {
682 server->negflavor = CIFS_NEGFLAVOR_UNENCAP;
679 server->capabilities &= ~CAP_EXTENDED_SECURITY; 683 server->capabilities &= ~CAP_EXTENDED_SECURITY;
684 }
680 685
681signing_check: 686signing_check:
682 if (!rc) 687 if (!rc)
diff --git a/fs/cifs/smb2pdu.c b/fs/cifs/smb2pdu.c
index ebb97b484ab1..1609699e7bec 100644
--- a/fs/cifs/smb2pdu.c
+++ b/fs/cifs/smb2pdu.c
@@ -405,6 +405,8 @@ SMB2_negotiate(const unsigned int xid, struct cifs_ses *ses)
405 } 405 }
406 server->dialect = le16_to_cpu(rsp->DialectRevision); 406 server->dialect = le16_to_cpu(rsp->DialectRevision);
407 407
408 /* SMB2 only has an extended negflavor */
409 server->negflavor = CIFS_NEGFLAVOR_EXTENDED;
408 server->maxBuf = le32_to_cpu(rsp->MaxTransactSize); 410 server->maxBuf = le32_to_cpu(rsp->MaxTransactSize);
409 server->max_read = le32_to_cpu(rsp->MaxReadSize); 411 server->max_read = le32_to_cpu(rsp->MaxReadSize);
410 server->max_write = le32_to_cpu(rsp->MaxWriteSize); 412 server->max_write = le32_to_cpu(rsp->MaxWriteSize);