|
|
|
|
@@ -143,100 +143,155 @@ fail:
|
|
|
|
|
return rc;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static BOOL run_payload(NdrContext* context, const BYTE* payload4, size_t sizeofPayload4)
|
|
|
|
|
{
|
|
|
|
|
WINPR_ASSERT(context);
|
|
|
|
|
|
|
|
|
|
if (!payload4)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
CreateApReqAuthenticatorReq createApReqAuthenticatorReq = { 0 };
|
|
|
|
|
|
|
|
|
|
wStream staticS = { 0 };
|
|
|
|
|
wStream* s = Stream_StaticInit(&staticS, payload4, sizeofPayload4);
|
|
|
|
|
if (!ndr_skip_bytes(context, s, 4)) /* skip union id */
|
|
|
|
|
return FALSE;
|
|
|
|
|
if (!ndr_read_CreateApReqAuthenticatorReq(context, s, NULL, &createApReqAuthenticatorReq))
|
|
|
|
|
return FALSE;
|
|
|
|
|
if (!ndr_treat_deferred_read(context, s))
|
|
|
|
|
return FALSE;
|
|
|
|
|
if (createApReqAuthenticatorReq.KeyUsage != 7)
|
|
|
|
|
return FALSE;
|
|
|
|
|
if (!createApReqAuthenticatorReq.EncryptionKey)
|
|
|
|
|
return FALSE;
|
|
|
|
|
if (createApReqAuthenticatorReq.SubKey)
|
|
|
|
|
return FALSE;
|
|
|
|
|
if (!createApReqAuthenticatorReq.ClientName)
|
|
|
|
|
return FALSE;
|
|
|
|
|
if (createApReqAuthenticatorReq.ClientName->nameHints.count != 1)
|
|
|
|
|
return FALSE;
|
|
|
|
|
if (!createApReqAuthenticatorReq.ClientRealm)
|
|
|
|
|
return FALSE;
|
|
|
|
|
if (!createApReqAuthenticatorReq.AuthData)
|
|
|
|
|
return FALSE;
|
|
|
|
|
if (createApReqAuthenticatorReq.AuthData->Asn1BufferHints.count != 2)
|
|
|
|
|
return FALSE;
|
|
|
|
|
if (!createApReqAuthenticatorReq.SkewTime)
|
|
|
|
|
return FALSE;
|
|
|
|
|
if (createApReqAuthenticatorReq.SkewTime->QuadPart != 0)
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
ndr_destroy_CreateApReqAuthenticatorReq(context, NULL, &createApReqAuthenticatorReq);
|
|
|
|
|
ndr_context_reset(context);
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static int TestNdrEarRead(int argc, char* argv[])
|
|
|
|
|
{
|
|
|
|
|
WINPR_UNUSED(argc);
|
|
|
|
|
WINPR_UNUSED(argv);
|
|
|
|
|
|
|
|
|
|
int retCode = -2;
|
|
|
|
|
int retCode = -1;
|
|
|
|
|
|
|
|
|
|
/* ====================================================================== */
|
|
|
|
|
NdrContext* context = ndr_context_new(FALSE, 1);
|
|
|
|
|
if (!context)
|
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
|
|
wStream staticS = { 0 };
|
|
|
|
|
wStream* s = NULL;
|
|
|
|
|
{
|
|
|
|
|
retCode = -2;
|
|
|
|
|
const BYTE payload[] = {
|
|
|
|
|
0x00, 0x00, 0x00, 0x00, // (PduType)
|
|
|
|
|
0x02, 0x00, 0x00, 0x00, // (Length)
|
|
|
|
|
0x28, 0x00, 0x02, 0x00, // (Asn1Buffer)
|
|
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
|
BYTE payload[] = {
|
|
|
|
|
0x00, 0x00, 0x00, 0x00, // (PduType)
|
|
|
|
|
0x02, 0x00, 0x00, 0x00, // (Length)
|
|
|
|
|
0x28, 0x00, 0x02, 0x00, // (Asn1Buffer)
|
|
|
|
|
// == conformant array ==
|
|
|
|
|
0x02, 0x00, 0x00, 0x00, // (nitems)
|
|
|
|
|
0x30, 0x00, // content
|
|
|
|
|
0x00, 0x00 // (padding)
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// == conformant array ==
|
|
|
|
|
0x02, 0x00, 0x00, 0x00, // (nitems)
|
|
|
|
|
0x30, 0x00, // content
|
|
|
|
|
0x00, 0x00 // (padding)
|
|
|
|
|
};
|
|
|
|
|
s = Stream_StaticInit(&staticS, payload, sizeof(payload));
|
|
|
|
|
wStream staticS = { 0 };
|
|
|
|
|
wStream* s = Stream_StaticInit(&staticS, payload, sizeof(payload));
|
|
|
|
|
|
|
|
|
|
KERB_ASN1_DATA asn1 = { 0 };
|
|
|
|
|
if (!ndr_read_KERB_ASN1_DATA(context, s, NULL, &asn1) || !ndr_treat_deferred_read(context, s) ||
|
|
|
|
|
asn1.Asn1BufferHints.count != 2 || *asn1.Asn1Buffer != 0x30)
|
|
|
|
|
goto out;
|
|
|
|
|
KERB_ASN1_DATA_destroy(context, &asn1);
|
|
|
|
|
ndr_context_reset(context);
|
|
|
|
|
KERB_ASN1_DATA asn1 = { 0 };
|
|
|
|
|
if (!ndr_read_KERB_ASN1_DATA(context, s, NULL, &asn1) ||
|
|
|
|
|
!ndr_treat_deferred_read(context, s) || asn1.Asn1BufferHints.count != 2 ||
|
|
|
|
|
*asn1.Asn1Buffer != 0x30)
|
|
|
|
|
goto out;
|
|
|
|
|
ndr_destroy_KERB_ASN1_DATA(context, NULL, &asn1);
|
|
|
|
|
ndr_context_reset(context);
|
|
|
|
|
|
|
|
|
|
/* ====================================================================== */
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
retCode = -3;
|
|
|
|
|
const BYTE payload2[] = {
|
|
|
|
|
// ------------ a RPC_UNICODE_STRING: Administrateur -------------------------
|
|
|
|
|
0x1c, 0x00, // (Length)
|
|
|
|
|
0x1e, 0x00, // (MaximumLength)
|
|
|
|
|
0x1c, 0x00, 0x02, 0x00, // (Buffer ptr)
|
|
|
|
|
// == conformant array ==
|
|
|
|
|
0x0f, 0x00, 0x00, 0x00, // (maximum count)
|
|
|
|
|
0x00, 0x00, 0x00, 0x00, // (offset)
|
|
|
|
|
0x0e, 0x00, 0x00, 0x00, // (length)
|
|
|
|
|
|
|
|
|
|
0x48, 0x00, 0x41, 0x00, 0x52, 0x00, 0x44, 0x00, 0x45, 0x00, 0x4e, 0x00, 0x49, 0x00,
|
|
|
|
|
0x4e, 0x00, 0x47, 0x00, 0x33, 0x00, 0x2e, 0x00, 0x43, 0x00, 0x4f, 0x00, 0x4d, 0x00,
|
|
|
|
|
0x00, 0x00,
|
|
|
|
|
|
|
|
|
|
0x00, 0x00
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
wStream staticS = { 0 };
|
|
|
|
|
wStream* s = Stream_StaticInit(&staticS, payload2, sizeof(payload2));
|
|
|
|
|
RPC_UNICODE_STRING unicode = { 0 };
|
|
|
|
|
if (!ndr_read_RPC_UNICODE_STRING(context, s, NULL, &unicode) ||
|
|
|
|
|
!ndr_treat_deferred_read(context, s))
|
|
|
|
|
goto out;
|
|
|
|
|
ndr_destroy_RPC_UNICODE_STRING(context, NULL, &unicode);
|
|
|
|
|
ndr_context_reset(context);
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
retCode = -4;
|
|
|
|
|
/* ====================================================================== */
|
|
|
|
|
const BYTE payload3[] = {
|
|
|
|
|
// ------------ an KERB_RPC_INTERNAL_NAME: HARDENING3.COM -------------------------
|
|
|
|
|
0x01, 0x00, // (NameType)
|
|
|
|
|
0x01, 0x00, // (NameCount)
|
|
|
|
|
0x10, 0x00, 0x02, 0x00, // (Names)
|
|
|
|
|
// == conformant array ==
|
|
|
|
|
0x01, 0x00, 0x00, 0x00, // (nitems)
|
|
|
|
|
|
|
|
|
|
// = RPC_UNICODE_STRING =
|
|
|
|
|
0x1c, 0x00, // (Length)
|
|
|
|
|
0x1e, 0x00, // (MaximumLength)
|
|
|
|
|
0x14, 0x00, 0x02, 0x00, /// (Buffer ptr)
|
|
|
|
|
// == Uni-dimensional Conformant-varying Array ==
|
|
|
|
|
0x0f, 0x00, 0x00, 0x00, // (maximum count)
|
|
|
|
|
0x00, 0x00, 0x00, 0x00, // (offset)
|
|
|
|
|
0x0e, 0x00, 0x00, 0x00, // (length)
|
|
|
|
|
0x41, 0x00, 0x64, 0x00, 0x6d, 0x00, 0x69, 0x00, 0x6e, 0x00, 0x69, 0x00, 0x73, 0x00,
|
|
|
|
|
0x74, 0x00, 0x72, 0x00, 0x61, 0x00, 0x74, 0x00, 0x65, 0x00, 0x75, 0x00, 0x72, 0x00,
|
|
|
|
|
0x00, 0x00,
|
|
|
|
|
|
|
|
|
|
0x00, 0x00
|
|
|
|
|
};
|
|
|
|
|
KERB_RPC_INTERNAL_NAME intName = { 0 };
|
|
|
|
|
|
|
|
|
|
wStream staticS = { 0 };
|
|
|
|
|
wStream* s = Stream_StaticInit(&staticS, payload3, sizeof(payload3));
|
|
|
|
|
if (!ndr_read_KERB_RPC_INTERNAL_NAME(context, s, NULL, &intName) ||
|
|
|
|
|
!ndr_treat_deferred_read(context, s))
|
|
|
|
|
goto out;
|
|
|
|
|
ndr_destroy_KERB_RPC_INTERNAL_NAME(context, NULL, &intName);
|
|
|
|
|
ndr_context_reset(context);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* ====================================================================== */
|
|
|
|
|
BYTE payload2[] = {
|
|
|
|
|
// ------------ a RPC_UNICODE_STRING: Administrateur -------------------------
|
|
|
|
|
0x1c, 0x00, // (Length)
|
|
|
|
|
0x1e, 0x00, // (MaximumLength)
|
|
|
|
|
0x1c, 0x00, 0x02, 0x00, // (Buffer ptr)
|
|
|
|
|
// == conformant array ==
|
|
|
|
|
0x0f, 0x00, 0x00, 0x00, // (maximum count)
|
|
|
|
|
0x00, 0x00, 0x00, 0x00, // (offset)
|
|
|
|
|
0x0e, 0x00, 0x00, 0x00, // (length)
|
|
|
|
|
|
|
|
|
|
0x48, 0x00, 0x41, 0x00, 0x52, 0x00, 0x44, 0x00, 0x45, 0x00, 0x4e, 0x00, 0x49, 0x00, 0x4e,
|
|
|
|
|
0x00, 0x47, 0x00, 0x33, 0x00, 0x2e, 0x00, 0x43, 0x00, 0x4f, 0x00, 0x4d, 0x00, 0x00, 0x00,
|
|
|
|
|
|
|
|
|
|
0x00, 0x00
|
|
|
|
|
};
|
|
|
|
|
retCode = -3;
|
|
|
|
|
|
|
|
|
|
s = Stream_StaticInit(&staticS, payload2, sizeof(payload2));
|
|
|
|
|
RPC_UNICODE_STRING unicode = { 0 };
|
|
|
|
|
if (!ndr_read_RPC_UNICODE_STRING(context, s, NULL, &unicode) || !ndr_treat_deferred_read(context, s))
|
|
|
|
|
goto out;
|
|
|
|
|
RPC_UNICODE_STRING_destroy(context, &unicode);
|
|
|
|
|
ndr_context_reset(context);
|
|
|
|
|
|
|
|
|
|
/* ====================================================================== */
|
|
|
|
|
BYTE payload3[] = {
|
|
|
|
|
// ------------ an KERB_RPC_INTERNAL_NAME: HARDENING3.COM -------------------------
|
|
|
|
|
0x01, 0x00, // (NameType)
|
|
|
|
|
0x01, 0x00, // (NameCount)
|
|
|
|
|
0x10, 0x00, 0x02, 0x00, // (Names)
|
|
|
|
|
// == conformant array ==
|
|
|
|
|
0x01, 0x00, 0x00, 0x00, // (nitems)
|
|
|
|
|
|
|
|
|
|
// = RPC_UNICODE_STRING =
|
|
|
|
|
0x1c, 0x00, // (Length)
|
|
|
|
|
0x1e, 0x00, // (MaximumLength)
|
|
|
|
|
0x14, 0x00, 0x02, 0x00, /// (Buffer ptr)
|
|
|
|
|
// == Uni-dimensional Conformant-varying Array ==
|
|
|
|
|
0x0f, 0x00, 0x00, 0x00, // (maximum count)
|
|
|
|
|
0x00, 0x00, 0x00, 0x00, // (offset)
|
|
|
|
|
0x0e, 0x00, 0x00, 0x00, // (length)
|
|
|
|
|
0x41, 0x00, 0x64, 0x00, 0x6d, 0x00, 0x69, 0x00, 0x6e, 0x00, 0x69, 0x00, 0x73, 0x00, 0x74,
|
|
|
|
|
0x00, 0x72, 0x00, 0x61, 0x00, 0x74, 0x00, 0x65, 0x00, 0x75, 0x00, 0x72, 0x00, 0x00, 0x00,
|
|
|
|
|
|
|
|
|
|
0x00, 0x00
|
|
|
|
|
};
|
|
|
|
|
KERB_RPC_INTERNAL_NAME intName = { 0 };
|
|
|
|
|
retCode = -4;
|
|
|
|
|
s = Stream_StaticInit(&staticS, payload3, sizeof(payload3));
|
|
|
|
|
if (!ndr_read_KERB_RPC_INTERNAL_NAME(context, s, NULL, &intName) || !ndr_treat_deferred_read(context, s))
|
|
|
|
|
goto out;
|
|
|
|
|
KERB_RPC_INTERNAL_NAME_destroy(context, &intName);
|
|
|
|
|
ndr_context_reset(context);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/* ====================================================================== */
|
|
|
|
|
#if 0
|
|
|
|
|
BYTE payload4[] = {
|
|
|
|
|
{
|
|
|
|
|
retCode = -5;
|
|
|
|
|
const BYTE payload4[] = {
|
|
|
|
|
0x03, 0x01, 0x03, 0x01, // unionId / unionId
|
|
|
|
|
0x04, 0x00, 0x02, 0x00, // (EncryptionKey ptr)
|
|
|
|
|
0xf8, 0xca, 0x95, 0x11, // (SequenceNumber)
|
|
|
|
|
@@ -251,80 +306,77 @@ static int TestNdrEarRead(int argc, char* argv[])
|
|
|
|
|
// === EncryptionKey ===
|
|
|
|
|
0x40, 0xe9, 0x12, 0xdf, // reserved1
|
|
|
|
|
0x12, 0x00, 0x00, 0x00, // reserved2
|
|
|
|
|
// KERB_RPC_OCTET_STRING
|
|
|
|
|
0x4c, 0x00, 0x00, 0x00, // (length)
|
|
|
|
|
0x08, 0x00, 0x02, 0x00, // (value ptr)
|
|
|
|
|
// == conformant array ==
|
|
|
|
|
0x4c, 0x00, 0x00, 0x00, // (length)
|
|
|
|
|
0xc4, 0x41, 0xee, 0x34,
|
|
|
|
|
0x82, 0x2b, 0x29, 0x61, 0xe2, 0x96, 0xb5, 0x75, 0x61, 0x2d, 0xbf, 0x86, 0x01, 0x00, 0x00, 0x00,
|
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x89, 0x08, 0x60, 0x2e,
|
|
|
|
|
0x30, 0x3e, 0xfe, 0x56, 0x11, 0xf0, 0x31, 0xf2, 0xd6, 0x2e, 0x3d, 0x33, 0xfe, 0xce, 0x56, 0x12,
|
|
|
|
|
0xbf, 0xb2, 0xe5, 0x86, 0x29, 0x8d, 0x29, 0x74, 0x1f, 0x8a, 0xf9, 0xb9, 0x8c, 0xd4, 0x86, 0x3a,
|
|
|
|
|
0x21, 0x92, 0xb2, 0x07, 0x95, 0x4b, 0xea, 0xee,
|
|
|
|
|
// KERB_RPC_OCTET_STRING
|
|
|
|
|
0x4c, 0x00, 0x00, 0x00, // (length)
|
|
|
|
|
0x08, 0x00, 0x02, 0x00, // (value ptr)
|
|
|
|
|
// == conformant array ==
|
|
|
|
|
0x4c, 0x00, 0x00, 0x00, // (length)
|
|
|
|
|
0xc4, 0x41, 0xee, 0x34, 0x82, 0x2b, 0x29, 0x61, 0xe2, 0x96, 0xb5, 0x75, 0x61, 0x2d,
|
|
|
|
|
0xbf, 0x86, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x89, 0x08, 0x60, 0x2e, 0x30, 0x3e, 0xfe, 0x56, 0x11, 0xf0,
|
|
|
|
|
0x31, 0xf2, 0xd6, 0x2e, 0x3d, 0x33, 0xfe, 0xce, 0x56, 0x12, 0xbf, 0xb2, 0xe5, 0x86,
|
|
|
|
|
0x29, 0x8d, 0x29, 0x74, 0x1f, 0x8a, 0xf9, 0xb9, 0x8c, 0xd4, 0x86, 0x3a, 0x21, 0x92,
|
|
|
|
|
0xb2, 0x07, 0x95, 0x4b, 0xea, 0xee,
|
|
|
|
|
|
|
|
|
|
//=== ClientName - KERB_RPC_INTERNAL_NAME ===
|
|
|
|
|
0x01, 0x00, // (NameType)
|
|
|
|
|
0x01, 0x00, // (NameCount)
|
|
|
|
|
0x01, 0x00, // (NameType)
|
|
|
|
|
0x01, 0x00, // (NameCount)
|
|
|
|
|
0x10, 0x00, 0x02, 0x00, // (Names)
|
|
|
|
|
|
|
|
|
|
0x01, 0x00, 0x00, 0x00, // (nitems)
|
|
|
|
|
0x01, 0x00, 0x00, 0x00, // (nitems)
|
|
|
|
|
|
|
|
|
|
// = RPC_UNICODE_STRING =
|
|
|
|
|
0x1c, 0x00, // (Length)
|
|
|
|
|
0x1e, 0x00, // (MaximumLength)
|
|
|
|
|
0x14, 0x00, 0x02, 0x00, //(Buffer ptr)
|
|
|
|
|
// == Uni-dimensional Conformant-varying Array ==
|
|
|
|
|
0x0f, 0x00, 0x00, 0x00, // (maximum count)
|
|
|
|
|
0x00, 0x00, 0x00, 0x00, // (offset)
|
|
|
|
|
0x0e, 0x00, 0x00, 0x00, // (length)
|
|
|
|
|
0x41, 0x00, 0x64, 0x00, 0x6d, 0x00, 0x69, 0x00, 0x6e, 0x00, 0x69, 0x00, 0x73, 0x00, 0x74, 0x00,
|
|
|
|
|
0x72, 0x00, 0x61, 0x00, 0x74, 0x00, 0x65, 0x00, 0x75, 0x00, 0x72, 0x00,
|
|
|
|
|
// = RPC_UNICODE_STRING =
|
|
|
|
|
0x1c, 0x00, // (Length)
|
|
|
|
|
0x1e, 0x00, // (MaximumLength)
|
|
|
|
|
0x14, 0x00, 0x02, 0x00, //(Buffer ptr)
|
|
|
|
|
// == Uni-dimensional Conformant-varying Array ==
|
|
|
|
|
0x0f, 0x00, 0x00, 0x00, // (maximum count)
|
|
|
|
|
0x00, 0x00, 0x00, 0x00, // (offset)
|
|
|
|
|
0x0e, 0x00, 0x00, 0x00, // (length)
|
|
|
|
|
0x41, 0x00, 0x64, 0x00, 0x6d, 0x00, 0x69, 0x00, 0x6e, 0x00, 0x69, 0x00, 0x73, 0x00,
|
|
|
|
|
0x74, 0x00, 0x72, 0x00, 0x61, 0x00, 0x74, 0x00, 0x65, 0x00, 0x75, 0x00, 0x72, 0x00,
|
|
|
|
|
|
|
|
|
|
// === ClientRealm - RPC_UNICODE_STRING ===
|
|
|
|
|
0x1c, 0x00, // (Length)
|
|
|
|
|
0x1e, 0x00, // (MaximumLength)
|
|
|
|
|
0x1c, 0x00, // (Length)
|
|
|
|
|
0x1e, 0x00, // (MaximumLength)
|
|
|
|
|
0x1c, 0x00, 0x02, 0x00, // (Buffer ptr)
|
|
|
|
|
// == Uni-dimensional conformant varying array ==
|
|
|
|
|
0x0f, 0x00, 0x00, 0x00, // (maximum count)
|
|
|
|
|
0x00, 0x00, 0x00, 0x00, // (offset)
|
|
|
|
|
0x0e, 0x00, 0x00, 0x00, // (length)
|
|
|
|
|
0x48, 0x00, 0x41, 0x00, 0x52, 0x00, 0x44, 0x00, 0x45, 0x00, 0x4e, 0x00, 0x49, 0x00, 0x4e, 0x00,
|
|
|
|
|
0x47, 0x00, 0x33, 0x00, 0x2e, 0x00, 0x43, 0x00, 0x4f, 0x00, 0x4d, 0x00,
|
|
|
|
|
// == Uni-dimensional conformant varying array ==
|
|
|
|
|
0x0f, 0x00, 0x00, 0x00, // (maximum count)
|
|
|
|
|
0x00, 0x00, 0x00, 0x00, // (offset)
|
|
|
|
|
0x0e, 0x00, 0x00, 0x00, // (length)
|
|
|
|
|
0x48, 0x00, 0x41, 0x00, 0x52, 0x00, 0x44, 0x00, 0x45, 0x00, 0x4e, 0x00, 0x49, 0x00,
|
|
|
|
|
0x4e, 0x00, 0x47, 0x00, 0x33, 0x00, 0x2e, 0x00, 0x43, 0x00, 0x4f, 0x00, 0x4d, 0x00,
|
|
|
|
|
|
|
|
|
|
0x00, 0x00, 0x00, 0x00, // padding
|
|
|
|
|
|
|
|
|
|
// == SkewTime ==
|
|
|
|
|
0x00, 0x00, 0x00, 0x00,
|
|
|
|
|
0x00, 0x00, 0x00, 0x00,
|
|
|
|
|
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
|
|
|
|
|
|
|
|
// === AuthData - KERB_ASN1_DATA ==
|
|
|
|
|
0x00, 0x00, 0x00, 0x00, // (PduType)
|
|
|
|
|
0x02, 0x00, 0x00, 0x00, // (Length)
|
|
|
|
|
0x28, 0x00, 0x02, 0x00, // (Asn1Buffer)
|
|
|
|
|
// == conformant array ==
|
|
|
|
|
0x02, 0x00, 0x00, 0x00, // (nitems)
|
|
|
|
|
0x30, 0x00,
|
|
|
|
|
0x00, 0x00, // (padding)
|
|
|
|
|
// == conformant array ==
|
|
|
|
|
0x02, 0x00, 0x00, 0x00, // (nitems)
|
|
|
|
|
0x30, 0x00, 0x00, 0x00, // (padding)
|
|
|
|
|
|
|
|
|
|
// === GssChecksum - KERB_ASN1_DATA ===
|
|
|
|
|
0x08, 0x00, 0x00, 0x00, // (PduType)
|
|
|
|
|
0x1b, 0x00, 0x00, 0x00, // (Length)
|
|
|
|
|
0x30, 0x00, 0x02, 0x00, // (Asn1Buffer)
|
|
|
|
|
// == conformant array ==
|
|
|
|
|
0x1b, 0x00, 0x00, 0x00, // (length)
|
|
|
|
|
0x30, 0x19,
|
|
|
|
|
0xa0, 0x03,
|
|
|
|
|
0x02, 0x01, 0x07,
|
|
|
|
|
0xa1, 0x12,
|
|
|
|
|
0x04, 0x10, 0xb9, 0x4f, 0xcd, 0xae, 0xd9, 0xa8, 0xff, 0x49, 0x69, 0x5a, 0xd1,
|
|
|
|
|
0x1d, 0x38, 0x49, 0xb6, 0x92, 0x00
|
|
|
|
|
};
|
|
|
|
|
size_t sizeofPayload4 = sizeof(payload4);
|
|
|
|
|
#endif
|
|
|
|
|
// == conformant array ==
|
|
|
|
|
0x1b, 0x00, 0x00, 0x00, // (length)
|
|
|
|
|
0x30, 0x19, 0xa0, 0x03, 0x02, 0x01, 0x07, 0xa1, 0x12, 0x04, 0x10, 0xb9, 0x4f, 0xcd,
|
|
|
|
|
0xae, 0xd9, 0xa8, 0xff, 0x49, 0x69, 0x5a, 0xd1, 0x1d, 0x38, 0x49, 0xb6, 0x92, 0x00
|
|
|
|
|
};
|
|
|
|
|
if (!run_payload(context, payload4, sizeof(payload4)))
|
|
|
|
|
goto out;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
size_t sizeofPayload4 = 0;
|
|
|
|
|
BYTE* payload4 = parseHexBlock("03 01 03 01 \
|
|
|
|
|
{
|
|
|
|
|
retCode = -6;
|
|
|
|
|
size_t sizeofPayload4 = 0;
|
|
|
|
|
BYTE* payload4 = parseHexBlock("03 01 03 01 \
|
|
|
|
|
04 00 02 00 38 9e ef 6b 0c 00 02 00 18 00 02 00 \
|
|
|
|
|
20 00 02 00 00 00 00 00 24 00 02 00 2c 00 02 00 \
|
|
|
|
|
07 00 00 00 13 8a a5 a8 12 00 00 00 20 00 00 00 \
|
|
|
|
|
@@ -342,31 +394,16 @@ static int TestNdrEarRead(int argc, char* argv[])
|
|
|
|
|
08 00 00 00 1b 00 00 00 30 00 02 00 1b 00 00 00 \
|
|
|
|
|
30 19 a0 03 02 01 07 a1 12 04 10 e4 aa ff 2b 93 \
|
|
|
|
|
97 4c f2 5c 0b 49 85 72 92 94 54 00",
|
|
|
|
|
&sizeofPayload4);
|
|
|
|
|
|
|
|
|
|
if (!payload4)
|
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
|
|
CreateApReqAuthenticatorReq createApReqAuthenticatorReq = { 0 };
|
|
|
|
|
s = Stream_StaticInit(&staticS, payload4, sizeofPayload4);
|
|
|
|
|
if (!ndr_skip_bytes(context, s, 4) || /* skip union id */
|
|
|
|
|
!ndr_read_CreateApReqAuthenticatorReq(context, s, NULL, &createApReqAuthenticatorReq) ||
|
|
|
|
|
!ndr_treat_deferred_read(context, s) || createApReqAuthenticatorReq.KeyUsage != 7 ||
|
|
|
|
|
!createApReqAuthenticatorReq.EncryptionKey || createApReqAuthenticatorReq.SubKey ||
|
|
|
|
|
!createApReqAuthenticatorReq.ClientName ||
|
|
|
|
|
createApReqAuthenticatorReq.ClientName->nameHints.count != 1 ||
|
|
|
|
|
!createApReqAuthenticatorReq.ClientRealm || !createApReqAuthenticatorReq.AuthData ||
|
|
|
|
|
createApReqAuthenticatorReq.AuthData->Asn1BufferHints.count != 2 ||
|
|
|
|
|
!createApReqAuthenticatorReq.SkewTime ||
|
|
|
|
|
createApReqAuthenticatorReq.SkewTime->QuadPart != 0)
|
|
|
|
|
goto out;
|
|
|
|
|
ndr_destroy_CreateApReqAuthenticatorReq(context, NULL, &createApReqAuthenticatorReq);
|
|
|
|
|
ndr_context_reset(context);
|
|
|
|
|
&sizeofPayload4);
|
|
|
|
|
const BOOL rc = run_payload(context, payload4, sizeofPayload4);
|
|
|
|
|
free(payload4);
|
|
|
|
|
if (!rc)
|
|
|
|
|
goto out;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* ============ successful end of test =============== */
|
|
|
|
|
retCode = 0;
|
|
|
|
|
out:
|
|
|
|
|
free(payload4);
|
|
|
|
|
ndr_context_destroy(&context);
|
|
|
|
|
return retCode;
|
|
|
|
|
}
|
|
|
|
|
|