From: Stefan Metzmacher Date: Sat, 20 Jun 2015 15:49:02 +0000 (+0200) Subject: s4:rpc_server: fix padding caclucation in dcesrv_auth_response() X-Git-Tag: samba-4.1.20~22 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6d6799a2190dc131b01e897f538b137b0b400ccf;p=thirdparty%2Fsamba.git s4:rpc_server: fix padding caclucation in dcesrv_auth_response() This is simplified by using DCERPC_AUTH_PAD_LENGTH() and changes the behaviour so that we will use no padding if the stub_length is already aligned to DCERPC_AUTH_PAD_ALIGNMENT (16 bytes). BUG: https://bugzilla.samba.org/show_bug.cgi?id=11061 Signed-off-by: Stefan Metzmacher Reviewed-by: Jeremy Allison Reviewed-by: Andreas Schneider Reviewed-by: Andrew Bartlett (cherry picked from commit 69c1b4b7c10dd5fd9cacaa3a76c47bc854ee3fed) --- diff --git a/source4/rpc_server/dcesrv_auth.c b/source4/rpc_server/dcesrv_auth.c index 38189cde69c..575ba7091c2 100644 --- a/source4/rpc_server/dcesrv_auth.c +++ b/source4/rpc_server/dcesrv_auth.c @@ -435,7 +435,7 @@ bool dcesrv_auth_response(struct dcesrv_call_state *call, whole packet, whereas w2k8 wants it relative to the start of the stub */ dce_conn->auth_state.auth_info->auth_pad_length = - (16 - (pkt->u.response.stub_and_verifier.length & 15)) & 15; + DCERPC_AUTH_PAD_LENGTH(pkt->u.response.stub_and_verifier.length); ndr_err = ndr_push_zero(ndr, dce_conn->auth_state.auth_info->auth_pad_length); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {