From: Stefan Metzmacher Date: Fri, 16 Aug 2019 10:50:21 +0000 (+0200) Subject: s4:torture: make rpc.handles.random-assoc test more robust X-Git-Tag: talloc-2.3.1~983 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=bebee47e6386476e9948089484f89d213fcc2660;p=thirdparty%2Fsamba.git s4:torture: make rpc.handles.random-assoc test more robust We've seen failures like this: RPC-HANDLE-RANDOM-ASSOC connect samr pipe1 pipe1 uses assoc_group_id[0x00000001] connect samr pipe2 with assoc_group_id[0xFFFFFFFF]- should fail Failed to bind to uuid 12345778-1234-abcd-ef00-0123456789ac for ncacn_np:localdc[\pipe\samr,bigendian,assoc_group_id=0xffffffff, abstract_syntax=12345778-1234-abcd-ef00-0123456789ac/0x00000001] NT_STATUS_UNSUCCESSFUL connect samr pipe3 with assoc_group_id[0x00000000]- should fail UNEXPECTED(failure): samba4.rpc.handles on ncacn_np with bigendian.random-assoc(ad_dc_default) REASON: Exception: Exception: ../../source4/torture/rpc/handles.c:546: status was NT_STATUS_OK, expected NT_STATUS_UNSUCCESSFUL: opening samr pipe3 Prevent that it wraps to 0x00000000 Signed-off-by: Stefan Metzmacher Reviewed-by: Volker Lendecke --- diff --git a/source4/torture/rpc/handles.c b/source4/torture/rpc/handles.c index fcbe7c4ee33..ae6a55eb965 100644 --- a/source4/torture/rpc/handles.c +++ b/source4/torture/rpc/handles.c @@ -525,9 +525,11 @@ static bool test_handles_random_assoc(struct torture_context *torture) /* * We use ~p1->assoc_group_id instead of p1->assoc_group_id, because * this way we are less likely to use an id which is already in use. + * + * And make sure it doesn't wrap. */ assoc_group_id = dcerpc_binding_get_assoc_group_id(p1->binding); - assoc_group_id = ~assoc_group_id; + assoc_group_id = MIN(~assoc_group_id, UINT32_MAX - 3); torture_comment(torture, "connect samr pipe2 with assoc_group_id[0x%08X]- should fail\n", ++assoc_group_id); status = torture_rpc_connection_transport(torture, &p2, &ndr_table_samr,