s3-dcerpc: use dcerpc_push_ncacn_packet() in create_rpc_bind_auth3()
[ira/wip.git] / source3 / rpc_client / cli_netlogon.c
index 03884479f9f08d77980030f7b2c2573ff1d5663a..28972c96fa8bd5a904675b32756baad63aafbac8 100644 (file)
@@ -23,6 +23,8 @@
 #include "includes.h"
 #include "../libcli/auth/libcli_auth.h"
 #include "../librpc/gen_ndr/cli_netlogon.h"
+#include "rpc_client/cli_netlogon.h"
+#include "rpc_client/init_netlogon.h"
 
 /****************************************************************************
  Wrapper function that uses the auth and auth2 calls to set up a NETLOGON
@@ -45,6 +47,7 @@ NTSTATUS rpccli_netlogon_setup_creds(struct rpc_pipe_client *cli,
        struct samr_Password password;
        bool retried = false;
        fstring mach_acct;
+       uint32_t neg_flags = *neg_flags_inout;
 
        if (!ndr_syntax_id_equal(&cli->abstract_syntax,
                                 &ndr_table_netlogon.syntax_id)) {
@@ -81,7 +84,7 @@ NTSTATUS rpccli_netlogon_setup_creds(struct rpc_pipe_client *cli,
                                    &srv_chal_recv,
                                    &password,
                                    &clnt_chal_send,
-                                   *neg_flags_inout);
+                                   neg_flags);
 
        if (!cli->dc) {
                return NT_STATUS_NO_MEMORY;
@@ -98,7 +101,7 @@ NTSTATUS rpccli_netlogon_setup_creds(struct rpc_pipe_client *cli,
                                                 cli->dc->computer_name,
                                                 &clnt_chal_send, /* input. */
                                                 &srv_chal_recv, /* output. */
-                                                neg_flags_inout);
+                                                &neg_flags);
 
        /* we might be talking to NT4, so let's downgrade in that case and retry
         * with the returned neg_flags - gd */
@@ -132,6 +135,9 @@ NTSTATUS rpccli_netlogon_setup_creds(struct rpc_pipe_client *cli,
                "chain established.\n",
                cli->desthost ));
 
+       cli->dc->negotiate_flags = neg_flags;
+       *neg_flags_inout = neg_flags;
+
        return NT_STATUS_OK;
 }
 
@@ -154,10 +160,8 @@ NTSTATUS rpccli_netlogon_sam_logon(struct rpc_pipe_client *cli,
        uint8_t authoritative;
        int validation_level = 3;
        fstring clnt_name_slash;
-       uint8 zeros[16];
 
        ZERO_STRUCT(ret_creds);
-       ZERO_STRUCT(zeros);
 
        logon = TALLOC_ZERO_P(mem_ctx, union netr_LogonLevel);
        if (!logon) {
@@ -302,7 +306,6 @@ NTSTATUS rpccli_netlogon_sam_network_logon(struct rpc_pipe_client *cli,
        int validation_level = 3;
        const char *workstation_name_slash;
        const char *server_name_slash;
-       uint8 zeros[16];
        struct netr_Authenticator clnt_creds;
        struct netr_Authenticator ret_creds;
        union netr_LogonLevel *logon = NULL;
@@ -314,7 +317,6 @@ NTSTATUS rpccli_netlogon_sam_network_logon(struct rpc_pipe_client *cli,
 
        *info3 = NULL;
 
-       ZERO_STRUCT(zeros);
        ZERO_STRUCT(ret_creds);
 
        ZERO_STRUCT(lm);
@@ -414,7 +416,6 @@ NTSTATUS rpccli_netlogon_sam_network_logon_ex(struct rpc_pipe_client *cli,
        int validation_level = 3;
        const char *workstation_name_slash;
        const char *server_name_slash;
-       uint8 zeros[16];
        union netr_LogonLevel *logon = NULL;
        struct netr_NetworkInfo *network_info;
        uint8_t authoritative;
@@ -425,8 +426,6 @@ NTSTATUS rpccli_netlogon_sam_network_logon_ex(struct rpc_pipe_client *cli,
 
        *info3 = NULL;
 
-       ZERO_STRUCT(zeros);
-
        ZERO_STRUCT(lm);
        ZERO_STRUCT(nt);