diff options
author | Simo Sorce <idra@samba.org> | 2010-07-09 15:33:03 -0400 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2010-07-13 14:44:10 +0200 |
commit | 98913d8f44b48da345e115847efdbefbe5536e5f (patch) | |
tree | 6f0b2a39d85308764b8516fc48407a3d79e6ba75 | |
parent | 77699c777e78a1cd8ed8bc9c92cfeebe46997f70 (diff) | |
download | samba-98913d8f44b48da345e115847efdbefbe5536e5f.tar.gz samba-98913d8f44b48da345e115847efdbefbe5536e5f.tar.bz2 samba-98913d8f44b48da345e115847efdbefbe5536e5f.zip |
s3-dcerpc: use dcerpc_push_ncacn_packet_header() in create_next_pdu_ntlmssp()
Signed-off-by: Günther Deschner <gd@samba.org>
-rw-r--r-- | source3/rpc_server/srv_pipe.c | 47 |
1 files changed, 26 insertions, 21 deletions
diff --git a/source3/rpc_server/srv_pipe.c b/source3/rpc_server/srv_pipe.c index 24ecfd5160..2fd2205d96 100644 --- a/source3/rpc_server/srv_pipe.c +++ b/source3/rpc_server/srv_pipe.c @@ -59,6 +59,8 @@ static DATA_BLOB generic_session_key(void) static bool create_next_pdu_ntlmssp(pipes_struct *p) { + DATA_BLOB hdr; + uint8_t hdr_flags; RPC_HDR_RESP hdr_resp; uint32 ss_padding_len = 0; uint32 data_space_available; @@ -83,14 +85,11 @@ static bool create_next_pdu_ntlmssp(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; } /* @@ -142,31 +141,37 @@ static bool create_next_pdu_ntlmssp(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; + if (p->out_data.data_sent_length + data_len >= + prs_offset(&p->out_data.rdata)) { + hdr_flags |= DCERPC_PFC_FLAG_LAST; } /* - * Set up the header lengths. - */ - - p->hdr.frag_len = RPC_HEADER_LEN + RPC_HDR_RESP_LEN + - data_len + ss_padding_len + - RPC_HDR_AUTH_LEN + NTLMSSP_SIG_SIZE; - p->hdr.auth_len = NTLMSSP_SIG_SIZE; - - - /* * 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 + ss_padding_len + + RPC_HDR_AUTH_LEN + NTLMSSP_SIG_SIZE, + NTLMSSP_SIG_SIZE, + 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_ntlmssp: 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; } |