summaryrefslogtreecommitdiff
path: root/source3/rpc_client
diff options
context:
space:
mode:
authorLuke Leighton <lkcl@samba.org>1998-10-20 18:27:49 +0000
committerLuke Leighton <lkcl@samba.org>1998-10-20 18:27:49 +0000
commit1ebeb54932de01323356e8201d465656b8723d46 (patch)
treeda41300fe2d31576f3efc0041739626b618fbb66 /source3/rpc_client
parent476d0fd23682452d0d9f56ff2e166243d74cfdbc (diff)
downloadsamba-1ebeb54932de01323356e8201d465656b8723d46.tar.gz
samba-1ebeb54932de01323356e8201d465656b8723d46.tar.bz2
samba-1ebeb54932de01323356e8201d465656b8723d46.zip
some quite important bug-fixes i missed because i transferred the wrong
smb.tgz file from my portable. particularly the call to mem_data followed by a realloc of that data in cli_pipe.c's rpc_read() function. smbd responses now use p->rdata_i which is a faked-up pointer into p->rdata's response data. rdata can be very long; rdata_i is limited to point to no more than max_tsize - 0x18 in length. this will make it an almost trivial task to add the encrypted rpc headers after rdata_i, and mem_buf_copy will cope admirably with rhdr chained to rdata_i chained to auth_verifier etc etc... (This used to be commit 05a297e3a98c14360782af4ad0d851638fb5da9a)
Diffstat (limited to 'source3/rpc_client')
-rw-r--r--source3/rpc_client/cli_pipe.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/source3/rpc_client/cli_pipe.c b/source3/rpc_client/cli_pipe.c
index 08b3575733..f5587567cd 100644
--- a/source3/rpc_client/cli_pipe.c
+++ b/source3/rpc_client/cli_pipe.c
@@ -54,12 +54,10 @@ static BOOL rpc_read(struct cli_state *cli,
int size = cli->max_recv_frag;
int file_offset = rdata_offset;
int num_read;
- char *data = rdata->data->data;
+ char *data;
uint32 err;
uint32 new_data_size = rdata->data->data_used + data_to_read;
- data += rdata_offset;
-
file_offset -= rdata_offset;
DEBUG(5,("rpc_read: data_to_read: %d data offset: %d file offset: %d\n",
@@ -71,6 +69,8 @@ static BOOL rpc_read(struct cli_state *cli,
DEBUG(5,("rpc_read: grow buffer to %d\n", rdata->data->data_used));
}
+ data = rdata->data->data + rdata_offset;
+
do /* read data using SMBreadX */
{
if (size > data_to_read)
@@ -84,7 +84,7 @@ static BOOL rpc_read(struct cli_state *cli,
DEBUG(5,("rpc_read: grow buffer to %d\n", rdata->data->data_used));
}
- num_read = cli_read(cli, cli->nt_pipe_fnum, data, file_offset + 0x100000, size);
+ num_read = cli_read(cli, cli->nt_pipe_fnum, data, file_offset, size);
DEBUG(5,("rpc_read: read offset: %d read: %d to read: %d\n",
file_offset, num_read, data_to_read));
@@ -101,9 +101,10 @@ static BOOL rpc_read(struct cli_state *cli,
mem_realloc_data(rdata->data, file_offset + rdata_offset);
rdata->data->offset.end = file_offset + rdata_offset;
- DEBUG(5,("rpc_read: data supposedly left to read:0x%x\n", data_to_read));
+ DEBUG(5,("rpc_read: offset end: 0x%x. data left to read:0x%x\n",
+ rdata->data->offset.end, data_to_read));
- return data_to_read == 0;
+ return data_to_read >= 0;
}
/****************************************************************************