diff options
author | Jeremy Allison <jra@samba.org> | 2003-02-14 23:04:03 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2003-02-14 23:04:03 +0000 |
commit | 4cd6e31bd364270580f2907fbc5669bf29d09578 (patch) | |
tree | 4a364bf23c3275d74bb3b8490d9a21a14a1f59cd /source3/rpc_server | |
parent | 4f6c2ab8957c39119afecc33718d457fa59bd874 (diff) | |
download | samba-4cd6e31bd364270580f2907fbc5669bf29d09578.tar.gz samba-4cd6e31bd364270580f2907fbc5669bf29d09578.tar.bz2 samba-4cd6e31bd364270580f2907fbc5669bf29d09578.zip |
Ensure that only parse_prs.c access internal members of the prs_struct.
Needed to move to disk based i/o later.
Jeremy.
(This used to be commit 4c3ee228fcdb089eaeead95e79532a9cf6cb0de6)
Diffstat (limited to 'source3/rpc_server')
-rw-r--r-- | source3/rpc_server/srv_pipe.c | 26 | ||||
-rw-r--r-- | source3/rpc_server/srv_pipe_hnd.c | 15 | ||||
-rw-r--r-- | source3/rpc_server/srv_spoolss_nt.c | 5 |
3 files changed, 18 insertions, 28 deletions
diff --git a/source3/rpc_server/srv_pipe.c b/source3/rpc_server/srv_pipe.c index 4c4b3e7af3..50127005a1 100644 --- a/source3/rpc_server/srv_pipe.c +++ b/source3/rpc_server/srv_pipe.c @@ -84,8 +84,6 @@ BOOL create_next_pdu(pipes_struct *p) uint32 data_space_available; uint32 data_len_left; prs_struct outgoing_pdu; - char *data; - char *data_from; uint32 data_pos; /* @@ -187,26 +185,26 @@ BOOL create_next_pdu(pipes_struct *p) data_pos = prs_offset(&outgoing_pdu); /* Copy the data into the PDU. */ - data_from = prs_data_p(&p->out_data.rdata) + p->out_data.data_sent_length; - if(!prs_append_data(&outgoing_pdu, data_from, data_len)) { + if(!prs_append_some_prs_data(&outgoing_pdu, &p->out_data.rdata, p->out_data.data_sent_length, data_len)) { DEBUG(0,("create_next_pdu: failed to copy %u bytes of data.\n", (unsigned int)data_len)); prs_mem_free(&outgoing_pdu); return False; } - /* - * Set data to point to where we copied the data into. - */ - - data = prs_data_p(&outgoing_pdu) + data_pos; - if (p->hdr.auth_len > 0) { uint32 crc32 = 0; + char *data; DEBUG(5,("create_next_pdu: sign: %s seal: %s data %d auth %d\n", BOOLSTR(auth_verify), BOOLSTR(auth_seal), data_len, p->hdr.auth_len)); + /* + * Set data to point to where we copied the data into. + */ + + data = prs_data_p(&outgoing_pdu) + data_pos; + if (auth_seal) { crc32 = crc32_calc_buffer(data, data_len); NTLMSSPcalc_p(p, (uchar*)data, data_len); @@ -1389,17 +1387,15 @@ BOOL api_rpcTNP(pipes_struct *p, const char *rpc_name, /* Check for buffer underflow in rpc parsing */ if ((DEBUGLEVEL >= 10) && - (p->in_data.data.data_offset != p->in_data.data.buffer_size)) { - int data_len = p->in_data.data.buffer_size - - p->in_data.data.data_offset; + (prs_offset(&p->in_data.data) != prs_data_size(&p->in_data.data))) { + size_t data_len = prs_data_size(&p->in_data.data) - prs_offset(&p->in_data.data); char *data; data = malloc(data_len); DEBUG(10, ("api_rpcTNP: rpc input buffer underflow (parse error?)\n")); if (data) { - prs_uint8s(False, "", &p->in_data.data, 0, (unsigned char *)data, - data_len); + prs_uint8s(False, "", &p->in_data.data, 0, (unsigned char *)data, (uint32)data_len); SAFE_FREE(data); } diff --git a/source3/rpc_server/srv_pipe_hnd.c b/source3/rpc_server/srv_pipe_hnd.c index 6cdb6836eb..8cb81b9c6d 100644 --- a/source3/rpc_server/srv_pipe_hnd.c +++ b/source3/rpc_server/srv_pipe_hnd.c @@ -618,16 +618,11 @@ authentication failed. Denying the request.\n", p->name)); * Append the data portion into the buffer and return. */ - { - char *data_from = prs_data_p(rpc_in_p) + prs_offset(rpc_in_p); - - if(!prs_append_data(&p->in_data.data, data_from, data_len)) { - DEBUG(0,("process_request_pdu: Unable to append data size %u to parse buffer of size %u.\n", - (unsigned int)data_len, (unsigned int)prs_data_size(&p->in_data.data) )); - set_incoming_fault(p); - return False; - } - + if(!prs_append_some_prs_data(&p->in_data.data, rpc_in_p, prs_offset(rpc_in_p), data_len)) { + DEBUG(0,("process_request_pdu: Unable to append data size %u to parse buffer of size %u.\n", + (unsigned int)data_len, (unsigned int)prs_data_size(&p->in_data.data) )); + set_incoming_fault(p); + return False; } if(p->hdr.flags & RPC_FLG_LAST) { diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c index 594c749c9c..8304b14a1c 100644 --- a/source3/rpc_server/srv_spoolss_nt.c +++ b/source3/rpc_server/srv_spoolss_nt.c @@ -706,10 +706,9 @@ static void notify_system_time(struct spoolss_notify_msg *msg, return; data->notify_data.data.length = prs_offset(&ps); - data->notify_data.data.string = - talloc(mem_ctx, prs_offset(&ps)); + data->notify_data.data.string = talloc(mem_ctx, prs_offset(&ps)); - memcpy(data->notify_data.data.string, prs_data_p(&ps), prs_offset(&ps)); + prs_copy_all_data_out((char *)data->notify_data.data.string, &ps); prs_mem_free(&ps); } |