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 <metze@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
/*
* 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,