s3:ntlmssp Don't reply with the LM_KEY negotiation flag when not available
authorAndrew Bartlett <abartlet@samba.org>
Fri, 6 Aug 2010 09:43:06 +0000 (19:43 +1000)
committerGünther Deschner <gd@samba.org>
Tue, 10 Aug 2010 10:13:00 +0000 (12:13 +0200)
This ensures the client isn't confused and we don't enter this
weaker authentication scheme when we don't really, really need to.

Andrew Bartlett

Signed-off-by: Günther Deschner <gd@samba.org>
source3/libsmb/ntlmssp.c

index 4398ecf4a33e7a3f401e266d5ef2601ef91eea7e..7ac20826de517a36f864c73b03fb84050428b9cb 100644 (file)
@@ -642,6 +642,9 @@ static NTSTATUS ntlmssp_server_auth(struct ntlmssp_state *ntlmssp_state,
                        dump_data_pw("LM session key:\n", session_key.data,
                                     session_key.length);
                } else {
+                       /* LM Key not selected */
+                       ntlmssp_state->neg_flags &= ~NTLMSSP_NEGOTIATE_LM_KEY;
+
                        DEBUG(10,("ntlmssp_server_auth: Failed to create NTLM session key.\n"));
                        session_key = data_blob_null;
                }
@@ -649,13 +652,25 @@ static NTSTATUS ntlmssp_server_auth(struct ntlmssp_state *ntlmssp_state,
                session_key = user_session_key;
                DEBUG(10,("ntlmssp_server_auth: Using unmodified nt session key.\n"));
                dump_data_pw("unmodified session key:\n", session_key.data, session_key.length);
+
+               /* LM Key not selected */
+               ntlmssp_state->neg_flags &= ~NTLMSSP_NEGOTIATE_LM_KEY;
+
        } else if (lm_session_key.data) {
+               /* Very weird to have LM key, but no user session key, but anyway.. */
                session_key = lm_session_key;
                DEBUG(10,("ntlmssp_server_auth: Using unmodified lm session key.\n"));
                dump_data_pw("unmodified session key:\n", session_key.data, session_key.length);
+
+               /* LM Key not selected */
+               ntlmssp_state->neg_flags &= ~NTLMSSP_NEGOTIATE_LM_KEY;
+
        } else {
                DEBUG(10,("ntlmssp_server_auth: Failed to create unmodified session key.\n"));
                session_key = data_blob_null;
+
+               /* LM Key not selected */
+               ntlmssp_state->neg_flags &= ~NTLMSSP_NEGOTIATE_LM_KEY;
        }
 
        /* With KEY_EXCH, the client supplies the proposed session key,