summaryrefslogtreecommitdiff
path: root/source3/rpc_server
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>1998-04-10 18:21:16 +0000
committerJeremy Allison <jra@samba.org>1998-04-10 18:21:16 +0000
commite300c0346ff92035ff9568b55b34469193e29769 (patch)
treef4d6a8527410556a158c548f091011885016d9dc /source3/rpc_server
parent31ae9c7013be791717f6e77794ce8c8fc1c1c16c (diff)
downloadsamba-e300c0346ff92035ff9568b55b34469193e29769.tar.gz
samba-e300c0346ff92035ff9568b55b34469193e29769.tar.bz2
samba-e300c0346ff92035ff9568b55b34469193e29769.zip
includes.h: Moved HPUX undefine of SEMMSL to where it actually does something.
ipc.c: Added Luke's debug statement. locking_slow.c: Added FTRUNCATE_NEEDS_ROOT code for broken systems that need it (not sure what these are yet). membuffer.c ntdomain.h proto.h lib/rpc/include/rpc_dce.h lib/rpc/include/rpc_srvsvc.h lib/rpc/parse/parse_prs.c lib/rpc/parse/parse_rpc.c lib/rpc/server/srv_pipe_hnd.c lib/rpc/server/srv_util.c: Re-merge of Luke's NTDOM changes 'cos he's a lazy git with carpel tunnel syndrome :-). Jeremy. (This used to be commit 52e3966fbcf7b5fbdbc7cbe9ac0b453ab5bf3217)
Diffstat (limited to 'source3/rpc_server')
-rw-r--r--source3/rpc_server/srv_pipe_hnd.c26
-rw-r--r--source3/rpc_server/srv_util.c17
2 files changed, 31 insertions, 12 deletions
diff --git a/source3/rpc_server/srv_pipe_hnd.c b/source3/rpc_server/srv_pipe_hnd.c
index e4893fee89..a371e48bfd 100644
--- a/source3/rpc_server/srv_pipe_hnd.c
+++ b/source3/rpc_server/srv_pipe_hnd.c
@@ -157,9 +157,10 @@ int read_pipe(uint16 pnum, char *data, uint32 pos, int n)
if (OPEN_PNUM(pnum - PIPE_HANDLE_OFFSET))
{
- int num;
- int len;
- uint32 rpc_frag_pos;
+ int num = 0;
+ int len = 0;
+ uint32 hdr_num = 0;
+ uint32 rpc_frag_pos = 0;
DEBUG(6,("OK\n"));
@@ -169,9 +170,14 @@ int read_pipe(uint16 pnum, char *data, uint32 pos, int n)
return 0;
}
+ DEBUG(6,("read_pipe: p: %p max_rdata_len: %d data_pos: %d num: %d\n",
+ p, p->max_rdata_len, data_pos, num));
+
/* the read request starts from where the SMBtrans2 left off. */
data_pos += p->max_rdata_len;
+ rpc_frag_pos = data_pos % p->hdr.frag_len;
+
/* headers accumulate an offset */
data_pos -= p->hdr_offsets;
@@ -182,22 +188,32 @@ int read_pipe(uint16 pnum, char *data, uint32 pos, int n)
if (!IS_BITS_SET_ALL(p->hdr.flags, RPC_FLG_LAST))
{
- rpc_frag_pos = data_pos % p->hdr.frag_len;
+ DEBUG(5,("read_pipe: hdr_offsets: %d rpc_frag_pos: %d frag_len: %d\n",
+ p->hdr_offsets, rpc_frag_pos, p->hdr.frag_len));
if (rpc_frag_pos == 0)
{
+ /* this is subtracted from the total data bytes, later */
+ hdr_num = 0x18;
+
/* create and copy in a new header. */
create_rpc_reply(p, data_pos, p->rdata.offset);
mem_buf_copy(data, p->rhdr.data, 0, 0x18);
/* make room in data stream for header */
p->hdr_offsets += 0x18;
+ data += 0x18;
+
+ DEBUG(6,("read_pipe: hdr_offsets: %d\n", p->hdr_offsets));
}
}
if (num > 0)
{
- mem_buf_copy(data, p->rhdr.data, data_pos, num);
+ DEBUG(6,("read_pipe: adjusted data_pos: %d num: %d\n",
+ data_pos, num - hdr_num));
+ mem_buf_copy(data, p->rhdr.data, data_pos, num - hdr_num);
+
return num;
}
diff --git a/source3/rpc_server/srv_util.c b/source3/rpc_server/srv_util.c
index 7be259029a..3f4d66eab2 100644
--- a/source3/rpc_server/srv_util.c
+++ b/source3/rpc_server/srv_util.c
@@ -173,13 +173,16 @@ void get_domain_user_groups(char *domain_groups, char *user)
BOOL create_rpc_reply(pipes_struct *p,
uint32 data_start, uint32 data_end)
{
+ DEBUG(5,("create_rpc_reply: data_start: %d data_end: %d max_tsize: %d\n",
+ data_start, data_end, p->hdr_ba.bba.max_tsize));
+
mem_buf_init(&(p->rhdr.data), 0);
mem_alloc_data(p->rhdr.data, 0x18);
p->rhdr.align = 4;
p->rhdr.io = False;
- p->hdr_rr.alloc_hint = data_end - data_start; /* calculate remaining data to be sent */
+ p->hdr_resp.alloc_hint = data_end - data_start; /* calculate remaining data to be sent */
p->hdr.pkt_type = RPC_RESPONSE; /* mark header as an rpc response */
/* set up rpc header (fragmentation issues) */
@@ -192,10 +195,10 @@ BOOL create_rpc_reply(pipes_struct *p,
p->hdr.flags = 0;
}
- if (p->hdr_rr.alloc_hint + 0x18 <= p->hdr_ba.bba.max_tsize)
+ if (p->hdr_resp.alloc_hint + 0x18 <= p->hdr_ba.bba.max_tsize)
{
p->hdr.flags |= RPC_FLG_LAST;
- p->hdr.frag_len = p->hdr_rr.alloc_hint + 0x18;
+ p->hdr.frag_len = p->hdr_resp.alloc_hint + 0x18;
}
else
{
@@ -208,7 +211,7 @@ BOOL create_rpc_reply(pipes_struct *p,
/* store the header in the data stream */
p->rhdr.offset = 0;
smb_io_rpc_hdr ("hdr", &(p->hdr ), &(p->rhdr), 0);
- smb_io_rpc_hdr_rr("rr" , &(p->hdr_rr), &(p->rhdr), 0);
+ smb_io_rpc_hdr_resp("resp", &(p->hdr_resp), &(p->rhdr), 0);
return p->rhdr.data != NULL && p->rhdr.offset == 0x18;
}
@@ -222,11 +225,11 @@ static BOOL api_rpc_command(pipes_struct *p,
prs_struct *data)
{
int fn_num;
- DEBUG(4,("api_rpc_command: %s op 0x%x - ", rpc_name, p->hdr_rr.opnum));
+ DEBUG(4,("api_rpc_command: %s op 0x%x - ", rpc_name, p->hdr_req.opnum));
for (fn_num = 0; api_rpc_cmds[fn_num].name; fn_num++)
{
- if (api_rpc_cmds[fn_num].opnum == p->hdr_rr.opnum && api_rpc_cmds[fn_num].fn != NULL)
+ if (api_rpc_cmds[fn_num].opnum == p->hdr_req.opnum && api_rpc_cmds[fn_num].fn != NULL)
{
DEBUG(3,("api_rpc_command: %s\n", api_rpc_cmds[fn_num].name));
break;
@@ -280,7 +283,7 @@ BOOL api_rpcTNP(pipes_struct *p, char *rpc_name, struct api_struct *api_rpc_cmds
}
/* read the rpc header */
- smb_io_rpc_hdr_rr("", &(p->hdr_rr), data, 0);
+ smb_io_rpc_hdr_req("req", &(p->hdr_req), data, 0);
/* interpret the command */
if (!api_rpc_command(p, rpc_name, api_rpc_cmds, data))