|
@@ -420,7 +420,6 @@ static int decode_ntlmssp_challenge(char *bcc_ptr, int blob_len,
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
-#ifdef CONFIG_CIFS_EXPERIMENTAL
|
|
|
/* BB Move to ntlmssp.c eventually */
|
|
|
|
|
|
/* We do not malloc the blob, it is passed in pbuffer, because
|
|
@@ -564,7 +563,6 @@ setup_ntlmv2_ret:
|
|
|
*buflen = tmp - pbuffer;
|
|
|
return rc;
|
|
|
}
|
|
|
-#endif
|
|
|
|
|
|
int
|
|
|
CIFS_SessSetup(unsigned int xid, struct cifsSesInfo *ses,
|
|
@@ -806,74 +804,70 @@ ssetup_ntlmssp_authenticate:
|
|
|
rc = -ENOSYS;
|
|
|
goto ssetup_exit;
|
|
|
#endif /* CONFIG_CIFS_UPCALL */
|
|
|
- } else {
|
|
|
-#ifdef CONFIG_CIFS_EXPERIMENTAL
|
|
|
- if (type == RawNTLMSSP) {
|
|
|
- if ((pSMB->req.hdr.Flags2 & SMBFLG2_UNICODE) == 0) {
|
|
|
- cERROR(1, "NTLMSSP requires Unicode support");
|
|
|
- rc = -ENOSYS;
|
|
|
+ } else if (type == RawNTLMSSP) {
|
|
|
+ if ((pSMB->req.hdr.Flags2 & SMBFLG2_UNICODE) == 0) {
|
|
|
+ cERROR(1, "NTLMSSP requires Unicode support");
|
|
|
+ rc = -ENOSYS;
|
|
|
+ goto ssetup_exit;
|
|
|
+ }
|
|
|
+
|
|
|
+ cFYI(1, "ntlmssp session setup phase %d", phase);
|
|
|
+ pSMB->req.hdr.Flags2 |= SMBFLG2_EXT_SEC;
|
|
|
+ capabilities |= CAP_EXTENDED_SECURITY;
|
|
|
+ pSMB->req.Capabilities |= cpu_to_le32(capabilities);
|
|
|
+ switch(phase) {
|
|
|
+ case NtLmNegotiate:
|
|
|
+ build_ntlmssp_negotiate_blob(
|
|
|
+ pSMB->req.SecurityBlob, ses);
|
|
|
+ iov[1].iov_len = sizeof(NEGOTIATE_MESSAGE);
|
|
|
+ iov[1].iov_base = pSMB->req.SecurityBlob;
|
|
|
+ pSMB->req.SecurityBlobLength =
|
|
|
+ cpu_to_le16(sizeof(NEGOTIATE_MESSAGE));
|
|
|
+ break;
|
|
|
+ case NtLmAuthenticate:
|
|
|
+ /*
|
|
|
+ * 5 is an empirical value, large enough to hold
|
|
|
+ * authenticate message plus max 10 of av paris,
|
|
|
+ * domain, user, workstation names, flags, etc.
|
|
|
+ */
|
|
|
+ ntlmsspblob = kzalloc(
|
|
|
+ 5*sizeof(struct _AUTHENTICATE_MESSAGE),
|
|
|
+ GFP_KERNEL);
|
|
|
+ if (!ntlmsspblob) {
|
|
|
+ cERROR(1, "Can't allocate NTLMSSP blob");
|
|
|
+ rc = -ENOMEM;
|
|
|
goto ssetup_exit;
|
|
|
}
|
|
|
|
|
|
- cFYI(1, "ntlmssp session setup phase %d", phase);
|
|
|
- pSMB->req.hdr.Flags2 |= SMBFLG2_EXT_SEC;
|
|
|
- capabilities |= CAP_EXTENDED_SECURITY;
|
|
|
- pSMB->req.Capabilities |= cpu_to_le32(capabilities);
|
|
|
- if (phase == NtLmNegotiate) {
|
|
|
- build_ntlmssp_negotiate_blob(
|
|
|
- pSMB->req.SecurityBlob, ses);
|
|
|
- iov[1].iov_len = sizeof(NEGOTIATE_MESSAGE);
|
|
|
- iov[1].iov_base = pSMB->req.SecurityBlob;
|
|
|
- pSMB->req.SecurityBlobLength =
|
|
|
- cpu_to_le16(sizeof(NEGOTIATE_MESSAGE));
|
|
|
- } else if (phase == NtLmAuthenticate) {
|
|
|
- /* 5 is an empirical value, large enought to
|
|
|
- * hold authenticate message, max 10 of
|
|
|
- * av paris, doamin,user,workstation mames,
|
|
|
- * flags etc..
|
|
|
- */
|
|
|
- ntlmsspblob = kzalloc(
|
|
|
- 5*sizeof(struct _AUTHENTICATE_MESSAGE),
|
|
|
- GFP_KERNEL);
|
|
|
- if (!ntlmsspblob) {
|
|
|
- cERROR(1, "Can't allocate NTLMSSP");
|
|
|
- rc = -ENOMEM;
|
|
|
- goto ssetup_exit;
|
|
|
- }
|
|
|
-
|
|
|
- rc = build_ntlmssp_auth_blob(ntlmsspblob,
|
|
|
- &blob_len, ses, nls_cp);
|
|
|
- if (rc)
|
|
|
- goto ssetup_exit;
|
|
|
- iov[1].iov_len = blob_len;
|
|
|
- iov[1].iov_base = ntlmsspblob;
|
|
|
- pSMB->req.SecurityBlobLength =
|
|
|
- cpu_to_le16(blob_len);
|
|
|
- /* Make sure that we tell the server that we
|
|
|
- are using the uid that it just gave us back
|
|
|
- on the response (challenge) */
|
|
|
- smb_buf->Uid = ses->Suid;
|
|
|
- } else {
|
|
|
- cERROR(1, "invalid phase %d", phase);
|
|
|
- rc = -ENOSYS;
|
|
|
+ rc = build_ntlmssp_auth_blob(ntlmsspblob,
|
|
|
+ &blob_len, ses, nls_cp);
|
|
|
+ if (rc)
|
|
|
goto ssetup_exit;
|
|
|
- }
|
|
|
- /* unicode strings must be word aligned */
|
|
|
- if ((iov[0].iov_len + iov[1].iov_len) % 2) {
|
|
|
- *bcc_ptr = 0;
|
|
|
- bcc_ptr++;
|
|
|
- }
|
|
|
- unicode_oslm_strings(&bcc_ptr, nls_cp);
|
|
|
- } else {
|
|
|
- cERROR(1, "secType %d not supported!", type);
|
|
|
+ iov[1].iov_len = blob_len;
|
|
|
+ iov[1].iov_base = ntlmsspblob;
|
|
|
+ pSMB->req.SecurityBlobLength = cpu_to_le16(blob_len);
|
|
|
+ /*
|
|
|
+ * Make sure that we tell the server that we are using
|
|
|
+ * the uid that it just gave us back on the response
|
|
|
+ * (challenge)
|
|
|
+ */
|
|
|
+ smb_buf->Uid = ses->Suid;
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ cERROR(1, "invalid phase %d", phase);
|
|
|
rc = -ENOSYS;
|
|
|
goto ssetup_exit;
|
|
|
}
|
|
|
-#else
|
|
|
+ /* unicode strings must be word aligned */
|
|
|
+ if ((iov[0].iov_len + iov[1].iov_len) % 2) {
|
|
|
+ *bcc_ptr = 0;
|
|
|
+ bcc_ptr++;
|
|
|
+ }
|
|
|
+ unicode_oslm_strings(&bcc_ptr, nls_cp);
|
|
|
+ } else {
|
|
|
cERROR(1, "secType %d not supported!", type);
|
|
|
rc = -ENOSYS;
|
|
|
goto ssetup_exit;
|
|
|
-#endif
|
|
|
}
|
|
|
|
|
|
iov[2].iov_base = str_area;
|