r25026: Move param/param.h out of includes.h
[kai/samba-autobuild/.git] / source4 / auth / ntlmssp / ntlmssp_client.c
index acb17330fbfbd4038031f3c4f44f027b2d62475e..a98918a54b7dfcaca2fb31ddc3cfc29e855bcca2 100644 (file)
@@ -9,7 +9,7 @@
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
+   the Free Software Foundation; either version 3 of the License, or
    (at your option) any later version.
    
    This program is distributed in the hope that it will be useful,
    GNU General Public License for more details.
    
    You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
 #include "includes.h"
-#include "auth/auth.h"
 #include "auth/ntlmssp/ntlmssp.h"
 #include "auth/ntlmssp/msrpc_parse.h"
 #include "lib/crypto/crypto.h"
-#include "libcli/auth/proto.h"
+#include "libcli/auth/libcli_auth.h"
+#include "auth/credentials/credentials.h"
+#include "auth/gensec/gensec.h"
+#include "param/param.h"
 
 /*********************************************************************
  Client side NTLMSSP
@@ -47,7 +48,7 @@ NTSTATUS ntlmssp_client_initial(struct gensec_security *gensec_security,
                                TALLOC_CTX *out_mem_ctx, 
                                DATA_BLOB in, DATA_BLOB *out) 
 {
-       struct gensec_ntlmssp_state *gensec_ntlmssp_state = gensec_security->private_data;
+       struct gensec_ntlmssp_state *gensec_ntlmssp_state = (struct gensec_ntlmssp_state *)gensec_security->private_data;
 
        if (gensec_ntlmssp_state->unicode) {
                gensec_ntlmssp_state->neg_flags |= NTLMSSP_NEGOTIATE_UNICODE;
@@ -87,7 +88,7 @@ NTSTATUS ntlmssp_client_challenge(struct gensec_security *gensec_security,
                                  TALLOC_CTX *out_mem_ctx,
                                  const DATA_BLOB in, DATA_BLOB *out) 
 {
-       struct gensec_ntlmssp_state *gensec_ntlmssp_state = gensec_security->private_data;
+       struct gensec_ntlmssp_state *gensec_ntlmssp_state = (struct gensec_ntlmssp_state *)gensec_security->private_data;
        uint32_t chal_flags, ntlmssp_command, unkn1, unkn2;
        DATA_BLOB server_domain_blob;
        DATA_BLOB challenge_blob;
@@ -194,8 +195,9 @@ NTSTATUS ntlmssp_client_challenge(struct gensec_security *gensec_security,
        }
        
        if (!(flags & CLI_CRED_LANMAN_AUTH)) {
-               /* LM Key is incompatible... */
-               gensec_ntlmssp_state->neg_flags &= ~NTLMSSP_NEGOTIATE_LM_KEY;
+               /* LM Key is still possible, just silly.  Fortunetly
+                * we require command line options to end up here */
+               /* gensec_ntlmssp_state->neg_flags &= ~NTLMSSP_NEGOTIATE_LM_KEY; */
        }
 
        if (!(flags & CLI_CRED_NTLM2)) {
@@ -291,7 +293,7 @@ NTSTATUS gensec_ntlmssp_client_start(struct gensec_security *gensec_security)
        nt_status = gensec_ntlmssp_start(gensec_security);
        NT_STATUS_NOT_OK_RETURN(nt_status);
 
-       gensec_ntlmssp_state = gensec_security->private_data;
+       gensec_ntlmssp_state = (struct gensec_ntlmssp_state *)gensec_security->private_data;
 
        gensec_ntlmssp_state->role = NTLMSSP_CLIENT;
 
@@ -329,6 +331,10 @@ NTSTATUS gensec_ntlmssp_client_start(struct gensec_security *gensec_security)
                gensec_ntlmssp_state->neg_flags |= NTLMSSP_NEGOTIATE_KEY_EXCH;          
        }
 
+       if (lp_parm_bool(-1, "ntlmssp_client", "alwayssign", True)) {
+               gensec_ntlmssp_state->neg_flags |= NTLMSSP_NEGOTIATE_ALWAYS_SIGN;               
+       }
+
        if (lp_parm_bool(-1, "ntlmssp_client", "ntlm2", True)) {
                gensec_ntlmssp_state->neg_flags |= NTLMSSP_NEGOTIATE_NTLM2;             
        } else {