s3-talloc Change TALLOC_ARRAY() to talloc_array()
[samba.git] / source3 / rpc_client / cli_pipe.c
index d7f990af2c98ce6fb6eadcdd36f384248b6ccaf3..76d2cf164b0aa5a7d3c3a4b85bdd031bff23505d 100644 (file)
  */
 
 #include "includes.h"
+#include "../lib/util/tevent_ntstatus.h"
 #include "librpc/gen_ndr/ndr_epmapper_c.h"
 #include "../librpc/gen_ndr/ndr_schannel.h"
 #include "../librpc/gen_ndr/ndr_dssetup.h"
 #include "../libcli/auth/schannel.h"
 #include "../libcli/auth/spnego.h"
-#include "smb_krb5.h"
 #include "../libcli/auth/ntlmssp.h"
 #include "ntlmssp_wrap.h"
 #include "librpc/gen_ndr/ndr_dcerpc.h"
@@ -33,7 +33,7 @@
 #include "librpc/crypto/spnego.h"
 #include "rpc_dce.h"
 #include "cli_pipe.h"
-#include "ntdomain.h"
+#include "client.h"
 
 #undef DBGC_CLASS
 #define DBGC_CLASS DBGC_RPC_CLI
@@ -469,11 +469,7 @@ static NTSTATUS cli_pipe_validate_current_pdu(TALLOC_CTX *mem_ctx,
                          pkt->u.fault.status),
                          rpccli_pipe_txt(talloc_tos(), cli)));
 
-               if (NT_STATUS_IS_OK(NT_STATUS(pkt->u.fault.status))) {
-                       return NT_STATUS_UNSUCCESSFUL;
-               } else {
-                       return NT_STATUS(pkt->u.fault.status);
-               }
+               return dcerpc_fault_to_nt_status(pkt->u.fault.status);
 
        default:
                DEBUG(0, (__location__ "Unknown packet type %u received "
@@ -610,7 +606,7 @@ static void cli_api_pipe_write_done(struct tevent_req *subreq)
                return;
        }
 
-       state->rdata = TALLOC_ARRAY(state, uint8_t, RPC_HEADER_LEN);
+       state->rdata = talloc_array(state, uint8_t, RPC_HEADER_LEN);
        if (tevent_req_nomem(state->rdata, req)) {
                return;
        }
@@ -2569,7 +2565,7 @@ static NTSTATUS rpc_pipe_get_tcp_port(const char *host,
 
        /* allocate further parameters for the epm_Map call */
 
-       res_towers = TALLOC_ARRAY(tmp_ctx, struct epm_twr_t, max_towers);
+       res_towers = talloc_array(tmp_ctx, struct epm_twr_t, max_towers);
        if (res_towers == NULL) {
                status = NT_STATUS_NO_MEMORY;
                goto done;
@@ -2586,7 +2582,7 @@ static NTSTATUS rpc_pipe_get_tcp_port(const char *host,
 
        status = dcerpc_epm_Map(epm_handle,
                                tmp_ctx,
-                               CONST_DISCARD(struct GUID *,
+                               discard_const_p(struct GUID,
                                              &(abstract_syntax->uuid)),
                                map_tower,
                                entry_handle,