diff options
Diffstat (limited to 'source4')
-rw-r--r-- | source4/libcli/rpc/dcerpc.c | 27 | ||||
-rw-r--r-- | source4/torture/rpc/lsa.c | 5 |
2 files changed, 23 insertions, 9 deletions
diff --git a/source4/libcli/rpc/dcerpc.c b/source4/libcli/rpc/dcerpc.c index 56c6d95482..0e78e16ed3 100644 --- a/source4/libcli/rpc/dcerpc.c +++ b/source4/libcli/rpc/dcerpc.c @@ -527,8 +527,8 @@ NTSTATUS dcerpc_bind(struct dcerpc_pipe *p, pkt.hdr.call_id = p->call_id++; pkt.hdr.auth_length = 0; - pkt.in.bind.max_xmit_frag = 5680; - pkt.in.bind.max_recv_frag = 5680; + pkt.in.bind.max_xmit_frag = 0x2000; + pkt.in.bind.max_recv_frag = 0x2000; pkt.in.bind.assoc_group_id = 0; pkt.in.bind.num_contexts = 1; pkt.in.bind.ctx_list = talloc(mem_ctx, sizeof(pkt.in.bind.ctx_list[0])); @@ -565,7 +565,6 @@ NTSTATUS dcerpc_bind(struct dcerpc_pipe *p, status = NT_STATUS_UNSUCCESSFUL; } - p->srv_max_xmit_frag = pkt.out.bind_ack.max_xmit_frag; p->srv_max_recv_frag = pkt.out.bind_ack.max_recv_frag; @@ -610,6 +609,9 @@ NTSTATUS cli_dcerpc_bind_byname(struct dcerpc_pipe *p, const char *pipe_name) return dcerpc_bind(p, &known_pipes[i].syntax, &known_pipes[i].transfer_syntax); } +/* + perform a full request/response pair on a dcerpc pipe +*/ NTSTATUS cli_dcerpc_request(struct dcerpc_pipe *p, uint16 opnum, TALLOC_CTX *mem_ctx, @@ -619,7 +621,7 @@ NTSTATUS cli_dcerpc_request(struct dcerpc_pipe *p, struct dcerpc_packet pkt; NTSTATUS status; - DATA_BLOB blob; + DATA_BLOB blob_in, blob_out; init_dcerpc_hdr(&pkt.hdr); @@ -633,12 +635,25 @@ NTSTATUS cli_dcerpc_request(struct dcerpc_pipe *p, pkt.in.request.stub_data = *stub_data_in; pkt.in.request.auth_verifier = data_blob(NULL, 0); - status = dcerpc_push(&blob, mem_ctx, &pkt); + status = dcerpc_push(&blob_in, mem_ctx, &pkt); if (!NT_STATUS_IS_OK(status)) { return status; } - status = dcerpc_raw_packet(p, mem_ctx, &blob, stub_data_out); + status = dcerpc_raw_packet(p, mem_ctx, &blob_in, &blob_out); + + status = dcerpc_pull(&blob_out, mem_ctx, &pkt); + if (!NT_STATUS_IS_OK(status)) { + return status; + } + + if (pkt.hdr.ptype != DCERPC_PKT_RESPONSE) { + status = NT_STATUS_UNSUCCESSFUL; + } + + if (stub_data_out) { + *stub_data_out = pkt.out.response.stub_data; + } return status; } diff --git a/source4/torture/rpc/lsa.c b/source4/torture/rpc/lsa.c index dcf97cbfe2..c618685676 100644 --- a/source4/torture/rpc/lsa.c +++ b/source4/torture/rpc/lsa.c @@ -36,7 +36,6 @@ static DATA_BLOB blob_lsa_open_policy_req(TALLOC_CTX *mem_ctx, BOOL sec_qos, prs_init(&qbuf, MAX_PDU_FRAG_LEN, mem_ctx, MARSHALL); /* Initialise input parameters */ - if (sec_qos) { init_lsa_sec_qos(&qos, 2, 1, 0); init_q_open_pol(&q, '\\', 0, des_access, &qos); @@ -55,7 +54,7 @@ BOOL torture_rpc_lsa(int dummy) { NTSTATUS status; struct dcerpc_pipe *p; - DATA_BLOB request; + DATA_BLOB request, response; TALLOC_CTX *mem_ctx; mem_ctx = talloc_init("torture_rpc_lsa"); @@ -68,7 +67,7 @@ BOOL torture_rpc_lsa(int dummy) request = blob_lsa_open_policy_req(mem_ctx, True, SEC_RIGHTS_MAXIMUM_ALLOWED); - status = cli_dcerpc_request(p, LSA_OPENPOLICY, mem_ctx, &request, NULL); + status = cli_dcerpc_request(p, LSA_OPENPOLICY, mem_ctx, &request, &response); if (!NT_STATUS_IS_OK(status)) { d_printf("Failed to LSA_OPENPOLICY - %s\n", nt_errstr(status)); } |