s4:librpc/rpc: fix padding caclucation in ncacn_push_request_sign()
authorStefan Metzmacher <metze@samba.org>
Sat, 20 Jun 2015 15:49:02 +0000 (17:49 +0200)
committerStefan Metzmacher <metze@samba.org>
Tue, 23 Jun 2015 12:38:53 +0000 (14:38 +0200)
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 <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source4/librpc/rpc/dcerpc.c

index f1c6d474ec657508ea43b391627e4cb9e8db427b..6e3410bd238d18fb36e2e68b2dee06f847f72a19 100644 (file)
@@ -884,7 +884,7 @@ static NTSTATUS ncacn_push_request_sign(struct dcecli_connection *c,
           whole packet, whereas w2k8 wants it relative to the start
           of the stub */
        c->security_state.auth_info->auth_pad_length =
-               (16 - (pkt->u.request.stub_and_verifier.length & 15)) & 15;
+               DCERPC_AUTH_PAD_LENGTH(pkt->u.request.stub_and_verifier.length);
        ndr_err = ndr_push_zero(ndr, c->security_state.auth_info->auth_pad_length);
        if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
                return ndr_map_error2ntstatus(ndr_err);