s4: ran minimal_includes.pl on source4/auth/ntlm
[ira/wip.git] / source4 / auth / ntlm / auth_server.c
index f154cf04258d28bf8e36201c4147507008e28b77..12849aa420299c42564ef9986d22034f6c3f075f 100644 (file)
 
 #include "includes.h"
 #include "auth/auth.h"
-#include "auth/ntlm/auth_proto.h"
 #include "auth/credentials/credentials.h"
 #include "libcli/security/security.h"
-#include "librpc/gen_ndr/ndr_samr.h"
 #include "libcli/smb_composite/smb_composite.h"
 #include "param/param.h"
 #include "libcli/resolve/resolve.h"
@@ -66,23 +64,32 @@ static NTSTATUS server_get_challenge(struct auth_method_context *ctx, TALLOC_CTX
                return NT_STATUS_INTERNAL_ERROR;
        }
        io.in.dest_ports = lp_smb_ports(ctx->auth_ctx->lp_ctx); 
+       io.in.socket_options = lp_socket_options(ctx->auth_ctx->lp_ctx);
+       io.in.gensec_settings = lp_gensec_settings(mem_ctx, ctx->auth_ctx->lp_ctx);
 
        io.in.called_name = strupper_talloc(mem_ctx, io.in.dest_host);
 
        /* We don't want to get as far as the session setup */
-       io.in.credentials = NULL;
+       io.in.credentials = cli_credentials_init_anon(mem_ctx);
+       cli_credentials_set_workstation(io.in.credentials,
+                                       lp_netbios_name(ctx->auth_ctx->lp_ctx),
+                                       CRED_SPECIFIED);
+
        io.in.service = NULL;
 
        io.in.workgroup = ""; /* only used with SPNEGO, disabled above */
 
        io.in.options = smb_options;
+       
+       io.in.iconv_convenience = lp_iconv_convenience(ctx->auth_ctx->lp_ctx);
+       lp_smbcli_session_options(ctx->auth_ctx->lp_ctx, &io.in.session_options);
 
        status = smb_composite_connect(&io, mem_ctx, lp_resolve_context(ctx->auth_ctx->lp_ctx),
                                       ctx->auth_ctx->event_ctx);
-       if (!NT_STATUS_IS_OK(status)) {
-               *_blob = io.out.tree->session->transport->negotiate.secblob;
-               ctx->private_data = talloc_steal(ctx, io.out.tree->session);
-       }
+       NT_STATUS_NOT_OK_RETURN(status);
+
+       *_blob = io.out.tree->session->transport->negotiate.secblob;
+       ctx->private_data = talloc_steal(ctx, io.out.tree->session);
        return NT_STATUS_OK;
 }
 
@@ -107,7 +114,6 @@ static NTSTATUS server_check_password(struct auth_method_context *ctx,
        NTSTATUS nt_status;
        struct auth_serversupplied_info *server_info;
        struct cli_credentials *creds;
-       const char *user;
        struct smb_composite_sesssetup session_setup;
 
        struct smbcli_session *session = talloc_get_type(ctx->private_data, struct smbcli_session);
@@ -139,6 +145,7 @@ static NTSTATUS server_check_password(struct auth_method_context *ctx,
 
        session_setup.in.credentials = creds;
        session_setup.in.workgroup = ""; /* Only used with SPNEGO, which we are not doing */
+       session_setup.in.gensec_settings = lp_gensec_settings(session, ctx->auth_ctx->lp_ctx);
 
        /* Check password with remove server - this should be async some day */
        nt_status = smb_composite_sesssetup(session, &session_setup);