mirror of
https://github.com/samba-team/samba.git
synced 2025-01-15 23:24:37 +03:00
r2038: get rid of the optimisation in the dcerpc server that tries to avoid a
data copy by playing internal games with DATA_BLOB and free().
This commit is contained in:
parent
c0862278ca
commit
5894b5c0f3
@ -856,32 +856,6 @@ NTSTATUS dcesrv_input(struct dcesrv_connection *dce_conn, const DATA_BLOB *data)
|
||||
{
|
||||
NTSTATUS status;
|
||||
|
||||
/* handle the very common case that the input contains a full packet and there
|
||||
is no partial packet pending. In this case we can avoid a copy of the
|
||||
data */
|
||||
if (dce_conn->partial_input.length == 0) {
|
||||
dce_conn->partial_input = *data;
|
||||
/* make sure that dce_partial_advance doesn't free this data */
|
||||
dce_conn->partial_input.free = NULL;
|
||||
while (dce_full_packet(&dce_conn->partial_input)) {
|
||||
status = dcesrv_input_process(dce_conn);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
return status;
|
||||
}
|
||||
}
|
||||
if (dce_conn->partial_input.length) {
|
||||
/* there was some data left over. We have to copy this
|
||||
as the caller may free the data */
|
||||
dce_conn->partial_input =
|
||||
data_blob(dce_conn->partial_input.data,
|
||||
dce_conn->partial_input.length);
|
||||
if (!dce_conn->partial_input.data) {
|
||||
return NT_STATUS_NO_MEMORY;
|
||||
}
|
||||
}
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
dce_conn->partial_input.data = Realloc(dce_conn->partial_input.data,
|
||||
dce_conn->partial_input.length + data->length);
|
||||
if (!dce_conn->partial_input.data) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user