1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

py:dcerpc/raw_protocol: test signing with and without header signing

BUG: https://bugzilla.samba.org/show_bug.cgi?id=7113
BUG: https://bugzilla.samba.org/show_bug.cgi?id=11892

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
Stefan Metzmacher 2018-11-20 17:37:38 +01:00 committed by Jeremy Allison
parent 78a5e4ec6e
commit f819df4de5

View File

@ -4368,13 +4368,15 @@ class TestDCERPC_BIND(RawDCERPCTest):
def _test_auth_bind_auth_level(self, auth_type, auth_level, auth_context_id, ctx, def _test_auth_bind_auth_level(self, auth_type, auth_level, auth_context_id, ctx,
g_auth_level=dcerpc.DCERPC_AUTH_LEVEL_INTEGRITY, g_auth_level=dcerpc.DCERPC_AUTH_LEVEL_INTEGRITY,
hdr_signing=False,
alter_fault=None): alter_fault=None):
creds = self.get_user_creds() creds = self.get_user_creds()
auth_context = self.get_auth_context_creds(creds=creds, auth_context = self.get_auth_context_creds(creds=creds,
auth_type=auth_type, auth_type=auth_type,
auth_level=auth_level, auth_level=auth_level,
auth_context_id=auth_context_id, auth_context_id=auth_context_id,
g_auth_level=g_auth_level) g_auth_level=g_auth_level,
hdr_signing=hdr_signing)
if auth_context is None: if auth_context is None:
return None return None
ack = self.do_generic_bind(ctx=ctx, ack = self.do_generic_bind(ctx=ctx,
@ -4586,6 +4588,7 @@ class TestDCERPC_BIND(RawDCERPCTest):
auth_context = self._test_auth_bind_auth_level(auth_type=auth_type, auth_context = self._test_auth_bind_auth_level(auth_type=auth_type,
auth_level=auth_level, auth_level=auth_level,
auth_context_id=auth_context_id, auth_context_id=auth_context_id,
hdr_signing=hdr_sign,
ctx=ctx1) ctx=ctx1)
self.assertIsNotNone(auth_context) self.assertIsNotNone(auth_context)
g = auth_context["gensec"] g = auth_context["gensec"]
@ -4844,10 +4847,22 @@ class TestDCERPC_BIND(RawDCERPCTest):
return self._test_auth_signing_auth_level_request(dcerpc.DCERPC_AUTH_TYPE_SPNEGO, return self._test_auth_signing_auth_level_request(dcerpc.DCERPC_AUTH_TYPE_SPNEGO,
dcerpc.DCERPC_AUTH_LEVEL_PACKET) dcerpc.DCERPC_AUTH_LEVEL_PACKET)
def test_spnego_hdr_signing_packet(self):
# DCERPC_AUTH_LEVEL_PACKET is handled as alias of
# DCERPC_AUTH_LEVEL_INTEGRITY
return self._test_auth_signing_auth_level_request(dcerpc.DCERPC_AUTH_TYPE_SPNEGO,
dcerpc.DCERPC_AUTH_LEVEL_PACKET,
hdr_sign=True)
def test_spnego_signing_integrity(self): def test_spnego_signing_integrity(self):
return self._test_auth_signing_auth_level_request(dcerpc.DCERPC_AUTH_TYPE_SPNEGO, return self._test_auth_signing_auth_level_request(dcerpc.DCERPC_AUTH_TYPE_SPNEGO,
dcerpc.DCERPC_AUTH_LEVEL_INTEGRITY) dcerpc.DCERPC_AUTH_LEVEL_INTEGRITY)
def test_spnego_hdr_signing_integrity(self):
return self._test_auth_signing_auth_level_request(dcerpc.DCERPC_AUTH_TYPE_SPNEGO,
dcerpc.DCERPC_AUTH_LEVEL_INTEGRITY,
hdr_sign=True)
def test_assoc_group_fail1(self): def test_assoc_group_fail1(self):
abstract = samba.dcerpc.mgmt.abstract_syntax() abstract = samba.dcerpc.mgmt.abstract_syntax()
transfer = base.transfer_syntax_ndr() transfer = base.transfer_syntax_ndr()