From c45b6ec29a5b3a39b83209e970b645e5ed0a411c Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 18 Jan 2009 12:22:14 +0100 Subject: Add code to torture the fragmentation code a bit --- source3/rpc_client/cli_pipe.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'source3/rpc_client/cli_pipe.c') diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c index 85085ad504..f3affd1cd8 100644 --- a/source3/rpc_client/cli_pipe.c +++ b/source3/rpc_client/cli_pipe.c @@ -1367,6 +1367,7 @@ static struct async_req *rpc_api_pipe_send(TALLOC_CTX *mem_ctx, { struct async_req *result, *subreq; struct rpc_api_pipe_state *state; + uint16_t max_recv_frag; NTSTATUS status; result = async_req_new(mem_ctx); @@ -1402,9 +1403,14 @@ static struct async_req *rpc_api_pipe_send(TALLOC_CTX *mem_ctx, DEBUG(5,("rpc_api_pipe: %s\n", rpccli_pipe_txt(debug_ctx(), cli))); - subreq = cli_api_pipe_send(state, ev, cli, - (uint8_t *)prs_data_p(data), - prs_offset(data), cli->max_recv_frag); + max_recv_frag = cli->max_recv_frag; + +#ifdef DEVELOPER + max_recv_frag = RPC_HEADER_LEN + 10 + (sys_random() % 32); +#endif + + subreq = cli_api_pipe_send(state, ev, cli, (uint8_t *)prs_data_p(data), + prs_offset(data), max_recv_frag); if (subreq == NULL) { status = NT_STATUS_NO_MEMORY; goto post_status; @@ -2085,6 +2091,12 @@ static uint32 calculate_data_len_tosend(struct rpc_pipe_client *cli, { uint32 data_space, data_len; +#ifdef DEVELOPER + if ((data_left > 0) && (sys_random() % 2)) { + data_left = MAX(data_left/2, 1); + } +#endif + switch (cli->auth->auth_level) { case PIPE_AUTH_LEVEL_NONE: case PIPE_AUTH_LEVEL_CONNECT: -- cgit