2 OpenChange implementation.
6 Copyright (C) Julien Kerihuel 2005-2008
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
++) {
56 ret
= asprintf(&idx_0
, "[%u]", cntr_mapi_req_0
);
57 if (ret
!= -1 && idx_0
) {
58 ndr_print_EcDoRpc_MAPI_REQ(ndr
, "mapi_request", &r
->mapi_req
[cntr_mapi_req_0
]);
69 ndr
->print(ndr
, "%-25s: (handles) number=%u", name
, rlength
/ 4);
71 for (i
= 0; i
< (rlength
/ 4); i
++) {
72 ndr_print_uint32(ndr
, "handle", r
->handles
[i
]);
78 void ndr_print_mapi_response(struct ndr_print
*ndr
, const char *name
, const struct mapi_response
*r
)
82 rlength
= r
->mapi_len
- r
->length
;
84 ndr
->print(ndr
, "%-25s: length=%u", name
, r
->length
);
85 if (r
->length
&& r
->length
> sizeof(uint16_t)) {
86 uint32_t cntr_mapi_repl_0
;
88 ndr
->print(ndr
, "%s: ARRAY(%d)", name
, r
->length
- 2);
90 for (cntr_mapi_repl_0
=0; r
->mapi_repl
[cntr_mapi_repl_0
].opnum
; cntr_mapi_repl_0
++) {
91 ndr_print_EcDoRpc_MAPI_REPL(ndr
, "mapi_repl", &r
->mapi_repl
[cntr_mapi_repl_0
]);
96 ndr
->print(ndr
, "%-25s: (handles) number=%u", name
, rlength
/ 4);
103 for (i
= 0; i
< (rlength
/ 4); i
++) {
104 ndr_print_uint32(ndr
, "handle id", r
->handles
[i
]);
112 push mapi_request / mapi_response onto the wire.
114 MAPI length field includes length bytes.
115 But these bytes do not belong to the mapi content in the user
116 context. We have to add them when pushing mapi content length
117 (uint16_t) and next substract when pushing the content blob
120 enum ndr_err_code
ndr_push_mapi_request(struct ndr_push
*ndr
, int ndr_flags
, const struct mapi_request
*r
)
122 uint32_t cntr_mapi_req_0
;
125 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_NOALIGN
);
126 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->length
));
128 for (count
= 0; ndr
->offset
< r
->length
- 2; count
++) {
129 NDR_CHECK(ndr_push_EcDoRpc_MAPI_REQ(ndr
, NDR_SCALARS
, &r
->mapi_req
[count
]));
132 count
= (r
->mapi_len
- r
->length
) / sizeof(uint32_t);
133 for (cntr_mapi_req_0
=0; cntr_mapi_req_0
< count
; cntr_mapi_req_0
++) {
134 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
, r
->handles
[cntr_mapi_req_0
]));
137 obfuscate_data(ndr
->data
, ndr
->offset
, 0xA5);
139 return NDR_ERR_SUCCESS
;
142 enum ndr_err_code
ndr_push_mapi_response(struct ndr_push
*ndr
, int ndr_flags
, const struct mapi_response
*r
)
144 uint32_t cntr_mapi_repl_0
;
147 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_REMAINING
);
148 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->length
));
150 if (r
->length
> sizeof (uint16_t)) {
151 for (count
= 0; ndr
->offset
< r
->length
- 2; count
++) {
152 NDR_CHECK(ndr_push_EcDoRpc_MAPI_REPL(ndr
, NDR_SCALARS
, &r
->mapi_repl
[count
]));
156 count
= (r
->mapi_len
- r
->length
) / sizeof (uint32_t);
157 for (cntr_mapi_repl_0
= 0; cntr_mapi_repl_0
<count
; cntr_mapi_repl_0
++) {
158 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
, r
->handles
[cntr_mapi_repl_0
]));
161 obfuscate_data(ndr
->data
, ndr
->alloc_size
, 0xA5);
163 return NDR_ERR_SUCCESS
;
167 pull mapi_request / mapi_response from the wire
170 enum ndr_err_code
ndr_pull_mapi_request(struct ndr_pull
*ndr
, int ndr_flags
, struct mapi_request
*r
)
172 uint32_t length
,count
;
173 uint32_t cntr_mapi_req_0
;
174 TALLOC_CTX
*_mem_save_mapi_req_0
;
175 TALLOC_CTX
*_mem_save_handles_0
;
176 struct ndr_pull
*_ndr_mapi_req
;
178 obfuscate_data(ndr
->data
, ndr
->data_size
, 0xA5);
180 if (ndr
->flags
& LIBNDR_FLAG_REMAINING
) {
181 length
= ndr
->data_size
- ndr
->offset
;
183 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &length
));
185 r
->mapi_len
= length
;
187 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->length
));
189 /* If length equals length field then skipping subcontext */
190 if (r
->length
> sizeof (uint16_t)) {
191 NDR_CHECK(ndr_pull_subcontext_start(ndr
, &_ndr_mapi_req
, 0, r
->length
- 2));
192 _mem_save_mapi_req_0
= NDR_PULL_GET_MEM_CTX(_ndr_mapi_req
);
193 r
->mapi_req
= talloc_zero(_mem_save_mapi_req_0
, struct EcDoRpc_MAPI_REQ
);
194 for (cntr_mapi_req_0
= 0; _ndr_mapi_req
->offset
< _ndr_mapi_req
->data_size
- 2; cntr_mapi_req_0
++) {
195 NDR_CHECK(ndr_pull_EcDoRpc_MAPI_REQ(_ndr_mapi_req
, NDR_SCALARS
, &r
->mapi_req
[cntr_mapi_req_0
]));
196 r
->mapi_req
= talloc_realloc(_mem_save_mapi_req_0
, r
->mapi_req
, struct EcDoRpc_MAPI_REQ
, cntr_mapi_req_0
+ 2);
198 r
->mapi_req
= talloc_realloc(_mem_save_mapi_req_0
, r
->mapi_req
, struct EcDoRpc_MAPI_REQ
, cntr_mapi_req_0
+ 2);
199 r
->mapi_req
[cntr_mapi_req_0
].opnum
= 0;
201 if (_ndr_mapi_req
->offset
!= r
->length
- 2) {
202 return NDR_ERR_BUFSIZE
;
204 NDR_CHECK(ndr_pull_subcontext_end(ndr
, _ndr_mapi_req
, 4, -1));
206 _mem_save_handles_0
= NDR_PULL_GET_MEM_CTX(ndr
);
207 count
= (r
->mapi_len
- r
->length
) / sizeof(uint32_t);
208 r
->handles
= talloc_array(_mem_save_handles_0
, uint32_t, count
+ 1);
209 for (cntr_mapi_req_0
=0; cntr_mapi_req_0
< count
; cntr_mapi_req_0
++) {
210 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &r
->handles
[cntr_mapi_req_0
]));
216 return NDR_ERR_SUCCESS
;
219 enum ndr_err_code
ndr_pull_mapi_response(struct ndr_pull
*ndr
, int ndr_flags
, struct mapi_response
*r
)
221 uint32_t length
,count
;
222 uint32_t cntr_mapi_repl_0
;
223 TALLOC_CTX
*_mem_save_mapi_repl_0
;
224 TALLOC_CTX
*_mem_save_handles_0
;
225 struct ndr_pull
*_ndr_mapi_repl
;
227 obfuscate_data(ndr
->data
, ndr
->data_size
, 0xA5);
229 if (ndr
->flags
& LIBNDR_FLAG_REMAINING
) {
230 length
= ndr
->data_size
- ndr
->offset
;
232 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &length
));
234 r
->mapi_len
= length
;
236 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->length
));
238 /* If length equals length field then skipping subcontext */
239 if (r
->length
> sizeof (uint16_t)) {
240 _mem_save_mapi_repl_0
= NDR_PULL_GET_MEM_CTX(ndr
);
241 r
->mapi_repl
= talloc_array(_mem_save_mapi_repl_0
, struct EcDoRpc_MAPI_REPL
, 2);
242 NDR_CHECK(ndr_pull_subcontext_start(ndr
, &_ndr_mapi_repl
, 0, r
->length
- 2));
243 for (cntr_mapi_repl_0
= 0; _ndr_mapi_repl
->offset
< _ndr_mapi_repl
->data_size
- 2; cntr_mapi_repl_0
++) {
244 NDR_CHECK(ndr_pull_EcDoRpc_MAPI_REPL(_ndr_mapi_repl
, NDR_SCALARS
, &r
->mapi_repl
[cntr_mapi_repl_0
]));
245 r
->mapi_repl
= talloc_realloc(_ndr_mapi_repl
, r
->mapi_repl
, struct EcDoRpc_MAPI_REPL
, cntr_mapi_repl_0
+ 2);
247 r
->mapi_repl
[cntr_mapi_repl_0
].opnum
= 0;
248 NDR_CHECK(ndr_pull_subcontext_end(ndr
, _ndr_mapi_repl
, 4, -1));
249 talloc_free(_ndr_mapi_repl
);
252 _mem_save_handles_0
= NDR_PULL_GET_MEM_CTX(ndr
);
253 count
= (r
->mapi_len
- r
->length
) / sizeof(uint32_t);
254 NDR_PULL_ALLOC_N(ndr
, r
->handles
, count
+ 1);
256 for (cntr_mapi_repl_0
=0; cntr_mapi_repl_0
< count
; cntr_mapi_repl_0
++) {
257 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &r
->handles
[cntr_mapi_repl_0
]));
259 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_handles_0
, LIBNDR_FLAG_REF_ALLOC
);
261 return NDR_ERR_SUCCESS
;
265 We stop processing the IDL if MAPISTATUS is different from MAPI_E_SUCCESS
268 _PUBLIC_
enum ndr_err_code
ndr_push_EcDoRpc_MAPI_REPL(struct ndr_push
*ndr
, int ndr_flags
, const struct EcDoRpc_MAPI_REPL
*r
)
270 if (r
->opnum
!= op_MAPI_Release
)
272 uint32_t _flags_save_STRUCT
= ndr
->flags
;
273 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_NOALIGN
);
274 if (ndr_flags
& NDR_SCALARS
) {
275 NDR_CHECK(ndr_push_align(ndr
, 8));
276 NDR_CHECK(ndr_push_uint8(ndr
, NDR_SCALARS
, r
->opnum
));
277 if ((r
->opnum
== op_MAPI_Notify
) || (r
->opnum
== op_MAPI_Pending
)) {
278 NDR_CHECK(ndr_push_set_switch_value(ndr
, &r
->u
, r
->opnum
));
279 NDR_CHECK(ndr_push_EcDoRpc_MAPI_REPL_UNION(ndr
, NDR_SCALARS
, &r
->u
));
281 NDR_CHECK(ndr_push_uint8(ndr
, NDR_SCALARS
, r
->handle_idx
));
282 NDR_CHECK(ndr_push_MAPISTATUS(ndr
, NDR_SCALARS
, r
->error_code
));
283 if (r
->error_code
== MAPI_E_SUCCESS
) {
284 NDR_CHECK(ndr_push_set_switch_value(ndr
, &r
->u
, r
->opnum
));
285 NDR_CHECK(ndr_push_EcDoRpc_MAPI_REPL_UNION(ndr
, NDR_SCALARS
, &r
->u
));
288 case op_MAPI_Logon
: {
289 if (r
->error_code
== ecWrongServer
) {
290 NDR_CHECK(ndr_push_Logon_redirect(ndr
, NDR_SCALARS
, &(r
->us
.mapi_Logon
)));
299 if (ndr_flags
& NDR_BUFFERS
) {
300 NDR_CHECK(ndr_push_EcDoRpc_MAPI_REPL_UNION(ndr
, NDR_BUFFERS
, &r
->u
));
302 ndr
->flags
= _flags_save_STRUCT
;
304 return NDR_ERR_SUCCESS
;
307 enum ndr_err_code
ndr_pull_EcDoRpc_MAPI_REPL(struct ndr_pull
*ndr
, int ndr_flags
, struct EcDoRpc_MAPI_REPL
*r
)
310 uint32_t _flags_save_STRUCT
= ndr
->flags
;
311 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_NOALIGN
);
312 if (ndr_flags
& NDR_SCALARS
) {
313 NDR_CHECK(ndr_pull_align(ndr
, 8));
314 NDR_CHECK(ndr_pull_uint8(ndr
, NDR_SCALARS
, &r
->opnum
));
315 if ((r
->opnum
== op_MAPI_Notify
) || (r
->opnum
== op_MAPI_Pending
)) {
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
));
319 NDR_CHECK(ndr_pull_uint8(ndr
, NDR_SCALARS
, &r
->handle_idx
));
320 NDR_CHECK(ndr_pull_MAPISTATUS(ndr
, NDR_SCALARS
, &r
->error_code
));
321 if ( r
->error_code
== MAPI_E_SUCCESS
) {
322 NDR_CHECK(ndr_pull_set_switch_value(ndr
, &r
->u
, r
->opnum
));
323 NDR_CHECK(ndr_pull_EcDoRpc_MAPI_REPL_UNION(ndr
, NDR_SCALARS
, &r
->u
));
326 case op_MAPI_Logon
: {
327 if (r
->error_code
== ecWrongServer
) {
328 NDR_CHECK(ndr_pull_Logon_redirect(ndr
, NDR_SCALARS
, &(r
->us
.mapi_Logon
)));
337 if (ndr_flags
& NDR_BUFFERS
) {
338 ndr
->flags
= _flags_save_STRUCT
;
341 return NDR_ERR_SUCCESS
;
344 void ndr_print_EcDoRpc_MAPI_REPL(struct ndr_print
*ndr
, const char *name
, const struct EcDoRpc_MAPI_REPL
*r
)
346 ndr_print_struct(ndr
, name
, "EcDoRpc_MAPI_REPL");
348 uint32_t _flags_save_STRUCT
= ndr
->flags
;
349 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_NOALIGN
);
351 ndr_print_uint8(ndr
, "opnum", r
->opnum
);
352 if ((r
->opnum
!= op_MAPI_Notify
) && (r
->opnum
!= op_MAPI_Pending
)) {
353 ndr_print_uint8(ndr
, "handle_idx", r
->handle_idx
);
354 ndr_print_MAPISTATUS(ndr
, "error_code", r
->error_code
);
355 if (r
->error_code
== MAPI_E_SUCCESS
) {
356 ndr_print_set_switch_value(ndr
, &r
->u
, r
->opnum
);
357 ndr_print_EcDoRpc_MAPI_REPL_UNION(ndr
, "u", &r
->u
);
360 case op_MAPI_Logon
: {
361 if (r
->error_code
== ecWrongServer
) {
362 ndr_print_set_switch_value(ndr
, &r
->us
, r
->opnum
);
363 ndr_print_EcDoRpc_MAPI_REPL_UNION_SPECIAL(ndr
, "us", &r
->us
);
371 ndr_print_set_switch_value(ndr
, &r
->u
, r
->opnum
);
372 ndr_print_EcDoRpc_MAPI_REPL_UNION(ndr
, "u", &r
->u
);
375 ndr
->flags
= _flags_save_STRUCT
;
380 We need to pull QueryRows replies on our own:
381 If we have no results, do not push/pull the DATA_BLOB
384 enum ndr_err_code
ndr_push_QueryRows_repl(struct ndr_push
*ndr
, int ndr_flags
, const struct QueryRows_repl
*r
)
387 uint32_t _flags_save_STRUCT
= ndr
->flags
;
388 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_NOALIGN
);
389 if (ndr_flags
& NDR_SCALARS
) {
390 NDR_CHECK(ndr_push_align(ndr
, 4));
391 NDR_CHECK(ndr_push_uint8(ndr
, NDR_SCALARS
, r
->Origin
));
392 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->RowCount
));
395 uint32_t _flags_save_DATA_BLOB
= ndr
->flags
;
396 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_REMAINING
);
397 NDR_CHECK(ndr_push_DATA_BLOB(ndr
, NDR_SCALARS
, r
->RowData
));
398 ndr
->flags
= _flags_save_DATA_BLOB
;
401 if (ndr_flags
& NDR_BUFFERS
) {
403 ndr
->flags
= _flags_save_STRUCT
;
405 return NDR_ERR_SUCCESS
;
408 enum ndr_err_code
ndr_pull_QueryRows_repl(struct ndr_pull
*ndr
, int ndr_flags
, struct QueryRows_repl
*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_pull_align(ndr
, 4));
415 NDR_CHECK(ndr_pull_uint8(ndr
, NDR_SCALARS
, &r
->Origin
));
416 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->RowCount
));
420 uint32_t _flags_save_DATA_BLOB
= ndr
->flags
;
422 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_REMAINING
);
423 NDR_CHECK(ndr_pull_DATA_BLOB(ndr
, NDR_SCALARS
, &r
->RowData
));
424 ndr
->flags
= _flags_save_DATA_BLOB
;
427 if (ndr_flags
& NDR_BUFFERS
) {
429 ndr
->flags
= _flags_save_STRUCT
;
431 return NDR_ERR_SUCCESS
;
435 enum ndr_err_code
ndr_push_Logon_req(struct ndr_push
*ndr
, int ndr_flags
, const struct Logon_req
*r
)
438 uint32_t _flags_save_STRUCT
= ndr
->flags
;
439 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_NOALIGN
);
440 if (ndr_flags
& NDR_SCALARS
) {
441 NDR_CHECK(ndr_push_align(ndr
, 4));
442 NDR_CHECK(ndr_push_LogonFlags(ndr
, NDR_SCALARS
, r
->LogonFlags
));
443 NDR_CHECK(ndr_push_OpenFlags(ndr
, NDR_SCALARS
, r
->OpenFlags
));
444 NDR_CHECK(ndr_push_StoreState(ndr
, NDR_SCALARS
, r
->StoreState
));
445 if (r
->EssDN
&& r
->EssDN
[0] != '\0') {
446 uint32_t _flags_save_string
= ndr
->flags
;
447 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_STR_ASCII
|LIBNDR_FLAG_STR_SIZE2
);
448 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->EssDN
));
449 ndr
->flags
= _flags_save_string
;
451 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, 0));
454 if (ndr_flags
& NDR_BUFFERS
) {
456 ndr
->flags
= _flags_save_STRUCT
;
458 return NDR_ERR_SUCCESS
;
462 _PUBLIC_
void ndr_print_SBinary_short(struct ndr_print
*ndr
, const char *name
, const struct SBinary_short
*r
)
464 ndr
->print(ndr
, "%-25s: SBinary_short cb=%u", name
, (unsigned)r
->cb
);
466 uint32_t _flags_save_STRUCT
= ndr
->flags
;
467 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_NOALIGN
);
469 dump_data(0, r
->lpb
, r
->cb
);
471 ndr
->flags
= _flags_save_STRUCT
;
476 _PUBLIC_
void ndr_print_fuzzyLevel(struct ndr_print
*ndr
, const char *name
, uint32_t r
)
478 ndr_print_uint32(ndr
, name
, r
);
480 switch ((r
& 0x0000FFFF)) {
482 ndr
->print(ndr
, "%-25s: FL_FULLSTRING", "lower 16 bits");
485 ndr
->print(ndr
, "%-25s: FL_SUBSTRING", "lower 16 bits");
488 ndr
->print(ndr
, "%-25s: FL_PREFIX", "lower 16 bits");
491 ndr
->print(ndr
, "%-25s", "higher 16 bits");
492 ndr_print_bitmap_flag(ndr
, sizeof(uint32_t), "FL_IGNORECASE", FL_IGNORECASE
, r
);
493 ndr_print_bitmap_flag(ndr
, sizeof(uint32_t), "FL_IGNORENONSPACE", FL_IGNORENONSPACE
, r
);
494 ndr_print_bitmap_flag(ndr
, sizeof(uint32_t), "FL_LOOSE", FL_LOOSE
, r
);
499 * Fake wrapper over mapi_SRestriction. Workaround the no-pointer deep
500 * recursion problem in pidl
502 enum ndr_err_code
ndr_push_mapi_SRestriction_wrap(struct ndr_push
*ndr
, int ndr_flags
, const struct mapi_SRestriction_wrap
*r
)
504 return ndr_push_mapi_SRestriction(ndr
, NDR_SCALARS
, (const struct mapi_SRestriction
*)r
);
508 enum ndr_err_code
ndr_pull_mapi_SRestriction_wrap(struct ndr_pull
*ndr
, int ndr_flags
, struct mapi_SRestriction_wrap
*r
)
510 return ndr_pull_mapi_SRestriction(ndr
, NDR_SCALARS
|NDR_BUFFERS
, (struct mapi_SRestriction
*)r
);
513 void ndr_print_mapi_SRestriction_wrap(struct ndr_print
*ndr
, const char *name
, const struct mapi_SRestriction_wrap
*r
)
515 ndr_print_mapi_SRestriction(ndr
, name
, (const struct mapi_SRestriction
*)r
);
519 * Fake wrapper over mapi_SPropValue. Workaround the no-pointer deep
520 * recursion problem in pidl
522 enum ndr_err_code
ndr_push_mapi_SPropValue_wrap(struct ndr_push
*ndr
, int ndr_flags
, const struct mapi_SPropValue_wrap
*r
)
524 NDR_CHECK(ndr_push_align(ndr
, 8));
525 return ndr_push_mapi_SPropValue(ndr
, NDR_SCALARS
, (const struct mapi_SPropValue
*)r
);
528 enum ndr_err_code
ndr_pull_mapi_SPropValue_wrap(struct ndr_pull
*ndr
, int ndr_flags
, struct mapi_SPropValue_wrap
*r
)
530 return ndr_pull_mapi_SPropValue(ndr
, NDR_SCALARS
, (struct mapi_SPropValue
*)r
);
533 void ndr_print_mapi_SPropValue_wrap(struct ndr_print
*ndr
, const char *name
, const struct mapi_SPropValue_wrap
*r
)
535 return ndr_print_mapi_SPropValue(ndr
, name
, (const struct mapi_SPropValue
*)r
);
540 * Fake wrapper over mapi_SPropValue_array. Workaround the no-pointer deep
541 * recursion problem in pidl
543 enum ndr_err_code
ndr_push_mapi_SPropValue_array_wrap(struct ndr_push
*ndr
, int ndr_flags
, const struct mapi_SPropValue_array_wrap
*r
)
545 NDR_CHECK(ndr_push_align(ndr
, 8));
546 return ndr_push_mapi_SPropValue_array(ndr
, NDR_SCALARS
, (const struct mapi_SPropValue_array
*)r
);
549 enum ndr_err_code
ndr_pull_mapi_SPropValue_array_wrap(struct ndr_pull
*ndr
, int ndr_flags
, struct mapi_SPropValue_array_wrap
*r
)
551 return ndr_pull_mapi_SPropValue_array(ndr
, NDR_SCALARS
, (struct mapi_SPropValue_array
*)r
);
554 void ndr_print_mapi_SPropValue_array_wrap(struct ndr_print
*ndr
, const char *name
, const struct mapi_SPropValue_array_wrap
*r
)
556 return ndr_print_mapi_SPropValue_array(ndr
, name
, (const struct mapi_SPropValue_array
*)r
);
559 enum ndr_err_code
ndr_push_RestrictionVariable(struct ndr_push
*ndr
, int ndr_flags
, const union RestrictionVariable
*r
)
562 uint32_t _flags_save_STRUCT
= ndr
->flags
;
563 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_NOALIGN
);
564 if (ndr_flags
& NDR_SCALARS
) {
565 int level
= ndr_push_get_switch_value(ndr
, r
);
571 NDR_CHECK(ndr_push_mapi_SRestriction_comment(ndr
, NDR_SCALARS
, &r
->res
[0]));
575 return ndr_push_error(ndr
, NDR_ERR_BAD_SWITCH
, "Bad switch value %u", level
);
578 if (ndr_flags
& NDR_BUFFERS
) {
579 int level
= ndr_push_get_switch_value(ndr
, r
);
586 NDR_CHECK(ndr_push_mapi_SRestriction_comment(ndr
, NDR_BUFFERS
, &r
->res
[0]));
591 return ndr_push_error(ndr
, NDR_ERR_BAD_SWITCH
, "Bad switch value %u", level
);
594 ndr
->flags
= _flags_save_STRUCT
;
596 return NDR_ERR_SUCCESS
;
599 enum ndr_err_code
ndr_pull_RestrictionVariable(struct ndr_pull
*ndr
, int ndr_flags
, union RestrictionVariable
*r
)
602 TALLOC_CTX
*_mem_save_res_0
;
603 level
= ndr_pull_get_switch_value(ndr
, r
);
605 uint32_t _flags_save_STRUCT
= ndr
->flags
;
606 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_NOALIGN
);
608 if (ndr_flags
& NDR_SCALARS
) {
614 NDR_CHECK(ndr_pull_align(ndr
, 4));
615 NDR_PULL_ALLOC_N(ndr
, r
->res
, 1);
616 _mem_save_res_0
= NDR_PULL_GET_MEM_CTX(ndr
);
617 NDR_PULL_SET_MEM_CTX(ndr
, r
->res
, 0);
618 NDR_CHECK(ndr_pull_mapi_SRestriction_comment(ndr
, NDR_SCALARS
, &r
->res
[0]));
619 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_res_0
, 0);
623 return ndr_pull_error(ndr
, NDR_ERR_BAD_SWITCH
, "Bad switch value %u", level
);
626 if (ndr_flags
& NDR_BUFFERS
) {
633 _mem_save_res_0
= NDR_PULL_GET_MEM_CTX(ndr
);
634 NDR_PULL_SET_MEM_CTX(ndr
, r
->res
, 0);
635 NDR_CHECK(ndr_pull_mapi_SRestriction_comment(ndr
, NDR_BUFFERS
, &r
->res
[0]));
636 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_res_0
, 0);
640 return ndr_pull_error(ndr
, NDR_ERR_BAD_SWITCH
, "Bad switch value %u", level
);
643 ndr
->flags
= _flags_save_STRUCT
;
645 return NDR_ERR_SUCCESS
;
649 _PUBLIC_
void ndr_print_RestrictionVariable(struct ndr_print
*ndr
, const char *name
, const union RestrictionVariable
*r
)
652 level
= ndr_print_get_switch_value(ndr
, r
);
653 ndr_print_union(ndr
, name
, level
, "RestrictionVariable");
659 ndr_print_ptr(ndr
, "res", r
->res
);
662 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_NOALIGN
);
663 ndr_print_mapi_SRestriction_comment(ndr
, "res", &r
->res
[0]);
670 enum ndr_err_code
ndr_push_Release_req(struct ndr_push
*ndr
, int ndr_flags
, const struct Release_req
*r
)
672 return NDR_ERR_SUCCESS
;
675 enum ndr_err_code
ndr_pull_Release_req(struct ndr_pull
*ndr
, int ndr_flags
, struct Release_req
*r
)
677 return NDR_ERR_SUCCESS
;
680 enum ndr_err_code
ndr_push_Release_repl(struct ndr_push
*ndr
, int ndr_flags
, const struct Release_repl
*r
)
682 return NDR_ERR_SUCCESS
;
685 enum ndr_err_code
ndr_pull_Release_repl(struct ndr_pull
*ndr
, int ndr_flags
, struct Release_repl
*r
)
687 return NDR_ERR_SUCCESS
;