2 OpenChange implementation.
6 Copyright (C) Julien Kerihuel 2005-2010
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #include "libmapi/libmapi.h"
23 #include "libmapi/libmapi_private.h"
25 #include "gen_ndr/ndr_exchange.h"
27 #define MIN(a,b) ((a)<(b)?(a):(b))
29 _PUBLIC_ void obfuscate_data(uint8_t *data, uint32_t size, uint8_t salt)
33 for (i=0; i<size; i++) {
38 ssize_t lzxpress_compress(const uint8_t *input,
41 uint32_t max_output_size);
43 ssize_t lzxpress_decompress(const uint8_t *input,
46 uint32_t max_output_size);
49 \details Compress a LZXPRESS chunk
51 \param ndrpush pointer to the compressed data to return
52 \param ndrpull pointer to the uncompressed data used for compression
53 \param last pointer on boolean to define whether or not this is the
56 \return NDR_ERR_SUCCESS on success, otherwise NDR error
58 static enum ndr_err_code ndr_push_lxpress_chunk(struct ndr_push *ndrpush,
59 struct ndr_pull *ndrpull,
63 DATA_BLOB plain_chunk;
64 uint32_t plain_chunk_size;
65 uint32_t plain_chunk_offset;
66 uint32_t max_plain_size = 0x00010000;
67 uint32_t max_comp_size = 0x00020000 + 2; /* TODO: use the correct value here */
70 /* Step 1. Retrieve the uncompressed buf */
71 plain_chunk_size = MIN(max_plain_size, ndrpull->data_size - ndrpull->offset);
72 plain_chunk_offset = ndrpull->offset;
73 NDR_CHECK(ndr_pull_advance(ndrpull, plain_chunk_size));
75 plain_chunk.data = ndrpull->data + plain_chunk_offset;
76 plain_chunk.length = plain_chunk_size;
78 if (plain_chunk_size < max_plain_size) {
82 NDR_CHECK(ndr_push_expand(ndrpush, max_comp_size));
84 comp_chunk.data = ndrpush->data + ndrpush->offset;
85 comp_chunk.length = max_comp_size;
87 /* Compressing the buffer using LZ Xpress algorithm */
88 ret = lzxpress_compress(plain_chunk.data,
94 return ndr_pull_error(ndrpull, NDR_ERR_COMPRESSION,
95 "XPRESS lzxpress_compress() returned %d\n",
98 comp_chunk.length = ret;
100 ndrpush->offset += comp_chunk.length;
101 return NDR_ERR_SUCCESS;
104 static enum ndr_err_code ndr_pull_lxpress_chunk(struct ndr_pull *ndrpull,
105 struct ndr_push *ndrpush,
106 ssize_t decompressed_len,
109 DATA_BLOB comp_chunk;
110 DATA_BLOB plain_chunk;
111 uint32_t plain_chunk_offset;
114 /* Step 1. Retrieve the compressed buf */
115 comp_chunk.length = ndrpull->data_size;
116 comp_chunk.data = ndrpull->data;
118 plain_chunk_offset = ndrpush->offset;
119 NDR_CHECK(ndr_push_zero(ndrpush, decompressed_len));
120 plain_chunk.length = decompressed_len;
121 plain_chunk.data = ndrpush->data + plain_chunk_offset;
123 ret = lzxpress_decompress(comp_chunk.data,
128 return ndr_pull_error(ndrpull, NDR_ERR_COMPRESSION,
129 "XPRESS lzxpress_decompress() returned %d\n",
132 plain_chunk.length = ret;
133 ndrpush->offset = ret;
135 if ((decompressed_len < 0x00010000) || (ndrpull->offset+4 >= ndrpull->data_size)) {
136 /* this is the last chunk */
140 return NDR_ERR_SUCCESS;
143 _PUBLIC_ enum ndr_err_code ndr_pull_lzxpress_decompress(struct ndr_pull *subndr,
144 struct ndr_pull **_comndr,
145 ssize_t decompressed_len)
147 struct ndr_push *ndrpush;
148 struct ndr_pull *comndr;
149 DATA_BLOB uncompressed;
152 ndrpush = ndr_push_init_ctx(subndr);
153 NDR_ERR_HAVE_NO_MEMORY(ndrpush);
156 NDR_CHECK(ndr_pull_lxpress_chunk(subndr, ndrpush, decompressed_len, &last));
159 uncompressed = ndr_push_blob(ndrpush);
160 if (uncompressed.length != decompressed_len) {
161 return ndr_pull_error(subndr, NDR_ERR_COMPRESSION,
162 "Bad uncompressed_len [%u] != [%u](0x%08X) (PULL)",
163 (int)uncompressed.length,
164 (int)decompressed_len,
165 (int)decompressed_len);
168 comndr = talloc_zero(subndr, struct ndr_pull);
169 NDR_ERR_HAVE_NO_MEMORY(comndr);
170 comndr->flags = subndr->flags;
171 comndr->current_mem_ctx = subndr->current_mem_ctx;
172 comndr->data = uncompressed.data;
173 comndr->data_size = uncompressed.length;
177 return NDR_ERR_SUCCESS;
181 \details Push a compressed LZXPRESS blob
183 \param subndr pointer to the compressed blob the function returns
184 \param _uncomndr pointer on pointer to the uncompressed DATA blob
186 \return NDR_ERR_SUCCESS on success, otherwise NDR error
188 _PUBLIC_ enum ndr_err_code ndr_push_lzxpress_compress(struct ndr_push *subndr,
189 struct ndr_push *uncomndr)
191 struct ndr_pull *ndrpull;
194 ndrpull = talloc_zero(uncomndr, struct ndr_pull);
195 NDR_ERR_HAVE_NO_MEMORY(ndrpull);
196 ndrpull->flags = uncomndr->flags;
197 ndrpull->data = uncomndr->data;
198 ndrpull->data_size = uncomndr->offset;
202 NDR_CHECK(ndr_push_lxpress_chunk(subndr, ndrpull, &last));
205 return NDR_ERR_SUCCESS;
209 _PUBLIC_ enum ndr_err_code ndr_pull_mapi2k7_request(struct ndr_pull *ndr, int ndr_flags, struct mapi2k7_request *r)
211 if (ndr_flags & NDR_SCALARS) {
212 NDR_CHECK(ndr_pull_align(ndr, 4));
213 NDR_CHECK(ndr_pull_RPC_HEADER_EXT(ndr, NDR_SCALARS, &r->header));
215 uint32_t _flags_save_mapi_request = ndr->flags;
216 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING|LIBNDR_FLAG_NOALIGN);
218 struct ndr_pull *_ndr_buffer;
220 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
221 NDR_PULL_ALLOC(ndr, r->mapi_request);
224 NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_buffer, 0, -1));
226 if (r->header.Flags & RHEF_Compressed) {
227 struct ndr_pull *_ndr_data_compressed = NULL;
229 NDR_CHECK(ndr_pull_lzxpress_decompress(_ndr_buffer, &_ndr_data_compressed, r->header.SizeActual));
230 NDR_CHECK(ndr_pull_mapi_request(_ndr_data_compressed, NDR_SCALARS|NDR_BUFFERS, r->mapi_request));
231 } else if (r->header.Flags & RHEF_XorMagic) {
232 obfuscate_data(_ndr_buffer->data, _ndr_buffer->data_size, 0xA5);
233 NDR_CHECK(ndr_pull_mapi_request(_ndr_buffer, NDR_SCALARS|NDR_BUFFERS, r->mapi_request));
235 NDR_CHECK(ndr_pull_mapi_request(_ndr_buffer, NDR_SCALARS|NDR_BUFFERS, r->mapi_request));
239 NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_buffer, 0, -1));
241 ndr->flags = _flags_save_mapi_request;
245 return NDR_ERR_SUCCESS;
249 _PUBLIC_ enum ndr_err_code ndr_pull_mapi2k7_response(struct ndr_pull *ndr, int ndr_flags, struct mapi2k7_response *r)
251 if (ndr_flags & NDR_SCALARS) {
252 NDR_CHECK(ndr_pull_RPC_HEADER_EXT(ndr, NDR_SCALARS, &r->header));
254 uint32_t _flags_save_mapi_response = ndr->flags;
255 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN|LIBNDR_FLAG_REMAINING);
257 struct ndr_pull *_ndr_buffer;
259 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
260 NDR_PULL_ALLOC(ndr, r->mapi_response);
263 NDR_CHECK((ndr_pull_subcontext_start(ndr, &_ndr_buffer, 0, r->header.Size)));
265 if (r->header.Flags & RHEF_Compressed) {
266 struct ndr_pull *_ndr_data_compressed = NULL;
268 NDR_CHECK(ndr_pull_lzxpress_decompress(_ndr_buffer, &_ndr_data_compressed, r->header.SizeActual));
269 NDR_CHECK(ndr_pull_mapi_response(_ndr_data_compressed, NDR_SCALARS|NDR_BUFFERS, r->mapi_response));
270 } else if (r->header.Flags & RHEF_XorMagic) {
271 obfuscate_data(_ndr_buffer->data, _ndr_buffer->data_size, 0xA5);
272 NDR_CHECK(ndr_pull_mapi_response(_ndr_buffer, NDR_SCALARS|NDR_BUFFERS, r->mapi_response));
274 NDR_CHECK(ndr_pull_mapi_response(_ndr_buffer, NDR_SCALARS|NDR_BUFFERS, r->mapi_response));
277 NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_buffer, 0, r->header.Size));
279 ndr->flags = _flags_save_mapi_response;
283 return NDR_ERR_SUCCESS;
287 _PUBLIC_ void ndr_print_AUX_HEADER(struct ndr_print *ndr, const char *name, const struct AUX_HEADER *r)
289 ndr_print_struct(ndr, name, "AUX_HEADER");
291 uint32_t _flags_save_STRUCT = ndr->flags;
292 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
294 ndr_print_uint16(ndr, "Size", r->Size);
295 ndr_print_AUX_VERSION(ndr, "Version", r->Version);
297 switch (r->Version) {
299 ndr_print_AUX_HEADER_TYPE_1(ndr, "Type", (enum AUX_HEADER_TYPE_1) r->Type);
300 ndr_print_set_switch_value(ndr, &r->Payload_1, r->Type);
301 ndr_print_AUX_HEADER_TYPE_UNION_1(ndr, "Payload", &r->Payload_1);
304 ndr_print_AUX_HEADER_TYPE_2(ndr, "Type", (enum AUX_HEADER_TYPE_2) r->Type);
305 ndr_print_set_switch_value(ndr, &r->Payload_2, r->Type);
306 ndr_print_AUX_HEADER_TYPE_UNION_2(ndr, "Payload", &r->Payload_2);
309 ndr->flags = _flags_save_STRUCT;
314 _PUBLIC_ enum ndr_err_code ndr_pull_AUX_HEADER(struct ndr_pull *ndr, int ndr_flags, struct AUX_HEADER *r)
316 struct ndr_pull *_ndr_buffer;
317 uint32_t _flags_save_STRUCT = ndr->flags;
319 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
320 if (ndr_flags & NDR_SCALARS) {
321 NDR_CHECK(ndr_pull_align(ndr, 4));
322 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->Size));
324 NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_buffer, 0, r->Size - 2));
326 NDR_CHECK(ndr_pull_AUX_VERSION(_ndr_buffer, NDR_SCALARS, &r->Version));
327 NDR_CHECK(ndr_pull_uint8(_ndr_buffer, NDR_SCALARS, &r->Type));
328 switch (r->Version) {
330 NDR_CHECK(ndr_pull_set_switch_value(_ndr_buffer, &r->Payload_1, r->Type));
331 NDR_CHECK(ndr_pull_AUX_HEADER_TYPE_UNION_1(_ndr_buffer, NDR_SCALARS, &r->Payload_1));
334 NDR_CHECK(ndr_pull_set_switch_value(_ndr_buffer, &r->Payload_2, r->Type));
335 NDR_CHECK(ndr_pull_AUX_HEADER_TYPE_UNION_2(_ndr_buffer, NDR_SCALARS, &r->Payload_2));
339 NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_buffer, 0, -1));
341 if (ndr_flags & NDR_BUFFERS) {
343 ndr->flags = _flags_save_STRUCT;
345 return NDR_ERR_SUCCESS;
349 _PUBLIC_ void ndr_print_mapi2k7_AuxInfo(struct ndr_print *ndr, const char *name, const struct mapi2k7_AuxInfo *r)
353 if (r && r->AUX_HEADER) {
354 ndr_print_struct(ndr, name, "mapi2k7_AuxInfo");
356 ndr_print_RPC_HEADER_EXT(ndr, "RPC_HEADER_EXT", &r->RPC_HEADER_EXT);
357 for (i = 0; r->AUX_HEADER[i].Size; i++) {
358 ndr_print_AUX_HEADER(ndr, "AUX_HEADER", &r->AUX_HEADER[i]);
362 ndr_print_pointer(ndr, "mapi2k7_AuxInfo", NULL);
367 _PUBLIC_ enum ndr_err_code ndr_pull_mapi2k7_AuxInfo(struct ndr_pull *ndr, int ndr_flags, struct mapi2k7_AuxInfo *r)
369 if (ndr_flags & NDR_SCALARS) {
372 if (!ndr->data_size) {
373 r->AUX_HEADER = NULL;
374 return NDR_ERR_SUCCESS;
377 NDR_CHECK(ndr_pull_align(ndr, 4));
378 NDR_CHECK(ndr_pull_RPC_HEADER_EXT(ndr, NDR_SCALARS, &r->RPC_HEADER_EXT));
380 uint32_t _flags_save_DATA_BLOB = ndr->flags;
381 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN|LIBNDR_FLAG_REMAINING);
382 if (r->RPC_HEADER_EXT.Size) {
383 struct ndr_pull *_ndr_buffer;
384 TALLOC_CTX *_mem_save_AUX_HEADER_0;
385 uint32_t cntr_AUX_HEADER_0 = 0;
387 _mem_save_AUX_HEADER_0 = NDR_PULL_GET_MEM_CTX(ndr);
389 NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_buffer, 0, r->RPC_HEADER_EXT.Size));
391 r->AUX_HEADER = talloc_array(_mem_save_AUX_HEADER_0, struct AUX_HEADER, 2);
394 if (r->RPC_HEADER_EXT.Flags & RHEF_Compressed) {
395 struct ndr_pull *_ndr_data_compressed = NULL;
397 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
398 NDR_CHECK(ndr_pull_lzxpress_decompress(_ndr_buffer, &_ndr_data_compressed, r->RPC_HEADER_EXT.SizeActual));
400 for (cntr_AUX_HEADER_0 = 0; _ndr_data_compressed->offset < _ndr_data_compressed->data_size; cntr_AUX_HEADER_0++) {
401 NDR_CHECK(ndr_pull_AUX_HEADER(_ndr_data_compressed, NDR_SCALARS, &r->AUX_HEADER[cntr_AUX_HEADER_0]));
402 r->AUX_HEADER = talloc_realloc(_mem_save_AUX_HEADER_0, r->AUX_HEADER, struct AUX_HEADER, cntr_AUX_HEADER_0 + 2);
404 r->AUX_HEADER = talloc_realloc(_mem_save_AUX_HEADER_0, r->AUX_HEADER, struct AUX_HEADER, cntr_AUX_HEADER_0 + 2);
405 r->AUX_HEADER[cntr_AUX_HEADER_0].Size = 0;
407 /* obfuscation case */
408 } else if (r->RPC_HEADER_EXT.Flags & RHEF_XorMagic) {
409 obfuscate_data(_ndr_buffer->data, _ndr_buffer->data_size, 0xA5);
411 for (cntr_AUX_HEADER_0 = 0; _ndr_buffer->offset < _ndr_buffer->data_size; cntr_AUX_HEADER_0++) {
412 NDR_CHECK(ndr_pull_AUX_HEADER(_ndr_buffer, NDR_SCALARS, &r->AUX_HEADER[cntr_AUX_HEADER_0]));
413 r->AUX_HEADER = talloc_realloc(_mem_save_AUX_HEADER_0, r->AUX_HEADER, struct AUX_HEADER, cntr_AUX_HEADER_0 + 2);
415 r->AUX_HEADER = talloc_realloc(_mem_save_AUX_HEADER_0, r->AUX_HEADER, struct AUX_HEADER, cntr_AUX_HEADER_0 + 2);
416 r->AUX_HEADER[cntr_AUX_HEADER_0].Size = 0;
419 for (cntr_AUX_HEADER_0 = 0; _ndr_buffer->offset < _ndr_buffer->data_size; cntr_AUX_HEADER_0++) {
420 NDR_CHECK(ndr_pull_AUX_HEADER(_ndr_buffer, NDR_SCALARS, &r->AUX_HEADER[cntr_AUX_HEADER_0]));
421 r->AUX_HEADER = talloc_realloc(_mem_save_AUX_HEADER_0, r->AUX_HEADER, struct AUX_HEADER, cntr_AUX_HEADER_0 + 2);
423 r->AUX_HEADER = talloc_realloc(_mem_save_AUX_HEADER_0, r->AUX_HEADER, struct AUX_HEADER, cntr_AUX_HEADER_0 + 2);
424 r->AUX_HEADER[cntr_AUX_HEADER_0].Size = 0;
427 NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_buffer, 0, -1));
429 r->AUX_HEADER = NULL;
431 ndr->flags = _flags_save_DATA_BLOB;
434 if (ndr_flags & NDR_BUFFERS) {
436 return NDR_ERR_SUCCESS;
440 print mapi_request / mapi_response structures
443 void ndr_print_mapi_request(struct ndr_print *ndr, const char *name, const struct mapi_request *r)
447 rlength = r->mapi_len - r->length;
449 ndr_print_uint32(ndr, "mapi_len", r->mapi_len);
450 if (r->length && r->length > sizeof(uint16_t)) {
451 uint32_t cntr_mapi_req_0;
453 ndr_print_uint16(ndr, "length", r->length);
455 for (cntr_mapi_req_0=0; r->mapi_req[cntr_mapi_req_0].opnum; cntr_mapi_req_0++) {
459 ret = asprintf(&idx_0, "[%u]", cntr_mapi_req_0);
460 if (ret != -1 && idx_0) {
461 ndr_print_EcDoRpc_MAPI_REQ(ndr, "mapi_request", &r->mapi_req[cntr_mapi_req_0]);
472 ndr->print(ndr, "%-25s: (handles) number=%u", name, rlength / 4);
474 for (i = 0; i < (rlength / 4); i++) {
475 ndr_print_uint32(ndr, "handle", r->handles[i]);
481 void ndr_print_mapi_response(struct ndr_print *ndr, const char *name, const struct mapi_response *r)
485 rlength = r->mapi_len - r->length;
487 ndr->print(ndr, "%-25s: length=%u", name, r->length);
488 if (r->length && r->length > sizeof(uint16_t)) {
489 uint32_t cntr_mapi_repl_0;
491 ndr->print(ndr, "%s: ARRAY(%d)", name, r->length - 2);
493 for (cntr_mapi_repl_0=0; r->mapi_repl[cntr_mapi_repl_0].opnum; cntr_mapi_repl_0++) {
494 ndr_print_EcDoRpc_MAPI_REPL(ndr, "mapi_repl", &r->mapi_repl[cntr_mapi_repl_0]);
499 ndr->print(ndr, "%-25s: (handles) number=%u", name, rlength / 4);
506 for (i = 0; i < (rlength / 4); i++) {
507 ndr_print_uint32(ndr, "handle id", r->handles[i]);
515 push mapi_request / mapi_response onto the wire.
517 MAPI length field includes length bytes.
518 But these bytes do not belong to the mapi content in the user
519 context. We have to add them when pushing mapi content length
520 (uint16_t) and next subtract when pushing the content blob
523 enum ndr_err_code ndr_push_mapi_request(struct ndr_push *ndr, int ndr_flags, const struct mapi_request *r)
525 uint32_t cntr_mapi_req_0;
528 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
529 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->length));
531 for (count = 0; ndr->offset < r->length - 2; count++) {
532 NDR_CHECK(ndr_push_EcDoRpc_MAPI_REQ(ndr, NDR_SCALARS, &r->mapi_req[count]));
535 count = (r->mapi_len - r->length) / sizeof(uint32_t);
536 for (cntr_mapi_req_0=0; cntr_mapi_req_0 < count; cntr_mapi_req_0++) {
537 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->handles[cntr_mapi_req_0]));
540 return NDR_ERR_SUCCESS;
543 enum ndr_err_code ndr_push_mapi_response(struct ndr_push *ndr, int ndr_flags, const struct mapi_response *r)
545 uint32_t cntr_mapi_repl_0;
548 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING);
549 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->length));
551 if (r->length > sizeof (uint16_t)) {
552 for (count = 0; ndr->offset < r->length - 2; count++) {
553 NDR_CHECK(ndr_push_EcDoRpc_MAPI_REPL(ndr, NDR_SCALARS, &r->mapi_repl[count]));
557 count = (r->mapi_len - r->length) / sizeof (uint32_t);
558 for (cntr_mapi_repl_0 = 0; cntr_mapi_repl_0 <count; cntr_mapi_repl_0++) {
559 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->handles[cntr_mapi_repl_0]));
562 return NDR_ERR_SUCCESS;
566 pull mapi_request / mapi_response from the wire
569 enum ndr_err_code ndr_pull_mapi_request(struct ndr_pull *ndr, int ndr_flags, struct mapi_request *r)
571 uint32_t length,count;
572 uint32_t cntr_mapi_req_0;
573 TALLOC_CTX *_mem_save_mapi_req_0;
574 TALLOC_CTX *_mem_save_handles_0;
575 struct ndr_pull *_ndr_mapi_req;
577 if (ndr->flags & LIBNDR_FLAG_REMAINING) {
578 length = ndr->data_size - ndr->offset;
580 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &length));
582 r->mapi_len = length;
584 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->length));
586 /* If length equals length field then skipping subcontext */
587 if (r->length > sizeof (uint16_t)) {
588 NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_mapi_req, 0, r->length - 2));
589 _mem_save_mapi_req_0 = NDR_PULL_GET_MEM_CTX(_ndr_mapi_req);
590 r->mapi_req = talloc_zero(_mem_save_mapi_req_0, struct EcDoRpc_MAPI_REQ);
591 for (cntr_mapi_req_0 = 0; _ndr_mapi_req->offset < _ndr_mapi_req->data_size - 2; cntr_mapi_req_0++) {
592 NDR_CHECK(ndr_pull_EcDoRpc_MAPI_REQ(_ndr_mapi_req, NDR_SCALARS, &r->mapi_req[cntr_mapi_req_0]));
593 r->mapi_req = talloc_realloc(_mem_save_mapi_req_0, r->mapi_req, struct EcDoRpc_MAPI_REQ, cntr_mapi_req_0 + 2);
595 r->mapi_req = talloc_realloc(_mem_save_mapi_req_0, r->mapi_req, struct EcDoRpc_MAPI_REQ, cntr_mapi_req_0 + 2);
596 r->mapi_req[cntr_mapi_req_0].opnum = 0;
598 if (_ndr_mapi_req->offset != r->length - 2) {
599 return NDR_ERR_BUFSIZE;
601 NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_mapi_req, 4, -1));
603 _mem_save_handles_0 = NDR_PULL_GET_MEM_CTX(ndr);
604 count = (r->mapi_len - r->length) / sizeof(uint32_t);
605 r->handles = talloc_array(_mem_save_handles_0, uint32_t, count + 1);
606 for (cntr_mapi_req_0=0; cntr_mapi_req_0 < count; cntr_mapi_req_0++) {
607 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->handles[cntr_mapi_req_0]));
613 return NDR_ERR_SUCCESS;
616 enum ndr_err_code ndr_pull_mapi_response(struct ndr_pull *ndr, int ndr_flags, struct mapi_response *r)
618 uint32_t length,count;
619 uint32_t cntr_mapi_repl_0;
620 TALLOC_CTX *_mem_save_mapi_repl_0;
621 TALLOC_CTX *_mem_save_handles_0;
622 struct ndr_pull *_ndr_mapi_repl;
624 if (ndr->flags & LIBNDR_FLAG_REMAINING) {
625 length = ndr->data_size - ndr->offset;
627 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &length));
629 r->mapi_len = length;
631 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->length));
633 /* If length equals length field then skipping subcontext */
634 if (r->length > sizeof (uint16_t)) {
635 _mem_save_mapi_repl_0 = NDR_PULL_GET_MEM_CTX(ndr);
636 r->mapi_repl = talloc_array(_mem_save_mapi_repl_0, struct EcDoRpc_MAPI_REPL, 2);
637 NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_mapi_repl, 0, r->length - 2));
638 for (cntr_mapi_repl_0 = 0; _ndr_mapi_repl->offset < _ndr_mapi_repl->data_size - 2; cntr_mapi_repl_0++) {
639 NDR_CHECK(ndr_pull_EcDoRpc_MAPI_REPL(_ndr_mapi_repl, NDR_SCALARS, &r->mapi_repl[cntr_mapi_repl_0]));
640 r->mapi_repl = talloc_realloc(_ndr_mapi_repl, r->mapi_repl, struct EcDoRpc_MAPI_REPL, cntr_mapi_repl_0 + 2);
642 r->mapi_repl[cntr_mapi_repl_0].opnum = 0;
643 NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_mapi_repl, 4, -1));
644 talloc_free(_ndr_mapi_repl);
647 _mem_save_handles_0 = NDR_PULL_GET_MEM_CTX(ndr);
648 count = (r->mapi_len - r->length) / sizeof(uint32_t);
649 NDR_PULL_ALLOC_N(ndr, r->handles, count + 1);
651 for (cntr_mapi_repl_0=0; cntr_mapi_repl_0 < count; cntr_mapi_repl_0++) {
652 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->handles[cntr_mapi_repl_0]));
654 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handles_0, LIBNDR_FLAG_REF_ALLOC);
656 return NDR_ERR_SUCCESS;
660 We stop processing the IDL if MAPISTATUS is different from MAPI_E_SUCCESS
663 _PUBLIC_ enum ndr_err_code ndr_push_EcDoRpc_MAPI_REPL(struct ndr_push *ndr, int ndr_flags, const struct EcDoRpc_MAPI_REPL *r)
665 if (r->opnum != op_MAPI_Release)
667 uint32_t _flags_save_STRUCT = ndr->flags;
668 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
669 if (ndr_flags & NDR_SCALARS) {
670 NDR_CHECK(ndr_push_align(ndr, 8));
671 NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->opnum));
672 if ((r->opnum == op_MAPI_Notify) || (r->opnum == op_MAPI_Pending)) {
673 NDR_CHECK(ndr_push_set_switch_value(ndr, &r->u, r->opnum));
674 NDR_CHECK(ndr_push_EcDoRpc_MAPI_REPL_UNION(ndr, NDR_SCALARS, &r->u));
676 NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->handle_idx));
677 NDR_CHECK(ndr_push_MAPISTATUS(ndr, NDR_SCALARS, r->error_code));
678 if (r->error_code == MAPI_E_SUCCESS) {
679 NDR_CHECK(ndr_push_set_switch_value(ndr, &r->u, r->opnum));
680 NDR_CHECK(ndr_push_EcDoRpc_MAPI_REPL_UNION(ndr, NDR_SCALARS, &r->u));
683 case op_MAPI_Logon: {
684 if (r->error_code == ecWrongServer) {
685 NDR_CHECK(ndr_push_Logon_redirect(ndr, NDR_SCALARS, &(r->us.mapi_Logon)));
688 case op_MAPI_GetIDsFromNames: {
689 /* MAPI_W_ERRORS_RETURNED still enables the final array to be passed */
690 if (r->error_code == MAPI_W_ERRORS_RETURNED) {
691 NDR_CHECK(ndr_push_set_switch_value(ndr, &r->u, r->opnum));
692 NDR_CHECK(ndr_push_EcDoRpc_MAPI_REPL_UNION(ndr, NDR_SCALARS, &r->u));
701 if (ndr_flags & NDR_BUFFERS) {
702 NDR_CHECK(ndr_push_EcDoRpc_MAPI_REPL_UNION(ndr, NDR_BUFFERS, &r->u));
704 ndr->flags = _flags_save_STRUCT;
706 return NDR_ERR_SUCCESS;
709 enum ndr_err_code ndr_pull_EcDoRpc_MAPI_REPL(struct ndr_pull *ndr, int ndr_flags, struct EcDoRpc_MAPI_REPL *r)
712 uint32_t _flags_save_STRUCT = ndr->flags;
713 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
714 if (ndr_flags & NDR_SCALARS) {
715 NDR_CHECK(ndr_pull_align(ndr, 8));
716 NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->opnum));
717 if ((r->opnum == op_MAPI_Notify) || (r->opnum == op_MAPI_Pending)) {
718 NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->u, r->opnum));
719 NDR_CHECK(ndr_pull_EcDoRpc_MAPI_REPL_UNION(ndr, NDR_SCALARS, &r->u));
721 NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->handle_idx));
722 NDR_CHECK(ndr_pull_MAPISTATUS(ndr, NDR_SCALARS, &r->error_code));
723 if ( r->error_code == MAPI_E_SUCCESS) {
724 NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->u, r->opnum));
725 NDR_CHECK(ndr_pull_EcDoRpc_MAPI_REPL_UNION(ndr, NDR_SCALARS, &r->u));
728 case op_MAPI_Logon: {
729 if (r->error_code == ecWrongServer) {
730 NDR_CHECK(ndr_pull_Logon_redirect(ndr, NDR_SCALARS, &(r->us.mapi_Logon)));
733 case op_MAPI_GetIDsFromNames: {
734 /* MAPI_W_ERRORS_RETURNED still enables the final array to be passed */
735 if (r->error_code == MAPI_W_ERRORS_RETURNED) {
736 NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->u, r->opnum));
737 NDR_CHECK(ndr_pull_EcDoRpc_MAPI_REPL_UNION(ndr, NDR_SCALARS, &r->u));
746 if (ndr_flags & NDR_BUFFERS) {
747 ndr->flags = _flags_save_STRUCT;
750 return NDR_ERR_SUCCESS;
753 void ndr_print_EcDoRpc_MAPI_REPL(struct ndr_print *ndr, const char *name, const struct EcDoRpc_MAPI_REPL *r)
755 ndr_print_struct(ndr, name, "EcDoRpc_MAPI_REPL");
757 uint32_t _flags_save_STRUCT = ndr->flags;
758 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
760 ndr_print_uint8(ndr, "opnum", r->opnum);
761 if ((r->opnum != op_MAPI_Notify) && (r->opnum != op_MAPI_Pending)) {
762 ndr_print_uint8(ndr, "handle_idx", r->handle_idx);
763 ndr_print_MAPISTATUS(ndr, "error_code", r->error_code);
764 if (r->error_code == MAPI_E_SUCCESS) {
765 ndr_print_set_switch_value(ndr, &r->u, r->opnum);
766 ndr_print_EcDoRpc_MAPI_REPL_UNION(ndr, "u", &r->u);
769 case op_MAPI_Logon: {
770 if (r->error_code == ecWrongServer) {
771 ndr_print_set_switch_value(ndr, &r->us, r->opnum);
772 ndr_print_EcDoRpc_MAPI_REPL_UNION_SPECIAL(ndr, "us", &r->us);
775 case op_MAPI_GetIDsFromNames: {
776 /* MAPI_W_ERRORS_RETURNED still enables the final array to be passed */
777 if (r->error_code == MAPI_W_ERRORS_RETURNED) {
778 ndr_print_set_switch_value(ndr, &r->u, r->opnum);
779 ndr_print_EcDoRpc_MAPI_REPL_UNION(ndr, "u", &r->u);
787 ndr_print_set_switch_value(ndr, &r->u, r->opnum);
788 ndr_print_EcDoRpc_MAPI_REPL_UNION(ndr, "u", &r->u);
791 ndr->flags = _flags_save_STRUCT;
796 _PUBLIC_ enum ndr_err_code ndr_pull_EcDoRpc(struct ndr_pull *ndr, int flags, struct EcDoRpc *r)
798 TALLOC_CTX *_mem_save_handle_0;
799 TALLOC_CTX *_mem_save_mapi_request_0;
800 TALLOC_CTX *_mem_save_mapi_response_0;
801 TALLOC_CTX *_mem_save_length_0;
803 if (flags & NDR_IN) {
806 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
807 NDR_PULL_ALLOC(ndr, r->in.handle);
809 _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
810 NDR_PULL_SET_MEM_CTX(ndr, r->in.handle, LIBNDR_FLAG_REF_ALLOC);
811 NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle));
812 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC);
813 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.size));
814 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.offset));
816 uint32_t _flags_save_mapi_request = ndr->flags;
817 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING|LIBNDR_FLAG_NOALIGN);
818 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
819 NDR_PULL_ALLOC(ndr, r->in.mapi_request);
821 _mem_save_mapi_request_0 = NDR_PULL_GET_MEM_CTX(ndr);
822 NDR_PULL_SET_MEM_CTX(ndr, r->in.mapi_request, LIBNDR_FLAG_REF_ALLOC);
824 struct ndr_pull *_ndr_mapi_request;
825 NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_mapi_request, 4, -1));
826 obfuscate_data(_ndr_mapi_request->data, _ndr_mapi_request->data_size, 0xA5);
827 NDR_CHECK(ndr_pull_mapi_request(_ndr_mapi_request, NDR_SCALARS|NDR_BUFFERS, r->in.mapi_request));
828 NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_mapi_request, 4, -1));
830 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_mapi_request_0, LIBNDR_FLAG_REF_ALLOC);
831 ndr->flags = _flags_save_mapi_request;
833 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
834 NDR_PULL_ALLOC(ndr, r->in.length);
836 _mem_save_length_0 = NDR_PULL_GET_MEM_CTX(ndr);
837 NDR_PULL_SET_MEM_CTX(ndr, r->in.length, LIBNDR_FLAG_REF_ALLOC);
838 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, r->in.length));
839 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_length_0, LIBNDR_FLAG_REF_ALLOC);
840 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->in.max_data));
841 NDR_PULL_ALLOC(ndr, r->out.handle);
842 *r->out.handle = *r->in.handle;
843 NDR_PULL_ALLOC(ndr, r->out.mapi_response);
844 ZERO_STRUCTP(r->out.mapi_response);
845 NDR_PULL_ALLOC(ndr, r->out.length);
846 *r->out.length = *r->in.length;
848 if (flags & NDR_OUT) {
849 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
850 NDR_PULL_ALLOC(ndr, r->out.handle);
852 _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
853 NDR_PULL_SET_MEM_CTX(ndr, r->out.handle, LIBNDR_FLAG_REF_ALLOC);
854 NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.handle));
855 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC);
856 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->out.size));
857 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->out.offset));
859 uint32_t _flags_save_mapi_response = ndr->flags;
860 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING|LIBNDR_FLAG_NOALIGN);
861 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
862 NDR_PULL_ALLOC(ndr, r->out.mapi_response);
864 _mem_save_mapi_response_0 = NDR_PULL_GET_MEM_CTX(ndr);
865 NDR_PULL_SET_MEM_CTX(ndr, r->out.mapi_response, LIBNDR_FLAG_REF_ALLOC);
867 struct ndr_pull *_ndr_mapi_response;
868 NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_mapi_response, 4, -1));
869 obfuscate_data(_ndr_mapi_response->data, _ndr_mapi_response->data_size, 0xA5);
870 NDR_CHECK(ndr_pull_mapi_response(_ndr_mapi_response, NDR_SCALARS|NDR_BUFFERS, r->out.mapi_response));
871 NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_mapi_response, 4, -1));
873 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_mapi_response_0, LIBNDR_FLAG_REF_ALLOC);
874 ndr->flags = _flags_save_mapi_response;
876 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
877 NDR_PULL_ALLOC(ndr, r->out.length);
879 _mem_save_length_0 = NDR_PULL_GET_MEM_CTX(ndr);
880 NDR_PULL_SET_MEM_CTX(ndr, r->out.length, LIBNDR_FLAG_REF_ALLOC);
881 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, r->out.length));
882 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_length_0, LIBNDR_FLAG_REF_ALLOC);
883 NDR_CHECK(ndr_pull_MAPISTATUS(ndr, NDR_SCALARS, &r->out.result));
885 return NDR_ERR_SUCCESS;
889 _PUBLIC_ enum ndr_err_code ndr_push_EcDoRpc(struct ndr_push *ndr, int flags, const struct EcDoRpc *r)
891 if (flags & NDR_IN) {
892 if (r->in.handle == NULL) {
893 return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
895 NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->in.handle));
896 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.size));
897 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.offset));
899 uint32_t _flags_save_mapi_request = ndr->flags;
900 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING|LIBNDR_FLAG_NOALIGN);
901 if (r->in.mapi_request == NULL) {
902 return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
905 struct ndr_push *_ndr_mapi_request;
906 NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_mapi_request, 4, -1));
907 NDR_CHECK(ndr_push_mapi_request(_ndr_mapi_request, NDR_SCALARS|NDR_BUFFERS, r->in.mapi_request));
908 obfuscate_data(_ndr_mapi_request->data, _ndr_mapi_request->offset, 0xA5);
909 NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_mapi_request, 4, -1));
911 ndr->flags = _flags_save_mapi_request;
913 if (r->in.length == NULL) {
914 return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
916 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, *r->in.length));
917 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->in.max_data));
919 if (flags & NDR_OUT) {
920 if (r->out.handle == NULL) {
921 return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
923 NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.handle));
924 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->out.size));
925 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->out.offset));
927 uint32_t _flags_save_mapi_response = ndr->flags;
928 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING|LIBNDR_FLAG_NOALIGN);
929 if (r->out.mapi_response == NULL) {
930 return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
933 struct ndr_push *_ndr_mapi_response;
934 NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_mapi_response, 4, -1));
935 NDR_CHECK(ndr_push_mapi_response(_ndr_mapi_response, NDR_SCALARS|NDR_BUFFERS, r->out.mapi_response));
936 obfuscate_data(_ndr_mapi_response->data, _ndr_mapi_response->alloc_size, 0xA5);
937 NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_mapi_response, 4, -1));
939 ndr->flags = _flags_save_mapi_response;
941 if (r->out.length == NULL) {
942 return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
944 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, *r->out.length));
945 NDR_CHECK(ndr_push_MAPISTATUS(ndr, NDR_SCALARS, r->out.result));
947 return NDR_ERR_SUCCESS;
951 _PUBLIC_ enum ndr_err_code ndr_push_EcDoConnectEx(struct ndr_push *ndr, int flags, const struct EcDoConnectEx *r)
953 uint32_t cntr_rgwClientVersion_0;
954 uint32_t cntr_rgwServerVersion_0;
955 uint32_t cntr_rgwBestVersion_0;
957 if (flags & NDR_IN) {
958 NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, ndr_charset_length(r->in.szUserDN, CH_DOS)));
959 NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, 0));
960 NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, ndr_charset_length(r->in.szUserDN, CH_DOS)));
961 NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->in.szUserDN, ndr_charset_length(r->in.szUserDN, CH_DOS), sizeof (uint8_t), CH_DOS));
962 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.ulFlags));
963 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.ulConMod));
964 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.cbLimit));
965 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.ulCpid));
966 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.ulLcidString));
967 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.ulLcidSort));
968 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.ulIcxrLink));
969 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->in.usFCanConvertCodePages));
970 for (cntr_rgwClientVersion_0 = 0; cntr_rgwClientVersion_0 < 3; cntr_rgwClientVersion_0++) {
971 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->in.rgwClientVersion[cntr_rgwClientVersion_0]));
973 if (r->in.pulTimeStamp == NULL) {
974 return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
976 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.pulTimeStamp));
978 uint32_t _flags_save_mapi2k7_AuxInfo = ndr->flags;
979 struct ndr_push *_ndr_rgbAuxIn;
981 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN|LIBNDR_FLAG_REMAINING);
982 NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_rgbAuxIn, 4, -1));
985 if (r->in.rgbAuxIn == NULL) {
986 return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
988 NDR_CHECK(ndr_push_mapi2k7_AuxInfo(_ndr_rgbAuxIn, NDR_SCALARS|NDR_BUFFERS, r->in.rgbAuxIn));
990 NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_rgbAuxIn, 4, -1));
991 ndr->flags = _flags_save_mapi2k7_AuxInfo;
993 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->in.cbAuxIn));
994 if (r->in.pcbAuxOut == NULL) {
995 return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
997 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->in.pcbAuxOut));
1000 if (flags & NDR_OUT) {
1001 if (r->out.handle == NULL) {
1002 return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
1004 NDR_CHECK(ndr_push_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.handle));
1005 if (r->out.pcmsPollsMax == NULL) {
1006 return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
1008 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.pcmsPollsMax));
1009 if (r->out.pcRetry == NULL) {
1010 return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
1012 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.pcRetry));
1013 if (r->out.pcmsRetryDelay == NULL) {
1014 return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
1016 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.pcmsRetryDelay));
1017 if (r->out.picxr == NULL) {
1018 return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
1020 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.picxr));
1021 if (r->out.szDNPrefix == NULL) {
1022 return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
1024 NDR_CHECK(ndr_push_unique_ptr(ndr, *r->out.szDNPrefix));
1025 if (r->out.szDNPrefix) {
1026 NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, ndr_charset_length(*r->out.szDNPrefix, CH_DOS)));
1027 NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, 0));
1028 NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, ndr_charset_length(*r->out.szDNPrefix, CH_DOS)));
1029 NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, *r->out.szDNPrefix, ndr_charset_length(*r->out.szDNPrefix, CH_DOS), sizeof(uint8_t), CH_DOS));
1031 if (r->out.szDisplayName == NULL) {
1032 return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
1034 NDR_CHECK(ndr_push_unique_ptr(ndr, *r->out.szDisplayName));
1035 if (*r->out.szDisplayName) {
1036 NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, ndr_charset_length(*r->out.szDisplayName, CH_DOS)));
1037 NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, 0));
1038 NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, ndr_charset_length(*r->out.szDisplayName, CH_DOS)));
1039 NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, *r->out.szDisplayName, ndr_charset_length(*r->out.szDisplayName, CH_DOS), sizeof(uint8_t), CH_DOS));
1041 for (cntr_rgwServerVersion_0 = 0; cntr_rgwServerVersion_0 < 3; cntr_rgwServerVersion_0++) {
1042 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->out.rgwServerVersion[cntr_rgwServerVersion_0]));
1044 for (cntr_rgwBestVersion_0 = 0; cntr_rgwBestVersion_0 < 3; cntr_rgwBestVersion_0++) {
1045 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->out.rgwBestVersion[cntr_rgwBestVersion_0]));
1047 if (r->out.pulTimeStamp == NULL) {
1048 return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
1050 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.pulTimeStamp));
1051 NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, *r->out.pcbAuxOut));
1052 NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, 0));
1053 NDR_CHECK(ndr_push_uint3264(ndr, NDR_SCALARS, *r->out.pcbAuxOut));
1054 /* Only try to fetch rgbAuxOut if pcbAuxOut is > 0 */
1055 if (r->out.pcbAuxOut && *r->out.pcbAuxOut) {
1056 NDR_CHECK(ndr_push_mapi2k7_AuxInfo(ndr, NDR_SCALARS, r->out.rgbAuxOut));
1059 if (r->out.pcbAuxOut == NULL) {
1060 return ndr_push_error(ndr, NDR_ERR_INVALID_POINTER, "NULL [ref] pointer");
1062 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, *r->out.pcbAuxOut));
1063 NDR_CHECK(ndr_push_MAPISTATUS(ndr, NDR_SCALARS, r->out.result));
1065 return NDR_ERR_SUCCESS;
1068 _PUBLIC_ enum ndr_err_code ndr_pull_EcDoConnectEx(struct ndr_pull *ndr, int flags, struct EcDoConnectEx *r)
1070 uint32_t _ptr_szDNPrefix;
1071 uint32_t _ptr_szDisplayName;
1072 uint32_t cntr_rgwClientVersion_0;
1073 uint32_t cntr_rgwServerVersion_0;
1074 uint32_t cntr_rgwBestVersion_0;
1075 TALLOC_CTX *_mem_save_handle_0;
1076 TALLOC_CTX *_mem_save_pcmsPollsMax_0;
1077 TALLOC_CTX *_mem_save_pcRetry_0;
1078 TALLOC_CTX *_mem_save_pcmsRetryDelay_0;
1079 TALLOC_CTX *_mem_save_picxr_0;
1080 TALLOC_CTX *_mem_save_szDNPrefix_0;
1081 TALLOC_CTX *_mem_save_szDNPrefix_1;
1082 TALLOC_CTX *_mem_save_szDisplayName_0;
1083 TALLOC_CTX *_mem_save_szDisplayName_1;
1084 TALLOC_CTX *_mem_save_pulTimeStamp_0;
1085 TALLOC_CTX *_mem_save_rgbAuxIn_0;
1086 TALLOC_CTX *_mem_save_pcbAuxOut_0;
1087 TALLOC_CTX *_mem_save_rgbAuxOut_1;
1089 if (flags & NDR_IN) {
1090 ZERO_STRUCT(r->out);
1092 NDR_CHECK(ndr_pull_array_size(ndr, &r->in.szUserDN));
1093 NDR_CHECK(ndr_pull_array_length(ndr, &r->in.szUserDN));
1094 if (ndr_get_array_length(ndr, &r->in.szUserDN) > ndr_get_array_size(ndr, &r->in.szUserDN)) {
1095 return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->in.szUserDN), ndr_get_array_length(ndr, &r->in.szUserDN));
1097 NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->in.szUserDN), sizeof(uint8_t)));
1098 NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->in.szUserDN, ndr_get_array_length(ndr, &r->in.szUserDN), sizeof(uint8_t), CH_DOS));
1099 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.ulFlags));
1100 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.ulConMod));
1101 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.cbLimit));
1102 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.ulCpid));
1103 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.ulLcidString));
1104 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.ulLcidSort));
1105 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.ulIcxrLink));
1106 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->in.usFCanConvertCodePages));
1107 for (cntr_rgwClientVersion_0 = 0; cntr_rgwClientVersion_0 < 3; cntr_rgwClientVersion_0++) {
1108 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->in.rgwClientVersion[cntr_rgwClientVersion_0]));
1110 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
1111 NDR_PULL_ALLOC(ndr, r->in.pulTimeStamp);
1113 _mem_save_pulTimeStamp_0 = NDR_PULL_GET_MEM_CTX(ndr);
1114 NDR_PULL_SET_MEM_CTX(ndr, r->in.pulTimeStamp, LIBNDR_FLAG_REF_ALLOC);
1115 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->in.pulTimeStamp));
1116 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_pulTimeStamp_0, LIBNDR_FLAG_REF_ALLOC);
1118 uint32_t _flags_save_mapi2k7_AuxInfo = ndr->flags;
1119 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN|LIBNDR_FLAG_REMAINING);
1120 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
1121 NDR_PULL_ALLOC(ndr, r->in.rgbAuxIn);
1123 _mem_save_rgbAuxIn_0 = NDR_PULL_GET_MEM_CTX(ndr);
1124 NDR_PULL_SET_MEM_CTX(ndr, r->in.rgbAuxIn, LIBNDR_FLAG_REF_ALLOC);
1126 struct ndr_pull *_ndr_rgbAuxIn;
1127 NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_rgbAuxIn, 4, -1));
1128 NDR_CHECK(ndr_pull_mapi2k7_AuxInfo(_ndr_rgbAuxIn, NDR_SCALARS|NDR_BUFFERS, r->in.rgbAuxIn));
1129 NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_rgbAuxIn, 4, -1));
1131 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_rgbAuxIn_0, LIBNDR_FLAG_REF_ALLOC);
1132 ndr->flags = _flags_save_mapi2k7_AuxInfo;
1134 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->in.cbAuxIn));
1135 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
1136 NDR_PULL_ALLOC(ndr, r->in.pcbAuxOut);
1138 _mem_save_pcbAuxOut_0 = NDR_PULL_GET_MEM_CTX(ndr);
1139 NDR_PULL_SET_MEM_CTX(ndr, r->in.pcbAuxOut, LIBNDR_FLAG_REF_ALLOC);
1140 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->in.pcbAuxOut));
1141 if (*r->in.pcbAuxOut > 0x1008) {
1142 return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range");
1144 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_pcbAuxOut_0, LIBNDR_FLAG_REF_ALLOC);
1145 NDR_PULL_ALLOC(ndr, r->out.handle);
1146 ZERO_STRUCTP(r->out.handle);
1147 NDR_PULL_ALLOC(ndr, r->out.pcmsPollsMax);
1148 ZERO_STRUCTP(r->out.pcmsPollsMax);
1149 NDR_PULL_ALLOC(ndr, r->out.pcRetry);
1150 ZERO_STRUCTP(r->out.pcRetry);
1151 NDR_PULL_ALLOC(ndr, r->out.pcmsRetryDelay);
1152 ZERO_STRUCTP(r->out.pcmsRetryDelay);
1153 NDR_PULL_ALLOC(ndr, r->out.picxr);
1154 ZERO_STRUCTP(r->out.picxr);
1155 NDR_PULL_ALLOC(ndr, r->out.szDNPrefix);
1156 ZERO_STRUCTP(r->out.szDNPrefix);
1157 NDR_PULL_ALLOC(ndr, r->out.szDisplayName);
1158 ZERO_STRUCTP(r->out.szDisplayName);
1159 NDR_PULL_ALLOC(ndr, r->out.pulTimeStamp);
1160 *r->out.pulTimeStamp = *r->in.pulTimeStamp;
1161 NDR_PULL_ALLOC(ndr, r->out.pcbAuxOut);
1162 *r->out.pcbAuxOut = *r->in.pcbAuxOut;
1165 if (flags & NDR_OUT) {
1166 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
1167 NDR_PULL_ALLOC(ndr, r->out.handle);
1169 _mem_save_handle_0 = NDR_PULL_GET_MEM_CTX(ndr);
1170 NDR_PULL_SET_MEM_CTX(ndr, r->out.handle, LIBNDR_FLAG_REF_ALLOC);
1171 NDR_CHECK(ndr_pull_policy_handle(ndr, NDR_SCALARS|NDR_BUFFERS, r->out.handle));
1172 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_handle_0, LIBNDR_FLAG_REF_ALLOC);
1173 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
1174 NDR_PULL_ALLOC(ndr, r->out.pcmsPollsMax);
1176 _mem_save_pcmsPollsMax_0 = NDR_PULL_GET_MEM_CTX(ndr);
1177 NDR_PULL_SET_MEM_CTX(ndr, r->out.pcmsPollsMax, LIBNDR_FLAG_REF_ALLOC);
1178 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.pcmsPollsMax));
1179 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_pcmsPollsMax_0, LIBNDR_FLAG_REF_ALLOC);
1180 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
1181 NDR_PULL_ALLOC(ndr, r->out.pcRetry);
1183 _mem_save_pcRetry_0 = NDR_PULL_GET_MEM_CTX(ndr);
1184 NDR_PULL_SET_MEM_CTX(ndr, r->out.pcRetry, LIBNDR_FLAG_REF_ALLOC);
1185 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.pcRetry));
1186 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_pcRetry_0, LIBNDR_FLAG_REF_ALLOC);
1187 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
1188 NDR_PULL_ALLOC(ndr, r->out.pcmsRetryDelay);
1190 _mem_save_pcmsRetryDelay_0 = NDR_PULL_GET_MEM_CTX(ndr);
1191 NDR_PULL_SET_MEM_CTX(ndr, r->out.pcmsRetryDelay, LIBNDR_FLAG_REF_ALLOC);
1192 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.pcmsRetryDelay));
1193 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_pcmsRetryDelay_0, LIBNDR_FLAG_REF_ALLOC);
1194 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
1195 NDR_PULL_ALLOC(ndr, r->out.picxr);
1197 _mem_save_picxr_0 = NDR_PULL_GET_MEM_CTX(ndr);
1198 NDR_PULL_SET_MEM_CTX(ndr, r->out.picxr, LIBNDR_FLAG_REF_ALLOC);
1199 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.picxr));
1200 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_picxr_0, LIBNDR_FLAG_REF_ALLOC);
1202 _mem_save_szDNPrefix_0 = NDR_PULL_GET_MEM_CTX(ndr);
1203 NDR_PULL_SET_MEM_CTX(ndr, r->out.szDNPrefix, LIBNDR_FLAG_REF_ALLOC);
1204 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_szDNPrefix));
1205 if (_ptr_szDNPrefix) {
1206 NDR_PULL_ALLOC(ndr, *r->out.szDNPrefix);
1208 *r->out.szDNPrefix = NULL;
1210 if (*r->out.szDNPrefix) {
1211 _mem_save_szDNPrefix_1 = NDR_PULL_GET_MEM_CTX(ndr);
1212 NDR_PULL_SET_MEM_CTX(ndr, *r->out.szDNPrefix, 0);
1213 NDR_CHECK(ndr_pull_array_size(ndr, r->out.szDNPrefix));
1214 NDR_CHECK(ndr_pull_array_length(ndr, r->out.szDNPrefix));
1215 if (ndr_get_array_length(ndr, r->out.szDNPrefix) > ndr_get_array_size(ndr, r->out.szDNPrefix)) {
1216 return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, r->out.szDNPrefix), ndr_get_array_length(ndr, r->out.szDNPrefix));
1218 NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, r->out.szDNPrefix), sizeof(uint8_t)));
1219 NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, r->out.szDNPrefix, ndr_get_array_length(ndr, r->out.szDNPrefix), sizeof(uint8_t), CH_DOS));
1220 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_szDNPrefix_1, 0);
1222 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_szDNPrefix_0, LIBNDR_FLAG_REF_ALLOC);
1224 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
1225 NDR_PULL_ALLOC(ndr, r->out.szDisplayName);
1227 _mem_save_szDisplayName_0 = NDR_PULL_GET_MEM_CTX(ndr);
1228 NDR_PULL_SET_MEM_CTX(ndr, r->out.szDisplayName, LIBNDR_FLAG_REF_ALLOC);
1229 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_szDisplayName));
1230 if (_ptr_szDisplayName) {
1231 NDR_PULL_ALLOC(ndr, *r->out.szDisplayName);
1233 *r->out.szDisplayName = NULL;
1235 if (*r->out.szDisplayName) {
1236 _mem_save_szDisplayName_1 = NDR_PULL_GET_MEM_CTX(ndr);
1237 NDR_PULL_SET_MEM_CTX(ndr, *r->out.szDisplayName, 0);
1238 NDR_CHECK(ndr_pull_array_size(ndr, r->out.szDisplayName));
1239 NDR_CHECK(ndr_pull_array_length(ndr, r->out.szDisplayName));
1240 if (ndr_get_array_length(ndr, r->out.szDisplayName) > ndr_get_array_size(ndr, r->out.szDisplayName)) {
1241 return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, r->out.szDisplayName), ndr_get_array_length(ndr, r->out.szDisplayName));
1243 NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, r->out.szDisplayName), sizeof(uint8_t)));
1244 NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, r->out.szDisplayName, ndr_get_array_length(ndr, r->out.szDisplayName), sizeof(uint8_t), CH_DOS));
1245 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_szDisplayName_1, 0);
1247 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_szDisplayName_0, LIBNDR_FLAG_REF_ALLOC);
1249 for (cntr_rgwServerVersion_0 = 0; cntr_rgwServerVersion_0 < 3; cntr_rgwServerVersion_0++) {
1250 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->out.rgwServerVersion[cntr_rgwServerVersion_0]));
1252 for (cntr_rgwBestVersion_0 = 0; cntr_rgwBestVersion_0 < 3; cntr_rgwBestVersion_0++) {
1253 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->out.rgwBestVersion[cntr_rgwBestVersion_0]));
1255 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
1256 NDR_PULL_ALLOC(ndr, r->out.pulTimeStamp);
1258 _mem_save_pulTimeStamp_0 = NDR_PULL_GET_MEM_CTX(ndr);
1259 NDR_PULL_SET_MEM_CTX(ndr, r->out.pulTimeStamp, LIBNDR_FLAG_REF_ALLOC);
1260 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.pulTimeStamp));
1261 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_pulTimeStamp_0, LIBNDR_FLAG_REF_ALLOC);
1262 NDR_CHECK(ndr_pull_array_size(ndr, &r->out.rgbAuxOut));
1263 NDR_CHECK(ndr_pull_array_length(ndr, &r->out.rgbAuxOut));
1264 if (ndr_get_array_length(ndr, &r->out.rgbAuxOut) > ndr_get_array_size(ndr, &r->out.rgbAuxOut)) {
1265 return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->out.rgbAuxOut), ndr_get_array_length(ndr, &r->out.rgbAuxOut));
1267 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
1268 NDR_PULL_ALLOC_N(ndr, r->out.rgbAuxOut, ndr_get_array_size(ndr, &r->out.rgbAuxOut));
1270 /* Only try to pull rgbAuxOut if the fake array size is > 0 */
1271 if (ndr_get_array_size(ndr, &r->out.rgbAuxOut)) {
1272 _mem_save_rgbAuxOut_1 = NDR_PULL_GET_MEM_CTX(ndr);
1273 NDR_PULL_SET_MEM_CTX(ndr, r->out.rgbAuxOut, 0);
1274 NDR_CHECK(ndr_pull_mapi2k7_AuxInfo(ndr, NDR_SCALARS, r->out.rgbAuxOut));
1275 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_rgbAuxOut_1, 0);
1277 if (ndr->flags & LIBNDR_FLAG_REF_ALLOC) {
1278 NDR_PULL_ALLOC(ndr, r->out.pcbAuxOut);
1280 _mem_save_pcbAuxOut_0 = NDR_PULL_GET_MEM_CTX(ndr);
1281 NDR_PULL_SET_MEM_CTX(ndr, r->out.pcbAuxOut, LIBNDR_FLAG_REF_ALLOC);
1282 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, r->out.pcbAuxOut));
1283 if (*r->out.pcbAuxOut > 0x1008) {
1284 return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range");
1286 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_pcbAuxOut_0, LIBNDR_FLAG_REF_ALLOC);
1287 NDR_CHECK(ndr_pull_MAPISTATUS(ndr, NDR_SCALARS, &r->out.result));
1289 return NDR_ERR_SUCCESS;
1292 _PUBLIC_ void ndr_print_EcDoConnectEx(struct ndr_print *ndr, const char *name, int flags, const struct EcDoConnectEx *r)
1294 uint32_t cntr_rgwClientVersion_0;
1295 uint32_t cntr_rgwServerVersion_0;
1296 uint32_t cntr_rgwBestVersion_0;
1298 ndr_print_struct(ndr, name, "EcDoConnectEx");
1300 if (flags & NDR_SET_VALUES) {
1301 ndr->flags |= LIBNDR_PRINT_SET_VALUES;
1303 if (flags & NDR_IN) {
1304 ndr_print_struct(ndr, "in", "EcDoConnectEx");
1306 ndr_print_string(ndr, "szUserDN", r->in.szUserDN);
1307 ndr_print_uint32(ndr, "ulFlags", r->in.ulFlags);
1308 ndr_print_uint32(ndr, "ulConMod", r->in.ulConMod);
1309 ndr_print_uint32(ndr, "cbLimit", r->in.cbLimit);
1310 ndr_print_uint32(ndr, "ulCpid", r->in.ulCpid);
1311 ndr_print_uint32(ndr, "ulLcidString", r->in.ulLcidString);
1312 ndr_print_uint32(ndr, "ulLcidSort", r->in.ulLcidSort);
1313 ndr_print_uint32(ndr, "ulIcxrLink", r->in.ulIcxrLink);
1314 ndr_print_uint16(ndr, "usFCanConvertCodePages", r->in.usFCanConvertCodePages);
1315 ndr->print(ndr, "%s: ARRAY(%d)", "rgwClientVersion", (int)3);
1317 for (cntr_rgwClientVersion_0=0;cntr_rgwClientVersion_0<3;cntr_rgwClientVersion_0++) {
1319 if (asprintf(&idx_0, "[%d]", cntr_rgwClientVersion_0) != -1) {
1320 ndr_print_uint16(ndr, "rgwClientVersion", r->in.rgwClientVersion[cntr_rgwClientVersion_0]);
1325 ndr_print_ptr(ndr, "pulTimeStamp", r->in.pulTimeStamp);
1327 ndr_print_uint32(ndr, "pulTimeStamp", *r->in.pulTimeStamp);
1329 ndr_print_ptr(ndr, "rgbAuxIn", r->in.rgbAuxIn);
1330 if (r->in.rgbAuxIn) {
1332 ndr_print_mapi2k7_AuxInfo(ndr, "rgbAuxIn", r->in.rgbAuxIn);
1335 ndr_print_uint32(ndr, "cbAuxIn", r->in.cbAuxIn);
1336 ndr_print_ptr(ndr, "pcbAuxOut", r->in.pcbAuxOut);
1338 ndr_print_uint32(ndr, "pcbAuxOut", *r->in.pcbAuxOut);
1342 if (flags & NDR_OUT) {
1343 ndr_print_struct(ndr, "out", "EcDoConnectEx");
1345 ndr_print_ptr(ndr, "handle", r->out.handle);
1347 ndr_print_policy_handle(ndr, "handle", r->out.handle);
1349 ndr_print_ptr(ndr, "pcmsPollsMax", r->out.pcmsPollsMax);
1351 ndr_print_uint32(ndr, "pcmsPollsMax", *r->out.pcmsPollsMax);
1353 ndr_print_ptr(ndr, "pcRetry", r->out.pcRetry);
1355 ndr_print_uint32(ndr, "pcRetry", *r->out.pcRetry);
1357 ndr_print_ptr(ndr, "pcmsRetryDelay", r->out.pcmsRetryDelay);
1359 ndr_print_uint32(ndr, "pcmsRetryDelay", *r->out.pcmsRetryDelay);
1361 ndr_print_ptr(ndr, "picxr", r->out.picxr);
1363 ndr_print_uint32(ndr, "picxr", *r->out.picxr);
1365 ndr_print_ptr(ndr, "szDNPrefix", r->out.szDisplayName);
1367 if (r->out.szDNPrefix && *r->out.szDNPrefix) {
1368 ndr_print_ptr(ndr, "szDNPrefix", *r->out.szDNPrefix);
1370 ndr_print_string(ndr, "szDNPrefix", *r->out.szDNPrefix);
1374 ndr_print_ptr(ndr, "szDisplayName", r->out.szDisplayName);
1376 if (r->out.szDisplayName && *r->out.szDisplayName) {
1377 ndr_print_ptr(ndr, "szDisplayName", *r->out.szDisplayName);
1379 ndr_print_string(ndr, "szDisplayName", *r->out.szDisplayName);
1383 ndr->print(ndr, "%s: ARRAY(%d)", "rgwServerVersion", (int)3);
1385 for (cntr_rgwServerVersion_0=0;cntr_rgwServerVersion_0<3;cntr_rgwServerVersion_0++) {
1387 if (asprintf(&idx_0, "[%d]", cntr_rgwServerVersion_0) != -1) {
1388 ndr_print_uint16(ndr, "rgwServerVersion", r->out.rgwServerVersion[cntr_rgwServerVersion_0]);
1393 ndr->print(ndr, "%s: ARRAY(%d)", "rgwBestVersion", (int)3);
1395 for (cntr_rgwBestVersion_0=0;cntr_rgwBestVersion_0<3;cntr_rgwBestVersion_0++) {
1397 if (asprintf(&idx_0, "[%d]", cntr_rgwBestVersion_0) != -1) {
1398 ndr_print_uint16(ndr, "rgwBestVersion", r->out.rgwBestVersion[cntr_rgwBestVersion_0]);
1403 ndr_print_ptr(ndr, "pulTimeStamp", r->out.pulTimeStamp);
1404 if (r->out.pulTimeStamp) {
1406 ndr_print_uint32(ndr, "pulTimeStamp", *r->out.pulTimeStamp);
1409 ndr_print_ptr(ndr, "rgbAuxOut", r->out.rgbAuxOut);
1410 if (r->out.rgbAuxOut && r->out.pcbAuxOut) {
1412 ndr_print_mapi2k7_AuxInfo(ndr, "rgbAuxOut", r->out.rgbAuxOut);
1415 ndr_print_ptr(ndr, "pcbAuxOut", r->out.pcbAuxOut);
1416 if (r->out.pcbAuxOut) {
1418 ndr_print_uint32(ndr, "pcbAuxOut", *r->out.pcbAuxOut);
1421 ndr_print_MAPISTATUS(ndr, "result", r->out.result);
1427 _PUBLIC_ void ndr_print_EcDoRpcExt(struct ndr_print *ndr, const char *name, int flags, const struct EcDoRpcExt *r)
1431 struct ndr_pull *ndr_pull;
1432 struct mapi2k7_request *mapi_request;
1433 struct mapi2k7_response *mapi_response;
1434 TALLOC_CTX *mem_ctx;
1436 mem_ctx = talloc_named(NULL, 0, "ndr_print_EcDoRpcExt2");
1438 ndr_print_struct(ndr, name, "EcDoRpcExt");
1439 if (r == NULL) { ndr_print_null(ndr); return; }
1441 if (flags & NDR_SET_VALUES) {
1442 ndr->flags |= LIBNDR_PRINT_SET_VALUES;
1444 if (flags & NDR_IN) {
1445 ndr_print_struct(ndr, "in", "EcDoRpcExt");
1447 ndr_print_ptr(ndr, "handle", r->in.handle);
1449 ndr_print_policy_handle(ndr, "handle", r->in.handle);
1451 ndr_print_ptr(ndr, "pulFlags", r->in.pulFlags);
1453 ndr_print_uint32(ndr, "pulFlags", *r->in.pulFlags);
1456 /* Put MAPI request blob into a ndr_pull structure */
1457 rgbIn.data = talloc_memdup(mem_ctx, r->in.rgbIn, r->in.cbIn);
1458 rgbIn.length = r->in.cbIn;
1459 dump_data(0, rgbIn.data, rgbIn.length);
1460 ndr_pull = ndr_pull_init_blob(&rgbIn, mem_ctx);
1461 ndr_set_flags(&ndr_pull->flags, LIBNDR_FLAG_NOALIGN);
1462 mapi_request = talloc_zero(mem_ctx, struct mapi2k7_request);
1463 mapi_request->mapi_request = talloc_zero(mapi_request, struct mapi_request);
1464 ndr_pull_mapi2k7_request(ndr_pull, NDR_SCALARS|NDR_BUFFERS, mapi_request);
1465 ndr_print_mapi2k7_request(ndr, "mapi_request", (const struct mapi2k7_request *)mapi_request);
1466 talloc_free(mapi_request);
1467 talloc_free(ndr_pull);
1468 talloc_free(rgbIn.data);
1470 ndr_print_uint32(ndr, "cbIn", r->in.cbIn);
1471 ndr_print_ptr(ndr, "pcbOut", r->in.pcbOut);
1473 ndr_print_uint32(ndr, "pcbOut", *r->in.pcbOut);
1475 ndr_print_array_uint8(ndr, "Reserved0", r->in.Reserved0, *r->in.Reserved1);
1476 ndr_print_ptr(ndr, "Reserved1", r->in.Reserved1);
1478 ndr_print_uint32(ndr, "Reserved1", *r->in.Reserved1);
1482 if (flags & NDR_OUT) {
1483 ndr_print_struct(ndr, "out", "EcDoRpcExt");
1485 ndr_print_ptr(ndr, "handle", r->out.handle);
1487 ndr_print_policy_handle(ndr, "handle", r->out.handle);
1489 ndr_print_ptr(ndr, "pulFlags", r->out.pulFlags);
1491 ndr_print_uint32(ndr, "pulFlags", *r->out.pulFlags);
1494 /* Put MAPI response blob into a ndr_pull structure */
1495 if (*r->out.pcbOut) {
1496 rgbOut.data = talloc_memdup(mem_ctx, r->out.rgbOut, *r->out.pcbOut);
1497 rgbOut.length = *r->out.pcbOut;
1498 ndr_pull = ndr_pull_init_blob(&rgbOut, mem_ctx);
1499 ndr_set_flags(&ndr_pull->flags, LIBNDR_FLAG_NOALIGN);
1500 while (ndr_pull->offset < ndr_pull->data_size) {
1501 mapi_response = talloc_zero(NULL, struct mapi2k7_response);
1502 mapi_response->mapi_response = talloc_zero(mapi_response, struct mapi_response);
1503 ndr_pull_mapi2k7_response(ndr_pull, NDR_SCALARS|NDR_BUFFERS, mapi_response);
1504 ndr_print_mapi2k7_response(ndr, "mapi_response",
1505 (const struct mapi2k7_response *)mapi_response);
1506 talloc_free(mapi_response);
1508 talloc_free(ndr_pull);
1509 talloc_free(rgbOut.data);
1512 ndr_print_ptr(ndr, "pcbOut", r->out.pcbOut);
1514 ndr_print_uint32(ndr, "pcbOut", *r->out.pcbOut);
1516 ndr_print_array_uint8(ndr, "Reserved0", r->out.Reserved0, *r->out.Reserved1);
1517 ndr_print_ptr(ndr, "Reserved1", r->out.Reserved1);
1519 ndr_print_uint32(ndr, "Reserved1", *r->out.Reserved1);
1521 ndr_print_ptr(ndr, "pulTransTime", r->out.pulTransTime);
1523 ndr_print_uint32(ndr, "pulTransTime", *r->out.pulTransTime);
1525 ndr_print_MAPISTATUS(ndr, "result", r->out.result);
1530 talloc_free(mem_ctx);
1533 _PUBLIC_ void ndr_print_EcDoRpcExt2(struct ndr_print *ndr, const char *name, int flags, const struct EcDoRpcExt2 *r)
1535 uint32_t cntr_rgbAuxOut_0;
1539 struct ndr_pull *ndr_pull;
1540 struct mapi2k7_request *mapi_request;
1541 struct mapi2k7_response *mapi_response;
1542 TALLOC_CTX *mem_ctx;
1544 mem_ctx = talloc_named(NULL, 0, "ndr_print_EcDoRpcExt2");
1546 ndr_print_struct(ndr, name, "EcDoRpcExt2");
1548 if (flags & NDR_SET_VALUES) {
1549 ndr->flags |= LIBNDR_PRINT_SET_VALUES;
1551 if (flags & NDR_IN) {
1552 ndr_print_struct(ndr, "in", "EcDoRpcExt2");
1554 ndr_print_ptr(ndr, "handle", r->in.handle);
1556 ndr_print_policy_handle(ndr, "handle", r->in.handle);
1558 ndr_print_ptr(ndr, "pulFlags", r->in.pulFlags);
1560 ndr_print_uint32(ndr, "pulFlags", *r->in.pulFlags);
1563 /* Put MAPI request blob into a ndr_pull structure */
1564 rgbIn.data = (uint8_t *)talloc_memdup(mem_ctx, r->in.rgbIn, r->in.cbIn);
1565 rgbIn.length = r->in.cbIn;
1566 dump_data(0, rgbIn.data, rgbIn.length);
1567 ndr_pull = ndr_pull_init_blob(&rgbIn, mem_ctx);
1568 ndr_set_flags(&ndr_pull->flags, LIBNDR_FLAG_NOALIGN);
1569 mapi_request = talloc_zero(mem_ctx, struct mapi2k7_request);
1570 mapi_request->mapi_request = talloc_zero(mapi_request, struct mapi_request);
1571 ndr_pull_mapi2k7_request(ndr_pull, NDR_SCALARS|NDR_BUFFERS, mapi_request);
1572 ndr_print_mapi2k7_request(ndr, "mapi_request", (const struct mapi2k7_request *)mapi_request);
1573 talloc_free(mapi_request);
1574 talloc_free(ndr_pull);
1575 talloc_free(rgbIn.data);
1577 ndr_print_uint32(ndr, "cbIn", r->in.cbIn);
1578 ndr_print_ptr(ndr, "pcbOut", r->in.pcbOut);
1580 ndr_print_uint32(ndr, "pcbOut", *r->in.pcbOut);
1583 rgbAuxIn.data = r->in.rgbAuxIn;
1584 rgbAuxIn.length = r->in.cbAuxIn;
1585 ndr_print_DATA_BLOB(ndr, "rgbAuxIn", rgbAuxIn);
1586 /* ndr_print_array_uint8(ndr, "rgbAuxIn", r->in.rgbAuxIn, r->in.cbAuxIn); */
1587 ndr_print_uint32(ndr, "cbAuxIn", r->in.cbAuxIn);
1588 ndr_print_ptr(ndr, "pcbAuxOut", r->in.pcbAuxOut);
1590 ndr_print_uint32(ndr, "pcbAuxOut", *r->in.pcbAuxOut);
1594 if (flags & NDR_OUT) {
1595 ndr_print_struct(ndr, "out", "EcDoRpcExt2");
1597 ndr_print_ptr(ndr, "handle", r->out.handle);
1599 ndr_print_policy_handle(ndr, "handle", r->out.handle);
1601 ndr_print_ptr(ndr, "pulFlags", r->out.pulFlags);
1603 ndr_print_uint32(ndr, "pulFlags", *r->out.pulFlags);
1606 /* Put MAPI response blob into a ndr_pull structure */
1607 if (*r->out.pcbOut) {
1608 rgbOut.data = (uint8_t *)talloc_memdup(mem_ctx, r->out.rgbOut, *r->out.pcbOut);
1609 rgbOut.length = *r->out.pcbOut;
1610 ndr_pull = ndr_pull_init_blob(&rgbOut, mem_ctx);
1611 ndr_set_flags(&ndr_pull->flags, LIBNDR_FLAG_NOALIGN);
1612 while (ndr_pull->offset < ndr_pull->data_size) {
1613 mapi_response = talloc_zero(NULL, struct mapi2k7_response);
1614 mapi_response->mapi_response = talloc_zero(mapi_response, struct mapi_response);
1615 ndr_pull_mapi2k7_response(ndr_pull, NDR_SCALARS|NDR_BUFFERS, mapi_response);
1616 ndr_print_mapi2k7_response(ndr, "mapi_response",
1617 (const struct mapi2k7_response *)mapi_response);
1618 talloc_free(mapi_response);
1620 talloc_free(ndr_pull);
1621 talloc_free(rgbOut.data);
1623 /* ndr_print_array_uint8(ndr, "rgbOut", r->out.rgbOut, *r->out.pcbOut); */
1624 ndr_print_ptr(ndr, "pcbOut", r->out.pcbOut);
1626 ndr_print_uint32(ndr, "pcbOut", *r->out.pcbOut);
1628 if (r->out.rgbAuxOut && r->out.pcbAuxOut) {
1629 ndr->print(ndr, "%s: ARRAY(%d)", "rgbAuxOut", (int)*r->out.pcbAuxOut);
1631 for (cntr_rgbAuxOut_0=0;cntr_rgbAuxOut_0<*r->out.pcbAuxOut;cntr_rgbAuxOut_0++) {
1633 if (asprintf(&idx_0, "[%d]", cntr_rgbAuxOut_0) != -1) {
1634 ndr_print_uint32(ndr, "rgbAuxOut", r->out.rgbAuxOut[cntr_rgbAuxOut_0]);
1639 ndr->print(ndr, "%s: NULL", "rgbAuxOut");
1642 ndr_print_ptr(ndr, "pcbAuxOut", r->out.pcbAuxOut);
1644 ndr_print_uint32(ndr, "pcbAuxOut", *r->out.pcbAuxOut);
1646 ndr_print_ptr(ndr, "pulTransTime", r->out.pulTransTime);
1648 ndr_print_uint32(ndr, "pulTransTime", *r->out.pulTransTime);
1650 ndr_print_MAPISTATUS(ndr, "result", r->out.result);
1655 talloc_free(mem_ctx);
1659 We need to pull QueryRows replies on our own:
1660 If we have no results, do not push/pull the DATA_BLOB
1663 enum ndr_err_code ndr_push_QueryRows_repl(struct ndr_push *ndr, int ndr_flags, const struct QueryRows_repl *r)
1666 uint32_t _flags_save_STRUCT = ndr->flags;
1667 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
1668 if (ndr_flags & NDR_SCALARS) {
1669 NDR_CHECK(ndr_push_align(ndr, 4));
1670 NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->Origin));
1671 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->RowCount));
1674 uint32_t _flags_save_DATA_BLOB = ndr->flags;
1675 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING);
1676 NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->RowData));
1677 ndr->flags = _flags_save_DATA_BLOB;
1680 if (ndr_flags & NDR_BUFFERS) {
1682 ndr->flags = _flags_save_STRUCT;
1684 return NDR_ERR_SUCCESS;
1687 enum ndr_err_code ndr_pull_QueryRows_repl(struct ndr_pull *ndr, int ndr_flags, struct QueryRows_repl *r)
1690 uint32_t _flags_save_STRUCT = ndr->flags;
1691 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
1692 if (ndr_flags & NDR_SCALARS) {
1693 NDR_CHECK(ndr_pull_align(ndr, 4));
1694 NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->Origin));
1695 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->RowCount));
1699 uint32_t _flags_save_DATA_BLOB = ndr->flags;
1701 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING);
1702 NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->RowData));
1703 ndr->flags = _flags_save_DATA_BLOB;
1705 r->RowData.length = 0;
1706 r->RowData.data = NULL;
1709 if (ndr_flags & NDR_BUFFERS) {
1711 ndr->flags = _flags_save_STRUCT;
1713 return NDR_ERR_SUCCESS;
1717 enum ndr_err_code ndr_push_Logon_req(struct ndr_push *ndr, int ndr_flags, const struct Logon_req *r)
1720 uint32_t _flags_save_STRUCT = ndr->flags;
1721 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
1722 if (ndr_flags & NDR_SCALARS) {
1723 NDR_CHECK(ndr_push_align(ndr, 4));
1724 NDR_CHECK(ndr_push_LogonFlags(ndr, NDR_SCALARS, r->LogonFlags));
1725 NDR_CHECK(ndr_push_OpenFlags(ndr, NDR_SCALARS, r->OpenFlags));
1726 NDR_CHECK(ndr_push_StoreState(ndr, NDR_SCALARS, r->StoreState));
1727 if (r->EssDN && r->EssDN[0] != '\0') {
1728 uint32_t _flags_save_string = ndr->flags;
1729 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_SIZE2);
1730 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->EssDN));
1731 ndr->flags = _flags_save_string;
1733 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, 0));
1736 if (ndr_flags & NDR_BUFFERS) {
1738 ndr->flags = _flags_save_STRUCT;
1740 return NDR_ERR_SUCCESS;
1744 _PUBLIC_ void ndr_print_SBinary_short(struct ndr_print *ndr, const char *name, const struct SBinary_short *r)
1746 ndr->print(ndr, "%-25s: SBinary_short cb=%u", name, (unsigned)r->cb);
1748 uint32_t _flags_save_STRUCT = ndr->flags;
1749 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
1751 dump_data(0, r->lpb, r->cb);
1753 ndr->flags = _flags_save_STRUCT;
1757 _PUBLIC_ void ndr_print_Binary_r(struct ndr_print *ndr, const char *name, const struct Binary_r *r)
1759 ndr->print(ndr, "%-25s: Binary_r cb=%u", name, (unsigned)r->cb);
1761 uint32_t _flags_save_STRUCT = ndr->flags;
1762 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
1764 dump_data(0, r->lpb, r->cb);
1766 ndr->flags = _flags_save_STRUCT;
1770 _PUBLIC_ void ndr_print_fuzzyLevel(struct ndr_print *ndr, const char *name, uint32_t r)
1772 ndr_print_uint32(ndr, name, r);
1774 switch ((r & 0x0000FFFF)) {
1776 ndr->print(ndr, "%-25s: FL_FULLSTRING", "lower 16 bits");
1779 ndr->print(ndr, "%-25s: FL_SUBSTRING", "lower 16 bits");
1782 ndr->print(ndr, "%-25s: FL_PREFIX", "lower 16 bits");
1785 ndr->print(ndr, "%-25s", "higher 16 bits");
1786 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "FL_IGNORECASE", FL_IGNORECASE, r);
1787 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "FL_IGNORENONSPACE", FL_IGNORENONSPACE, r);
1788 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "FL_LOOSE", FL_LOOSE, r);
1793 * Fake wrapper over mapi_SRestriction. Workaround the no-pointer deep
1794 * recursion problem in pidl
1796 enum ndr_err_code ndr_push_mapi_SRestriction_wrap(struct ndr_push *ndr, int ndr_flags, const struct mapi_SRestriction_wrap *r)
1798 return ndr_push_mapi_SRestriction(ndr, ndr_flags, (struct mapi_SRestriction *)r);
1801 enum ndr_err_code ndr_pull_mapi_SRestriction_wrap(struct ndr_pull *ndr, int ndr_flags, struct mapi_SRestriction_wrap *r)
1803 return ndr_pull_mapi_SRestriction(ndr, ndr_flags, (struct mapi_SRestriction *)r);
1806 void ndr_print_mapi_SRestriction_wrap(struct ndr_print *ndr, const char *name, const struct mapi_SRestriction_wrap *r)
1808 ndr_print_mapi_SRestriction(ndr, name, (const struct mapi_SRestriction *)r);
1812 * Fake wrapper over mapi_SNotRestriction. Workaround the pointer inclusion
1815 enum ndr_err_code ndr_push_mapi_SNotRestriction(struct ndr_push *ndr, int ndr_flags, const struct mapi_SNotRestriction *r)
1817 return ndr_push_mapi_SRestriction(ndr, ndr_flags, r->res);
1820 enum ndr_err_code ndr_pull_mapi_SNotRestriction(struct ndr_pull *ndr, int ndr_flags, struct mapi_SNotRestriction *r)
1822 return ndr_pull_mapi_SRestriction(ndr, ndr_flags, r->res);
1825 void ndr_print_mapi_SNotRestriction(struct ndr_print *ndr, const char *name, const struct mapi_SNotRestriction *r)
1827 ndr_print_mapi_SRestriction(ndr, name, r->res);
1831 * Fake wrapper over mapi_SPropValue. Workaround the no-pointer deep
1832 * recursion problem in pidl
1834 enum ndr_err_code ndr_push_mapi_SPropValue_wrap(struct ndr_push *ndr, int ndr_flags, const struct mapi_SPropValue_wrap *r)
1836 NDR_CHECK(ndr_push_align(ndr, 8));
1837 return ndr_push_mapi_SPropValue(ndr, NDR_SCALARS, (const struct mapi_SPropValue *)r);
1840 enum ndr_err_code ndr_pull_mapi_SPropValue_wrap(struct ndr_pull *ndr, int ndr_flags, struct mapi_SPropValue_wrap *r)
1842 return ndr_pull_mapi_SPropValue(ndr, NDR_SCALARS, (struct mapi_SPropValue *)r);
1845 void ndr_print_mapi_SPropValue_wrap(struct ndr_print *ndr, const char *name, const struct mapi_SPropValue_wrap *r)
1847 ndr_print_mapi_SPropValue(ndr, name, (const struct mapi_SPropValue *)r);
1852 * Fake wrapper over mapi_SPropValue_array. Workaround the no-pointer deep
1853 * recursion problem in pidl
1855 enum ndr_err_code ndr_push_mapi_SPropValue_array_wrap(struct ndr_push *ndr, int ndr_flags, const struct mapi_SPropValue_array_wrap *r)
1857 NDR_CHECK(ndr_push_align(ndr, 8));
1858 return ndr_push_mapi_SPropValue_array(ndr, NDR_SCALARS, (const struct mapi_SPropValue_array *)r);
1861 enum ndr_err_code ndr_pull_mapi_SPropValue_array_wrap(struct ndr_pull *ndr, int ndr_flags, struct mapi_SPropValue_array_wrap *r)
1863 return ndr_pull_mapi_SPropValue_array(ndr, NDR_SCALARS, (struct mapi_SPropValue_array *)r);
1866 void ndr_print_mapi_SPropValue_array_wrap(struct ndr_print *ndr, const char *name, const struct mapi_SPropValue_array_wrap *r)
1868 ndr_print_mapi_SPropValue_array(ndr, name, (const struct mapi_SPropValue_array *)r);
1871 enum ndr_err_code ndr_push_RestrictionVariable(struct ndr_push *ndr, int ndr_flags, const union RestrictionVariable *r)
1874 uint32_t _flags_save_STRUCT = ndr->flags;
1875 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
1876 if (ndr_flags & NDR_SCALARS) {
1877 int level = ndr_push_get_switch_value(ndr, r);
1883 NDR_CHECK(ndr_push_mapi_SRestriction_comment(ndr, NDR_SCALARS, &r->res[0]));
1887 return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
1890 if (ndr_flags & NDR_BUFFERS) {
1891 int level = ndr_push_get_switch_value(ndr, r);
1898 NDR_CHECK(ndr_push_mapi_SRestriction_comment(ndr, NDR_BUFFERS, &r->res[0]));
1903 return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
1906 ndr->flags = _flags_save_STRUCT;
1908 return NDR_ERR_SUCCESS;
1911 enum ndr_err_code ndr_pull_RestrictionVariable(struct ndr_pull *ndr, int ndr_flags, union RestrictionVariable *r)
1914 TALLOC_CTX *_mem_save_res_0;
1915 level = ndr_pull_get_switch_value(ndr, r);
1917 uint32_t _flags_save_STRUCT = ndr->flags;
1918 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
1920 if (ndr_flags & NDR_SCALARS) {
1926 NDR_CHECK(ndr_pull_align(ndr, 4));
1927 NDR_PULL_ALLOC_N(ndr, r->res, 1);
1928 _mem_save_res_0 = NDR_PULL_GET_MEM_CTX(ndr);
1929 NDR_PULL_SET_MEM_CTX(ndr, r->res, 0);
1930 NDR_CHECK(ndr_pull_mapi_SRestriction_comment(ndr, NDR_SCALARS, &r->res[0]));
1931 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_res_0, 0);
1935 return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
1938 if (ndr_flags & NDR_BUFFERS) {
1945 _mem_save_res_0 = NDR_PULL_GET_MEM_CTX(ndr);
1946 NDR_PULL_SET_MEM_CTX(ndr, r->res, 0);
1947 NDR_CHECK(ndr_pull_mapi_SRestriction_comment(ndr, NDR_BUFFERS, &r->res[0]));
1948 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_res_0, 0);
1952 return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
1955 ndr->flags = _flags_save_STRUCT;
1957 return NDR_ERR_SUCCESS;
1961 _PUBLIC_ void ndr_print_RestrictionVariable(struct ndr_print *ndr, const char *name, const union RestrictionVariable *r)
1964 level = ndr_print_get_switch_value(ndr, r);
1965 ndr_print_union(ndr, name, level, "RestrictionVariable");
1971 ndr_print_ptr(ndr, "res", r->res);
1974 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
1975 ndr_print_mapi_SRestriction_comment(ndr, "res", &r->res[0]);
1982 enum ndr_err_code ndr_push_Release_req(struct ndr_push *ndr, int ndr_flags, const struct Release_req *r)
1984 return NDR_ERR_SUCCESS;
1987 enum ndr_err_code ndr_pull_Release_req(struct ndr_pull *ndr, int ndr_flags, struct Release_req *r)
1989 return NDR_ERR_SUCCESS;
1992 enum ndr_err_code ndr_push_Release_repl(struct ndr_push *ndr, int ndr_flags, const struct Release_repl *r)
1994 return NDR_ERR_SUCCESS;
1997 enum ndr_err_code ndr_pull_Release_repl(struct ndr_pull *ndr, int ndr_flags, struct Release_repl *r)
1999 return NDR_ERR_SUCCESS;
2003 enum ndr_err_code ndr_push_GetSearchCriteria_repl(struct ndr_push *ndr, int ndr_flags, const struct GetSearchCriteria_repl *r)
2005 uint32_t cntr_FolderIds_0;
2007 uint32_t _flags_save_STRUCT = ndr->flags;
2008 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
2009 if (ndr_flags & NDR_SCALARS) {
2010 NDR_CHECK(ndr_push_align(ndr, 8));
2011 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->RestrictionDataSize));
2012 if (r->RestrictionDataSize) {
2013 struct ndr_push *_ndr_RestrictionData;
2014 NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_RestrictionData, 0, r->RestrictionDataSize));
2015 NDR_CHECK(ndr_push_mapi_SRestriction(_ndr_RestrictionData, NDR_SCALARS|NDR_BUFFERS, &r->RestrictionData));
2016 NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_RestrictionData, 0, r->RestrictionDataSize));
2018 NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->LogonId));
2019 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->FolderIdCount));
2020 for (cntr_FolderIds_0 = 0; cntr_FolderIds_0 < r->FolderIdCount; cntr_FolderIds_0++) {
2021 NDR_CHECK(ndr_push_hyper(ndr, NDR_SCALARS, r->FolderIds[cntr_FolderIds_0]));
2023 NDR_CHECK(ndr_push_SearchFlags(ndr, NDR_SCALARS, r->SearchFlags));
2024 NDR_CHECK(ndr_push_trailer_align(ndr, 8));
2026 if (ndr_flags & NDR_BUFFERS) {
2028 ndr->flags = _flags_save_STRUCT;
2030 return NDR_ERR_SUCCESS;
2034 enum ndr_err_code ndr_pull_GetSearchCriteria_repl(struct ndr_pull *ndr, int ndr_flags, struct GetSearchCriteria_repl *r)
2036 uint32_t cntr_FolderIds_0;
2037 TALLOC_CTX *_mem_save_FolderIds_0;
2039 uint32_t _flags_save_STRUCT = ndr->flags;
2040 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
2041 if (ndr_flags & NDR_SCALARS) {
2042 NDR_CHECK(ndr_pull_align(ndr, 8));
2043 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->RestrictionDataSize));
2044 if (r->RestrictionDataSize) {
2045 struct ndr_pull *_ndr_RestrictionData;
2046 NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_RestrictionData, 0, r->RestrictionDataSize));
2047 NDR_CHECK(ndr_pull_mapi_SRestriction(_ndr_RestrictionData, NDR_SCALARS|NDR_BUFFERS, &r->RestrictionData));
2048 NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_RestrictionData, 0, r->RestrictionDataSize));
2050 NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->LogonId));
2051 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->FolderIdCount));
2052 NDR_PULL_ALLOC_N(ndr, r->FolderIds, r->FolderIdCount);
2053 _mem_save_FolderIds_0 = NDR_PULL_GET_MEM_CTX(ndr);
2054 NDR_PULL_SET_MEM_CTX(ndr, r->FolderIds, 0);
2055 for (cntr_FolderIds_0 = 0; cntr_FolderIds_0 < r->FolderIdCount; cntr_FolderIds_0++) {
2056 NDR_CHECK(ndr_pull_hyper(ndr, NDR_SCALARS, &r->FolderIds[cntr_FolderIds_0]));
2058 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_FolderIds_0, 0);
2059 NDR_CHECK(ndr_pull_SearchFlags(ndr, NDR_SCALARS, &r->SearchFlags));
2060 NDR_CHECK(ndr_pull_trailer_align(ndr, 8));
2062 if (ndr_flags & NDR_BUFFERS) {
2064 ndr->flags = _flags_save_STRUCT;
2066 return NDR_ERR_SUCCESS;
2070 void ndr_print_GetSearchCriteria_repl(struct ndr_print *ndr, const char *name, const struct GetSearchCriteria_repl *r)
2072 uint32_t cntr_FolderIds_0;
2073 ndr_print_struct(ndr, name, "GetSearchCriteria_repl");
2075 uint32_t _flags_save_STRUCT = ndr->flags;
2076 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
2078 ndr_print_uint16(ndr, "RestrictionDataSize", r->RestrictionDataSize);
2079 if (r->RestrictionDataSize) {
2080 ndr_print_mapi_SRestriction(ndr, "RestrictionData", &r->RestrictionData);
2082 ndr_print_uint8(ndr, "RestrictionData", 0);
2084 ndr_print_uint8(ndr, "LogonId", r->LogonId);
2085 ndr_print_uint16(ndr, "FolderIdCount", r->FolderIdCount);
2086 ndr->print(ndr, "%s: ARRAY(%d)", "FolderIds", (int)r->FolderIdCount);
2088 for (cntr_FolderIds_0=0;cntr_FolderIds_0<r->FolderIdCount;cntr_FolderIds_0++) {
2090 if (asprintf(&idx_0, "[%d]", cntr_FolderIds_0) != -1) {
2091 ndr_print_hyper(ndr, "FolderIds", r->FolderIds[cntr_FolderIds_0]);
2096 ndr_print_SearchFlags(ndr, "SearchFlags", r->SearchFlags);
2098 ndr->flags = _flags_save_STRUCT;
2102 enum ndr_err_code ndr_push_Backoff_req(struct ndr_push *ndr, int ndr_flags, const struct Backoff_req *r)
2104 return NDR_ERR_SUCCESS;
2107 enum ndr_err_code ndr_pull_Backoff_req(struct ndr_pull *ndr, int ndr_flags, struct Backoff_req *r)
2109 return NDR_ERR_SUCCESS;
2112 enum ndr_err_code ndr_push_Backoff_repl(struct ndr_push *ndr, int ndr_flags, const struct Backoff_repl *r)
2114 return NDR_ERR_SUCCESS;
2117 enum ndr_err_code ndr_pull_Backoff_repl(struct ndr_pull *ndr, int ndr_flags, struct Backoff_repl *r)
2119 return NDR_ERR_SUCCESS;
2122 enum ndr_err_code ndr_push_BufferTooSmall_req(struct ndr_push *ndr, int ndr_flags, const struct BufferTooSmall_req *r)
2124 return NDR_ERR_SUCCESS;
2127 enum ndr_err_code ndr_pull_BufferTooSmall_req(struct ndr_pull *ndr, int ndr_flags, struct BufferTooSmall_req *r)
2129 return NDR_ERR_SUCCESS;
2132 enum ndr_err_code ndr_push_BufferTooSmall_repl(struct ndr_push *ndr, int ndr_flags, const struct BufferTooSmall_repl *r)
2134 return NDR_ERR_SUCCESS;
2137 enum ndr_err_code ndr_pull_BufferTooSmall_repl(struct ndr_pull *ndr, int ndr_flags, struct BufferTooSmall_repl *r)
2139 return NDR_ERR_SUCCESS;