1 | #include "idl_types.h"
|
---|
2 |
|
---|
3 | /*
|
---|
4 | the base dcerpc packet definitions - not traditionally coded as IDL,
|
---|
5 | but given that pidl can handle it nicely it simplifies things a lot
|
---|
6 | to do it this way
|
---|
7 |
|
---|
8 | see http://www.opengroup.org/onlinepubs/9629399/chap12.htm for packet
|
---|
9 | layouts
|
---|
10 | */
|
---|
11 | import "misc.idl";
|
---|
12 |
|
---|
13 | cpp_quote("extern const uint8_t DCERPC_SEC_VT_MAGIC[8];")
|
---|
14 |
|
---|
15 | interface dcerpc
|
---|
16 | {
|
---|
17 | typedef struct {
|
---|
18 | uint16 context_id;
|
---|
19 | uint8 num_transfer_syntaxes;
|
---|
20 | ndr_syntax_id abstract_syntax;
|
---|
21 | ndr_syntax_id transfer_syntaxes[num_transfer_syntaxes];
|
---|
22 | } dcerpc_ctx_list;
|
---|
23 |
|
---|
24 | typedef [public] struct {
|
---|
25 | uint16 max_xmit_frag;
|
---|
26 | uint16 max_recv_frag;
|
---|
27 | uint32 assoc_group_id;
|
---|
28 | uint8 num_contexts;
|
---|
29 | dcerpc_ctx_list ctx_list[num_contexts];
|
---|
30 | [flag(NDR_REMAINING)] DATA_BLOB auth_info;
|
---|
31 | } dcerpc_bind;
|
---|
32 |
|
---|
33 | const uint8 DCERPC_REQUEST_LENGTH = 24;
|
---|
34 |
|
---|
35 | typedef struct {
|
---|
36 | } dcerpc_empty;
|
---|
37 |
|
---|
38 | typedef [nodiscriminant] union {
|
---|
39 | [default] dcerpc_empty empty;
|
---|
40 | [case(LIBNDR_FLAG_OBJECT_PRESENT)] GUID object;
|
---|
41 | } dcerpc_object;
|
---|
42 |
|
---|
43 | typedef struct {
|
---|
44 | uint32 alloc_hint;
|
---|
45 | uint16 context_id;
|
---|
46 | uint16 opnum;
|
---|
47 | [switch_is(ndr->flags & LIBNDR_FLAG_OBJECT_PRESENT)] dcerpc_object object;
|
---|
48 | [flag(NDR_ALIGN8)] DATA_BLOB _pad;
|
---|
49 | [flag(NDR_REMAINING)] DATA_BLOB stub_and_verifier;
|
---|
50 | } dcerpc_request;
|
---|
51 |
|
---|
52 | const int DCERPC_BIND_REASON_ASYNTAX = 1;
|
---|
53 | const int DCERPC_BIND_PROVIDER_REJECT = 2;
|
---|
54 | const int DECRPC_BIND_PROTOCOL_VERSION_NOT_SUPPORTED = 4;
|
---|
55 | const int DCERPC_BIND_REASON_INVALID_AUTH_TYPE = 8;
|
---|
56 |
|
---|
57 | typedef struct {
|
---|
58 | uint16 result;
|
---|
59 | uint16 reason;
|
---|
60 | ndr_syntax_id syntax;
|
---|
61 | } dcerpc_ack_ctx;
|
---|
62 |
|
---|
63 | typedef struct {
|
---|
64 | uint16 max_xmit_frag;
|
---|
65 | uint16 max_recv_frag;
|
---|
66 | uint32 assoc_group_id;
|
---|
67 | [value(strlen(secondary_address)+1)] uint16 secondary_address_size;
|
---|
68 | [charset(DOS)] uint8 secondary_address[secondary_address_size];
|
---|
69 | [flag(NDR_ALIGN4)] DATA_BLOB _pad1;
|
---|
70 | uint8 num_results;
|
---|
71 | dcerpc_ack_ctx ctx_list[num_results];
|
---|
72 | [flag(NDR_REMAINING)] DATA_BLOB auth_info;
|
---|
73 | } dcerpc_bind_ack;
|
---|
74 |
|
---|
75 | typedef struct {
|
---|
76 | uint32 num_versions;
|
---|
77 | uint32 versions[num_versions];
|
---|
78 | } dcerpc_bind_nak_versions;
|
---|
79 |
|
---|
80 | typedef [nodiscriminant] union {
|
---|
81 | [case(DECRPC_BIND_PROTOCOL_VERSION_NOT_SUPPORTED)] dcerpc_bind_nak_versions v;
|
---|
82 | [default] ;
|
---|
83 | } dcerpc_bind_nak_versions_ctr;
|
---|
84 |
|
---|
85 | typedef struct {
|
---|
86 | uint16 reject_reason;
|
---|
87 | [switch_is(reject_reason)] dcerpc_bind_nak_versions_ctr versions;
|
---|
88 | } dcerpc_bind_nak;
|
---|
89 |
|
---|
90 | const uint8 DCERPC_RESPONSE_LENGTH = 24;
|
---|
91 |
|
---|
92 | typedef struct {
|
---|
93 | uint32 alloc_hint;
|
---|
94 | uint16 context_id;
|
---|
95 | uint8 cancel_count;
|
---|
96 | [flag(NDR_ALIGN8)] DATA_BLOB _pad;
|
---|
97 | [flag(NDR_REMAINING)] DATA_BLOB stub_and_verifier;
|
---|
98 | } dcerpc_response;
|
---|
99 |
|
---|
100 | typedef [v1_enum] enum {
|
---|
101 | DCERPC_NCA_S_COMM_FAILURE = 0x1C010001,
|
---|
102 | DCERPC_NCA_S_OP_RNG_ERROR = 0x1C010002,
|
---|
103 | DCERPC_NCA_S_UNKNOWN_IF = 0x1C010003,
|
---|
104 | DCERPC_NCA_S_WRONG_BOOT_TIME = 0x1C010006,
|
---|
105 | DCERPC_NCA_S_YOU_CRASHED = 0x1C010009,
|
---|
106 | DCERPC_NCA_S_PROTO_ERROR = 0x1C01000B,
|
---|
107 | DCERPC_NCA_S_OUT_ARGS_TOO_BIG = 0x1C010013,
|
---|
108 | DCERPC_NCA_S_SERVER_TOO_BUSY = 0x1C010014,
|
---|
109 | DCERPC_NCA_S_FAULT_STRING_TOO_LARGE = 0x1C010015,
|
---|
110 | DCERPC_NCA_S_UNSUPPORTED_TYPE = 0x1C010017,
|
---|
111 | DCERPC_NCA_S_FAULT_INT_DIV_BY_ZERO = 0x1C000001,
|
---|
112 | DCERPC_NCA_S_FAULT_ADDR_ERROR = 0x1C000002,
|
---|
113 | DCERPC_NCA_S_FAULT_FP_DIV_BY_ZERO = 0x1C000003,
|
---|
114 | DCERPC_NCA_S_FAULT_FP_UNDERFLOW = 0x1C000004,
|
---|
115 | DCERPC_NCA_S_FAULT_FP_OVERRFLOW = 0x1C000005,
|
---|
116 | DCERPC_NCA_S_FAULT_INVALID_TAG = 0x1C000006,
|
---|
117 | DCERPC_NCA_S_FAULT_INVALID_BOUND = 0x1C000007,
|
---|
118 | DCERPC_NCA_S_FAULT_RPC_VERSION_MISMATCH = 0x1C000008,
|
---|
119 | DCERPC_NCA_S_FAULT_UNSPEC_REJECT = 0x1C000009,
|
---|
120 | DCERPC_NCA_S_FAULT_BAD_ACTID = 0x1C00000A,
|
---|
121 | DCERPC_NCA_S_FAULT_WHO_ARE_YOU_FAILED = 0x1C00000B,
|
---|
122 | DCERPC_NCA_S_FAULT_MANAGER_NOT_ENTERED = 0x1C00000C,
|
---|
123 | DCERPC_NCA_S_FAULT_CANCEL = 0x1C00000D,
|
---|
124 | DCERPC_NCA_S_FAULT_ILL_INST = 0x1C00000E,
|
---|
125 | DCERPC_NCA_S_FAULT_FP_ERROR = 0x1C00000F,
|
---|
126 | DCERPC_NCA_S_FAULT_INT_OVERFLOW = 0x1C000010,
|
---|
127 | DCERPC_NCA_S_UNUSED_1C000011 = 0x1C000011,
|
---|
128 | DCERPC_NCA_S_FAULT_UNSPEC = 0x1C000012,
|
---|
129 | DCERPC_NCA_S_FAULT_REMOTE_COMM_FAILURE = 0x1C000013,
|
---|
130 | DCERPC_NCA_S_FAULT_PIPE_EMPTY = 0x1C000014,
|
---|
131 | DCERPC_NCA_S_FAULT_PIPE_CLOSED = 0x1C000015,
|
---|
132 | DCERPC_NCA_S_FAULT_PIPE_ORDER = 0x1C000016,
|
---|
133 | DCERPC_NCA_S_FAULT_PIPE_DISCIPLINE = 0x1C000017,
|
---|
134 | DCERPC_NCA_S_FAULT_PIPE_COMM_ERROR = 0x1C000018,
|
---|
135 | DCERPC_NCA_S_FAULT_PIPE_MEMORY = 0x1C000019,
|
---|
136 | DCERPC_NCA_S_FAULT_CONTEXT_MISMATCH = 0x1C00001A,
|
---|
137 | DCERPC_NCA_S_FAULT_REMOTE_NO_MEMORY = 0x1C00001B,
|
---|
138 | DCERPC_NCA_S_INVALID_PRES_CONTEXT_ID = 0x1C00001C,
|
---|
139 | DCERPC_NCA_S_UNSUPPORTED_AUTHN_LEVEL = 0x1C00001D,
|
---|
140 | DCERPC_NCA_S_UNUSED_1C00001E = 0x1C00001E,
|
---|
141 | DCERPC_NCA_S_INVALID_CHECKSUM = 0x1C00001F,
|
---|
142 | DCERPC_NCA_S_INVALID_CRC = 0x1C000020,
|
---|
143 | DCERPC_NCA_S_FAULT_USER_DEFINED = 0x1C000021,
|
---|
144 | DCERPC_NCA_S_FAULT_TX_OPEN_FAILED = 0x1C000022,
|
---|
145 | DCERPC_NCA_S_FAULT_CODESET_CONV_ERROR = 0x1C000023,
|
---|
146 | DCERPC_NCA_S_FAULT_OBJECT_NOT_FOUND = 0x1C000024,
|
---|
147 | DCERPC_NCA_S_FAULT_NO_CLIENT_STUB = 0x1C000025
|
---|
148 | } dcerpc_nca_status;
|
---|
149 |
|
---|
150 | const int DCERPC_FAULT_OP_RNG_ERROR = 0x1c010002;
|
---|
151 | const int DCERPC_FAULT_UNK_IF = 0x1c010003;
|
---|
152 | const int DCERPC_FAULT_NDR = 0x000006f7;
|
---|
153 | const int DCERPC_FAULT_INVALID_TAG = 0x1c000006;
|
---|
154 | const int DCERPC_FAULT_CONTEXT_MISMATCH = 0x1c00001a;
|
---|
155 | const int DCERPC_FAULT_OTHER = 0x00000001;
|
---|
156 | const int DCERPC_FAULT_ACCESS_DENIED = 0x00000005;
|
---|
157 | const int DCERPC_FAULT_CANT_PERFORM = 0x000006d8;
|
---|
158 | const int DCERPC_FAULT_SEC_PKG_ERROR = 0x00000721;
|
---|
159 |
|
---|
160 | /* we return this fault when we haven't yet run the test
|
---|
161 | to see what fault w2k3 returns in this case */
|
---|
162 | const int DCERPC_FAULT_TODO = 0x00000042;
|
---|
163 |
|
---|
164 | typedef struct {
|
---|
165 | uint32 alloc_hint;
|
---|
166 | uint16 context_id;
|
---|
167 | uint8 cancel_count;
|
---|
168 | dcerpc_nca_status status;
|
---|
169 | [flag(NDR_REMAINING)] DATA_BLOB _pad;
|
---|
170 | } dcerpc_fault;
|
---|
171 |
|
---|
172 | /* the auth types we know about */
|
---|
173 | typedef [enum8bit] enum {
|
---|
174 | DCERPC_AUTH_TYPE_NONE = 0,
|
---|
175 | /* this seems to be not krb5! */
|
---|
176 | DCERPC_AUTH_TYPE_KRB5_1 = 1,
|
---|
177 | DCERPC_AUTH_TYPE_SPNEGO = 9,
|
---|
178 | DCERPC_AUTH_TYPE_NTLMSSP = 10,
|
---|
179 | DCERPC_AUTH_TYPE_KRB5 = 16,
|
---|
180 | DCERPC_AUTH_TYPE_DPA = 17,
|
---|
181 | DCERPC_AUTH_TYPE_MSN = 18,
|
---|
182 | DCERPC_AUTH_TYPE_DIGEST = 21,
|
---|
183 | DCERPC_AUTH_TYPE_SCHANNEL = 68,
|
---|
184 | DCERPC_AUTH_TYPE_MSMQ = 100,
|
---|
185 | DCERPC_AUTH_TYPE_NCALRPC_AS_SYSTEM = 200
|
---|
186 | } dcerpc_AuthType;
|
---|
187 |
|
---|
188 | typedef [enum8bit] enum {
|
---|
189 | DCERPC_AUTH_LEVEL_NONE = 1,
|
---|
190 | DCERPC_AUTH_LEVEL_CONNECT = 2,
|
---|
191 | DCERPC_AUTH_LEVEL_CALL = 3,
|
---|
192 | DCERPC_AUTH_LEVEL_PACKET = 4,
|
---|
193 | DCERPC_AUTH_LEVEL_INTEGRITY = 5,
|
---|
194 | DCERPC_AUTH_LEVEL_PRIVACY = 6
|
---|
195 | } dcerpc_AuthLevel;
|
---|
196 |
|
---|
197 | const uint8 DCERPC_AUTH_LEVEL_DEFAULT = DCERPC_AUTH_LEVEL_CONNECT;
|
---|
198 |
|
---|
199 | typedef [public] struct {
|
---|
200 | dcerpc_AuthType auth_type;
|
---|
201 | dcerpc_AuthLevel auth_level;
|
---|
202 | uint8 auth_pad_length;
|
---|
203 | uint8 auth_reserved;
|
---|
204 | uint32 auth_context_id;
|
---|
205 | [flag(NDR_REMAINING)] DATA_BLOB credentials;
|
---|
206 | } dcerpc_auth;
|
---|
207 |
|
---|
208 | const uint8 DCERPC_AUTH_TRAILER_LENGTH = 8;
|
---|
209 |
|
---|
210 | typedef [public] struct {
|
---|
211 | [value(0)] uint32 _pad;
|
---|
212 | [flag(NDR_REMAINING)] DATA_BLOB auth_info;
|
---|
213 | } dcerpc_auth3;
|
---|
214 |
|
---|
215 | typedef [public] struct {
|
---|
216 | [value(0)] uint32 _pad;
|
---|
217 | [flag(NDR_REMAINING)] DATA_BLOB auth_info;
|
---|
218 | } dcerpc_orphaned;
|
---|
219 |
|
---|
220 | typedef [public] struct {
|
---|
221 | [value(0)] uint32 _pad;
|
---|
222 | [flag(NDR_REMAINING)] DATA_BLOB auth_info;
|
---|
223 | } dcerpc_co_cancel;
|
---|
224 |
|
---|
225 | typedef [public] struct {
|
---|
226 | uint32 version;
|
---|
227 | uint32 id;
|
---|
228 | } dcerpc_cl_cancel;
|
---|
229 |
|
---|
230 | typedef [public] struct {
|
---|
231 | uint32 version;
|
---|
232 | uint32 id;
|
---|
233 | boolean32 server_is_accepting;
|
---|
234 | } dcerpc_cancel_ack;
|
---|
235 |
|
---|
236 | typedef [public] struct {
|
---|
237 | uint32 version;
|
---|
238 | uint8 _pad1;
|
---|
239 | uint16 window_size;
|
---|
240 | uint32 max_tdsu;
|
---|
241 | uint32 max_frag_size;
|
---|
242 | uint16 serial_no;
|
---|
243 | uint16 selack_size;
|
---|
244 | uint32 selack[selack_size];
|
---|
245 | } dcerpc_fack;
|
---|
246 |
|
---|
247 | typedef [public] struct {
|
---|
248 | } dcerpc_ack;
|
---|
249 |
|
---|
250 | typedef [public] struct {
|
---|
251 | } dcerpc_ping;
|
---|
252 |
|
---|
253 | typedef [public] struct {
|
---|
254 | } dcerpc_shutdown;
|
---|
255 |
|
---|
256 | typedef [public] struct {
|
---|
257 | } dcerpc_working;
|
---|
258 |
|
---|
259 | /* RTS data structures */
|
---|
260 | typedef [public] struct {
|
---|
261 | GUID Cookie;
|
---|
262 | } RTSCookie;
|
---|
263 |
|
---|
264 | typedef [v1_enum,public] enum {
|
---|
265 | RTS_IPV4 = 0,
|
---|
266 | RTS_IPV6 = 1
|
---|
267 | } AddressType;
|
---|
268 |
|
---|
269 | typedef [nodiscriminant] union {
|
---|
270 | [case(RTS_IPV4)] ipv4address ClientAddressIPV4;
|
---|
271 | [case(RTS_IPV6)] ipv6address ClientAddressIPV6;
|
---|
272 | } ClientAddressType;
|
---|
273 |
|
---|
274 | typedef [public] struct {
|
---|
275 | AddressType AddressType;
|
---|
276 | [switch_is(AddressType)] ClientAddressType ClientAddress;
|
---|
277 | uint8 Padding[12];
|
---|
278 | } ClientAddress;
|
---|
279 |
|
---|
280 | typedef [v1_enum, public] enum {
|
---|
281 | FDClient = 0,
|
---|
282 | FDInProxy = 1,
|
---|
283 | FDServer = 2,
|
---|
284 | FDOutProxy = 3
|
---|
285 | } ForwardDestination;
|
---|
286 |
|
---|
287 | typedef [public] struct {
|
---|
288 | uint32 BytesReceived;
|
---|
289 | uint32 AvailableWindow;
|
---|
290 | RTSCookie ChannelCookie;
|
---|
291 | } FlowControlAcknowledgment;
|
---|
292 |
|
---|
293 | /* RTS commands */
|
---|
294 |
|
---|
295 | /* RTS command: 0x0 */
|
---|
296 | typedef [public] struct {
|
---|
297 | [range(0x2000,0x40000)] uint32 ReceiveWindowSize;
|
---|
298 | } dcerpc_rts_cmd_ReceiveWindowSize;
|
---|
299 |
|
---|
300 | /* RTS command: 0x1 */
|
---|
301 | typedef [public] struct {
|
---|
302 | FlowControlAcknowledgment Ack;
|
---|
303 | } dcerpc_rts_cmd_FlowControlAck;
|
---|
304 |
|
---|
305 | /* RTS command: 0x2 */
|
---|
306 | typedef [public] struct {
|
---|
307 | [range(0x1D4C0,0xDBBA00)] uint32 ConnectionTimeout;
|
---|
308 | } dcerpc_rts_cmd_ConnectionTimeout;
|
---|
309 |
|
---|
310 | /* RTS command: 0x3 */
|
---|
311 | typedef [public] struct {
|
---|
312 | RTSCookie Cookie;
|
---|
313 | } dcerpc_rts_cmd_Cookie;
|
---|
314 |
|
---|
315 | /* RTS command: 0x4 */
|
---|
316 | typedef [public] struct {
|
---|
317 | [range(0x20000,0x80000000)] uint32 ChannelLifetime;
|
---|
318 | } dcerpc_rts_cmd_ChannelLifetime;
|
---|
319 |
|
---|
320 | /* RTS command: 0x5 */
|
---|
321 | typedef [public] struct {
|
---|
322 | uint32 ClientKeepalive;
|
---|
323 | } dcerpc_rts_cmd_ClientKeepalive;
|
---|
324 |
|
---|
325 | /* RTS command: 0x6 */
|
---|
326 | typedef [public] struct {
|
---|
327 | uint32 Version;
|
---|
328 | } dcerpc_rts_cmd_Version;
|
---|
329 |
|
---|
330 | /* RTS command: 0x7 */
|
---|
331 | typedef [public] struct {
|
---|
332 | } dcerpc_rts_cmd_Empty;
|
---|
333 |
|
---|
334 | /* RTS command: 0x8 */
|
---|
335 | typedef [public] struct {
|
---|
336 | [range(0x0,0xFFFF)] uint32 ConformanceCount;
|
---|
337 | uint8 Padding[ConformanceCount];
|
---|
338 | } dcerpc_rts_cmd_Padding;
|
---|
339 |
|
---|
340 | /* RTS command: 0x9 */
|
---|
341 | typedef [public] struct {
|
---|
342 | } dcerpc_rts_cmd_NegativeANCE;
|
---|
343 |
|
---|
344 | /* RTS Command: 0xA */
|
---|
345 | typedef [public] struct {
|
---|
346 | } dcerpc_rts_cmd_ANCE;
|
---|
347 |
|
---|
348 | /* RTS command: 0xB */
|
---|
349 | typedef [public] struct {
|
---|
350 | ClientAddress ClientAddress;
|
---|
351 | } dcerpc_rts_cmd_ClientAddress;
|
---|
352 |
|
---|
353 | /* RTS command: 0xC */
|
---|
354 | typedef [public] struct {
|
---|
355 | RTSCookie AssociationGroupId;
|
---|
356 | } dcerpc_rts_cmd_AssociationGroupId;
|
---|
357 |
|
---|
358 | /* RTS command: 0xD */
|
---|
359 | typedef [public] struct {
|
---|
360 | ForwardDestination ForwardDestination;
|
---|
361 | } dcerpc_rts_cmd_Destination;
|
---|
362 |
|
---|
363 | /* RTS command: 0xE */
|
---|
364 | typedef [public] struct {
|
---|
365 | uint32 PingTrafficSent;
|
---|
366 | } dcerpc_rts_cmd_PingTrafficSentNotify;
|
---|
367 |
|
---|
368 | typedef [nodiscriminant] union {
|
---|
369 | [case(0x0)] dcerpc_rts_cmd_ReceiveWindowSize ReceiveWindowSize;
|
---|
370 | [case(0x1)] dcerpc_rts_cmd_FlowControlAck FlowControlAck;
|
---|
371 | [case(0x2)] dcerpc_rts_cmd_ConnectionTimeout ConnectionTimeout;
|
---|
372 | [case(0x3)] dcerpc_rts_cmd_Cookie Cookie;
|
---|
373 | [case(0x4)] dcerpc_rts_cmd_ChannelLifetime ChannelLifetime;
|
---|
374 | [case(0x5)] dcerpc_rts_cmd_ClientKeepalive ClientKeepalive;
|
---|
375 | [case(0x6)] dcerpc_rts_cmd_Version Version;
|
---|
376 | [case(0x7)] dcerpc_rts_cmd_Empty Empty;
|
---|
377 | [case(0x8)] dcerpc_rts_cmd_Padding Padding;
|
---|
378 | [case(0x9)] dcerpc_rts_cmd_NegativeANCE NegativeANCE;
|
---|
379 | [case(0xA)] dcerpc_rts_cmd_ANCE ANCE;
|
---|
380 | [case(0xB)] dcerpc_rts_cmd_ClientAddress ClientAddress;
|
---|
381 | [case(0xC)] dcerpc_rts_cmd_AssociationGroupId AssociationGroupId;
|
---|
382 | [case(0xD)] dcerpc_rts_cmd_Destination Destination;
|
---|
383 | [case(0xE)] dcerpc_rts_cmd_PingTrafficSentNotify PingTrafficSentNotify;
|
---|
384 | } dcerpc_rts_cmds;
|
---|
385 |
|
---|
386 | typedef [public] struct {
|
---|
387 | uint32 CommandType;
|
---|
388 | [switch_is(CommandType)] dcerpc_rts_cmds Command;
|
---|
389 | } dcerpc_rts_cmd;
|
---|
390 |
|
---|
391 | /* The RTS flags */
|
---|
392 | typedef [public, bitmap16bit] bitmap {
|
---|
393 | RTS_FLAG_NONE = 0x0000,
|
---|
394 | RTS_FLAG_PING = 0x0001,
|
---|
395 | RTS_FLAG_OTHER_CMD = 0x0002,
|
---|
396 | RTS_FLAG_RECYCLE_CHANNEL = 0x0004,
|
---|
397 | RTS_FLAG_IN_CHANNEL = 0x0008,
|
---|
398 | RTS_FLAG_OUT_CHANNEL = 0x0010,
|
---|
399 | RTS_FLAG_EOF = 0x0020,
|
---|
400 | RTS_FLAG_ECHO = 0x0040
|
---|
401 | } dcerpc_rts_flags;
|
---|
402 |
|
---|
403 | typedef [public] struct {
|
---|
404 | dcerpc_rts_flags Flags;
|
---|
405 | uint16 NumberOfCommands;
|
---|
406 | dcerpc_rts_cmd Commands[NumberOfCommands];
|
---|
407 | } dcerpc_rts;
|
---|
408 |
|
---|
409 | typedef [enum8bit] enum {
|
---|
410 | DCERPC_PKT_REQUEST = 0, /* Ordinary request. */
|
---|
411 | DCERPC_PKT_PING = 1, /* Connectionless is server alive ? */
|
---|
412 | DCERPC_PKT_RESPONSE = 2, /* Ordinary reply. */
|
---|
413 | DCERPC_PKT_FAULT = 3, /* Fault in processing of call. */
|
---|
414 | DCERPC_PKT_WORKING = 4, /* Connectionless reply to a ping when server busy. */
|
---|
415 | DCERPC_PKT_NOCALL = 5, /* Connectionless reply to a ping when server has lost part of clients call. */
|
---|
416 | DCERPC_PKT_REJECT = 6, /* Refuse a request with a code. */
|
---|
417 | DCERPC_PKT_ACK = 7, /* Connectionless client to server code. */
|
---|
418 | DCERPC_PKT_CL_CANCEL = 8, /* Connectionless cancel. */
|
---|
419 | DCERPC_PKT_FACK = 9, /* Connectionless fragment ack. Both client and server send. */
|
---|
420 | DCERPC_PKT_CANCEL_ACK = 10, /* Server ACK to client cancel request. */
|
---|
421 | DCERPC_PKT_BIND = 11, /* Bind to interface. */
|
---|
422 | DCERPC_PKT_BIND_ACK = 12, /* Server ack of bind. */
|
---|
423 | DCERPC_PKT_BIND_NAK = 13, /* Server nack of bind. */
|
---|
424 | DCERPC_PKT_ALTER = 14, /* Alter auth. */
|
---|
425 | DCERPC_PKT_ALTER_RESP = 15, /* Reply to alter auth. */
|
---|
426 | DCERPC_PKT_AUTH3 = 16, /* not the real name! this is undocumented! */
|
---|
427 | DCERPC_PKT_SHUTDOWN = 17, /* Server to client request to shutdown. */
|
---|
428 | DCERPC_PKT_CO_CANCEL = 18, /* Connection-oriented cancel request. */
|
---|
429 | DCERPC_PKT_ORPHANED = 19, /* Client telling server it's aborting a partially sent request or telling server to stop sending replies. */
|
---|
430 | DCERPC_PKT_RTS = 20 /* RTS packets used in ncacn_http */
|
---|
431 | } dcerpc_pkt_type;
|
---|
432 |
|
---|
433 | typedef [nodiscriminant] union {
|
---|
434 | [case(DCERPC_PKT_REQUEST)] dcerpc_request request;
|
---|
435 | [case(DCERPC_PKT_PING)] dcerpc_ping ping;
|
---|
436 | [case(DCERPC_PKT_RESPONSE)] dcerpc_response response;
|
---|
437 | [case(DCERPC_PKT_FAULT)] dcerpc_fault fault;
|
---|
438 | [case(DCERPC_PKT_WORKING)] dcerpc_working working;
|
---|
439 | [case(DCERPC_PKT_NOCALL)] dcerpc_fack nocall;
|
---|
440 | [case(DCERPC_PKT_REJECT)] dcerpc_fault reject;
|
---|
441 | [case(DCERPC_PKT_ACK)] dcerpc_ack ack;
|
---|
442 | [case(DCERPC_PKT_CL_CANCEL)] dcerpc_cl_cancel cl_cancel;
|
---|
443 | [case(DCERPC_PKT_FACK)] dcerpc_fack fack;
|
---|
444 | [case(DCERPC_PKT_CANCEL_ACK)] dcerpc_cancel_ack cancel_ack;
|
---|
445 | [case(DCERPC_PKT_BIND)] dcerpc_bind bind;
|
---|
446 | [case(DCERPC_PKT_BIND_ACK)] dcerpc_bind_ack bind_ack;
|
---|
447 | [case(DCERPC_PKT_BIND_NAK)] dcerpc_bind_nak bind_nak;
|
---|
448 | [case(DCERPC_PKT_ALTER)] dcerpc_bind alter;
|
---|
449 | [case(DCERPC_PKT_ALTER_RESP)] dcerpc_bind_ack alter_resp;
|
---|
450 | [case(DCERPC_PKT_SHUTDOWN)] dcerpc_shutdown shutdown;
|
---|
451 | [case(DCERPC_PKT_CO_CANCEL)] dcerpc_co_cancel co_cancel;
|
---|
452 | [case(DCERPC_PKT_ORPHANED)] dcerpc_orphaned orphaned;
|
---|
453 | [case(DCERPC_PKT_AUTH3)] dcerpc_auth3 auth3;
|
---|
454 | [case(DCERPC_PKT_RTS)] dcerpc_rts rts;
|
---|
455 | } dcerpc_payload;
|
---|
456 |
|
---|
457 | /* pfc_flags values */
|
---|
458 | typedef [bitmap8bit] bitmap {
|
---|
459 | DCERPC_PFC_FLAG_FIRST = 0x01, /* First fragment */
|
---|
460 | DCERPC_PFC_FLAG_LAST = 0x02, /* Last fragment */
|
---|
461 | DCERPC_PFC_FLAG_PENDING_CANCEL_OR_HDR_SIGNING = 0x04, /* depends on the pdu type */
|
---|
462 | DCERPC_PFC_FLAG_CONC_MPX = 0x10, /* supports concurrent multiplexing of a single connection. */
|
---|
463 | DCERPC_PFC_FLAG_DID_NOT_EXECUTE = 0x20, /* on a fault it means the server hasn't done anything */
|
---|
464 | DCERPC_PFC_FLAG_MAYBE = 0x40, /* `maybe' call semantics requested */
|
---|
465 | DCERPC_PFC_FLAG_OBJECT_UUID = 0x80 /* on valid guid is in the optional object field */
|
---|
466 | } dcerpc_pfc_flags;
|
---|
467 |
|
---|
468 | /* Cancel was pending at sender */
|
---|
469 | const int DCERPC_PFC_FLAG_PENDING_CANCEL =
|
---|
470 | DCERPC_PFC_FLAG_PENDING_CANCEL_OR_HDR_SIGNING;
|
---|
471 | const ist DCERPC_PFC_FLAG_SUPPORT_HEADER_SIGN =
|
---|
472 | DCERPC_PFC_FLAG_PENDING_CANCEL_OR_HDR_SIGNING;
|
---|
473 |
|
---|
474 | /* these offsets are needed by the signing code */
|
---|
475 | const uint8 DCERPC_PFC_OFFSET = 3;
|
---|
476 | const uint8 DCERPC_DREP_OFFSET = 4;
|
---|
477 | const uint8 DCERPC_FRAG_LEN_OFFSET = 8;
|
---|
478 | const uint32 DCERPC_FRAG_MAX_SIZE = 5840;
|
---|
479 | const uint8 DCERPC_AUTH_LEN_OFFSET = 10;
|
---|
480 | const uint8 DCERPC_CALL_ID_OFFSET = 12;
|
---|
481 | const uint8 DCERPC_NCACN_PAYLOAD_OFFSET = 16;
|
---|
482 | const uint32 DCERPC_NCACN_PAYLOAD_MAX_SIZE = 0x400000; /* 4 MByte */
|
---|
483 |
|
---|
484 | /* little-endian flag */
|
---|
485 | const uint8 DCERPC_DREP_LE = 0x10;
|
---|
486 |
|
---|
487 | typedef [public] struct {
|
---|
488 | uint8 rpc_vers; /* RPC version */
|
---|
489 | uint8 rpc_vers_minor; /* Minor version */
|
---|
490 | dcerpc_pkt_type ptype; /* Packet type */
|
---|
491 | dcerpc_pfc_flags pfc_flags; /* Fragmentation flags */
|
---|
492 | uint8 drep[4]; /* NDR data representation */
|
---|
493 | uint16 frag_length; /* Total length of fragment */
|
---|
494 | uint16 auth_length; /* authenticator length */
|
---|
495 | uint32 call_id; /* Call identifier */
|
---|
496 | [switch_is(ptype)] dcerpc_payload u;
|
---|
497 | } ncacn_packet;
|
---|
498 |
|
---|
499 | typedef [public] struct {
|
---|
500 | uint8 rpc_vers; /* RPC version (4) */
|
---|
501 | uint8 ptype;
|
---|
502 | uint8 pfc_flags;
|
---|
503 | uint8 ncadg_flags;
|
---|
504 | uint8 drep[3];
|
---|
505 | uint8 serial_high;
|
---|
506 | GUID object;
|
---|
507 | GUID iface;
|
---|
508 | GUID activity;
|
---|
509 | uint32 server_boot; /* Server boot time */
|
---|
510 | uint32 iface_version;
|
---|
511 | uint32 seq_num;
|
---|
512 | uint16 opnum;
|
---|
513 | uint16 ihint;
|
---|
514 | uint16 ahint;
|
---|
515 | uint16 len;
|
---|
516 | uint16 fragnum;
|
---|
517 | uint8 auth_proto;
|
---|
518 | uint8 serial_low;
|
---|
519 | [switch_is(ptype)] dcerpc_payload u;
|
---|
520 | } ncadg_packet;
|
---|
521 |
|
---|
522 | typedef [bitmap16bit] bitmap {
|
---|
523 | DCERPC_SEC_VT_COMMAND_ENUM = 0x3FFF,
|
---|
524 | DCERPC_SEC_VT_COMMAND_END = 0x4000,
|
---|
525 | DCERPC_SEC_VT_MUST_PROCESS = 0x8000
|
---|
526 | } dcerpc_sec_vt_command;
|
---|
527 |
|
---|
528 | typedef [enum16bit] enum {
|
---|
529 | DCERPC_SEC_VT_COMMAND_BITMASK1 = 0x0001,
|
---|
530 | DCERPC_SEC_VT_COMMAND_PCONTEXT = 0x0002,
|
---|
531 | DCERPC_SEC_VT_COMMAND_HEADER2 = 0x0003
|
---|
532 | } dcerpc_sec_vt_command_enum;
|
---|
533 |
|
---|
534 | typedef [bitmap32bit] bitmap {
|
---|
535 | DCERPC_SEC_VT_CLIENT_SUPPORTS_HEADER_SIGNING = 0x00000001
|
---|
536 | } dcerpc_sec_vt_bitmask1;
|
---|
537 |
|
---|
538 | typedef struct {
|
---|
539 | ndr_syntax_id abstract_syntax;
|
---|
540 | ndr_syntax_id transfer_syntax;
|
---|
541 | } dcerpc_sec_vt_pcontext;
|
---|
542 |
|
---|
543 | typedef struct {
|
---|
544 | dcerpc_pkt_type ptype; /* Packet type */
|
---|
545 | [value(0)] uint8 reserved1;
|
---|
546 | [value(0)] uint16 reserved2;
|
---|
547 | uint8 drep[4]; /* NDR data representation */
|
---|
548 | uint32 call_id; /* Call identifier */
|
---|
549 | uint16 context_id;
|
---|
550 | uint16 opnum;
|
---|
551 | } dcerpc_sec_vt_header2;
|
---|
552 |
|
---|
553 | typedef [switch_type(dcerpc_sec_vt_command_enum),nodiscriminant] union {
|
---|
554 | [case(DCERPC_SEC_VT_COMMAND_BITMASK1)] dcerpc_sec_vt_bitmask1 bitmask1;
|
---|
555 | [case(DCERPC_SEC_VT_COMMAND_PCONTEXT)] dcerpc_sec_vt_pcontext pcontext;
|
---|
556 | [case(DCERPC_SEC_VT_COMMAND_HEADER2)] dcerpc_sec_vt_header2 header2;
|
---|
557 | [default,flag(NDR_REMAINING)] DATA_BLOB _unknown;
|
---|
558 | } dcerpc_sec_vt_union;
|
---|
559 |
|
---|
560 | typedef struct {
|
---|
561 | dcerpc_sec_vt_command command;
|
---|
562 | [switch_is(command & DCERPC_SEC_VT_COMMAND_ENUM)]
|
---|
563 | [subcontext(2),flag(NDR_SUBCONTEXT_NO_UNREAD_BYTES)]
|
---|
564 | dcerpc_sec_vt_union u;
|
---|
565 | } dcerpc_sec_vt;
|
---|
566 |
|
---|
567 | typedef [public,nopush,nopull] struct {
|
---|
568 | uint16 count;
|
---|
569 | } dcerpc_sec_vt_count;
|
---|
570 |
|
---|
571 | /*
|
---|
572 | * We assume that the whole verification trailer fits into
|
---|
573 | * the last 1024 bytes after the stub data.
|
---|
574 | *
|
---|
575 | * There're currently only 3 commands defined and each should
|
---|
576 | * only be used once.
|
---|
577 | */
|
---|
578 | const uint16 DCERPC_SEC_VT_MAX_SIZE = 1024;
|
---|
579 |
|
---|
580 | typedef [public,flag(NDR_PAHEX)] struct {
|
---|
581 | [flag(NDR_ALIGN4)] DATA_BLOB _pad;
|
---|
582 | [value(DCERPC_SEC_VT_MAGIC)] uint8 magic[8];
|
---|
583 | dcerpc_sec_vt_count count;
|
---|
584 | dcerpc_sec_vt commands[count.count];
|
---|
585 | } dcerpc_sec_verification_trailer;
|
---|
586 | }
|
---|