Skip to content

Commit 07cc6cf

Browse files
author
Steve French
committed
Fix extended security auth failure
Fix authentication failures using extended security mechanisms. cifs client does not take into consideration extended security bit in capabilities field in negotiate protocol response from the server. Please refer to Samba bugzilla 8046. Reported-and-tested by: Werner Maes <Werner.Maes@icts.kuleuven.be> Signed-off-by: Shirish Pargaonkar <shirishpargaonkar@gmail.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
1 parent d4ffff1 commit 07cc6cf

1 file changed

Lines changed: 6 additions & 11 deletions

File tree

‎fs/cifs/cifssmb.c‎

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -571,18 +571,10 @@ CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses)
571571
if (pSMBr->EncryptionKeyLength == CIFS_CRYPTO_KEY_SIZE) {
572572
memcpy(ses->server->cryptkey, pSMBr->u.EncryptionKey,
573573
CIFS_CRYPTO_KEY_SIZE);
574-
} else if ((pSMBr->hdr.Flags2 & SMBFLG2_EXT_SEC)
575-
&& (pSMBr->EncryptionKeyLength == 0)) {
574+
} else if ((pSMBr->hdr.Flags2 & SMBFLG2_EXT_SEC ||
575+
server->capabilities & CAP_EXTENDED_SECURITY) &&
576+
(pSMBr->EncryptionKeyLength == 0)) {
576577
/* decode security blob */
577-
} else if (server->secMode & SECMODE_PW_ENCRYPT) {
578-
rc = -EIO; /* no crypt key only if plain text pwd */
579-
goto neg_err_exit;
580-
}
581-
582-
/* BB might be helpful to save off the domain of server here */
583-
584-
if ((pSMBr->hdr.Flags2 & SMBFLG2_EXT_SEC) &&
585-
(server->capabilities & CAP_EXTENDED_SECURITY)) {
586578
count = get_bcc(&pSMBr->hdr);
587579
if (count < 16) {
588580
rc = -EIO;
@@ -625,6 +617,9 @@ CIFSSMBNegotiate(unsigned int xid, struct cifsSesInfo *ses)
625617
} else
626618
rc = -EOPNOTSUPP;
627619
}
620+
} else if (server->secMode & SECMODE_PW_ENCRYPT) {
621+
rc = -EIO; /* no crypt key only if plain text pwd */
622+
goto neg_err_exit;
628623
} else
629624
server->capabilities &= ~CAP_EXTENDED_SECURITY;
630625

0 commit comments

Comments
 (0)