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

dcerpc.idl: split the padding from a possible fault buffer in dcerpc_fault

The 4 bytes of padding are always present and part of the header.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Günther Deschner <gd@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
This commit is contained in:
Stefan Metzmacher 2015-10-09 06:51:16 +02:00 committed by Andreas Schneider
parent 0bc10e7c46
commit 4464896167
4 changed files with 80 additions and 52 deletions

View File

@ -221,10 +221,14 @@ interface dcerpc
uint32 alloc_hint;
uint16 context_id;
uint8 cancel_count;
uint8 flags;
dcerpc_nca_status status;
[flag(NDR_REMAINING)] DATA_BLOB _pad;
[value(0)] uint32 reserved;
[flag(NDR_REMAINING)] DATA_BLOB error_and_verifier;
} dcerpc_fault;
const uint8 DCERPC_FAULT_LENGTH = 32;
/* the auth types we know about */
typedef [enum8bit] enum {
DCERPC_AUTH_TYPE_NONE = 0,

View File

@ -515,9 +515,10 @@ class TestDCERPC_BIND(RawDCERPCTest):
self.assertNotEquals(rep.u.alloc_hint, 0)
self.assertEquals(rep.u.context_id, 0)
self.assertEquals(rep.u.cancel_count, 0)
self.assertEquals(rep.u.flags, 0)
self.assertEquals(rep.u.status, dcerpc.DCERPC_NCA_S_PROTO_ERROR)
self.assertEquals(len(rep.u._pad), 4)
self.assertEquals(rep.u._pad, '\0' * 4)
self.assertEquals(rep.u.reserved, 0)
self.assertEquals(len(rep.u.error_and_verifier), 0)
# wait for a disconnect
rep = self.recv_pdu()
@ -670,9 +671,10 @@ class TestDCERPC_BIND(RawDCERPCTest):
self.assertNotEquals(rep.u.alloc_hint, 0)
self.assertEquals(rep.u.context_id, req.u.context_id)
self.assertEquals(rep.u.cancel_count, 0)
self.assertEquals(rep.u.flags, 0)
self.assertEquals(rep.u.status, dcerpc.DCERPC_FAULT_ACCESS_DENIED)
self.assertEquals(len(rep.u._pad), 4)
self.assertEquals(rep.u._pad, '\0' * 4)
self.assertEquals(rep.u.reserved, 0)
self.assertEquals(len(rep.u.error_and_verifier), 0)
# wait for a disconnect
rep = self.recv_pdu()
@ -801,9 +803,10 @@ class TestDCERPC_BIND(RawDCERPCTest):
self.assertNotEquals(rep.u.alloc_hint, 0)
self.assertEquals(rep.u.context_id, 0)
self.assertEquals(rep.u.cancel_count, 0)
self.assertEquals(rep.u.flags, 0)
self.assertEquals(rep.u.status, dcerpc.DCERPC_NCA_S_PROTO_ERROR)
self.assertEquals(len(rep.u._pad), 4)
self.assertEquals(rep.u._pad, '\0' * 4)
self.assertEquals(rep.u.reserved, 0)
self.assertEquals(len(rep.u.error_and_verifier), 0)
# wait for a disconnect
rep = self.recv_pdu()
@ -1030,9 +1033,10 @@ class TestDCERPC_BIND(RawDCERPCTest):
self.assertNotEquals(rep.u.alloc_hint, 0)
self.assertEquals(rep.u.context_id, req.u.context_id)
self.assertEquals(rep.u.cancel_count, 0)
self.assertEquals(rep.u.flags, 0)
self.assertEquals(rep.u.status, fault_first)
self.assertEquals(len(rep.u._pad), 4)
self.assertEquals(rep.u._pad, '\0' * 4)
self.assertEquals(rep.u.reserved, 0)
self.assertEquals(len(rep.u.error_and_verifier), 0)
# wait for a disconnect
rep = self.recv_pdu()
@ -1049,9 +1053,10 @@ class TestDCERPC_BIND(RawDCERPCTest):
self.assertNotEquals(rep.u.alloc_hint, 0)
self.assertEquals(rep.u.context_id, req.u.context_id)
self.assertEquals(rep.u.cancel_count, 0)
self.assertEquals(rep.u.flags, 0)
self.assertEquals(rep.u.status, fault_last)
self.assertEquals(len(rep.u._pad), 4)
self.assertEquals(rep.u._pad, '\0' * 4)
self.assertEquals(rep.u.reserved, 0)
self.assertEquals(len(rep.u.error_and_verifier), 0)
# wait for a disconnect
rep = self.recv_pdu()
@ -1070,9 +1075,10 @@ class TestDCERPC_BIND(RawDCERPCTest):
self.assertNotEquals(rep.u.alloc_hint, 0)
self.assertEquals(rep.u.context_id, req.u.context_id)
self.assertEquals(rep.u.cancel_count, 0)
self.assertEquals(rep.u.flags, 0)
self.assertEquals(rep.u.status, fault_last)
self.assertEquals(len(rep.u._pad), 4)
self.assertEquals(rep.u._pad, '\0' * 4)
self.assertEquals(rep.u.reserved, 0)
self.assertEquals(len(rep.u.error_and_verifier), 0)
# wait for a disconnect
rep = self.recv_pdu()
@ -1131,9 +1137,10 @@ class TestDCERPC_BIND(RawDCERPCTest):
self.assertNotEquals(rep.u.alloc_hint, 0)
self.assertEquals(rep.u.context_id, req.u.context_id)
self.assertEquals(rep.u.cancel_count, 0)
self.assertEquals(rep.u.flags, 0)
self.assertEquals(rep.u.status, dcerpc.DCERPC_NCA_S_PROTO_ERROR)
self.assertEquals(len(rep.u._pad), 4)
self.assertEquals(rep.u._pad, '\0' * 4)
self.assertEquals(rep.u.reserved, 0)
self.assertEquals(len(rep.u.error_and_verifier), 0)
# wait for a disconnect
rep = self.recv_pdu()
@ -1160,9 +1167,10 @@ class TestDCERPC_BIND(RawDCERPCTest):
self.assertNotEquals(rep.u.alloc_hint, 0)
self.assertEquals(rep.u.context_id, req.u.context_id)
self.assertEquals(rep.u.cancel_count, 0)
self.assertEquals(rep.u.flags, 0)
self.assertEquals(rep.u.status, dcerpc.DCERPC_NCA_S_PROTO_ERROR)
self.assertEquals(len(rep.u._pad), 4)
self.assertEquals(rep.u._pad, '\0' * 4)
self.assertEquals(rep.u.reserved, 0)
self.assertEquals(len(rep.u.error_and_verifier), 0)
# wait for a disconnect
rep = self.recv_pdu()
@ -1226,9 +1234,10 @@ class TestDCERPC_BIND(RawDCERPCTest):
self.assertNotEquals(rep.u.alloc_hint, 0)
self.assertEquals(rep.u.context_id, req.u.context_id)
self.assertEquals(rep.u.cancel_count, 0)
self.assertEquals(rep.u.flags, 0)
self.assertEquals(rep.u.status, dcerpc.DCERPC_FAULT_NO_CALL_ACTIVE)
self.assertEquals(len(rep.u._pad), 4)
self.assertEquals(rep.u._pad, '\0' * 4)
self.assertEquals(rep.u.reserved, 0)
self.assertEquals(len(rep.u.error_and_verifier), 0)
# wait for a disconnect
rep = self.recv_pdu()
@ -1343,9 +1352,10 @@ class TestDCERPC_BIND(RawDCERPCTest):
self.assertNotEquals(rep.u.alloc_hint, 0)
self.assertEquals(rep.u.context_id, req.u.context_id)
self.assertEquals(rep.u.cancel_count, 0)
self.assertEquals(rep.u.flags, 0)
self.assertEquals(rep.u.status, dcerpc.DCERPC_NCA_S_PROTO_ERROR)
self.assertEquals(len(rep.u._pad), 4)
self.assertEquals(rep.u._pad, '\0' * 4)
self.assertEquals(rep.u.reserved, 0)
self.assertEquals(len(rep.u.error_and_verifier), 0)
def test_spnego_connect_request(self):
ndr32 = base.transfer_syntax_ndr()
@ -1488,9 +1498,10 @@ class TestDCERPC_BIND(RawDCERPCTest):
self.assertNotEquals(rep.u.alloc_hint, 0)
self.assertEquals(rep.u.context_id, req.u.context_id)
self.assertEquals(rep.u.cancel_count, 0)
self.assertEquals(rep.u.flags, 0)
self.assertEquals(rep.u.status, dcerpc.DCERPC_FAULT_ACCESS_DENIED)
self.assertEquals(len(rep.u._pad), 4)
self.assertEquals(rep.u._pad, '\0' * 4)
self.assertEquals(rep.u.reserved, 0)
self.assertEquals(len(rep.u.error_and_verifier), 0)
# wait for a disconnect
rep = self.recv_pdu()
@ -1604,9 +1615,10 @@ class TestDCERPC_BIND(RawDCERPCTest):
self.assertNotEquals(rep.u.alloc_hint, 0)
self.assertEquals(rep.u.context_id, req.u.context_id)
self.assertEquals(rep.u.cancel_count, 0)
self.assertEquals(rep.u.flags, 0)
self.assertEquals(rep.u.status, dcerpc.DCERPC_FAULT_ACCESS_DENIED)
self.assertEquals(len(rep.u._pad), 4)
self.assertEquals(rep.u._pad, '\0' * 4)
self.assertEquals(rep.u.reserved, 0)
self.assertEquals(len(rep.u.error_and_verifier), 0)
# wait for a disconnect
rep = self.recv_pdu()
@ -1690,9 +1702,10 @@ class TestDCERPC_BIND(RawDCERPCTest):
self.assertNotEquals(rep.u.alloc_hint, 0)
self.assertEquals(rep.u.context_id, 0)
self.assertEquals(rep.u.cancel_count, 0)
self.assertEquals(rep.u.flags, 0)
self.assertEquals(rep.u.status, dcerpc.DCERPC_NCA_S_PROTO_ERROR)
self.assertEquals(len(rep.u._pad), 4)
self.assertEquals(rep.u._pad, '\0' * 4)
self.assertEquals(rep.u.reserved, 0)
self.assertEquals(len(rep.u.error_and_verifier), 0)
# wait for a disconnect
rep = self.recv_pdu()
@ -1777,9 +1790,10 @@ class TestDCERPC_BIND(RawDCERPCTest):
self.assertNotEquals(rep.u.alloc_hint, 0)
self.assertEquals(rep.u.context_id, req.u.context_id)
self.assertEquals(rep.u.cancel_count, 0)
self.assertEquals(rep.u.flags, 0)
self.assertEquals(rep.u.status, dcerpc.DCERPC_FAULT_ACCESS_DENIED)
self.assertEquals(len(rep.u._pad), 4)
self.assertEquals(rep.u._pad, '\0' * 4)
self.assertEquals(rep.u.reserved, 0)
self.assertEquals(len(rep.u.error_and_verifier), 0)
# wait for a disconnect
rep = self.recv_pdu()
@ -1938,9 +1952,10 @@ class TestDCERPC_BIND(RawDCERPCTest):
self.assertNotEquals(rep.u.alloc_hint, 0)
self.assertEquals(rep.u.context_id, 0)
self.assertEquals(rep.u.cancel_count, 0)
self.assertEquals(rep.u.flags, 0)
self.assertEquals(rep.u.status, dcerpc.DCERPC_FAULT_ACCESS_DENIED)
self.assertEquals(len(rep.u._pad), 4)
self.assertEquals(rep.u._pad, '\0' * 4)
self.assertEquals(rep.u.reserved, 0)
self.assertEquals(len(rep.u.error_and_verifier), 0)
# wait for a disconnect
rep = self.recv_pdu()
@ -2098,9 +2113,10 @@ class TestDCERPC_BIND(RawDCERPCTest):
self.assertNotEquals(rep.u.alloc_hint, 0)
self.assertEquals(rep.u.context_id, 0)
self.assertEquals(rep.u.cancel_count, 0)
self.assertEquals(rep.u.flags, 0)
self.assertEquals(rep.u.status, dcerpc.DCERPC_NCA_S_PROTO_ERROR)
self.assertEquals(len(rep.u._pad), 4)
self.assertEquals(rep.u._pad, '\0' * 4)
self.assertEquals(rep.u.reserved, 0)
self.assertEquals(len(rep.u.error_and_verifier), 0)
# wait for a disconnect
rep = self.recv_pdu()
@ -2177,9 +2193,10 @@ class TestDCERPC_BIND(RawDCERPCTest):
self.assertNotEquals(rep.u.alloc_hint, 0)
self.assertEquals(rep.u.context_id, 0)
self.assertEquals(rep.u.cancel_count, 0)
self.assertEquals(rep.u.flags, 0)
self.assertEquals(rep.u.status, dcerpc.DCERPC_FAULT_ACCESS_DENIED)
self.assertEquals(len(rep.u._pad), 4)
self.assertEquals(rep.u._pad, '\0' * 4)
self.assertEquals(rep.u.reserved, 0)
self.assertEquals(len(rep.u.error_and_verifier), 0)
# wait for a disconnect
rep = self.recv_pdu()
@ -2262,9 +2279,10 @@ class TestDCERPC_BIND(RawDCERPCTest):
self.assertNotEquals(rep.u.alloc_hint, 0)
self.assertEquals(rep.u.context_id, 0)
self.assertEquals(rep.u.cancel_count, 0)
self.assertEquals(rep.u.flags, 0)
self.assertEquals(rep.u.status, dcerpc.DCERPC_NCA_S_PROTO_ERROR)
self.assertEquals(len(rep.u._pad), 4)
self.assertEquals(rep.u._pad, '\0' * 4)
self.assertEquals(rep.u.reserved, 0)
self.assertEquals(len(rep.u.error_and_verifier), 0)
# wait for a disconnect
rep = self.recv_pdu()
@ -2350,9 +2368,10 @@ class TestDCERPC_BIND(RawDCERPCTest):
self.assertNotEquals(rep.u.alloc_hint, 0)
self.assertEquals(rep.u.context_id, 0)
self.assertEquals(rep.u.cancel_count, 0)
self.assertEquals(rep.u.flags, 0)
self.assertEquals(rep.u.status, dcerpc.DCERPC_NCA_S_PROTO_ERROR)
self.assertEquals(len(rep.u._pad), 4)
self.assertEquals(rep.u._pad, '\0' * 4)
self.assertEquals(rep.u.reserved, 0)
self.assertEquals(len(rep.u.error_and_verifier), 0)
# wait for a disconnect
rep = self.recv_pdu()
@ -2431,9 +2450,10 @@ class TestDCERPC_BIND(RawDCERPCTest):
self.assertNotEquals(rep.u.alloc_hint, 0)
self.assertEquals(rep.u.context_id, 0)
self.assertEquals(rep.u.cancel_count, 0)
self.assertEquals(rep.u.flags, 0)
self.assertEquals(rep.u.status, dcerpc.DCERPC_FAULT_SEC_PKG_ERROR)
self.assertEquals(len(rep.u._pad), 4)
self.assertEquals(rep.u._pad, '\0' * 4)
self.assertEquals(rep.u.reserved, 0)
self.assertEquals(len(rep.u.error_and_verifier), 0)
# wait for a disconnect
rep = self.recv_pdu()
@ -2519,9 +2539,10 @@ class TestDCERPC_BIND(RawDCERPCTest):
self.assertNotEquals(rep.u.alloc_hint, 0)
self.assertEquals(rep.u.context_id, 0)
self.assertEquals(rep.u.cancel_count, 0)
self.assertEquals(rep.u.flags, 0)
self.assertEquals(rep.u.status, dcerpc.DCERPC_NCA_S_PROTO_ERROR)
self.assertEquals(len(rep.u._pad), 4)
self.assertEquals(rep.u._pad, '\0' * 4)
self.assertEquals(rep.u.reserved, 0)
self.assertEquals(len(rep.u.error_and_verifier), 0)
# wait for a disconnect
rep = self.recv_pdu()
@ -2607,9 +2628,10 @@ class TestDCERPC_BIND(RawDCERPCTest):
self.assertNotEquals(rep.u.alloc_hint, 0)
self.assertEquals(rep.u.context_id, 0)
self.assertEquals(rep.u.cancel_count, 0)
self.assertEquals(rep.u.flags, 0)
self.assertEquals(rep.u.status, dcerpc.DCERPC_FAULT_ACCESS_DENIED)
self.assertEquals(len(rep.u._pad), 4)
self.assertEquals(rep.u._pad, '\0' * 4)
self.assertEquals(rep.u.reserved, 0)
self.assertEquals(len(rep.u.error_and_verifier), 0)
# wait for a disconnect
rep = self.recv_pdu()
@ -2939,9 +2961,10 @@ class TestDCERPC_BIND(RawDCERPCTest):
self.assertNotEquals(rep.u.alloc_hint, 0)
self.assertEquals(rep.u.context_id, 0)
self.assertEquals(rep.u.cancel_count, 0)
self.assertEquals(rep.u.flags, 0)
self.assertEquals(rep.u.status, dcerpc.DCERPC_NCA_S_PROTO_ERROR)
self.assertEquals(len(rep.u._pad), 4)
self.assertEquals(rep.u._pad, '\0' * 4)
self.assertEquals(rep.u.reserved, 0)
self.assertEquals(len(rep.u.error_and_verifier), 0)
# wait for a disconnect
rep = self.recv_pdu()
@ -3155,9 +3178,10 @@ class TestDCERPC_BIND(RawDCERPCTest):
self.assertNotEquals(rep.u.alloc_hint, 0)
self.assertEquals(rep.u.context_id, 0)
self.assertEquals(rep.u.cancel_count, 0)
self.assertEquals(rep.u.flags, 0)
self.assertEquals(rep.u.status, dcerpc.DCERPC_NCA_S_FAULT_REMOTE_NO_MEMORY)
self.assertEquals(len(rep.u._pad), 4)
self.assertEquals(rep.u._pad, '\0' * 4)
self.assertEquals(rep.u.reserved, 0)
self.assertEquals(len(rep.u.error_and_verifier), 0)
# wait for a disconnect
rep = self.recv_pdu()

View File

@ -309,7 +309,6 @@ bool setup_fault_pdu(struct pipes_struct *p, NTSTATUS fault_status)
ZERO_STRUCT(u);
u.fault.status = NT_STATUS_V(fault_status);
u.fault._pad = data_blob_talloc_zero(p->mem_ctx, 4);
/*
* Marshall directly into the outgoing PDU space. We

View File

@ -103,7 +103,6 @@ NTSTATUS dcesrv_fault_with_flags(struct dcesrv_call_state *call,
{
struct ncacn_packet pkt;
struct data_blob_list_item *rep;
static const uint8_t zeros[4] = { 0, };
NTSTATUS status;
/* setup a fault */
@ -128,8 +127,10 @@ NTSTATUS dcesrv_fault_with_flags(struct dcesrv_call_state *call,
pkt.u.fault.context_id = 0;
}
pkt.u.fault.cancel_count = 0;
pkt.u.fault.flags = 0;
pkt.u.fault.status = fault_code;
pkt.u.fault._pad = data_blob_const(zeros, sizeof(zeros));
pkt.u.fault.reserved = 0;
pkt.u.fault.error_and_verifier = data_blob_null;
rep = talloc_zero(call, struct data_blob_list_item);
if (!rep) {