smbd: avoid a panic in close_directory()
[samba4-gss.git] / librpc / ndr / ndr_drsuapi.c
blob787347fbf4d20620ec3b729ea49815379f15f698
1 /*
2 Unix SMB/CIFS implementation.
4 routines for printing some linked list structs in DRSUAPI
6 Copyright (C) Stefan (metze) Metzmacher 2005
7 Copyright (C) Matthieu Patou 2013
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>.
24 #include "includes.h"
25 #include "librpc/gen_ndr/ndr_drsuapi.h"
26 #include "librpc/gen_ndr/ndr_misc.h"
27 #include "../lib/util/asn1.h"
28 #include "librpc/ndr/ndr_compression.h"
29 /* We don't need multibyte if we're just comparing to 'ff' */
30 #undef strncasecmp
32 void ndr_print_drsuapi_DsReplicaObjectListItem(struct ndr_print *ndr, const char *name,
33 const struct drsuapi_DsReplicaObjectListItem *r)
35 ndr_print_struct(ndr, name, "drsuapi_DsReplicaObjectListItem");
36 ndr->depth++;
37 ndr_print_ptr(ndr, "next_object", r->next_object);
38 ndr_print_drsuapi_DsReplicaObject(ndr, "object", &r->object);
39 ndr->depth--;
40 if (r->next_object) {
41 ndr_print_drsuapi_DsReplicaObjectListItem(ndr, "next_object", r->next_object);
45 void ndr_print_drsuapi_DsReplicaObjectListItemEx(struct ndr_print *ndr, const char *name, const struct drsuapi_DsReplicaObjectListItemEx *r)
47 ndr_print_struct(ndr, name, "drsuapi_DsReplicaObjectListItemEx");
48 ndr->depth++;
49 ndr_print_ptr(ndr, "next_object", r->next_object);
50 ndr_print_drsuapi_DsReplicaObject(ndr, "object", &r->object);
51 ndr_print_uint32(ndr, "is_nc_prefix", r->is_nc_prefix);
52 ndr_print_ptr(ndr, "parent_object_guid", r->parent_object_guid);
53 ndr->depth++;
54 if (r->parent_object_guid) {
55 ndr_print_GUID(ndr, "parent_object_guid", r->parent_object_guid);
57 ndr->depth--;
58 ndr_print_ptr(ndr, "meta_data_ctr", r->meta_data_ctr);
59 ndr->depth++;
60 if (r->meta_data_ctr) {
61 ndr_print_drsuapi_DsReplicaMetaDataCtr(ndr, "meta_data_ctr", r->meta_data_ctr);
63 ndr->depth--;
64 ndr->depth--;
65 if (r->next_object) {
66 ndr_print_drsuapi_DsReplicaObjectListItemEx(ndr, "next_object", r->next_object);
70 _PUBLIC_ void ndr_print_drsuapi_DsReplicaOID(struct ndr_print *ndr, const char *name, const struct drsuapi_DsReplicaOID *r)
72 ndr_print_struct(ndr, name, "drsuapi_DsReplicaOID");
73 ndr->depth++;
74 ndr_print_uint32(ndr, "length", r->length);
75 ndr->print(ndr, "%-25s: length=%"PRIu32, "oid", r->length);
76 if (r->binary_oid) {
77 char *partial_oid = NULL;
78 DATA_BLOB oid_blob = data_blob_const(r->binary_oid, r->length);
79 char *hex_str = data_blob_hex_string_upper(ndr, &oid_blob);
80 ber_read_partial_OID_String(ndr, oid_blob, &partial_oid);
81 ndr->depth++;
82 ndr->print(ndr, "%-25s: 0x%s (%s)", "binary_oid", hex_str, partial_oid);
83 ndr->depth--;
84 TALLOC_FREE(hex_str);
85 TALLOC_FREE(partial_oid);
87 ndr->depth--;
90 static void _print_drsuapi_DsAttributeValue_attid(struct ndr_print *ndr, const char *name,
91 const struct drsuapi_DsAttributeValue *r)
93 uint32_t v;
95 ndr_print_struct(ndr, name, "drsuapi_DsAttributeValue");
96 ndr->depth++;
97 if (r->blob == NULL || r->blob->data == NULL) {
98 ndr_print_string(ndr, "attid", "NULL");
99 } else if (r->blob->length < 4) {
100 ndr_print_DATA_BLOB(ndr, "attid", *r->blob);
101 } else {
102 v = IVAL(r->blob->data, 0);
103 ndr_print_uint32(ndr, "attid", v);
105 ndr->depth--;
108 static void _print_drsuapi_DsAttributeValue_str(struct ndr_print *ndr, const char *name,
109 const struct drsuapi_DsAttributeValue *r)
111 void *p;
112 size_t converted_size = 0;
114 ndr_print_struct(ndr, name, "drsuapi_DsAttributeValue");
115 ndr->depth++;
116 if (r->blob == NULL || r->blob->data == NULL) {
117 ndr_print_string(ndr, "string", "NULL");
118 } else if (!convert_string_talloc(ndr,
119 CH_UTF16, CH_UNIX,
120 r->blob->data,
121 r->blob->length,
122 &p, &converted_size)) {
123 ndr_print_DATA_BLOB(ndr, "string (INVALID CONVERSION)",
124 *r->blob);
125 } else {
126 char *str = (char *)p;
127 ndr_print_string(ndr, "string", str);
128 TALLOC_FREE(str);
130 ndr->depth--;
133 static void _print_drsuapi_DsAttributeValueCtr(struct ndr_print *ndr,
134 const char *name,
135 const struct drsuapi_DsAttributeValueCtr *r,
136 void (*print_val_fn)(struct ndr_print *ndr, const char *name, const struct drsuapi_DsAttributeValue *r))
138 uint32_t cntr_values_1;
139 ndr_print_struct(ndr, name, "drsuapi_DsAttributeValueCtr");
140 ndr->depth++;
141 ndr_print_uint32(ndr, "num_values", r->num_values);
142 ndr_print_ptr(ndr, "values", r->values);
143 ndr->depth++;
144 if (r->values) {
145 ndr->print(ndr, "%s: ARRAY(%"PRIu32")", "values", r->num_values);
146 ndr->depth++;
147 for (cntr_values_1=0;cntr_values_1<r->num_values;cntr_values_1++) {
148 char *idx_1=NULL;
149 if (asprintf(&idx_1, "[%"PRIu32"]", cntr_values_1) != -1) {
150 //ndr_print_drsuapi_DsAttributeValue(ndr, "values", &r->values[cntr_values_1]);
151 print_val_fn(ndr, "values", &r->values[cntr_values_1]);
152 free(idx_1);
155 ndr->depth--;
157 ndr->depth--;
158 ndr->depth--;
161 _PUBLIC_ void ndr_print_drsuapi_DsReplicaAttribute(struct ndr_print *ndr,
162 const char *name,
163 const struct drsuapi_DsReplicaAttribute *r)
165 ndr_print_struct(ndr, name, "drsuapi_DsReplicaAttribute");
166 ndr->depth++;
167 ndr_print_drsuapi_DsAttributeId(ndr, "attid", r->attid);
168 switch (r->attid) {
169 case DRSUAPI_ATTID_objectClass:
170 case DRSUAPI_ATTID_possSuperiors:
171 case DRSUAPI_ATTID_subClassOf:
172 case DRSUAPI_ATTID_governsID:
173 case DRSUAPI_ATTID_mustContain:
174 case DRSUAPI_ATTID_mayContain:
175 case DRSUAPI_ATTID_rDNAttId:
176 case DRSUAPI_ATTID_attributeID:
177 case DRSUAPI_ATTID_attributeSyntax:
178 case DRSUAPI_ATTID_auxiliaryClass:
179 case DRSUAPI_ATTID_systemPossSuperiors:
180 case DRSUAPI_ATTID_systemMayContain:
181 case DRSUAPI_ATTID_systemMustContain:
182 case DRSUAPI_ATTID_systemAuxiliaryClass:
183 case DRSUAPI_ATTID_transportAddressAttribute:
184 /* ATTIDs for classSchema and attributeSchema */
185 _print_drsuapi_DsAttributeValueCtr(ndr, "value_ctr", &r->value_ctr,
186 _print_drsuapi_DsAttributeValue_attid);
187 break;
188 case DRSUAPI_ATTID_cn:
189 case DRSUAPI_ATTID_ou:
190 case DRSUAPI_ATTID_description:
191 case DRSUAPI_ATTID_displayName:
192 case DRSUAPI_ATTID_dMDLocation:
193 case DRSUAPI_ATTID_adminDisplayName:
194 case DRSUAPI_ATTID_adminDescription:
195 case DRSUAPI_ATTID_lDAPDisplayName:
196 case DRSUAPI_ATTID_name:
197 _print_drsuapi_DsAttributeValueCtr(ndr, "value_ctr", &r->value_ctr,
198 _print_drsuapi_DsAttributeValue_str);
199 break;
200 default:
201 _print_drsuapi_DsAttributeValueCtr(ndr, "value_ctr", &r->value_ctr,
202 ndr_print_drsuapi_DsAttributeValue);
203 break;
205 ndr->depth--;
208 enum ndr_err_code ndr_push_drsuapi_DsGetNCChangesMSZIPCtr1(struct ndr_push *ndr, ndr_flags_type ndr_flags, const struct drsuapi_DsGetNCChangesMSZIPCtr1 *r)
210 if (ndr_flags & NDR_SCALARS) {
211 uint32_t decompressed_length = 0;
212 uint32_t compressed_length = 0;
213 if (r->ts) {
215 struct ndr_push *_ndr_ts;
216 NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_ts, 4, -1));
218 struct ndr_push *_ndr_ts_compressed;
219 NDR_CHECK(ndr_push_compression_state_init(_ndr_ts, NDR_COMPRESSION_MSZIP));
220 NDR_CHECK(ndr_push_compression_start(_ndr_ts, &_ndr_ts_compressed));
221 NDR_CHECK(ndr_push_drsuapi_DsGetNCChangesCtr1TS(_ndr_ts_compressed, NDR_SCALARS|NDR_BUFFERS, r->ts));
222 decompressed_length = _ndr_ts_compressed->offset;
223 NDR_CHECK(ndr_push_compression_end(_ndr_ts, _ndr_ts_compressed));
225 compressed_length = _ndr_ts->offset;
226 TALLOC_FREE(_ndr_ts);
229 NDR_CHECK(ndr_push_align(ndr, 4));
230 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, decompressed_length));
231 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, compressed_length));
232 NDR_CHECK(ndr_push_unique_ptr(ndr, r->ts));
234 if (ndr_flags & NDR_BUFFERS) {
235 if (r->ts) {
237 struct ndr_push *_ndr_ts;
238 NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_ts, 4, -1));
240 struct ndr_push *_ndr_ts_compressed;
241 NDR_CHECK(ndr_push_compression_state_init(_ndr_ts, NDR_COMPRESSION_MSZIP));
242 NDR_CHECK(ndr_push_compression_start(_ndr_ts, &_ndr_ts_compressed));
243 NDR_CHECK(ndr_push_drsuapi_DsGetNCChangesCtr1TS(_ndr_ts_compressed, NDR_SCALARS|NDR_BUFFERS, r->ts));
244 NDR_CHECK(ndr_push_compression_end(_ndr_ts, _ndr_ts_compressed));
246 NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_ts, 4, -1));
250 return NDR_ERR_SUCCESS;
253 enum ndr_err_code ndr_push_drsuapi_DsGetNCChangesMSZIPCtr6(struct ndr_push *ndr, ndr_flags_type ndr_flags, const struct drsuapi_DsGetNCChangesMSZIPCtr6 *r)
255 if (ndr_flags & NDR_SCALARS) {
256 uint32_t decompressed_length = 0;
257 uint32_t compressed_length = 0;
258 if (r->ts) {
260 struct ndr_push *_ndr_ts;
261 NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_ts, 4, -1));
263 struct ndr_push *_ndr_ts_compressed;
264 NDR_CHECK(ndr_push_compression_state_init(_ndr_ts, NDR_COMPRESSION_MSZIP));
265 NDR_CHECK(ndr_push_compression_start(_ndr_ts, &_ndr_ts_compressed));
266 NDR_CHECK(ndr_push_drsuapi_DsGetNCChangesCtr6TS(_ndr_ts_compressed, NDR_SCALARS|NDR_BUFFERS, r->ts));
267 decompressed_length = _ndr_ts_compressed->offset;
268 NDR_CHECK(ndr_push_compression_end(_ndr_ts, _ndr_ts_compressed));
270 compressed_length = _ndr_ts->offset;
271 TALLOC_FREE(_ndr_ts);
274 NDR_CHECK(ndr_push_align(ndr, 4));
275 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, decompressed_length));
276 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, compressed_length));
277 NDR_CHECK(ndr_push_unique_ptr(ndr, r->ts));
279 if (ndr_flags & NDR_BUFFERS) {
280 if (r->ts) {
282 struct ndr_push *_ndr_ts;
283 NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_ts, 4, -1));
285 struct ndr_push *_ndr_ts_compressed;
286 NDR_CHECK(ndr_push_compression_state_init(_ndr_ts, NDR_COMPRESSION_MSZIP));
287 NDR_CHECK(ndr_push_compression_start(_ndr_ts, &_ndr_ts_compressed));
288 NDR_CHECK(ndr_push_drsuapi_DsGetNCChangesCtr6TS(_ndr_ts_compressed, NDR_SCALARS|NDR_BUFFERS, r->ts));
289 NDR_CHECK(ndr_push_compression_end(_ndr_ts, _ndr_ts_compressed));
291 NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_ts, 4, -1));
295 return NDR_ERR_SUCCESS;
298 enum ndr_err_code ndr_push_drsuapi_DsGetNCChangesWIN2K3_LZ77_DIRECT2Ctr1(struct ndr_push *ndr, ndr_flags_type ndr_flags, const struct drsuapi_DsGetNCChangesWIN2K3_LZ77_DIRECT2Ctr1 *r)
300 if (ndr_flags & NDR_SCALARS) {
301 uint32_t decompressed_length = 0;
302 uint32_t compressed_length = 0;
303 if (r->ts) {
305 struct ndr_push *_ndr_ts;
306 NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_ts, 4, -1));
308 struct ndr_push *_ndr_ts_compressed;
309 NDR_CHECK(ndr_push_compression_state_init(_ndr_ts, NDR_COMPRESSION_WIN2K3_LZ77_DIRECT2));
310 NDR_CHECK(ndr_push_compression_start(_ndr_ts, &_ndr_ts_compressed));
311 NDR_CHECK(ndr_push_drsuapi_DsGetNCChangesCtr1TS(_ndr_ts_compressed, NDR_SCALARS|NDR_BUFFERS, r->ts));
312 decompressed_length = _ndr_ts_compressed->offset;
313 NDR_CHECK(ndr_push_compression_end(_ndr_ts, _ndr_ts_compressed));
315 compressed_length = _ndr_ts->offset;
316 TALLOC_FREE(_ndr_ts);
319 NDR_CHECK(ndr_push_align(ndr, 4));
320 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, decompressed_length));
321 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, compressed_length));
322 NDR_CHECK(ndr_push_unique_ptr(ndr, r->ts));
324 if (ndr_flags & NDR_BUFFERS) {
325 if (r->ts) {
327 struct ndr_push *_ndr_ts;
328 NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_ts, 4, -1));
330 struct ndr_push *_ndr_ts_compressed;
331 NDR_CHECK(ndr_push_compression_state_init(_ndr_ts, NDR_COMPRESSION_WIN2K3_LZ77_DIRECT2));
332 NDR_CHECK(ndr_push_compression_start(_ndr_ts, &_ndr_ts_compressed));
333 NDR_CHECK(ndr_push_drsuapi_DsGetNCChangesCtr1TS(_ndr_ts_compressed, NDR_SCALARS|NDR_BUFFERS, r->ts));
334 NDR_CHECK(ndr_push_compression_end(_ndr_ts, _ndr_ts_compressed));
336 NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_ts, 4, -1));
340 return NDR_ERR_SUCCESS;
343 enum ndr_err_code ndr_push_drsuapi_DsGetNCChangesWIN2K3_LZ77_DIRECT2Ctr6(struct ndr_push *ndr, ndr_flags_type ndr_flags, const struct drsuapi_DsGetNCChangesWIN2K3_LZ77_DIRECT2Ctr6 *r)
345 if (ndr_flags & NDR_SCALARS) {
346 uint32_t decompressed_length = 0;
347 uint32_t compressed_length = 0;
348 if (r->ts) {
350 struct ndr_push *_ndr_ts;
351 NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_ts, 4, -1));
353 struct ndr_push *_ndr_ts_compressed;
354 NDR_CHECK(ndr_push_compression_state_init(_ndr_ts, NDR_COMPRESSION_WIN2K3_LZ77_DIRECT2));
355 NDR_CHECK(ndr_push_compression_start(_ndr_ts, &_ndr_ts_compressed));
356 NDR_CHECK(ndr_push_drsuapi_DsGetNCChangesCtr6TS(_ndr_ts_compressed, NDR_SCALARS|NDR_BUFFERS, r->ts));
357 decompressed_length = _ndr_ts_compressed->offset;
358 NDR_CHECK(ndr_push_compression_end(_ndr_ts, _ndr_ts_compressed));
360 compressed_length = _ndr_ts->offset;
361 TALLOC_FREE(_ndr_ts);
364 NDR_CHECK(ndr_push_align(ndr, 4));
365 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, decompressed_length));
366 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, compressed_length));
367 NDR_CHECK(ndr_push_unique_ptr(ndr, r->ts));
369 if (ndr_flags & NDR_BUFFERS) {
370 if (r->ts) {
372 struct ndr_push *_ndr_ts;
373 NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_ts, 4, -1));
375 struct ndr_push *_ndr_ts_compressed;
376 NDR_CHECK(ndr_push_compression_state_init(_ndr_ts, NDR_COMPRESSION_WIN2K3_LZ77_DIRECT2));
377 NDR_CHECK(ndr_push_compression_start(_ndr_ts, &_ndr_ts_compressed));
378 NDR_CHECK(ndr_push_drsuapi_DsGetNCChangesCtr6TS(_ndr_ts_compressed, NDR_SCALARS|NDR_BUFFERS, r->ts));
379 NDR_CHECK(ndr_push_compression_end(_ndr_ts, _ndr_ts_compressed));
381 NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_ts, 4, -1));
385 return NDR_ERR_SUCCESS;
388 _PUBLIC_ size_t ndr_size_drsuapi_DsReplicaObjectIdentifier3Binary_without_Binary(const struct drsuapi_DsReplicaObjectIdentifier3Binary *r, libndr_flags flags)
390 return ndr_size_struct((const struct drsuapi_DsReplicaObjectIdentifier3 *)r, flags, (ndr_push_flags_fn_t)ndr_push_drsuapi_DsReplicaObjectIdentifier3);
393 _PUBLIC_ void ndr_print_drsuapi_SecBufferType(struct ndr_print *ndr, const char *name, enum drsuapi_SecBufferType r)
395 const char *val = NULL;
397 switch (r & 0x00000007) {
398 case DRSUAPI_SECBUFFER_EMPTY: val = "DRSUAPI_SECBUFFER_EMPTY"; break;
399 case DRSUAPI_SECBUFFER_DATA: val = "DRSUAPI_SECBUFFER_DATA"; break;
400 case DRSUAPI_SECBUFFER_TOKEN: val = "DRSUAPI_SECBUFFER_TOKEN"; break;
401 case DRSUAPI_SECBUFFER_PKG_PARAMS: val = "DRSUAPI_SECBUFFER_PKG_PARAMS"; break;
402 case DRSUAPI_SECBUFFER_MISSING: val = "DRSUAPI_SECBUFFER_MISSING"; break;
403 case DRSUAPI_SECBUFFER_EXTRA: val = "DRSUAPI_SECBUFFER_EXTRA"; break;
404 case DRSUAPI_SECBUFFER_STREAM_TRAILER: val = "DRSUAPI_SECBUFFER_STREAM_TRAILER"; break;
405 case DRSUAPI_SECBUFFER_STREAM_HEADER: val = "DRSUAPI_SECBUFFER_STREAM_HEADER"; break;
408 if (r & DRSUAPI_SECBUFFER_READONLY) {
409 char *v = talloc_asprintf(ndr, "DRSUAPI_SECBUFFER_READONLY | %s", val);
410 ndr_print_enum(ndr, name, "ENUM", v, r);
411 } else {
412 ndr_print_enum(ndr, name, "ENUM", val, r);
416 _PUBLIC_ void ndr_print_drsuapi_DsAddEntry_AttrErrListItem_V1(struct ndr_print *ndr, const char *name, const struct drsuapi_DsAddEntry_AttrErrListItem_V1 *r)
418 ndr_print_struct(ndr, name, "drsuapi_DsAddEntry_AttrErrListItem_V1");
419 ndr->depth++;
420 ndr_print_ptr(ndr, "next", r->next);
421 ndr_print_drsuapi_DsAddEntry_AttrErr_V1(ndr, "err_data", &r->err_data);
422 ndr->depth--;
423 if (r->next) {
424 ndr_print_drsuapi_DsAddEntry_AttrErrListItem_V1(ndr, "next", r->next);
428 enum ndr_err_code ndr_push_drsuapi_DsBindInfo(struct ndr_push *ndr, ndr_flags_type ndr_flags, const union drsuapi_DsBindInfo *r)
430 libndr_flags _flags_save = ndr->flags;
431 ndr->flags = ndr->flags & ~LIBNDR_FLAG_NDR64;
432 NDR_PUSH_CHECK_FLAGS(ndr, ndr_flags);
433 if (ndr_flags & NDR_SCALARS) {
434 uint32_t level;
435 NDR_CHECK(ndr_push_steal_switch_value(ndr, r, &level));
436 NDR_CHECK(ndr_push_union_align(ndr, 4));
437 switch (level) {
438 case 24: {
440 struct ndr_push *_ndr_info24;
441 NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_info24, 0, 24));
442 NDR_CHECK(ndr_push_drsuapi_DsBindInfo24(_ndr_info24, NDR_SCALARS, &r->info24));
443 NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_info24, 0, 24));
445 break; }
447 case 28: {
449 struct ndr_push *_ndr_info28;
450 NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_info28, 0, 28));
451 NDR_CHECK(ndr_push_drsuapi_DsBindInfo28(_ndr_info28, NDR_SCALARS, &r->info28));
452 NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_info28, 0, 28));
454 break; }
456 case 48: {
458 struct ndr_push *_ndr_info48;
459 NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_info48, 0, 48));
460 NDR_CHECK(ndr_push_drsuapi_DsBindInfo48(_ndr_info48, NDR_SCALARS, &r->info48));
461 NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_info48, 0, 48));
463 break; }
465 case 52: {
467 struct ndr_push *_ndr_info52;
468 NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_info52, 0, 52));
469 NDR_CHECK(ndr_push_drsuapi_DsBindInfo52(_ndr_info52, NDR_SCALARS, &r->info52));
470 NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_info52, 0, 52));
472 break; }
474 default: {
476 struct ndr_push *_ndr_Fallback;
477 NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_Fallback, 0, level));
478 NDR_CHECK(ndr_push_drsuapi_DsBindInfoFallBack(_ndr_Fallback, NDR_SCALARS, &r->Fallback));
479 NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_Fallback, 0, level));
481 break; }
485 ndr->flags = _flags_save;
486 return NDR_ERR_SUCCESS;
489 enum ndr_err_code ndr_pull_drsuapi_DsBindInfo(struct ndr_pull *ndr, ndr_flags_type ndr_flags, union drsuapi_DsBindInfo *r)
491 libndr_flags _flags_save = ndr->flags;
492 ndr->flags = ndr->flags & ~LIBNDR_FLAG_NDR64;
493 NDR_PULL_CHECK_FLAGS(ndr, ndr_flags);
494 if (ndr_flags & NDR_SCALARS) {
495 uint32_t level;
496 NDR_CHECK(ndr_pull_steal_switch_value(ndr, r, &level));
497 NDR_CHECK(ndr_pull_union_align(ndr, 4));
498 switch (level) {
499 case 24: {
501 struct ndr_pull *_ndr_info24;
502 NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_info24, 0, 24));
503 NDR_CHECK(ndr_pull_drsuapi_DsBindInfo24(_ndr_info24, NDR_SCALARS, &r->info24));
504 NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_info24, 0, 24));
506 break; }
508 case 28: {
510 struct ndr_pull *_ndr_info28;
511 NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_info28, 0, 28));
512 NDR_CHECK(ndr_pull_drsuapi_DsBindInfo28(_ndr_info28, NDR_SCALARS, &r->info28));
513 NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_info28, 0, 28));
515 break; }
517 case 48: {
519 struct ndr_pull *_ndr_info48;
520 NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_info48, 0, 48));
521 NDR_CHECK(ndr_pull_drsuapi_DsBindInfo48(_ndr_info48, NDR_SCALARS, &r->info48));
522 NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_info48, 0, 48));
524 break; }
526 case 52: {
528 struct ndr_pull *_ndr_info52;
529 NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_info52, 0, 52));
530 NDR_CHECK(ndr_pull_drsuapi_DsBindInfo52(_ndr_info52, NDR_SCALARS, &r->info52));
531 NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_info52, 0, 52));
533 break; }
535 default: {
537 struct ndr_pull *_ndr_Fallback;
538 NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_Fallback, 0, level));
539 NDR_CHECK(ndr_pull_drsuapi_DsBindInfoFallBack(_ndr_Fallback, NDR_SCALARS, &r->Fallback));
540 NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_Fallback, 0, level));
542 break; }
546 ndr->flags = _flags_save;
547 return NDR_ERR_SUCCESS;
550 _PUBLIC_ void ndr_print_drsuapi_DsBindInfo(struct ndr_print *ndr, const char *name, const union drsuapi_DsBindInfo *r)
552 uint32_t level;
553 level = ndr_print_steal_switch_value(ndr, r);
554 ndr_print_union(ndr, name, level, "drsuapi_DsBindInfo");
555 switch (level) {
556 case 24:
557 ndr_print_drsuapi_DsBindInfo24(ndr, "info24", &r->info24);
558 break;
560 case 28:
561 ndr_print_drsuapi_DsBindInfo28(ndr, "info28", &r->info28);
562 break;
564 case 48:
565 ndr_print_drsuapi_DsBindInfo48(ndr, "info48", &r->info48);
566 break;
568 case 52:
569 ndr_print_drsuapi_DsBindInfo52(ndr, "info52", &r->info52);
570 break;
572 default:
573 ndr_print_drsuapi_DsBindInfoFallBack(ndr, "Fallback", &r->Fallback);
574 break;