diff options
author | Simo Sorce <idra@samba.org> | 2010-07-09 15:46:43 -0400 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2010-07-13 14:44:10 +0200 |
commit | d078b54b22061be808c07a40e0e55dd00591cc69 (patch) | |
tree | 84439bb940cbb22b917443c512386eeac44ec0bb /source3/rpc_server | |
parent | 53e9c262712ffe5b1fa60ca53a1e5b407d1ebea8 (diff) | |
download | samba-d078b54b22061be808c07a40e0e55dd00591cc69.tar.gz samba-d078b54b22061be808c07a40e0e55dd00591cc69.tar.bz2 samba-d078b54b22061be808c07a40e0e55dd00591cc69.zip |
s3-dcerpc: use dceprc_push_ncacn_packet_header in create_next_pdu_noauth()
Signed-off-by: Günther Deschner <gd@samba.org>
Diffstat (limited to 'source3/rpc_server')
-rw-r--r-- | source3/rpc_server/srv_pipe.c | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/source3/rpc_server/srv_pipe.c b/source3/rpc_server/srv_pipe.c index 86a72eb643..cdb59ade80 100644 --- a/source3/rpc_server/srv_pipe.c +++ b/source3/rpc_server/srv_pipe.c @@ -525,6 +525,9 @@ static bool create_next_pdu_schannel(pipes_struct *p) static bool create_next_pdu_noauth(pipes_struct *p) { + DATA_BLOB hdr; + uint8_t hdr_flags; + NTSTATUS status; RPC_HDR_RESP hdr_resp; uint32 data_len; uint32 data_space_available; @@ -542,14 +545,11 @@ static bool create_next_pdu_noauth(pipes_struct *p) memset((char *)&hdr_resp, '\0', sizeof(hdr_resp)); - /* Change the incoming request header to a response. */ - p->hdr.pkt_type = DCERPC_PKT_RESPONSE; - /* Set up rpc header flags. */ if (p->out_data.data_sent_length == 0) { - p->hdr.flags = DCERPC_PFC_FLAG_FIRST; + hdr_flags = DCERPC_PFC_FLAG_FIRST; } else { - p->hdr.flags = 0; + hdr_flags = 0; } /* @@ -587,28 +587,34 @@ static bool create_next_pdu_noauth(pipes_struct *p) /* * Work out if this PDU will be the last. */ - if(p->out_data.data_sent_length + data_len >= prs_offset(&p->out_data.rdata)) { - p->hdr.flags |= DCERPC_PFC_FLAG_LAST; + hdr_flags |= DCERPC_PFC_FLAG_LAST; } /* - * Set up the header lengths. - */ - - p->hdr.frag_len = RPC_HEADER_LEN + RPC_HDR_RESP_LEN + data_len; - p->hdr.auth_len = 0; - - /* * Init the parse struct to point at the outgoing * data. */ - prs_init_empty(&p->out_data.frag, p->mem_ctx, MARSHALL); + status = dcerpc_push_ncacn_packet_header( + prs_get_mem_context(&p->out_data.frag), + DCERPC_PKT_RESPONSE, + hdr_flags, + RPC_HEADER_LEN + RPC_HDR_RESP_LEN + data_len, + 0, + p->hdr.call_id, + &hdr); + if (!NT_STATUS_IS_OK(status)) { + DEBUG(0, ("Failed to marshall RPC Header.\n")); + prs_mem_free(&p->out_data.frag); + return False; + } + /* Store the header in the data stream. */ - if(!smb_io_rpc_hdr("hdr", &p->hdr, &p->out_data.frag, 0)) { - DEBUG(0,("create_next_pdu_noath: failed to marshall RPC_HDR.\n")); + if (!prs_copy_data_in(&p->out_data.frag, + (char *)hdr.data, hdr.length)) { + DEBUG(0, ("Out of memory.\n")); prs_mem_free(&p->out_data.frag); return False; } |