2 OpenChange implementation.
6 Copyright (C) Julien Kerihuel 2005-2007
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>
24 #include <gen_ndr/ndr_exchange.h>
27 static void obfuscate_data(uint8_t *data, uint32_t size, uint8_t salt)
31 for (i=0; i<size; i++) {
37 print mapi_request / mapi_response structures
40 void ndr_print_mapi_request(struct ndr_print *ndr, const char *name, const struct mapi_request *r)
44 rlength = r->mapi_len - r->length;
46 ndr_print_uint32(ndr, "mapi_len", r->mapi_len);
47 if (r->length && r->length > sizeof(uint16_t)) {
48 uint32_t cntr_mapi_req_0;
50 ndr_print_uint16(ndr, "length", r->length);
52 for (cntr_mapi_req_0=0; r->mapi_req[cntr_mapi_req_0].opnum; cntr_mapi_req_0++) {
54 asprintf(&idx_0, "[%d]", cntr_mapi_req_0);
56 ndr_print_EcDoRpc_MAPI_REQ(ndr, "mapi_request", &r->mapi_req[cntr_mapi_req_0]);
67 ndr->print(ndr, "%-25s: (handles) number=%u", name, rlength / 4);
69 for (i = 0; i < (rlength / 4); i++) {
70 ndr_print_uint32(ndr, "handle", r->handles[i]);
76 void ndr_print_mapi_response(struct ndr_print *ndr, const char *name, const struct mapi_response *r)
80 rlength = r->mapi_len - r->length;
82 ndr->print(ndr, "%-25s: length=%u", name, r->length);
83 if (r->length && r->length > sizeof(uint16_t)) {
84 uint32_t cntr_mapi_repl_0;
86 ndr->print(ndr, "%s: ARRAY(%d)", name, r->length - 2);
88 for (cntr_mapi_repl_0=0; r->mapi_repl[cntr_mapi_repl_0].opnum; cntr_mapi_repl_0++) {
89 ndr_print_EcDoRpc_MAPI_REPL(ndr, "mapi_repl", &r->mapi_repl[cntr_mapi_repl_0]);
94 ndr->print(ndr, "%-25s: (handles) number=%u", name, rlength / 4);
101 for (i = 0; i < (rlength / 4); i++) {
102 ndr_print_uint32(ndr, "handle id", r->handles[i]);
110 push mapi_request / mapi_response onto the wire.
112 MAPI length field includes length bytes.
113 But these bytes do not belong to the mapi content in the user
114 context. We have to add them when pushing mapi content length
115 (uint16_t) and next substract when pushing the content blob
118 enum ndr_err_code ndr_push_mapi_request(struct ndr_push *ndr, int ndr_flags, const struct mapi_request *r)
120 uint32_t cntr_mapi_req_0;
123 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
124 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->length));
126 for (count = 0; ndr->offset < r->length - 2; count++) {
127 NDR_CHECK(ndr_push_EcDoRpc_MAPI_REQ(ndr, NDR_SCALARS, &r->mapi_req[count]));
130 count = (r->mapi_len - r->length) / sizeof(uint32_t);
131 for (cntr_mapi_req_0=0; cntr_mapi_req_0 < count; cntr_mapi_req_0++) {
132 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->handles[cntr_mapi_req_0]));
135 obfuscate_data(ndr->data, ndr->offset, 0xA5);
137 return NDR_ERR_SUCCESS;
140 enum ndr_err_code ndr_push_mapi_response(struct ndr_push *ndr, int ndr_flags, const struct mapi_response *r)
142 uint32_t cntr_mapi_repl_0;
145 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING);
146 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->length));
148 if (r->length > sizeof (uint16_t)) {
149 for (count = 0; ndr->offset < r->length - 2; count++) {
150 NDR_CHECK(ndr_push_EcDoRpc_MAPI_REPL(ndr, NDR_SCALARS, &r->mapi_repl[count]));
153 /* hack adding padding bytes */
154 count = r->length - ndr->offset;
156 for (cntr_mapi_repl_0 =0; cntr_mapi_repl_0 < count; cntr_mapi_repl_0++) {
157 NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, 0));
162 count = (r->mapi_len - r->length) / sizeof (uint32_t);
163 for (cntr_mapi_repl_0 = 0; cntr_mapi_repl_0 <count; cntr_mapi_repl_0++) {
164 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->handles[cntr_mapi_repl_0]));
167 obfuscate_data(ndr->data, ndr->alloc_size, 0xA5);
169 return NDR_ERR_SUCCESS;
173 pull mapi_request / mapi_response from the wire
176 enum ndr_err_code ndr_pull_mapi_request(struct ndr_pull *ndr, int ndr_flags, struct mapi_request *r)
178 uint32_t length,count;
179 uint32_t cntr_mapi_req_0;
180 TALLOC_CTX *_mem_save_mapi_req_0;
181 TALLOC_CTX *_mem_save_handles_0;
182 struct ndr_pull *_ndr_mapi_req;
184 obfuscate_data(ndr->data, ndr->data_size, 0xA5);
186 if (ndr->flags & LIBNDR_FLAG_REMAINING) {
187 length = ndr->data_size - ndr->offset;
189 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &length));
191 r->mapi_len = length;
193 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->length));
195 /* If length equals length field then skipping subcontext */
196 if (r->length > sizeof (uint16_t)) {
197 NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_mapi_req, 0, r->length - 2));
198 _mem_save_mapi_req_0 = NDR_PULL_GET_MEM_CTX(_ndr_mapi_req);
199 r->mapi_req = talloc_zero(_mem_save_mapi_req_0, struct EcDoRpc_MAPI_REQ);
200 for (cntr_mapi_req_0 = 0; _ndr_mapi_req->offset < _ndr_mapi_req->data_size - 2; cntr_mapi_req_0++) {
201 NDR_CHECK(ndr_pull_EcDoRpc_MAPI_REQ(_ndr_mapi_req, NDR_SCALARS, &r->mapi_req[cntr_mapi_req_0]));
202 r->mapi_req = talloc_realloc(_mem_save_mapi_req_0, r->mapi_req, struct EcDoRpc_MAPI_REQ, cntr_mapi_req_0 + 2);
204 r->mapi_req = talloc_realloc(_mem_save_mapi_req_0, r->mapi_req, struct EcDoRpc_MAPI_REQ, cntr_mapi_req_0 + 2);
205 r->mapi_req[cntr_mapi_req_0].opnum = 0;
207 if (_ndr_mapi_req->offset != r->length - 2) {
208 return NDR_ERR_BUFSIZE;
210 NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_mapi_req, 4, -1));
212 _mem_save_handles_0 = NDR_PULL_GET_MEM_CTX(ndr);
213 count = (r->mapi_len - r->length) / sizeof(uint32_t);
214 r->handles = talloc_array(_mem_save_handles_0, uint32_t, count + 1);
215 for (cntr_mapi_req_0=0; cntr_mapi_req_0 < count; cntr_mapi_req_0++) {
216 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->handles[cntr_mapi_req_0]));
222 return NDR_ERR_SUCCESS;
225 enum ndr_err_code ndr_pull_mapi_response(struct ndr_pull *ndr, int ndr_flags, struct mapi_response *r)
227 uint32_t length,count;
228 uint32_t cntr_mapi_repl_0;
229 TALLOC_CTX *_mem_save_mapi_repl_0;
230 TALLOC_CTX *_mem_save_handles_0;
231 struct ndr_pull *_ndr_mapi_repl;
233 obfuscate_data(ndr->data, ndr->data_size, 0xA5);
235 if (ndr->flags & LIBNDR_FLAG_REMAINING) {
236 length = ndr->data_size - ndr->offset;
238 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &length));
240 r->mapi_len = length;
242 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->length));
244 /* If length equals length field then skipping subcontext */
245 if (r->length > sizeof (uint16_t)) {
246 NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_mapi_repl, 0, r->length - 2));
247 _mem_save_mapi_repl_0 = NDR_PULL_GET_MEM_CTX(_ndr_mapi_repl);
248 r->mapi_repl = talloc_zero(_mem_save_mapi_repl_0, struct EcDoRpc_MAPI_REPL);
249 for (cntr_mapi_repl_0 = 0; _ndr_mapi_repl->offset < _ndr_mapi_repl->data_size - 2; cntr_mapi_repl_0++) {
250 NDR_CHECK(ndr_pull_EcDoRpc_MAPI_REPL(_ndr_mapi_repl, NDR_SCALARS, &r->mapi_repl[cntr_mapi_repl_0]));
251 r->mapi_repl = talloc_realloc(_mem_save_mapi_repl_0, r->mapi_repl, struct EcDoRpc_MAPI_REPL, cntr_mapi_repl_0 + 2);
253 r->mapi_repl = talloc_realloc(_mem_save_mapi_repl_0, r->mapi_repl, struct EcDoRpc_MAPI_REPL, cntr_mapi_repl_0 + 2);
254 r->mapi_repl[cntr_mapi_repl_0].opnum = 0;
255 NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_mapi_repl, 4, -1));
258 _mem_save_handles_0 = NDR_PULL_GET_MEM_CTX(ndr);
259 count = (r->mapi_len - r->length) / sizeof(uint32_t);
260 r->handles = talloc_array(_mem_save_handles_0, uint32_t, count + 1);
261 for (cntr_mapi_repl_0=0; cntr_mapi_repl_0 < count; cntr_mapi_repl_0++) {
262 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->handles[cntr_mapi_repl_0]));
265 return NDR_ERR_SUCCESS;
269 We stop processing the IDL if MAPISTATUS is different from MAPI_E_SUCCESS
272 _PUBLIC_ enum ndr_err_code ndr_push_EcDoRpc_MAPI_REPL(struct ndr_push *ndr, int ndr_flags, const struct EcDoRpc_MAPI_REPL *r)
274 if (r->opnum != op_MAPI_Release)
276 uint32_t _flags_save_STRUCT = ndr->flags;
277 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
278 if (ndr_flags & NDR_SCALARS) {
279 NDR_CHECK(ndr_push_align(ndr, 8));
280 NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->opnum));
281 if ((r->opnum == op_MAPI_Notify) || (r->opnum == op_MAPI_Pending)) {
282 NDR_CHECK(ndr_push_set_switch_value(ndr, &r->u, r->opnum));
283 NDR_CHECK(ndr_push_EcDoRpc_MAPI_REPL_UNION(ndr, NDR_SCALARS, &r->u));
285 NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->handle_idx));
286 NDR_CHECK(ndr_push_MAPISTATUS(ndr, NDR_SCALARS, r->error_code));
287 if (r->error_code == MAPI_E_SUCCESS) {
288 NDR_CHECK(ndr_push_set_switch_value(ndr, &r->u, r->opnum));
289 NDR_CHECK(ndr_push_EcDoRpc_MAPI_REPL_UNION(ndr, NDR_SCALARS, &r->u));
293 if (ndr_flags & NDR_BUFFERS) {
294 NDR_CHECK(ndr_push_EcDoRpc_MAPI_REPL_UNION(ndr, NDR_BUFFERS, &r->u));
296 ndr->flags = _flags_save_STRUCT;
298 return NDR_ERR_SUCCESS;
301 enum ndr_err_code ndr_pull_EcDoRpc_MAPI_REPL(struct ndr_pull *ndr, int ndr_flags, struct EcDoRpc_MAPI_REPL *r)
304 uint32_t _flags_save_STRUCT = ndr->flags;
305 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
306 if (ndr_flags & NDR_SCALARS) {
307 NDR_CHECK(ndr_pull_align(ndr, 8));
308 NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->opnum));
309 if ((r->opnum == op_MAPI_Notify) || (r->opnum == op_MAPI_Pending)) {
310 NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->u, r->opnum));
311 NDR_CHECK(ndr_pull_EcDoRpc_MAPI_REPL_UNION(ndr, NDR_SCALARS, &r->u));
313 NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->handle_idx));
314 NDR_CHECK(ndr_pull_MAPISTATUS(ndr, NDR_SCALARS, &r->error_code));
315 if ( r->error_code == MAPI_E_SUCCESS) {
316 NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->u, r->opnum));
317 NDR_CHECK(ndr_pull_EcDoRpc_MAPI_REPL_UNION(ndr, NDR_SCALARS, &r->u));
321 if (ndr_flags & NDR_BUFFERS) {
322 ndr->flags = _flags_save_STRUCT;
325 return NDR_ERR_SUCCESS;
328 void ndr_print_EcDoRpc_MAPI_REPL(struct ndr_print *ndr, const char *name, const struct EcDoRpc_MAPI_REPL *r)
330 ndr_print_struct(ndr, name, "EcDoRpc_MAPI_REPL");
332 uint32_t _flags_save_STRUCT = ndr->flags;
333 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
335 ndr_print_uint8(ndr, "opnum", r->opnum);
336 if ((r->opnum != op_MAPI_Notify) && (r->opnum != op_MAPI_Pending)) {
337 ndr_print_uint8(ndr, "handle_idx", r->handle_idx);
338 ndr_print_MAPISTATUS(ndr, "error_code", r->error_code);
339 if (r->error_code == MAPI_E_SUCCESS) {
340 ndr_print_set_switch_value(ndr, &r->u, r->opnum);
341 ndr_print_EcDoRpc_MAPI_REPL_UNION(ndr, "u", &r->u);
344 ndr_print_set_switch_value(ndr, &r->u, r->opnum);
345 ndr_print_EcDoRpc_MAPI_REPL_UNION(ndr, "u", &r->u);
348 ndr->flags = _flags_save_STRUCT;
353 We need to pull QueryRows replies on our own:
354 If we have no results, do not push/pull the DATA_BLOB
357 enum ndr_err_code ndr_push_QueryRows_repl(struct ndr_push *ndr, int ndr_flags, const struct QueryRows_repl *r)
360 uint32_t _flags_save_STRUCT = ndr->flags;
361 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
362 if (ndr_flags & NDR_SCALARS) {
363 NDR_CHECK(ndr_push_align(ndr, 4));
364 NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->Origin));
365 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->RowCount));
368 uint32_t _flags_save_DATA_BLOB = ndr->flags;
369 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING);
370 NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->RowData));
371 ndr->flags = _flags_save_DATA_BLOB;
374 if (ndr_flags & NDR_BUFFERS) {
376 ndr->flags = _flags_save_STRUCT;
378 return NDR_ERR_SUCCESS;
381 enum ndr_err_code ndr_pull_QueryRows_repl(struct ndr_pull *ndr, int ndr_flags, struct QueryRows_repl *r)
384 uint32_t _flags_save_STRUCT = ndr->flags;
385 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
386 if (ndr_flags & NDR_SCALARS) {
387 NDR_CHECK(ndr_pull_align(ndr, 4));
388 NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->Origin));
389 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->RowCount));
393 uint32_t _flags_save_DATA_BLOB = ndr->flags;
395 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING);
396 NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->RowData));
397 ndr->flags = _flags_save_DATA_BLOB;
400 if (ndr_flags & NDR_BUFFERS) {
402 ndr->flags = _flags_save_STRUCT;
404 return NDR_ERR_SUCCESS;
408 enum ndr_err_code ndr_push_Logon_req(struct ndr_push *ndr, int ndr_flags, const struct Logon_req *r)
411 uint32_t _flags_save_STRUCT = ndr->flags;
412 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
413 if (ndr_flags & NDR_SCALARS) {
414 NDR_CHECK(ndr_push_align(ndr, 4));
415 NDR_CHECK(ndr_push_LogonFlags(ndr, NDR_SCALARS, r->LogonFlags));
416 NDR_CHECK(ndr_push_OpenFlags(ndr, NDR_SCALARS, r->OpenFlags));
417 NDR_CHECK(ndr_push_StoreState(ndr, NDR_SCALARS, r->StoreState));
418 if (r->LegacyDN && r->LegacyDN[0] != '\0') {
419 uint32_t _flags_save_string = ndr->flags;
420 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_SIZE2);
421 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->LegacyDN));
422 ndr->flags = _flags_save_string;
424 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, 0));
427 if (ndr_flags & NDR_BUFFERS) {
429 ndr->flags = _flags_save_STRUCT;
431 return NDR_ERR_SUCCESS;
435 _PUBLIC_ void ndr_print_SBinary_short(struct ndr_print *ndr, const char *name, const struct SBinary_short *r)
437 ndr->print(ndr, "%-25s: SBinary_short cb=%u", name, (unsigned)r->cb);
439 uint32_t _flags_save_STRUCT = ndr->flags;
440 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
442 dump_data(0, r->lpb, r->cb);
444 ndr->flags = _flags_save_STRUCT;
449 _PUBLIC_ void ndr_print_fuzzyLevel(struct ndr_print *ndr, const char *name, uint32_t r)
451 ndr_print_uint32(ndr, name, r);
453 switch ((r & 0x0000FFFF)) {
455 ndr->print(ndr, "%-25s: FL_FULLSTRING", "lower 16 bits");
458 ndr->print(ndr, "%-25s: FL_SUBSTRING", "lower 16 bits");
461 ndr->print(ndr, "%-25s: FL_PREFIX", "lower 16 bits");
464 ndr->print(ndr, "%-25s", "higher 16 bits");
465 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "FL_IGNORECASE", FL_IGNORECASE, r);
466 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "FL_IGNORENONSPACE", FL_IGNORENONSPACE, r);
467 ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "FL_LOOSE", FL_LOOSE, r);
472 * Fake wrapper over mapi_SRestriction. Workaround the no-pointer deep
473 * recursion problem in pidl
475 enum ndr_err_code ndr_push_mapi_SRestriction_wrap(struct ndr_push *ndr, int ndr_flags, const struct mapi_SRestriction_wrap *r)
477 return ndr_push_mapi_SRestriction(ndr, NDR_SCALARS, (const struct mapi_SRestriction *)r);
481 enum ndr_err_code ndr_pull_mapi_SRestriction_wrap(struct ndr_pull *ndr, int ndr_flags, struct mapi_SRestriction_wrap *r)
483 return ndr_pull_mapi_SRestriction(ndr, NDR_SCALARS|NDR_BUFFERS, (struct mapi_SRestriction *)r);
486 void ndr_print_mapi_SRestriction_wrap(struct ndr_print *ndr, const char *name, const struct mapi_SRestriction_wrap *r)
488 ndr_print_mapi_SRestriction(ndr, name, (const struct mapi_SRestriction *)r);
492 * Fake wrapper over mapi_SPropValue. Workaround the no-pointer deep
493 * recursion problem in pidl
495 enum ndr_err_code ndr_push_mapi_SPropValue_wrap(struct ndr_push *ndr, int ndr_flags, const struct mapi_SPropValue_wrap *r)
497 NDR_CHECK(ndr_push_align(ndr, 8));
498 return ndr_push_mapi_SPropValue(ndr, NDR_SCALARS, (const struct mapi_SPropValue *)r);
501 enum ndr_err_code ndr_pull_mapi_SPropValue_wrap(struct ndr_pull *ndr, int ndr_flags, struct mapi_SPropValue_wrap *r)
503 return ndr_pull_mapi_SPropValue(ndr, NDR_SCALARS, (struct mapi_SPropValue *)r);
506 void ndr_print_mapi_SPropValue_wrap(struct ndr_print *ndr, const char *name, const struct mapi_SPropValue_wrap *r)
508 return ndr_print_mapi_SPropValue(ndr, name, (const struct mapi_SPropValue *)r);
513 * Fake wrapper over mapi_SPropValue_array. Workaround the no-pointer deep
514 * recursion problem in pidl
516 enum ndr_err_code ndr_push_mapi_SPropValue_array_wrap(struct ndr_push *ndr, int ndr_flags, const struct mapi_SPropValue_array_wrap *r)
518 NDR_CHECK(ndr_push_align(ndr, 8));
519 return ndr_push_mapi_SPropValue_array(ndr, NDR_SCALARS, (const struct mapi_SPropValue_array *)r);
522 enum ndr_err_code ndr_pull_mapi_SPropValue_array_wrap(struct ndr_pull *ndr, int ndr_flags, struct mapi_SPropValue_array_wrap *r)
524 return ndr_pull_mapi_SPropValue_array(ndr, NDR_SCALARS, (struct mapi_SPropValue_array *)r);
527 void ndr_print_mapi_SPropValue_array_wrap(struct ndr_print *ndr, const char *name, const struct mapi_SPropValue_array_wrap *r)
529 return ndr_print_mapi_SPropValue_array(ndr, name, (const struct mapi_SPropValue_array *)r);
532 enum ndr_err_code ndr_push_RestrictionVariable(struct ndr_push *ndr, int ndr_flags, const union RestrictionVariable *r)
535 uint32_t _flags_save_STRUCT = ndr->flags;
536 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
537 if (ndr_flags & NDR_SCALARS) {
538 int level = ndr_push_get_switch_value(ndr, r);
544 NDR_CHECK(ndr_push_mapi_SRestriction_comment(ndr, NDR_SCALARS, &r->res[0]));
548 return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
551 if (ndr_flags & NDR_BUFFERS) {
552 int level = ndr_push_get_switch_value(ndr, r);
559 NDR_CHECK(ndr_push_mapi_SRestriction_comment(ndr, NDR_BUFFERS, &r->res[0]));
564 return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
567 ndr->flags = _flags_save_STRUCT;
569 return NDR_ERR_SUCCESS;
572 enum ndr_err_code ndr_pull_RestrictionVariable(struct ndr_pull *ndr, int ndr_flags, union RestrictionVariable *r)
575 TALLOC_CTX *_mem_save_res_0;
576 level = ndr_pull_get_switch_value(ndr, r);
578 uint32_t _flags_save_STRUCT = ndr->flags;
579 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
581 if (ndr_flags & NDR_SCALARS) {
587 NDR_CHECK(ndr_pull_align(ndr, 4));
588 NDR_PULL_ALLOC_N(ndr, r->res, 1);
589 _mem_save_res_0 = NDR_PULL_GET_MEM_CTX(ndr);
590 NDR_PULL_SET_MEM_CTX(ndr, r->res, 0);
591 NDR_CHECK(ndr_pull_mapi_SRestriction_comment(ndr, NDR_SCALARS, &r->res[0]));
592 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_res_0, 0);
596 return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
599 if (ndr_flags & NDR_BUFFERS) {
606 _mem_save_res_0 = NDR_PULL_GET_MEM_CTX(ndr);
607 NDR_PULL_SET_MEM_CTX(ndr, r->res, 0);
608 NDR_CHECK(ndr_pull_mapi_SRestriction_comment(ndr, NDR_BUFFERS, &r->res[0]));
609 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_res_0, 0);
613 return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
616 ndr->flags = _flags_save_STRUCT;
618 return NDR_ERR_SUCCESS;
622 _PUBLIC_ void ndr_print_RestrictionVariable(struct ndr_print *ndr, const char *name, const union RestrictionVariable *r)
625 level = ndr_print_get_switch_value(ndr, r);
626 ndr_print_union(ndr, name, level, "RestrictionVariable");
632 ndr_print_ptr(ndr, "res", r->res);
635 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
636 ndr_print_mapi_SRestriction_comment(ndr, "res", &r->res[0]);
643 enum ndr_err_code ndr_push_Release_req(struct ndr_push *ndr, int ndr_flags, const struct Release_req *r)
645 return NDR_ERR_SUCCESS;
648 enum ndr_err_code ndr_pull_Release_req(struct ndr_pull *ndr, int ndr_flags, struct Release_req *r)
650 return NDR_ERR_SUCCESS;
653 enum ndr_err_code ndr_push_Release_repl(struct ndr_push *ndr, int ndr_flags, const struct Release_repl *r)
655 return NDR_ERR_SUCCESS;
658 enum ndr_err_code ndr_pull_Release_repl(struct ndr_pull *ndr, int ndr_flags, struct Release_repl *r)
660 return NDR_ERR_SUCCESS;