s3:ntlmssp Don't permit LM_KEY in combination with NTLMv2
authorAndrew Bartlett <abartlet@samba.org>
Fri, 6 Aug 2010 10:24:35 +0000 (20:24 +1000)
committerAndrew Bartlett <abartlet@samba.org>
Mon, 9 Aug 2010 06:30:42 +0000 (16:30 +1000)
This is another 'belts and braces' check to avoid the use of the
weak 'LM_KEY' encryption when the client has chosen NTLMv2.

Andrew Bartlett

source3/libsmb/ntlmssp.c

index 66b55a1bec0c5c963c41931e254daa0f8e072f28..1157ef9d1558f6a854647be0f13e09fac3588bf0 100644 (file)
@@ -617,7 +617,10 @@ static NTSTATUS ntlmssp_server_auth(struct ntlmssp_state *ntlmssp_state,
                        DEBUG(10,("ntlmssp_server_auth: Failed to create NTLM2 session key.\n"));
                        session_key = data_blob_null;
                }
-       } else if (ntlmssp_state->neg_flags & NTLMSSP_NEGOTIATE_LM_KEY) {
+       } else if ((ntlmssp_state->neg_flags & NTLMSSP_NEGOTIATE_LM_KEY)
+               /* Ensure we can never get here on NTLMv2 */
+               && (ntlmssp_state->nt_resp.length == 0 || ntlmssp_state->nt_resp.length == 24)) {
+
                if (lm_session_key.data && lm_session_key.length >= 8) {
                        if (ntlmssp_state->lm_resp.data && ntlmssp_state->lm_resp.length == 24) {
                                session_key = data_blob_talloc(ntlmssp_state,