summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2009-01-18 12:22:14 +0100
committerVolker Lendecke <vl@samba.org>2009-01-18 15:40:45 +0100
commitc45b6ec29a5b3a39b83209e970b645e5ed0a411c (patch)
tree51d1af7386cbb5f14563b585a4c87f1cfc6edc56
parenta158ebbe49d431259f002ae8272c39e5792adf4f (diff)
downloadsamba-c45b6ec29a5b3a39b83209e970b645e5ed0a411c.tar.gz
samba-c45b6ec29a5b3a39b83209e970b645e5ed0a411c.tar.bz2
samba-c45b6ec29a5b3a39b83209e970b645e5ed0a411c.zip
Add code to torture the fragmentation code a bit
-rw-r--r--source3/rpc_client/cli_pipe.c18
1 files changed, 15 insertions, 3 deletions
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: