/src/FreeRDP/channels/rdpear/common/rdpear_common.c
Line | Count | Source |
1 | | /** |
2 | | * FreeRDP: A Remote Desktop Protocol Implementation |
3 | | * |
4 | | * Copyright 2023 David Fort <contact@hardening-consulting.com> |
5 | | * |
6 | | * Licensed under the Apache License, Version 2.0 (the "License"); |
7 | | * you may not use this file except in compliance with the License. |
8 | | * You may obtain a copy of the License at |
9 | | * |
10 | | * http://www.apache.org/licenses/LICENSE-2.0 |
11 | | * |
12 | | * Unless required by applicable law or agreed to in writing, software |
13 | | * distributed under the License is distributed on an "AS IS" BASIS, |
14 | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
15 | | * See the License for the specific language governing permissions and |
16 | | * limitations under the License. |
17 | | */ |
18 | | |
19 | | #include <winpr/ndr.h> |
20 | | #include <winpr/print.h> |
21 | | |
22 | | #include <rdpear-common/rdpear_common.h> |
23 | | #include <rdpear-common/rdpear_asn1.h> |
24 | | |
25 | | #include <stddef.h> |
26 | | #include <freerdp/channels/log.h> |
27 | | |
28 | | #define TAG CHANNELS_TAG("rdpear") |
29 | | |
30 | | static char kerberosPackageName[] = { |
31 | | 'K', 0, 'e', 0, 'r', 0, 'b', 0, 'e', 0, 'r', 0, 'o', 0, 's', 0 |
32 | | }; |
33 | | static char ntlmPackageName[] = { 'N', 0, 'T', 0, 'L', 0, 'M', 0 }; |
34 | | |
35 | | RdpEarPackageType rdpear_packageType_from_name(const WinPrAsn1_OctetString* package) |
36 | 0 | { |
37 | 0 | if (package->len == sizeof(kerberosPackageName) && |
38 | 0 | memcmp(package->data, kerberosPackageName, package->len) == 0) |
39 | 0 | return RDPEAR_PACKAGE_KERBEROS; |
40 | | |
41 | 0 | if (package->len == sizeof(ntlmPackageName) && |
42 | 0 | memcmp(package->data, ntlmPackageName, package->len) == 0) |
43 | 0 | return RDPEAR_PACKAGE_NTLM; |
44 | | |
45 | 0 | return RDPEAR_PACKAGE_UNKNOWN; |
46 | 0 | } |
47 | | |
48 | | wStream* rdpear_encodePayload(RdpEarPackageType packageType, wStream* payload) |
49 | 0 | { |
50 | 0 | wStream* ret = nullptr; |
51 | 0 | WinPrAsn1Encoder* enc = WinPrAsn1Encoder_New(WINPR_ASN1_DER); |
52 | 0 | if (!enc) |
53 | 0 | return nullptr; |
54 | | |
55 | | /* TSRemoteGuardInnerPacket ::= SEQUENCE { */ |
56 | 0 | if (!WinPrAsn1EncSeqContainer(enc)) |
57 | 0 | goto out; |
58 | | |
59 | | /* packageName [1] OCTET STRING */ |
60 | 0 | WinPrAsn1_OctetString packageOctetString; |
61 | 0 | switch (packageType) |
62 | 0 | { |
63 | 0 | case RDPEAR_PACKAGE_KERBEROS: |
64 | 0 | packageOctetString.data = (BYTE*)kerberosPackageName; |
65 | 0 | packageOctetString.len = sizeof(kerberosPackageName); |
66 | 0 | break; |
67 | 0 | case RDPEAR_PACKAGE_NTLM: |
68 | 0 | packageOctetString.data = (BYTE*)ntlmPackageName; |
69 | 0 | packageOctetString.len = sizeof(ntlmPackageName); |
70 | 0 | break; |
71 | 0 | default: |
72 | 0 | goto out; |
73 | 0 | } |
74 | | |
75 | 0 | if (!WinPrAsn1EncContextualOctetString(enc, 1, &packageOctetString)) |
76 | 0 | goto out; |
77 | | |
78 | | /* buffer [2] OCTET STRING*/ |
79 | 0 | WinPrAsn1_OctetString payloadOctetString = { Stream_GetPosition(payload), |
80 | 0 | Stream_Buffer(payload) }; |
81 | 0 | if (!WinPrAsn1EncContextualOctetString(enc, 2, &payloadOctetString)) |
82 | 0 | goto out; |
83 | | |
84 | | /* } */ |
85 | 0 | if (!WinPrAsn1EncEndContainer(enc)) |
86 | 0 | goto out; |
87 | | |
88 | 0 | ret = Stream_New(nullptr, 100); |
89 | 0 | if (!ret) |
90 | 0 | goto out; |
91 | | |
92 | 0 | if (!WinPrAsn1EncToStream(enc, ret)) |
93 | 0 | { |
94 | 0 | Stream_Free(ret, TRUE); |
95 | 0 | ret = nullptr; |
96 | 0 | goto out; |
97 | 0 | } |
98 | 0 | out: |
99 | 0 | WinPrAsn1Encoder_Free(&enc); |
100 | 0 | return ret; |
101 | 0 | } |
102 | | |
103 | | #define RDPEAR_SIMPLE_MESSAGE_TYPE(V) \ |
104 | | FREERDP_LOCAL BOOL ndr_decoder_read_##V(WinPrNdrDecoder* context, wStream* s, \ |
105 | | const void* hints, V* obj) \ |
106 | 0 | { \ |
107 | 0 | WINPR_UNUSED(hints); \ |
108 | 0 | return winpr_ndr_decoder_read_fromDescr(context, s, &V##_struct, obj); \ |
109 | 0 | } \ Unexecuted instantiation: ndr_decoder_read_KERB_RPC_OCTET_STRING Unexecuted instantiation: ndr_decoder_read_KERB_ASN1_DATA Unexecuted instantiation: ndr_decoder_read_KERB_RPC_ENCRYPTION_KEY Unexecuted instantiation: ndr_decoder_read_BuildEncryptedAuthDataReq Unexecuted instantiation: ndr_decoder_read_ComputeTgsChecksumReq Unexecuted instantiation: ndr_decoder_read_CreateApReqAuthenticatorReq Unexecuted instantiation: ndr_decoder_read_CreateApReqAuthenticatorResp Unexecuted instantiation: ndr_decoder_read_UnpackKdcReplyBodyReq Unexecuted instantiation: ndr_decoder_read_UnpackKdcReplyBodyResp Unexecuted instantiation: ndr_decoder_read_DecryptApReplyReq Unexecuted instantiation: ndr_decoder_read_PackApReplyReq Unexecuted instantiation: ndr_decoder_read_PackApReplyResp |
110 | | FREERDP_LOCAL BOOL ndr_encoder_write_##V(WinPrNdrEncoder* context, wStream* s, \ |
111 | | const void* hints, const V* obj) \ |
112 | 0 | { \ |
113 | 0 | WINPR_UNUSED(hints); \ |
114 | 0 | return winpr_ndr_encoder_write_fromDescr(context, s, &V##_struct, obj); \ |
115 | 0 | } \ Unexecuted instantiation: ndr_encoder_write_KERB_RPC_OCTET_STRING Unexecuted instantiation: ndr_encoder_write_KERB_ASN1_DATA Unexecuted instantiation: ndr_encoder_write_KERB_RPC_ENCRYPTION_KEY Unexecuted instantiation: ndr_encoder_write_BuildEncryptedAuthDataReq Unexecuted instantiation: ndr_encoder_write_ComputeTgsChecksumReq Unexecuted instantiation: ndr_encoder_write_CreateApReqAuthenticatorReq Unexecuted instantiation: ndr_encoder_write_CreateApReqAuthenticatorResp Unexecuted instantiation: ndr_encoder_write_UnpackKdcReplyBodyReq Unexecuted instantiation: ndr_encoder_write_UnpackKdcReplyBodyResp Unexecuted instantiation: ndr_encoder_write_DecryptApReplyReq Unexecuted instantiation: ndr_encoder_write_PackApReplyReq Unexecuted instantiation: ndr_encoder_write_PackApReplyResp |
116 | | FREERDP_LOCAL void ndr_destroy_##V(const void* hints, V* obj) \ |
117 | 0 | { \ |
118 | 0 | WINPR_UNUSED(hints); \ |
119 | 0 | winpr_ndr_struct_destroy(&V##_struct, obj); \ |
120 | 0 | } \ Unexecuted instantiation: ndr_destroy_KERB_RPC_OCTET_STRING Unexecuted instantiation: ndr_destroy_KERB_ASN1_DATA Unexecuted instantiation: ndr_destroy_KERB_RPC_ENCRYPTION_KEY Unexecuted instantiation: ndr_destroy_BuildEncryptedAuthDataReq Unexecuted instantiation: ndr_destroy_ComputeTgsChecksumReq Unexecuted instantiation: ndr_destroy_CreateApReqAuthenticatorReq Unexecuted instantiation: ndr_destroy_CreateApReqAuthenticatorResp Unexecuted instantiation: ndr_destroy_UnpackKdcReplyBodyReq Unexecuted instantiation: ndr_destroy_UnpackKdcReplyBodyResp Unexecuted instantiation: ndr_destroy_DecryptApReplyReq Unexecuted instantiation: ndr_destroy_PackApReplyReq Unexecuted instantiation: ndr_destroy_PackApReplyResp |
121 | | FREERDP_LOCAL void ndr_dump_##V(wLog* logger, UINT32 lvl, size_t indentLevel, const V* obj) \ |
122 | 0 | { \ |
123 | 0 | winpr_ndr_struct_dump_fromDescr(logger, lvl, indentLevel, &V##_struct, obj); \ |
124 | 0 | } \ Unexecuted instantiation: ndr_dump_KERB_RPC_OCTET_STRING Unexecuted instantiation: ndr_dump_KERB_ASN1_DATA Unexecuted instantiation: ndr_dump_KERB_RPC_ENCRYPTION_KEY Unexecuted instantiation: ndr_dump_BuildEncryptedAuthDataReq Unexecuted instantiation: ndr_dump_ComputeTgsChecksumReq Unexecuted instantiation: ndr_dump_CreateApReqAuthenticatorReq Unexecuted instantiation: ndr_dump_CreateApReqAuthenticatorResp Unexecuted instantiation: ndr_dump_UnpackKdcReplyBodyReq Unexecuted instantiation: ndr_dump_UnpackKdcReplyBodyResp Unexecuted instantiation: ndr_dump_DecryptApReplyReq Unexecuted instantiation: ndr_dump_PackApReplyReq Unexecuted instantiation: ndr_dump_PackApReplyResp |
125 | | \ |
126 | | static BOOL ndr_descr_read_##V(WinPrNdrDecoder* context, wStream* s, const void* hints, \ |
127 | | void* obj) \ |
128 | 0 | { \ |
129 | 0 | return ndr_decoder_read_##V(context, s, hints, obj); \ |
130 | 0 | } \ Unexecuted instantiation: rdpear_common.c:ndr_descr_read_KERB_RPC_OCTET_STRING Unexecuted instantiation: rdpear_common.c:ndr_descr_read_KERB_ASN1_DATA Unexecuted instantiation: rdpear_common.c:ndr_descr_read_KERB_RPC_ENCRYPTION_KEY Unexecuted instantiation: rdpear_common.c:ndr_descr_read_BuildEncryptedAuthDataReq Unexecuted instantiation: rdpear_common.c:ndr_descr_read_ComputeTgsChecksumReq Unexecuted instantiation: rdpear_common.c:ndr_descr_read_CreateApReqAuthenticatorReq Unexecuted instantiation: rdpear_common.c:ndr_descr_read_CreateApReqAuthenticatorResp Unexecuted instantiation: rdpear_common.c:ndr_descr_read_UnpackKdcReplyBodyReq Unexecuted instantiation: rdpear_common.c:ndr_descr_read_UnpackKdcReplyBodyResp Unexecuted instantiation: rdpear_common.c:ndr_descr_read_DecryptApReplyReq Unexecuted instantiation: rdpear_common.c:ndr_descr_read_PackApReplyReq Unexecuted instantiation: rdpear_common.c:ndr_descr_read_PackApReplyResp |
131 | | static BOOL ndr_descr_write_##V(WinPrNdrEncoder* context, wStream* s, const void* hints, \ |
132 | | const void* obj) \ |
133 | 0 | { \ |
134 | 0 | return ndr_encoder_write_##V(context, s, hints, obj); \ |
135 | 0 | } \ Unexecuted instantiation: rdpear_common.c:ndr_descr_write_KERB_RPC_OCTET_STRING Unexecuted instantiation: rdpear_common.c:ndr_descr_write_KERB_ASN1_DATA Unexecuted instantiation: rdpear_common.c:ndr_descr_write_KERB_RPC_ENCRYPTION_KEY Unexecuted instantiation: rdpear_common.c:ndr_descr_write_BuildEncryptedAuthDataReq Unexecuted instantiation: rdpear_common.c:ndr_descr_write_ComputeTgsChecksumReq Unexecuted instantiation: rdpear_common.c:ndr_descr_write_CreateApReqAuthenticatorReq Unexecuted instantiation: rdpear_common.c:ndr_descr_write_CreateApReqAuthenticatorResp Unexecuted instantiation: rdpear_common.c:ndr_descr_write_UnpackKdcReplyBodyReq Unexecuted instantiation: rdpear_common.c:ndr_descr_write_UnpackKdcReplyBodyResp Unexecuted instantiation: rdpear_common.c:ndr_descr_write_DecryptApReplyReq Unexecuted instantiation: rdpear_common.c:ndr_descr_write_PackApReplyReq Unexecuted instantiation: rdpear_common.c:ndr_descr_write_PackApReplyResp |
136 | | static void ndr_descr_destroy_##V(const void* hints, void* obj) \ |
137 | 0 | { \ |
138 | 0 | WINPR_UNUSED(hints); \ |
139 | 0 | winpr_ndr_struct_destroy(&V##_struct, obj); \ |
140 | 0 | } \ Unexecuted instantiation: rdpear_common.c:ndr_descr_destroy_KERB_RPC_OCTET_STRING Unexecuted instantiation: rdpear_common.c:ndr_descr_destroy_KERB_ASN1_DATA Unexecuted instantiation: rdpear_common.c:ndr_descr_destroy_KERB_RPC_ENCRYPTION_KEY Unexecuted instantiation: rdpear_common.c:ndr_descr_destroy_BuildEncryptedAuthDataReq Unexecuted instantiation: rdpear_common.c:ndr_descr_destroy_ComputeTgsChecksumReq Unexecuted instantiation: rdpear_common.c:ndr_descr_destroy_CreateApReqAuthenticatorReq Unexecuted instantiation: rdpear_common.c:ndr_descr_destroy_CreateApReqAuthenticatorResp Unexecuted instantiation: rdpear_common.c:ndr_descr_destroy_UnpackKdcReplyBodyReq Unexecuted instantiation: rdpear_common.c:ndr_descr_destroy_UnpackKdcReplyBodyResp Unexecuted instantiation: rdpear_common.c:ndr_descr_destroy_DecryptApReplyReq Unexecuted instantiation: rdpear_common.c:ndr_descr_destroy_PackApReplyReq Unexecuted instantiation: rdpear_common.c:ndr_descr_destroy_PackApReplyResp |
141 | | static void ndr_descr_dump_##V(wLog* logger, UINT32 lvl, size_t indentLevel, const void* obj) \ |
142 | 0 | { \ |
143 | 0 | winpr_ndr_struct_dump_fromDescr(logger, lvl, indentLevel, &V##_struct, obj); \ |
144 | 0 | } \ Unexecuted instantiation: rdpear_common.c:ndr_descr_dump_KERB_RPC_OCTET_STRING Unexecuted instantiation: rdpear_common.c:ndr_descr_dump_KERB_ASN1_DATA Unexecuted instantiation: rdpear_common.c:ndr_descr_dump_KERB_RPC_ENCRYPTION_KEY Unexecuted instantiation: rdpear_common.c:ndr_descr_dump_BuildEncryptedAuthDataReq Unexecuted instantiation: rdpear_common.c:ndr_descr_dump_ComputeTgsChecksumReq Unexecuted instantiation: rdpear_common.c:ndr_descr_dump_CreateApReqAuthenticatorReq Unexecuted instantiation: rdpear_common.c:ndr_descr_dump_CreateApReqAuthenticatorResp Unexecuted instantiation: rdpear_common.c:ndr_descr_dump_UnpackKdcReplyBodyReq Unexecuted instantiation: rdpear_common.c:ndr_descr_dump_UnpackKdcReplyBodyResp Unexecuted instantiation: rdpear_common.c:ndr_descr_dump_DecryptApReplyReq Unexecuted instantiation: rdpear_common.c:ndr_descr_dump_PackApReplyReq Unexecuted instantiation: rdpear_common.c:ndr_descr_dump_PackApReplyResp |
145 | | \ |
146 | | static WinPrNdrMessageDescr ndr_##V##_descr_s = { \ |
147 | | WINPR_NDR_ARITY_SIMPLE, sizeof(V), ndr_descr_read_##V, ndr_descr_write_##V, \ |
148 | | ndr_descr_destroy_##V, ndr_descr_dump_##V, \ |
149 | | }; \ |
150 | | \ |
151 | | WinPrNdrMessageType ndr_##V##_descr(void) \ |
152 | 0 | { \ |
153 | 0 | return &ndr_##V##_descr_s; \ |
154 | 0 | } Unexecuted instantiation: ndr_KERB_RPC_OCTET_STRING_descr Unexecuted instantiation: ndr_KERB_ASN1_DATA_descr Unexecuted instantiation: ndr_KERB_RPC_ENCRYPTION_KEY_descr Unexecuted instantiation: ndr_BuildEncryptedAuthDataReq_descr Unexecuted instantiation: ndr_ComputeTgsChecksumReq_descr Unexecuted instantiation: ndr_CreateApReqAuthenticatorReq_descr Unexecuted instantiation: ndr_CreateApReqAuthenticatorResp_descr Unexecuted instantiation: ndr_UnpackKdcReplyBodyReq_descr Unexecuted instantiation: ndr_UnpackKdcReplyBodyResp_descr Unexecuted instantiation: ndr_DecryptApReplyReq_descr Unexecuted instantiation: ndr_PackApReplyReq_descr Unexecuted instantiation: ndr_PackApReplyResp_descr |
155 | | |
156 | | static const WinPrNdrFieldStruct KERB_RPC_OCTET_STRING_fields[] = { |
157 | | { "Length", offsetof(KERB_RPC_OCTET_STRING, length), WINPR_NDR_NOT_POINTER, -1, |
158 | | &winpr_ndr_uint32_descr_s, 0, 0 }, |
159 | | { "value", offsetof(KERB_RPC_OCTET_STRING, value), WINPR_NDR_POINTER_NON_NULL, 0, |
160 | | &winpr_ndr_uint8Array_descr_s, 0, 0 } |
161 | | }; |
162 | | static const WinPrNdrStructDescr KERB_RPC_OCTET_STRING_struct = { "KERB_RPC_OCTET_STRING", 2, |
163 | | KERB_RPC_OCTET_STRING_fields, 0 }; |
164 | | |
165 | | RDPEAR_SIMPLE_MESSAGE_TYPE(KERB_RPC_OCTET_STRING) |
166 | | |
167 | | /* ============================= KERB_ASN1_DATA ============================== */ |
168 | | |
169 | | static const WinPrNdrFieldStruct KERB_ASN1_DATA_fields[] = { |
170 | | { "Pdu", offsetof(KERB_ASN1_DATA, Pdu), WINPR_NDR_NOT_POINTER, -1, &winpr_ndr_uint32_descr_s, 0, |
171 | | 0 }, |
172 | | { "Count", offsetof(KERB_ASN1_DATA, Asn1BufferHints.count), WINPR_NDR_NOT_POINTER, -1, |
173 | | &winpr_ndr_uint32_descr_s, 0, 0 }, |
174 | | { "Asn1Buffer", offsetof(KERB_ASN1_DATA, Asn1Buffer), WINPR_NDR_POINTER_NON_NULL, 1, |
175 | | &winpr_ndr_uint8Array_descr_s, 0, 0 } |
176 | | }; |
177 | | static const WinPrNdrStructDescr KERB_ASN1_DATA_struct = { "KERB_ASN1_DATA", |
178 | | ARRAYSIZE(KERB_ASN1_DATA_fields), |
179 | | KERB_ASN1_DATA_fields, 0 }; |
180 | | |
181 | | RDPEAR_SIMPLE_MESSAGE_TYPE(KERB_ASN1_DATA) |
182 | | |
183 | | /* ============================ RPC_UNICODE_STRING ========================== */ |
184 | | |
185 | | BOOL ndr_decoder_read_RPC_UNICODE_STRING(WinPrNdrDecoder* context, wStream* s, const void* hints, |
186 | | RPC_UNICODE_STRING* res) |
187 | 0 | { |
188 | 0 | WINPR_ASSERT(res); |
189 | 0 | WinPrNdrDeferredEntry bufferDesc = { WINPR_NDR_PTR_NULL, |
190 | 0 | "RPC_UNICODE_STRING.Buffer", |
191 | 0 | &res->lenHints, |
192 | 0 | (void*)&res->Buffer, |
193 | 0 | TRUE, |
194 | 0 | winpr_ndr_uint16VaryingArray_descr() }; |
195 | 0 | UINT16 Length = 0; |
196 | 0 | UINT16 MaximumLength = 0; |
197 | |
|
198 | 0 | WINPR_UNUSED(hints); |
199 | | /* the structure is aligned on its Buffer pointer */ |
200 | 0 | if (!winpr_ndr_decoder_read_align(context, s, 4) || |
201 | 0 | !winpr_ndr_decoder_read_uint16(context, s, &Length) || |
202 | 0 | !winpr_ndr_decoder_read_uint16(context, s, &MaximumLength) || |
203 | 0 | !winpr_ndr_decoder_read_refpointer(context, s, &bufferDesc.ptrId) || Length > MaximumLength) |
204 | 0 | return FALSE; |
205 | | |
206 | 0 | res->lenHints.length = Length; |
207 | 0 | res->lenHints.maxLength = MaximumLength; |
208 | 0 | res->strLength = Length / 2; |
209 | |
|
210 | 0 | return winpr_ndr_decoder_push_deferreds(context, &bufferDesc, 1); |
211 | 0 | } |
212 | | |
213 | | static BOOL ndr_decoder_read_RPC_UNICODE_STRING_(WinPrNdrDecoder* context, wStream* s, |
214 | | const void* hints, void* res) |
215 | 0 | { |
216 | 0 | return ndr_decoder_read_RPC_UNICODE_STRING(context, s, hints, res); |
217 | 0 | } |
218 | | |
219 | | BOOL ndr_encoder_write_RPC_UNICODE_STRING(WinPrNdrEncoder* context, wStream* s, |
220 | | WINPR_ATTR_UNUSED const void* hints, |
221 | | const RPC_UNICODE_STRING* res) |
222 | 0 | { |
223 | 0 | WINPR_ASSERT(res); |
224 | 0 | if (!winpr_ndr_encoder_write_uint32(context, s, res->lenHints.length)) |
225 | 0 | return FALSE; |
226 | | |
227 | 0 | if (!winpr_ndr_encoder_write_uint32(context, s, res->lenHints.maxLength)) |
228 | 0 | return FALSE; |
229 | | |
230 | 0 | return winpr_ndr_encoder_write_data(context, s, res->Buffer, res->strLength); |
231 | 0 | } |
232 | | |
233 | | static BOOL ndr_encoder_write_RPC_UNICODE_STRING_(WinPrNdrEncoder* context, wStream* s, |
234 | | const void* hints, const void* pvres) |
235 | 0 | { |
236 | 0 | const RPC_UNICODE_STRING* res = pvres; |
237 | 0 | return ndr_encoder_write_RPC_UNICODE_STRING(context, s, hints, res); |
238 | 0 | } |
239 | | |
240 | | void ndr_dump_RPC_UNICODE_STRING(wLog* logger, UINT32 lvl, size_t indentLevel, |
241 | | const RPC_UNICODE_STRING* obj) |
242 | 0 | { |
243 | 0 | WINPR_UNUSED(indentLevel); |
244 | 0 | WLog_Print(logger, lvl, "\tLength=%" PRIu32 " MaximumLength=%" PRIu32, obj->lenHints.length, |
245 | 0 | obj->lenHints.maxLength); |
246 | 0 | winpr_HexLogDump(logger, lvl, obj->Buffer, obj->lenHints.length); |
247 | 0 | } |
248 | | |
249 | | static void ndr_dump_RPC_UNICODE_STRING_(wLog* logger, UINT32 lvl, size_t indentLevel, |
250 | | const void* obj) |
251 | 0 | { |
252 | 0 | ndr_dump_RPC_UNICODE_STRING(logger, lvl, indentLevel, obj); |
253 | 0 | } |
254 | | |
255 | | void ndr_destroy_RPC_UNICODE_STRING(const void* hints, RPC_UNICODE_STRING* obj) |
256 | 0 | { |
257 | 0 | WINPR_UNUSED(hints); |
258 | 0 | if (!obj) |
259 | 0 | return; |
260 | 0 | winpr_ndr_pointer_release(obj->Buffer); |
261 | 0 | obj->Buffer = nullptr; |
262 | 0 | } |
263 | | |
264 | | static void ndr_descr_destroy_RPC_UNICODE_STRING_(const void* hints, void* obj) |
265 | 0 | { |
266 | 0 | ndr_destroy_RPC_UNICODE_STRING(hints, obj); |
267 | 0 | } |
268 | | |
269 | | static const WinPrNdrMessageDescr RPC_UNICODE_STRING_descr_s = { |
270 | | WINPR_NDR_ARITY_SIMPLE, |
271 | | sizeof(RPC_UNICODE_STRING), |
272 | | ndr_decoder_read_RPC_UNICODE_STRING_, |
273 | | ndr_encoder_write_RPC_UNICODE_STRING_, |
274 | | ndr_descr_destroy_RPC_UNICODE_STRING_, |
275 | | ndr_dump_RPC_UNICODE_STRING_ |
276 | | }; |
277 | | |
278 | | WinPrNdrMessageType ndr_RPC_UNICODE_STRING_descr(void) |
279 | 0 | { |
280 | 0 | return &RPC_UNICODE_STRING_descr_s; |
281 | 0 | } |
282 | | |
283 | | /* ========================= RPC_UNICODE_STRING_Array ======================== */ |
284 | | |
285 | | static BOOL ndr_decoder_read_RPC_UNICODE_STRING_Array(WinPrNdrDecoder* context, wStream* s, |
286 | | const void* hints, void* v) |
287 | 0 | { |
288 | 0 | WINPR_ASSERT(context); |
289 | 0 | WINPR_ASSERT(s); |
290 | 0 | WINPR_ASSERT(hints); |
291 | 0 | return winpr_ndr_decoder_read_uconformant_array(context, s, hints, |
292 | 0 | ndr_RPC_UNICODE_STRING_descr(), v); |
293 | 0 | } |
294 | | |
295 | | static BOOL ndr_encoder_write_RPC_UNICODE_STRING_Array(WinPrNdrEncoder* context, wStream* s, |
296 | | const void* ghints, const void* v) |
297 | 0 | { |
298 | 0 | WINPR_ASSERT(context); |
299 | 0 | WINPR_ASSERT(s); |
300 | 0 | WINPR_ASSERT(ghints); |
301 | |
|
302 | 0 | const WinPrNdrArrayHints* hints = (const WinPrNdrArrayHints*)ghints; |
303 | |
|
304 | 0 | return winpr_ndr_encoder_write_uconformant_array(context, s, hints->count, |
305 | 0 | ndr_RPC_UNICODE_STRING_descr(), v); |
306 | 0 | } |
307 | | |
308 | | static const WinPrNdrMessageDescr RPC_UNICODE_STRING_Array_descr_s = { |
309 | | WINPR_NDR_ARITY_ARRAYOF, |
310 | | sizeof(RPC_UNICODE_STRING), |
311 | | ndr_decoder_read_RPC_UNICODE_STRING_Array, |
312 | | ndr_encoder_write_RPC_UNICODE_STRING_Array, |
313 | | nullptr, |
314 | | nullptr |
315 | | }; |
316 | | |
317 | | static WinPrNdrMessageType ndr_RPC_UNICODE_STRING_Array_descr(void) |
318 | 0 | { |
319 | 0 | return &RPC_UNICODE_STRING_Array_descr_s; |
320 | 0 | } |
321 | | |
322 | | /* ========================== KERB_RPC_INTERNAL_NAME ======================== */ |
323 | | |
324 | | BOOL ndr_decoder_read_KERB_RPC_INTERNAL_NAME(WinPrNdrDecoder* context, wStream* s, |
325 | | const void* hints, KERB_RPC_INTERNAL_NAME* res) |
326 | 0 | { |
327 | 0 | WINPR_ASSERT(res); |
328 | |
|
329 | 0 | union |
330 | 0 | { |
331 | 0 | RPC_UNICODE_STRING** ppstr; |
332 | 0 | void* pv; |
333 | 0 | } cnv; |
334 | 0 | cnv.ppstr = &res->Names; |
335 | 0 | WinPrNdrDeferredEntry names = { WINPR_NDR_PTR_NULL, |
336 | 0 | "KERB_RPC_INTERNAL_NAME.Names", |
337 | 0 | &res->nameHints, |
338 | 0 | cnv.pv, |
339 | 0 | TRUE, |
340 | 0 | ndr_RPC_UNICODE_STRING_Array_descr() }; |
341 | |
|
342 | 0 | UINT16 nameCount = 0; |
343 | 0 | WINPR_UNUSED(hints); |
344 | |
|
345 | 0 | if (!winpr_ndr_decoder_read_uint16(context, s, &res->NameType) || |
346 | 0 | !winpr_ndr_decoder_read_uint16(context, s, &nameCount)) |
347 | 0 | return FALSE; |
348 | | |
349 | 0 | res->nameHints.count = nameCount; |
350 | |
|
351 | 0 | return winpr_ndr_decoder_read_refpointer(context, s, &names.ptrId) && |
352 | 0 | winpr_ndr_decoder_push_deferreds(context, &names, 1); |
353 | 0 | } |
354 | | |
355 | | static BOOL ndr_descr_read_KERB_RPC_INTERNAL_NAME(WinPrNdrDecoder* context, wStream* s, |
356 | | const void* hints, void* res) |
357 | 0 | { |
358 | 0 | return ndr_decoder_read_KERB_RPC_INTERNAL_NAME(context, s, hints, res); |
359 | 0 | } |
360 | | |
361 | | BOOL ndr_encoder_write_KERB_RPC_INTERNAL_NAME(WinPrNdrEncoder* context, wStream* s, |
362 | | const void* hints, const KERB_RPC_INTERNAL_NAME* res) |
363 | 0 | { |
364 | 0 | WINPR_UNUSED(context); |
365 | 0 | WINPR_UNUSED(s); |
366 | 0 | WINPR_UNUSED(hints); |
367 | 0 | WINPR_UNUSED(res); |
368 | 0 | WLog_ERR(TAG, "TODO: implement this"); |
369 | 0 | return FALSE; |
370 | 0 | } |
371 | | |
372 | | void ndr_dump_KERB_RPC_INTERNAL_NAME(wLog* logger, UINT32 lvl, size_t indentLevel, |
373 | | const KERB_RPC_INTERNAL_NAME* obj) |
374 | 0 | { |
375 | 0 | WINPR_UNUSED(indentLevel); |
376 | 0 | WINPR_UNUSED(obj); |
377 | 0 | WLog_Print(logger, lvl, "TODO: implement this"); |
378 | 0 | } |
379 | | |
380 | | static void ndr_descr_dump_KERB_RPC_INTERNAL_NAME(wLog* logger, UINT32 lvl, size_t indentLevel, |
381 | | const void* obj) |
382 | 0 | { |
383 | 0 | ndr_dump_KERB_RPC_INTERNAL_NAME(logger, lvl, indentLevel, obj); |
384 | 0 | } |
385 | | |
386 | | void ndr_destroy_KERB_RPC_INTERNAL_NAME(const void* hints, KERB_RPC_INTERNAL_NAME* obj) |
387 | 0 | { |
388 | 0 | WINPR_UNUSED(hints); |
389 | 0 | if (!obj) |
390 | 0 | return; |
391 | | |
392 | 0 | if (obj->Names) |
393 | 0 | { |
394 | 0 | for (UINT32 i = 0; i < obj->nameHints.count; i++) |
395 | 0 | ndr_destroy_RPC_UNICODE_STRING(nullptr, &obj->Names[i]); |
396 | 0 | } |
397 | |
|
398 | 0 | winpr_ndr_pointer_release(obj->Names); |
399 | 0 | obj->Names = nullptr; |
400 | 0 | obj->nameHints.count = 0; |
401 | 0 | } |
402 | | |
403 | | static void ndr_descr_destroy_KERB_RPC_INTERNAL_NAME(const void* hints, void* obj) |
404 | 0 | { |
405 | 0 | ndr_destroy_KERB_RPC_INTERNAL_NAME(hints, obj); |
406 | 0 | } |
407 | | |
408 | | static WinPrNdrMessageDescr KERB_RPC_INTERNAL_NAME_descr_s = { |
409 | | WINPR_NDR_ARITY_SIMPLE, |
410 | | sizeof(KERB_RPC_INTERNAL_NAME), |
411 | | ndr_descr_read_KERB_RPC_INTERNAL_NAME, |
412 | | nullptr, |
413 | | ndr_descr_destroy_KERB_RPC_INTERNAL_NAME, |
414 | | ndr_descr_dump_KERB_RPC_INTERNAL_NAME |
415 | | }; |
416 | | |
417 | | WinPrNdrMessageType ndr_KERB_RPC_INTERNAL_NAME_descr(void) |
418 | 0 | { |
419 | 0 | return &KERB_RPC_INTERNAL_NAME_descr_s; |
420 | 0 | } |
421 | | |
422 | | /* ========================== KERB_RPC_ENCRYPTION_KEY ======================== */ |
423 | | |
424 | | static const WinPrNdrFieldStruct KERB_RPC_ENCRYPTION_KEY_fields[] = { |
425 | | { "reserved1", offsetof(KERB_RPC_ENCRYPTION_KEY, reserved1), WINPR_NDR_NOT_POINTER, -1, |
426 | | &winpr_ndr_uint32_descr_s, 0, 0 }, |
427 | | { "reserved2", offsetof(KERB_RPC_ENCRYPTION_KEY, reserved2), WINPR_NDR_NOT_POINTER, -1, |
428 | | &winpr_ndr_uint32_descr_s, 0, 0 }, |
429 | | { "reserved3", offsetof(KERB_RPC_ENCRYPTION_KEY, reserved3), WINPR_NDR_NOT_POINTER, -1, |
430 | | &ndr_KERB_RPC_OCTET_STRING_descr_s, 0, 0 } |
431 | | }; |
432 | | static const WinPrNdrStructDescr KERB_RPC_ENCRYPTION_KEY_struct = { |
433 | | "KERB_RPC_ENCRYPTION_KEY", ARRAYSIZE(KERB_RPC_ENCRYPTION_KEY_fields), |
434 | | KERB_RPC_ENCRYPTION_KEY_fields, 0 |
435 | | }; |
436 | | |
437 | | RDPEAR_SIMPLE_MESSAGE_TYPE(KERB_RPC_ENCRYPTION_KEY) |
438 | | |
439 | | /* ========================== BuildEncryptedAuthDataReq ======================== */ |
440 | | |
441 | | static const WinPrNdrFieldStruct BuildEncryptedAuthDataReq_fields[] = { |
442 | | { "KeyUsage", offsetof(BuildEncryptedAuthDataReq, KeyUsage), WINPR_NDR_NOT_POINTER, -1, |
443 | | &winpr_ndr_uint32_descr_s, 0, 0 }, |
444 | | { "key", offsetof(BuildEncryptedAuthDataReq, Key), WINPR_NDR_POINTER_NON_NULL, -1, |
445 | | &ndr_KERB_RPC_ENCRYPTION_KEY_descr_s, 0, 0 }, |
446 | | { "plainAuthData", offsetof(BuildEncryptedAuthDataReq, PlainAuthData), |
447 | | WINPR_NDR_POINTER_NON_NULL, -1, &ndr_KERB_ASN1_DATA_descr_s, 0, 0 } |
448 | | }; |
449 | | static const WinPrNdrStructDescr BuildEncryptedAuthDataReq_struct = { |
450 | | "BuildEncryptedAuthDataReq", ARRAYSIZE(BuildEncryptedAuthDataReq_fields), |
451 | | BuildEncryptedAuthDataReq_fields, 0 |
452 | | }; |
453 | | |
454 | | RDPEAR_SIMPLE_MESSAGE_TYPE(BuildEncryptedAuthDataReq) |
455 | | |
456 | | /* ========================== ComputeTgsChecksumReq ======================== */ |
457 | | |
458 | | static const WinPrNdrFieldStruct ComputeTgsChecksumReq_fields[] = { |
459 | | { "requestBody", offsetof(ComputeTgsChecksumReq, requestBody), WINPR_NDR_POINTER_NON_NULL, -1, |
460 | | &ndr_KERB_ASN1_DATA_descr_s, 0, 0 }, |
461 | | { "key", offsetof(ComputeTgsChecksumReq, Key), WINPR_NDR_POINTER_NON_NULL, -1, |
462 | | &ndr_KERB_RPC_ENCRYPTION_KEY_descr_s, 0, 0 }, |
463 | | { "ChecksumType", offsetof(ComputeTgsChecksumReq, ChecksumType), WINPR_NDR_NOT_POINTER, -1, |
464 | | &winpr_ndr_uint32_descr_s, 0, 0 } |
465 | | }; |
466 | | static const WinPrNdrStructDescr ComputeTgsChecksumReq_struct = { |
467 | | "ComputeTgsChecksumReq", ARRAYSIZE(ComputeTgsChecksumReq_fields), ComputeTgsChecksumReq_fields, |
468 | | 0 |
469 | | }; |
470 | | |
471 | | RDPEAR_SIMPLE_MESSAGE_TYPE(ComputeTgsChecksumReq) |
472 | | |
473 | | /* ========================== CreateApReqAuthenticatorReq ======================== */ |
474 | | |
475 | | static const WinPrNdrFieldStruct CreateApReqAuthenticatorReq_fields[] = { |
476 | | { "EncryptionKey", offsetof(CreateApReqAuthenticatorReq, EncryptionKey), |
477 | | WINPR_NDR_POINTER_NON_NULL, -1, &ndr_KERB_RPC_ENCRYPTION_KEY_descr_s, 0, 0 }, |
478 | | { "SequenceNumber", offsetof(CreateApReqAuthenticatorReq, SequenceNumber), |
479 | | WINPR_NDR_NOT_POINTER, -1, &winpr_ndr_uint32_descr_s, 0, 0 }, |
480 | | { "ClientName", offsetof(CreateApReqAuthenticatorReq, ClientName), WINPR_NDR_POINTER_NON_NULL, |
481 | | -1, &KERB_RPC_INTERNAL_NAME_descr_s, 0, 0 }, |
482 | | { "ClientRealm", offsetof(CreateApReqAuthenticatorReq, ClientRealm), WINPR_NDR_POINTER_NON_NULL, |
483 | | -1, &RPC_UNICODE_STRING_descr_s, 0, 0 }, |
484 | | { "SkewTime", offsetof(CreateApReqAuthenticatorReq, SkewTime), WINPR_NDR_POINTER_NON_NULL, -1, |
485 | | &winpr_ndr_uint64_descr_s, 0, 0 }, |
486 | | { "SubKey", offsetof(CreateApReqAuthenticatorReq, SubKey), WINPR_NDR_POINTER, -1, |
487 | | &ndr_KERB_RPC_ENCRYPTION_KEY_descr_s, 0, 0 }, |
488 | | { "AuthData", offsetof(CreateApReqAuthenticatorReq, AuthData), WINPR_NDR_POINTER_NON_NULL, -1, |
489 | | &ndr_KERB_ASN1_DATA_descr_s, 0, 0 }, |
490 | | { "GssChecksum", offsetof(CreateApReqAuthenticatorReq, GssChecksum), WINPR_NDR_POINTER, -1, |
491 | | &ndr_KERB_ASN1_DATA_descr_s, 0, 0 }, |
492 | | { "KeyUsage", offsetof(CreateApReqAuthenticatorReq, KeyUsage), WINPR_NDR_NOT_POINTER, -1, |
493 | | &winpr_ndr_uint32_descr_s, 0, 0 }, |
494 | | }; |
495 | | static const WinPrNdrStructDescr CreateApReqAuthenticatorReq_struct = { |
496 | | "CreateApReqAuthenticatorReq", ARRAYSIZE(CreateApReqAuthenticatorReq_fields), |
497 | | CreateApReqAuthenticatorReq_fields, 0 |
498 | | }; |
499 | | |
500 | | RDPEAR_SIMPLE_MESSAGE_TYPE(CreateApReqAuthenticatorReq) |
501 | | |
502 | | /* ========================== CreateApReqAuthenticatorResp ======================== */ |
503 | | |
504 | | static const WinPrNdrFieldStruct CreateApReqAuthenticatorResp_fields[] = { |
505 | | { "AuthenticatorTime", offsetof(CreateApReqAuthenticatorResp, AuthenticatorTime), |
506 | | WINPR_NDR_NOT_POINTER, -1, &winpr_ndr_uint64_descr_s, 0, 0 }, |
507 | | { "Authenticator", offsetof(CreateApReqAuthenticatorResp, Authenticator), WINPR_NDR_NOT_POINTER, |
508 | | -1, &ndr_KERB_ASN1_DATA_descr_s, 0, 0 }, |
509 | | { "KerbProtocolError", offsetof(CreateApReqAuthenticatorResp, KerbProtocolError), |
510 | | WINPR_NDR_NOT_POINTER, -1, &winpr_ndr_uint32_descr_s, 0, 0 }, |
511 | | }; |
512 | | |
513 | | static const WinPrNdrStructDescr CreateApReqAuthenticatorResp_struct = { |
514 | | "CreateApReqAuthenticatorResp", ARRAYSIZE(CreateApReqAuthenticatorResp_fields), |
515 | | CreateApReqAuthenticatorResp_fields, 0 |
516 | | }; |
517 | | |
518 | | RDPEAR_SIMPLE_MESSAGE_TYPE(CreateApReqAuthenticatorResp) |
519 | | |
520 | | /* ========================== UnpackKdcReplyBodyReq ======================== */ |
521 | | |
522 | | static const WinPrNdrFieldStruct UnpackKdcReplyBodyReq_fields[] = { |
523 | | { "EncryptedData", offsetof(UnpackKdcReplyBodyReq, EncryptedData), WINPR_NDR_POINTER_NON_NULL, |
524 | | -1, &ndr_KERB_ASN1_DATA_descr_s, 0, 0 }, |
525 | | { "Key", offsetof(UnpackKdcReplyBodyReq, Key), WINPR_NDR_POINTER_NON_NULL, -1, |
526 | | &ndr_KERB_RPC_ENCRYPTION_KEY_descr_s, 0, 0 }, |
527 | | { "StrenghtenKey", offsetof(UnpackKdcReplyBodyReq, StrengthenKey), WINPR_NDR_POINTER, -1, |
528 | | &ndr_KERB_RPC_ENCRYPTION_KEY_descr_s, 0, 0 }, |
529 | | { "Pdu", offsetof(UnpackKdcReplyBodyReq, Pdu), WINPR_NDR_NOT_POINTER, -1, |
530 | | &winpr_ndr_uint32_descr_s, 0, 0 }, |
531 | | { "KeyUsage", offsetof(UnpackKdcReplyBodyReq, KeyUsage), WINPR_NDR_NOT_POINTER, -1, |
532 | | &winpr_ndr_uint32_descr_s, 0, 0 }, |
533 | | }; |
534 | | |
535 | | static const WinPrNdrStructDescr UnpackKdcReplyBodyReq_struct = { |
536 | | "UnpackKdcReplyBodyReq", ARRAYSIZE(UnpackKdcReplyBodyReq_fields), UnpackKdcReplyBodyReq_fields, |
537 | | 0 |
538 | | }; |
539 | | |
540 | | RDPEAR_SIMPLE_MESSAGE_TYPE(UnpackKdcReplyBodyReq) |
541 | | |
542 | | /* ========================== UnpackKdcReplyBodyResp ======================== */ |
543 | | |
544 | | static const WinPrNdrFieldStruct UnpackKdcReplyBodyResp_fields[] = { |
545 | | { "KerbProtocolError", offsetof(UnpackKdcReplyBodyResp, KerbProtocolError), |
546 | | WINPR_NDR_NOT_POINTER, -1, &winpr_ndr_uint32_descr_s, 0, 0 }, |
547 | | { "ReplyBody", offsetof(UnpackKdcReplyBodyResp, ReplyBody), WINPR_NDR_NOT_POINTER, -1, |
548 | | &ndr_KERB_ASN1_DATA_descr_s, 0, 0 } |
549 | | }; |
550 | | |
551 | | static const WinPrNdrStructDescr UnpackKdcReplyBodyResp_struct = { |
552 | | "UnpackKdcReplyBodyResp", ARRAYSIZE(UnpackKdcReplyBodyResp_fields), |
553 | | UnpackKdcReplyBodyResp_fields, 0 |
554 | | }; |
555 | | |
556 | | RDPEAR_SIMPLE_MESSAGE_TYPE(UnpackKdcReplyBodyResp) |
557 | | |
558 | | /* ========================== DecryptApReplyReq ======================== */ |
559 | | |
560 | | static const WinPrNdrFieldStruct DecryptApReplyReq_fields[] = { |
561 | | { "EncryptedReply", offsetof(DecryptApReplyReq, EncryptedReply), WINPR_NDR_POINTER_NON_NULL, -1, |
562 | | &ndr_KERB_ASN1_DATA_descr_s, 0, 0 }, |
563 | | { "Key", offsetof(DecryptApReplyReq, Key), WINPR_NDR_POINTER_NON_NULL, -1, |
564 | | &ndr_KERB_RPC_ENCRYPTION_KEY_descr_s, 0, 0 } |
565 | | }; |
566 | | |
567 | | static const WinPrNdrStructDescr DecryptApReplyReq_struct = { "DecryptApReplyReq", |
568 | | ARRAYSIZE(DecryptApReplyReq_fields), |
569 | | DecryptApReplyReq_fields, 0 }; |
570 | | |
571 | | RDPEAR_SIMPLE_MESSAGE_TYPE(DecryptApReplyReq) |
572 | | |
573 | | /* ========================== PackApReplyReq ======================== */ |
574 | | |
575 | | static const WinPrNdrFieldStruct PackApReplyReq_fields[] = { |
576 | | { "Reply", offsetof(PackApReplyReq, Reply), WINPR_NDR_POINTER_NON_NULL, -1, |
577 | | &ndr_KERB_ASN1_DATA_descr_s, 0, 0 }, |
578 | | { "ReplyBody", offsetof(PackApReplyReq, ReplyBody), WINPR_NDR_POINTER_NON_NULL, -1, |
579 | | &ndr_KERB_ASN1_DATA_descr_s, 0, 0 }, |
580 | | { "SessionKey", offsetof(PackApReplyReq, SessionKey), WINPR_NDR_POINTER_NON_NULL, -1, |
581 | | &ndr_KERB_RPC_ENCRYPTION_KEY_descr_s, 0, 0 } |
582 | | }; |
583 | | |
584 | | static const WinPrNdrStructDescr PackApReplyReq_struct = { "PackApReplyReq", |
585 | | ARRAYSIZE(PackApReplyReq_fields), |
586 | | PackApReplyReq_fields, 0 }; |
587 | | |
588 | | RDPEAR_SIMPLE_MESSAGE_TYPE(PackApReplyReq) |
589 | | |
590 | | /* ========================== PackApReplyResp ======================== */ |
591 | | |
592 | | static const WinPrNdrFieldStruct PackApReplyResp_fields[] = { |
593 | | { "PackedReplySize", offsetof(PackApReplyResp, PackedReplyHints), WINPR_NDR_NOT_POINTER, -1, |
594 | | &winpr_ndr_uint32_descr_s, 0, 0 }, |
595 | | { "PackedReply", offsetof(PackApReplyResp, PackedReply), WINPR_NDR_POINTER_NON_NULL, 0, |
596 | | &winpr_ndr_uint8Array_descr_s, 0, 0 }, |
597 | | }; |
598 | | |
599 | | static const WinPrNdrStructDescr PackApReplyResp_struct = { "PackApReplyResp", |
600 | | ARRAYSIZE(PackApReplyResp_fields), |
601 | | PackApReplyResp_fields, 0 }; |
602 | | |
603 | | RDPEAR_SIMPLE_MESSAGE_TYPE(PackApReplyResp) |
604 | | |
605 | | /* ========================== messages ======================== */ |
606 | | |
607 | | /** @brief reads a type serialized message: the object holding the top-level pointer on it */ |
608 | | static BOOL rdpear_read_message(WinPrNdrDecoder* decoder, wStream* s, |
609 | | const WinPrNdrStructDescr* descr, void* msg) |
610 | 0 | { |
611 | 0 | WINPR_ASSERT(decoder); |
612 | 0 | WINPR_ASSERT(s); |
613 | |
|
614 | 0 | wStream object = WINPR_C_ARRAY_INIT; |
615 | 0 | winpr_ndr_refid refId = WINPR_NDR_PTR_NULL; |
616 | 0 | if (!winpr_ndr_decoder_read_object(decoder, s, &object) || |
617 | 0 | !winpr_ndr_decoder_read_refpointer(decoder, &object, &refId)) |
618 | 0 | return FALSE; |
619 | | |
620 | 0 | if (!refId) |
621 | 0 | { |
622 | 0 | WLog_ERR(TAG, "%s: null top-level pointer", descr->name); |
623 | 0 | return FALSE; |
624 | 0 | } |
625 | | |
626 | 0 | return winpr_ndr_decoder_read_fromDescr(decoder, &object, descr, msg) && |
627 | 0 | winpr_ndr_decoder_treat_deferreds(decoder, &object); |
628 | 0 | } |
629 | | |
630 | | /** @brief writes a type serialized message: the header and the object holding the top-level |
631 | | * pointer on it */ |
632 | | static BOOL rdpear_write_message(WinPrNdrEncoder* encoder, wStream* s, |
633 | | const WinPrNdrStructDescr* descr, const void* msg) |
634 | 0 | { |
635 | 0 | WINPR_ASSERT(encoder); |
636 | 0 | WINPR_ASSERT(s); |
637 | |
|
638 | 0 | return winpr_ndr_encoder_write_header(encoder, s) && |
639 | 0 | winpr_ndr_encoder_start_object(encoder, s) && |
640 | 0 | winpr_ndr_encoder_write_toplevel_refid(encoder, s) && |
641 | 0 | winpr_ndr_encoder_write_fromDescr(encoder, s, descr, msg) && |
642 | 0 | winpr_ndr_encoder_treat_deferreds(encoder, s) && |
643 | 0 | winpr_ndr_encoder_end_object(encoder, s); |
644 | 0 | } |
645 | | |
646 | | #define RDPEAR_ARM(CALLID, NAME, DESCR) \ |
647 | | { CALLID, { #NAME, 0, WINPR_NDR_NOT_POINTER, -1, DESCR, 0, 0 } } |
648 | | |
649 | | /* the calls without a description are encoded without their arm */ |
650 | | static const WinPrNdrUnionArm rdpear_default_arm = { |
651 | | 0, { "default", 0, WINPR_NDR_NOT_POINTER, -1, nullptr, 0, 0 } |
652 | | }; |
653 | | |
654 | | /* ========================== KerbCredIsoRemoteInput ======================== */ |
655 | | |
656 | | static const WinPrNdrUnionArm KerbCredIsoRemoteInputUnion_arms[] = { |
657 | | RDPEAR_ARM(RemoteCallKerbNegotiateVersion, NegotiateVersion, &winpr_ndr_uint32_descr_s), |
658 | | RDPEAR_ARM(RemoteCallKerbCreateApReqAuthenticator, CreateApReqAuthenticator, |
659 | | &ndr_CreateApReqAuthenticatorReq_descr_s), |
660 | | RDPEAR_ARM(RemoteCallKerbDecryptApReply, DecryptApReply, &ndr_DecryptApReplyReq_descr_s), |
661 | | RDPEAR_ARM(RemoteCallKerbUnpackKdcReplyBody, UnpackKdcReplyBody, |
662 | | &ndr_UnpackKdcReplyBodyReq_descr_s), |
663 | | RDPEAR_ARM(RemoteCallKerbComputeTgsChecksum, ComputeTgsChecksum, |
664 | | &ndr_ComputeTgsChecksumReq_descr_s), |
665 | | RDPEAR_ARM(RemoteCallKerbBuildEncryptedAuthData, BuildEncryptedAuthData, |
666 | | &ndr_BuildEncryptedAuthDataReq_descr_s), |
667 | | RDPEAR_ARM(RemoteCallKerbPackApReply, PackApReply, &ndr_PackApReplyReq_descr_s), |
668 | | }; |
669 | | |
670 | | static const WinPrNdrUnionDescr KerbCredIsoRemoteInputUnion_union = { |
671 | | "KerbCredIsoRemoteInputUnion", ARRAYSIZE(KerbCredIsoRemoteInputUnion_arms), |
672 | | KerbCredIsoRemoteInputUnion_arms, sizeof(UINT16), &rdpear_default_arm |
673 | | }; |
674 | | |
675 | | WINPR_NDR_UNION_MESSAGE_DEFINE(KerbCredIsoRemoteInputUnion, KerbCredIsoRemoteInputUnion); |
676 | | |
677 | | static const WinPrNdrFieldStruct KerbCredIsoRemoteInput_fields[] = { |
678 | | { "CallId", offsetof(KerbCredIsoRemoteInput, CallId), WINPR_NDR_NOT_POINTER, -1, |
679 | | &winpr_ndr_uint16_descr_s, 0, 0 }, |
680 | | { "Input", offsetof(KerbCredIsoRemoteInput, Input), WINPR_NDR_NOT_POINTER, 0, |
681 | | &KerbCredIsoRemoteInputUnion_descr_s, 0, 0 }, |
682 | | }; |
683 | | |
684 | | /* the largest arm alignment is the one of CreateApReqAuthenticator.AuthenticatorTime */ |
685 | | static const WinPrNdrStructDescr KerbCredIsoRemoteInput_struct = { |
686 | | "KerbCredIsoRemoteInput", ARRAYSIZE(KerbCredIsoRemoteInput_fields), |
687 | | KerbCredIsoRemoteInput_fields, 8 |
688 | | }; |
689 | | |
690 | | BOOL rdpear_kerb_input_read(WinPrNdrDecoder* decoder, wStream* s, KerbCredIsoRemoteInput* input) |
691 | 0 | { |
692 | 0 | WINPR_ASSERT(input); |
693 | 0 | return rdpear_read_message(decoder, s, &KerbCredIsoRemoteInput_struct, input); |
694 | 0 | } |
695 | | |
696 | | void rdpear_kerb_input_free(KerbCredIsoRemoteInput* input) |
697 | 0 | { |
698 | 0 | if (input) |
699 | 0 | winpr_ndr_struct_destroy(&KerbCredIsoRemoteInput_struct, input); |
700 | 0 | } |
701 | | |
702 | | /* ========================== KerbCredIsoRemoteOutput ======================== */ |
703 | | |
704 | | static const WinPrNdrUnionArm KerbCredIsoRemoteOutputUnion_arms[] = { |
705 | | RDPEAR_ARM(RemoteCallKerbNegotiateVersion, NegotiateVersion, &winpr_ndr_uint32_descr_s), |
706 | | RDPEAR_ARM(RemoteCallKerbCreateApReqAuthenticator, CreateApReqAuthenticator, |
707 | | &ndr_CreateApReqAuthenticatorResp_descr_s), |
708 | | RDPEAR_ARM(RemoteCallKerbDecryptApReply, DecryptApReply, &ndr_KERB_ASN1_DATA_descr_s), |
709 | | RDPEAR_ARM(RemoteCallKerbUnpackKdcReplyBody, UnpackKdcReplyBody, |
710 | | &ndr_UnpackKdcReplyBodyResp_descr_s), |
711 | | RDPEAR_ARM(RemoteCallKerbComputeTgsChecksum, ComputeTgsChecksum, &ndr_KERB_ASN1_DATA_descr_s), |
712 | | RDPEAR_ARM(RemoteCallKerbBuildEncryptedAuthData, BuildEncryptedAuthData, |
713 | | &ndr_KERB_ASN1_DATA_descr_s), |
714 | | RDPEAR_ARM(RemoteCallKerbPackApReply, PackApReply, &ndr_PackApReplyResp_descr_s), |
715 | | }; |
716 | | |
717 | | static const WinPrNdrUnionDescr KerbCredIsoRemoteOutputUnion_union = { |
718 | | "KerbCredIsoRemoteOutputUnion", ARRAYSIZE(KerbCredIsoRemoteOutputUnion_arms), |
719 | | KerbCredIsoRemoteOutputUnion_arms, sizeof(UINT16), &rdpear_default_arm |
720 | | }; |
721 | | |
722 | | WINPR_NDR_UNION_MESSAGE_DEFINE(KerbCredIsoRemoteOutputUnion, KerbCredIsoRemoteOutputUnion); |
723 | | |
724 | | static const WinPrNdrFieldStruct KerbCredIsoRemoteOutput_fields[] = { |
725 | | { "CallId", offsetof(KerbCredIsoRemoteOutput, CallId), WINPR_NDR_NOT_POINTER, -1, |
726 | | &winpr_ndr_uint16_descr_s, 0, 0 }, |
727 | | { "Status", offsetof(KerbCredIsoRemoteOutput, Status), WINPR_NDR_NOT_POINTER, -1, |
728 | | &winpr_ndr_uint32_descr_s, 0, 0 }, |
729 | | { "Output", offsetof(KerbCredIsoRemoteOutput, Output), WINPR_NDR_NOT_POINTER, 0, |
730 | | &KerbCredIsoRemoteOutputUnion_descr_s, 0, 0 }, |
731 | | }; |
732 | | |
733 | | static const WinPrNdrStructDescr KerbCredIsoRemoteOutput_struct = { |
734 | | "KerbCredIsoRemoteOutput", ARRAYSIZE(KerbCredIsoRemoteOutput_fields), |
735 | | KerbCredIsoRemoteOutput_fields, 8 |
736 | | }; |
737 | | |
738 | | BOOL rdpear_kerb_output_write(WinPrNdrEncoder* encoder, wStream* s, |
739 | | const KerbCredIsoRemoteOutput* output) |
740 | 0 | { |
741 | 0 | WINPR_ASSERT(output); |
742 | 0 | return rdpear_write_message(encoder, s, &KerbCredIsoRemoteOutput_struct, output); |
743 | 0 | } |
744 | | |
745 | | void rdpear_kerb_output_free(KerbCredIsoRemoteOutput* output) |
746 | 0 | { |
747 | 0 | if (output) |
748 | 0 | winpr_ndr_struct_destroy(&KerbCredIsoRemoteOutput_struct, output); |
749 | 0 | } |
750 | | |
751 | | /* ========================== NTLM types ======================== */ |
752 | | |
753 | | #define RDPEAR_BYTES_FIELD(TYPE, NAME, SIZE) \ |
754 | | { #NAME, offsetof(TYPE, NAME), WINPR_NDR_NOT_POINTER, -1, &winpr_ndr_uint8_descr_s, SIZE, 0 } |
755 | | |
756 | | /** @brief a USHORT count of a conformant array stored in a WinPrNdrArrayHints */ |
757 | | static BOOL ndr_decoder_read_uint16_count(WinPrNdrDecoder* context, wStream* s, const void* hints, |
758 | | void* v) |
759 | 0 | { |
760 | 0 | WINPR_UNUSED(hints); |
761 | 0 | UINT16 count = 0; |
762 | 0 | if (!winpr_ndr_decoder_read_uint16(context, s, &count)) |
763 | 0 | return FALSE; |
764 | 0 | ((WinPrNdrArrayHints*)v)->count = count; |
765 | 0 | return TRUE; |
766 | 0 | } |
767 | | |
768 | | static BOOL ndr_encoder_write_uint16_count(WinPrNdrEncoder* context, wStream* s, const void* hints, |
769 | | const void* v) |
770 | 0 | { |
771 | 0 | WINPR_UNUSED(hints); |
772 | 0 | const UINT32 count = ((const WinPrNdrArrayHints*)v)->count; |
773 | 0 | if (count > UINT16_MAX) |
774 | 0 | { |
775 | 0 | WLog_ERR(TAG, "count %" PRIu32 " doesn't fit in a USHORT", count); |
776 | 0 | return FALSE; |
777 | 0 | } |
778 | 0 | return winpr_ndr_encoder_write_uint16(context, s, (UINT16)count); |
779 | 0 | } |
780 | | |
781 | | static const WinPrNdrMessageDescr ndr_uint16_count_descr_s = { WINPR_NDR_ARITY_SIMPLE, |
782 | | sizeof(WinPrNdrArrayHints), |
783 | | ndr_decoder_read_uint16_count, |
784 | | ndr_encoder_write_uint16_count, |
785 | | nullptr, |
786 | | nullptr }; |
787 | | |
788 | | static const WinPrNdrFieldStruct MSV1_0_REMOTE_ENCRYPTED_SECRETS_fields[] = { |
789 | | { "reserved1", offsetof(MSV1_0_REMOTE_ENCRYPTED_SECRETS, reserved1), WINPR_NDR_NOT_POINTER, -1, |
790 | | &winpr_ndr_uint8_descr_s, 0, 0 }, |
791 | | { "reserved2", offsetof(MSV1_0_REMOTE_ENCRYPTED_SECRETS, reserved2), WINPR_NDR_NOT_POINTER, -1, |
792 | | &winpr_ndr_uint8_descr_s, 0, 0 }, |
793 | | { "reserved3", offsetof(MSV1_0_REMOTE_ENCRYPTED_SECRETS, reserved3), WINPR_NDR_NOT_POINTER, -1, |
794 | | &winpr_ndr_uint8_descr_s, 0, 0 }, |
795 | | { "reserved4", offsetof(MSV1_0_REMOTE_ENCRYPTED_SECRETS, reserved4), WINPR_NDR_NOT_POINTER, -1, |
796 | | &winpr_ndr_uint16_descr_s, 0, 0 }, |
797 | | RDPEAR_BYTES_FIELD(MSV1_0_REMOTE_ENCRYPTED_SECRETS, reserved5, |
798 | | RDPEAR_MSV1_0_CREDENTIAL_KEY_LENGTH), |
799 | | { "reservedSize", offsetof(MSV1_0_REMOTE_ENCRYPTED_SECRETS, reservedSize), |
800 | | WINPR_NDR_NOT_POINTER, -1, &winpr_ndr_uint32_descr_s, 0, 0 }, |
801 | | { "reserved6", offsetof(MSV1_0_REMOTE_ENCRYPTED_SECRETS, reserved6), WINPR_NDR_POINTER, 5, |
802 | | &winpr_ndr_uint8Array_descr_s, 0, 0 }, |
803 | | }; |
804 | | |
805 | | static const WinPrNdrStructDescr MSV1_0_REMOTE_ENCRYPTED_SECRETS_struct = { |
806 | | "MSV1_0_REMOTE_ENCRYPTED_SECRETS", ARRAYSIZE(MSV1_0_REMOTE_ENCRYPTED_SECRETS_fields), |
807 | | MSV1_0_REMOTE_ENCRYPTED_SECRETS_fields, 4 |
808 | | }; |
809 | | |
810 | | WINPR_NDR_STRUCT_MESSAGE_DEFINE(MSV1_0_REMOTE_ENCRYPTED_SECRETS, MSV1_0_REMOTE_ENCRYPTED_SECRETS); |
811 | | |
812 | | static const WinPrNdrFieldStruct NT_CHALLENGE_fields[] = { |
813 | | RDPEAR_BYTES_FIELD(NT_CHALLENGE, Data, RDPEAR_MSV1_0_CHALLENGE_LENGTH), |
814 | | }; |
815 | | |
816 | | static const WinPrNdrStructDescr NT_CHALLENGE_struct = { "NT_CHALLENGE", |
817 | | ARRAYSIZE(NT_CHALLENGE_fields), |
818 | | NT_CHALLENGE_fields, 1 }; |
819 | | |
820 | | WINPR_NDR_STRUCT_MESSAGE_DEFINE(NT_CHALLENGE, NT_CHALLENGE); |
821 | | |
822 | | static const WinPrNdrFieldStruct NT_RESPONSE_fields[] = { |
823 | | RDPEAR_BYTES_FIELD(NT_RESPONSE, Data, RDPEAR_MSV1_0_RESPONSE_LENGTH), |
824 | | }; |
825 | | |
826 | | static const WinPrNdrStructDescr NT_RESPONSE_struct = { "NT_RESPONSE", |
827 | | ARRAYSIZE(NT_RESPONSE_fields), |
828 | | NT_RESPONSE_fields, 1 }; |
829 | | |
830 | | WINPR_NDR_STRUCT_MESSAGE_DEFINE(NT_RESPONSE, NT_RESPONSE); |
831 | | |
832 | | static const WinPrNdrFieldStruct USER_SESSION_KEY_fields[] = { |
833 | | RDPEAR_BYTES_FIELD(USER_SESSION_KEY, Data, RDPEAR_MSV1_0_USER_SESSION_KEY_LENGTH), |
834 | | }; |
835 | | |
836 | | static const WinPrNdrStructDescr USER_SESSION_KEY_struct = { "USER_SESSION_KEY", |
837 | | ARRAYSIZE(USER_SESSION_KEY_fields), |
838 | | USER_SESSION_KEY_fields, 1 }; |
839 | | |
840 | | WINPR_NDR_STRUCT_MESSAGE_DEFINE(USER_SESSION_KEY, USER_SESSION_KEY); |
841 | | |
842 | | /* ========================== NTLM calls ======================== */ |
843 | | |
844 | | static const WinPrNdrFieldStruct Lm20GetNtlm3ChallengeResponseReq_fields[] = { |
845 | | { "Credential", offsetof(Lm20GetNtlm3ChallengeResponseReq, Credential), WINPR_NDR_POINTER, -1, |
846 | | &MSV1_0_REMOTE_ENCRYPTED_SECRETS_descr_s, 0, 0 }, |
847 | | { "UserName", offsetof(Lm20GetNtlm3ChallengeResponseReq, UserName), WINPR_NDR_POINTER, -1, |
848 | | &RPC_UNICODE_STRING_descr_s, 0, 0 }, |
849 | | { "LogonDomainName", offsetof(Lm20GetNtlm3ChallengeResponseReq, LogonDomainName), |
850 | | WINPR_NDR_POINTER, -1, &RPC_UNICODE_STRING_descr_s, 0, 0 }, |
851 | | { "ServerName", offsetof(Lm20GetNtlm3ChallengeResponseReq, ServerName), WINPR_NDR_POINTER, -1, |
852 | | &RPC_UNICODE_STRING_descr_s, 0, 0 }, |
853 | | RDPEAR_BYTES_FIELD(Lm20GetNtlm3ChallengeResponseReq, ChallengeToClient, |
854 | | RDPEAR_MSV1_0_CHALLENGE_LENGTH), |
855 | | }; |
856 | | |
857 | | static const WinPrNdrStructDescr Lm20GetNtlm3ChallengeResponseReq_struct = { |
858 | | "Lm20GetNtlm3ChallengeResponseReq", ARRAYSIZE(Lm20GetNtlm3ChallengeResponseReq_fields), |
859 | | Lm20GetNtlm3ChallengeResponseReq_fields, 4 |
860 | | }; |
861 | | |
862 | | WINPR_NDR_STRUCT_MESSAGE_DEFINE(Lm20GetNtlm3ChallengeResponseReq, Lm20GetNtlm3ChallengeResponseReq); |
863 | | |
864 | | static const WinPrNdrFieldStruct Lm20GetNtlm3ChallengeResponseResp_fields[] = { |
865 | | { "Ntlm3ResponseLength", offsetof(Lm20GetNtlm3ChallengeResponseResp, Ntlm3ResponseLength), |
866 | | WINPR_NDR_NOT_POINTER, -1, &ndr_uint16_count_descr_s, 0, 0 }, |
867 | | { "Ntlm3Response", offsetof(Lm20GetNtlm3ChallengeResponseResp, Ntlm3Response), |
868 | | WINPR_NDR_POINTER, 0, &winpr_ndr_uint8Array_descr_s, 0, 0 }, |
869 | | RDPEAR_BYTES_FIELD(Lm20GetNtlm3ChallengeResponseResp, Lm3Response.Response, |
870 | | RDPEAR_MSV1_0_NTLM3_RESPONSE_LENGTH), |
871 | | RDPEAR_BYTES_FIELD(Lm20GetNtlm3ChallengeResponseResp, Lm3Response.ChallengeFromClient, |
872 | | RDPEAR_MSV1_0_CHALLENGE_LENGTH), |
873 | | RDPEAR_BYTES_FIELD(Lm20GetNtlm3ChallengeResponseResp, UserSessionKey.Data, |
874 | | RDPEAR_MSV1_0_USER_SESSION_KEY_LENGTH), |
875 | | RDPEAR_BYTES_FIELD(Lm20GetNtlm3ChallengeResponseResp, LmSessionKey.Data, |
876 | | RDPEAR_MSV1_0_CHALLENGE_LENGTH), |
877 | | }; |
878 | | |
879 | | static const WinPrNdrStructDescr Lm20GetNtlm3ChallengeResponseResp_struct = { |
880 | | "Lm20GetNtlm3ChallengeResponseResp", ARRAYSIZE(Lm20GetNtlm3ChallengeResponseResp_fields), |
881 | | Lm20GetNtlm3ChallengeResponseResp_fields, 4 |
882 | | }; |
883 | | |
884 | | WINPR_NDR_STRUCT_MESSAGE_DEFINE(Lm20GetNtlm3ChallengeResponseResp, |
885 | | Lm20GetNtlm3ChallengeResponseResp); |
886 | | |
887 | | static const WinPrNdrFieldStruct CalculateNtResponseReq_fields[] = { |
888 | | { "NtChallenge", offsetof(CalculateNtResponseReq, NtChallenge), WINPR_NDR_POINTER, -1, |
889 | | &NT_CHALLENGE_descr_s, 0, 0 }, |
890 | | { "Credential", offsetof(CalculateNtResponseReq, Credential), WINPR_NDR_POINTER, -1, |
891 | | &MSV1_0_REMOTE_ENCRYPTED_SECRETS_descr_s, 0, 0 }, |
892 | | }; |
893 | | |
894 | | static const WinPrNdrStructDescr CalculateNtResponseReq_struct = { |
895 | | "CalculateNtResponseReq", ARRAYSIZE(CalculateNtResponseReq_fields), |
896 | | CalculateNtResponseReq_fields, 4 |
897 | | }; |
898 | | |
899 | | WINPR_NDR_STRUCT_MESSAGE_DEFINE(CalculateNtResponseReq, CalculateNtResponseReq); |
900 | | |
901 | | static const WinPrNdrFieldStruct CalculateUserSessionKeyNtReq_fields[] = { |
902 | | { "NtResponse", offsetof(CalculateUserSessionKeyNtReq, NtResponse), WINPR_NDR_POINTER, -1, |
903 | | &NT_RESPONSE_descr_s, 0, 0 }, |
904 | | { "Credential", offsetof(CalculateUserSessionKeyNtReq, Credential), WINPR_NDR_POINTER, -1, |
905 | | &MSV1_0_REMOTE_ENCRYPTED_SECRETS_descr_s, 0, 0 }, |
906 | | }; |
907 | | |
908 | | static const WinPrNdrStructDescr CalculateUserSessionKeyNtReq_struct = { |
909 | | "CalculateUserSessionKeyNtReq", ARRAYSIZE(CalculateUserSessionKeyNtReq_fields), |
910 | | CalculateUserSessionKeyNtReq_fields, 4 |
911 | | }; |
912 | | |
913 | | WINPR_NDR_STRUCT_MESSAGE_DEFINE(CalculateUserSessionKeyNtReq, CalculateUserSessionKeyNtReq); |
914 | | |
915 | | static const WinPrNdrFieldStruct CompareCredentialsReq_fields[] = { |
916 | | { "LhsCredential", offsetof(CompareCredentialsReq, LhsCredential), WINPR_NDR_POINTER, -1, |
917 | | &MSV1_0_REMOTE_ENCRYPTED_SECRETS_descr_s, 0, 0 }, |
918 | | { "RhsCredential", offsetof(CompareCredentialsReq, RhsCredential), WINPR_NDR_POINTER, -1, |
919 | | &MSV1_0_REMOTE_ENCRYPTED_SECRETS_descr_s, 0, 0 }, |
920 | | }; |
921 | | |
922 | | static const WinPrNdrStructDescr CompareCredentialsReq_struct = { |
923 | | "CompareCredentialsReq", ARRAYSIZE(CompareCredentialsReq_fields), CompareCredentialsReq_fields, |
924 | | 4 |
925 | | }; |
926 | | |
927 | | WINPR_NDR_STRUCT_MESSAGE_DEFINE(CompareCredentialsReq, CompareCredentialsReq); |
928 | | |
929 | | static const WinPrNdrFieldStruct CompareCredentialsResp_fields[] = { |
930 | | { "AreNtOwfsEqual", offsetof(CompareCredentialsResp, AreNtOwfsEqual), WINPR_NDR_NOT_POINTER, -1, |
931 | | &winpr_ndr_uint32_descr_s, 0, 0 }, |
932 | | { "AreLmOwfsEqual", offsetof(CompareCredentialsResp, AreLmOwfsEqual), WINPR_NDR_NOT_POINTER, -1, |
933 | | &winpr_ndr_uint32_descr_s, 0, 0 }, |
934 | | { "AreShaOwfsEqual", offsetof(CompareCredentialsResp, AreShaOwfsEqual), WINPR_NDR_NOT_POINTER, |
935 | | -1, &winpr_ndr_uint32_descr_s, 0, 0 }, |
936 | | }; |
937 | | |
938 | | static const WinPrNdrStructDescr CompareCredentialsResp_struct = { |
939 | | "CompareCredentialsResp", ARRAYSIZE(CompareCredentialsResp_fields), |
940 | | CompareCredentialsResp_fields, 4 |
941 | | }; |
942 | | |
943 | | WINPR_NDR_STRUCT_MESSAGE_DEFINE(CompareCredentialsResp, CompareCredentialsResp); |
944 | | |
945 | | /* ========================== NtlmCredIsoRemoteInput ======================== */ |
946 | | |
947 | | static const WinPrNdrUnionArm NtlmCredIsoRemoteInputUnion_arms[] = { |
948 | | RDPEAR_ARM(RemoteCallNtlmNegotiateVersion, NegotiateVersion, &winpr_ndr_uint32_descr_s), |
949 | | RDPEAR_ARM(RemoteCallNtlmLm20GetNtlm3ChallengeResponse, Lm20GetNtlm3ChallengeResponse, |
950 | | &Lm20GetNtlm3ChallengeResponseReq_descr_s), |
951 | | RDPEAR_ARM(RemoteCallNtlmCalculateNtResponse, CalculateNtResponse, |
952 | | &CalculateNtResponseReq_descr_s), |
953 | | RDPEAR_ARM(RemoteCallNtlmCalculateUserSessionKeyNt, CalculateUserSessionKeyNt, |
954 | | &CalculateUserSessionKeyNtReq_descr_s), |
955 | | RDPEAR_ARM(RemoteCallNtlmCompareCredentials, CompareCredentials, |
956 | | &CompareCredentialsReq_descr_s), |
957 | | }; |
958 | | |
959 | | static const WinPrNdrUnionDescr NtlmCredIsoRemoteInputUnion_union = { |
960 | | "NtlmCredIsoRemoteInputUnion", ARRAYSIZE(NtlmCredIsoRemoteInputUnion_arms), |
961 | | NtlmCredIsoRemoteInputUnion_arms, sizeof(UINT16), &rdpear_default_arm |
962 | | }; |
963 | | |
964 | | WINPR_NDR_UNION_MESSAGE_DEFINE(NtlmCredIsoRemoteInputUnion, NtlmCredIsoRemoteInputUnion); |
965 | | |
966 | | static const WinPrNdrFieldStruct NtlmCredIsoRemoteInput_fields[] = { |
967 | | { "CallId", offsetof(NtlmCredIsoRemoteInput, CallId), WINPR_NDR_NOT_POINTER, -1, |
968 | | &winpr_ndr_uint16_descr_s, 0, 0 }, |
969 | | { "Input", offsetof(NtlmCredIsoRemoteInput, Input), WINPR_NDR_NOT_POINTER, 0, |
970 | | &NtlmCredIsoRemoteInputUnion_descr_s, 0, 0 }, |
971 | | }; |
972 | | |
973 | | static const WinPrNdrStructDescr NtlmCredIsoRemoteInput_struct = { |
974 | | "NtlmCredIsoRemoteInput", ARRAYSIZE(NtlmCredIsoRemoteInput_fields), |
975 | | NtlmCredIsoRemoteInput_fields, 4 |
976 | | }; |
977 | | |
978 | | BOOL rdpear_ntlm_input_read(WinPrNdrDecoder* decoder, wStream* s, NtlmCredIsoRemoteInput* input) |
979 | 0 | { |
980 | 0 | WINPR_ASSERT(input); |
981 | 0 | return rdpear_read_message(decoder, s, &NtlmCredIsoRemoteInput_struct, input); |
982 | 0 | } |
983 | | |
984 | | void rdpear_ntlm_input_free(NtlmCredIsoRemoteInput* input) |
985 | 0 | { |
986 | 0 | if (input) |
987 | 0 | winpr_ndr_struct_destroy(&NtlmCredIsoRemoteInput_struct, input); |
988 | 0 | } |
989 | | |
990 | | /* ========================== NtlmCredIsoRemoteOutput ======================== */ |
991 | | |
992 | | static const WinPrNdrUnionArm NtlmCredIsoRemoteOutputUnion_arms[] = { |
993 | | RDPEAR_ARM(RemoteCallNtlmNegotiateVersion, NegotiateVersion, &winpr_ndr_uint32_descr_s), |
994 | | RDPEAR_ARM(RemoteCallNtlmLm20GetNtlm3ChallengeResponse, Lm20GetNtlm3ChallengeResponse, |
995 | | &Lm20GetNtlm3ChallengeResponseResp_descr_s), |
996 | | RDPEAR_ARM(RemoteCallNtlmCalculateNtResponse, CalculateNtResponse, &NT_RESPONSE_descr_s), |
997 | | RDPEAR_ARM(RemoteCallNtlmCalculateUserSessionKeyNt, CalculateUserSessionKeyNt, |
998 | | &USER_SESSION_KEY_descr_s), |
999 | | RDPEAR_ARM(RemoteCallNtlmCompareCredentials, CompareCredentials, |
1000 | | &CompareCredentialsResp_descr_s), |
1001 | | }; |
1002 | | |
1003 | | static const WinPrNdrUnionDescr NtlmCredIsoRemoteOutputUnion_union = { |
1004 | | "NtlmCredIsoRemoteOutputUnion", ARRAYSIZE(NtlmCredIsoRemoteOutputUnion_arms), |
1005 | | NtlmCredIsoRemoteOutputUnion_arms, sizeof(UINT16), &rdpear_default_arm |
1006 | | }; |
1007 | | |
1008 | | WINPR_NDR_UNION_MESSAGE_DEFINE(NtlmCredIsoRemoteOutputUnion, NtlmCredIsoRemoteOutputUnion); |
1009 | | |
1010 | | static const WinPrNdrFieldStruct NtlmCredIsoRemoteOutput_fields[] = { |
1011 | | { "CallId", offsetof(NtlmCredIsoRemoteOutput, CallId), WINPR_NDR_NOT_POINTER, -1, |
1012 | | &winpr_ndr_uint16_descr_s, 0, 0 }, |
1013 | | { "Status", offsetof(NtlmCredIsoRemoteOutput, Status), WINPR_NDR_NOT_POINTER, -1, |
1014 | | &winpr_ndr_uint32_descr_s, 0, 0 }, |
1015 | | { "Output", offsetof(NtlmCredIsoRemoteOutput, Output), WINPR_NDR_NOT_POINTER, 0, |
1016 | | &NtlmCredIsoRemoteOutputUnion_descr_s, 0, 0 }, |
1017 | | }; |
1018 | | |
1019 | | static const WinPrNdrStructDescr NtlmCredIsoRemoteOutput_struct = { |
1020 | | "NtlmCredIsoRemoteOutput", ARRAYSIZE(NtlmCredIsoRemoteOutput_fields), |
1021 | | NtlmCredIsoRemoteOutput_fields, 4 |
1022 | | }; |
1023 | | |
1024 | | BOOL rdpear_ntlm_output_write(WinPrNdrEncoder* encoder, wStream* s, |
1025 | | const NtlmCredIsoRemoteOutput* output) |
1026 | 0 | { |
1027 | 0 | WINPR_ASSERT(output); |
1028 | 0 | return rdpear_write_message(encoder, s, &NtlmCredIsoRemoteOutput_struct, output); |
1029 | 0 | } |
1030 | | |
1031 | | void rdpear_ntlm_output_free(NtlmCredIsoRemoteOutput* output) |
1032 | 0 | { |
1033 | 0 | if (output) |
1034 | 0 | winpr_ndr_struct_destroy(&NtlmCredIsoRemoteOutput_struct, output); |
1035 | 0 | } |