From: Stefan Metzmacher Date: Wed, 22 Jun 2016 15:18:28 +0000 (+0200) Subject: s4:rpc_server: use a variable for the max total reassembled request payload X-Git-Tag: samba-4.2.14~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f77264943a29fcea842e9eb91fd96fa99768cc37;p=thirdparty%2Fsamba.git s4:rpc_server: use a variable for the max total reassembled request payload We still use the same limit of 4 MByte (DCERPC_NCACN_REQUEST_DEFAULT_MAX_SIZE) by default. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11948 Signed-off-by: Stefan Metzmacher Reviewed-by: Andrew Bartlett Autobuild-User(master): Andrew Bartlett Autobuild-Date(master): Thu Jun 23 04:51:16 CEST 2016 on sn-devel-144 (cherry picked from commit 3f36d31c848496bf509db573e4c12821905b448d) --- diff --git a/source4/rpc_server/dcerpc_server.c b/source4/rpc_server/dcerpc_server.c index 278e1af3eaa..8439d84e37d 100644 --- a/source4/rpc_server/dcerpc_server.c +++ b/source4/rpc_server/dcerpc_server.c @@ -408,6 +408,7 @@ _PUBLIC_ NTSTATUS dcesrv_endpoint_connect(struct dcesrv_context *dce_ctx, p->allow_bind = true; p->max_recv_frag = 5840; p->max_xmit_frag = 5840; + p->max_total_request_size = DCERPC_NCACN_REQUEST_DEFAULT_MAX_SIZE; *_p = p; return NT_STATUS_OK; @@ -1532,7 +1533,7 @@ static NTSTATUS dcesrv_process_ncacn_packet(struct dcesrv_connection *dce_conn, /* * Up to 4 MByte are allowed by all fragments */ - available = DCERPC_NCACN_PAYLOAD_MAX_SIZE; + available = dce_conn->max_total_request_size; if (er->stub_and_verifier.length > available) { dcesrv_call_disconnect_after(existing, "dcesrv_auth_request - existing payload too large"); @@ -1585,7 +1586,7 @@ static NTSTATUS dcesrv_process_ncacn_packet(struct dcesrv_connection *dce_conn, /* * Up to 4 MByte are allowed by all fragments */ - if (call->pkt.u.request.alloc_hint > DCERPC_NCACN_PAYLOAD_MAX_SIZE) { + if (call->pkt.u.request.alloc_hint > dce_conn->max_total_request_size) { dcesrv_call_disconnect_after(call, "dcesrv_auth_request - initial alloc hint too large"); return dcesrv_fault(call, DCERPC_FAULT_ACCESS_DENIED); diff --git a/source4/rpc_server/dcerpc_server.h b/source4/rpc_server/dcerpc_server.h index 15b25ea8fda..72cb1bb1222 100644 --- a/source4/rpc_server/dcerpc_server.h +++ b/source4/rpc_server/dcerpc_server.h @@ -273,6 +273,9 @@ struct dcesrv_connection { /* the association group the connection belongs to */ struct dcesrv_assoc_group *assoc_group; + + /* The maximum total payload of reassembled request pdus */ + size_t max_total_request_size; };