2aee3f7fde9da38811e05cd48b2a504a7de30ccf
[ira/wip.git] / librpc / gen_ndr / ndr_lsa.c
1 /* parser auto-generated by pidl */
2
3 #include "includes.h"
4 #include "../librpc/gen_ndr/ndr_lsa.h"
5
6 #include "librpc/gen_ndr/ndr_misc.h"
7 #include "librpc/gen_ndr/ndr_security.h"
8 _PUBLIC_ enum ndr_err_code ndr_push_lsa_String(struct ndr_push *ndr, int ndr_flags, const struct lsa_String *r)
9 {
10         if (ndr_flags & NDR_SCALARS) {
11                 NDR_CHECK(ndr_push_align(ndr, 4));
12                 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, 2 * strlen_m(r->string)));
13                 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, 2 * strlen_m(r->string)));
14                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->string));
15         }
16         if (ndr_flags & NDR_BUFFERS) {
17                 if (r->string) {
18                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 2 * strlen_m(r->string) / 2));
19                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
20                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 2 * strlen_m(r->string) / 2));
21                         NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->string, 2 * strlen_m(r->string) / 2, sizeof(uint16_t), CH_UTF16));
22                 }
23         }
24         return NDR_ERR_SUCCESS;
25 }
26
27 _PUBLIC_ enum ndr_err_code ndr_pull_lsa_String(struct ndr_pull *ndr, int ndr_flags, struct lsa_String *r)
28 {
29         uint32_t _ptr_string;
30         TALLOC_CTX *_mem_save_string_0;
31         if (ndr_flags & NDR_SCALARS) {
32                 NDR_CHECK(ndr_pull_align(ndr, 4));
33                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->length));
34                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->size));
35                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_string));
36                 if (_ptr_string) {
37                         NDR_PULL_ALLOC(ndr, r->string);
38                 } else {
39                         r->string = NULL;
40                 }
41         }
42         if (ndr_flags & NDR_BUFFERS) {
43                 if (r->string) {
44                         _mem_save_string_0 = NDR_PULL_GET_MEM_CTX(ndr);
45                         NDR_PULL_SET_MEM_CTX(ndr, r->string, 0);
46                         NDR_CHECK(ndr_pull_array_size(ndr, &r->string));
47                         NDR_CHECK(ndr_pull_array_length(ndr, &r->string));
48                         if (ndr_get_array_length(ndr, &r->string) > ndr_get_array_size(ndr, &r->string)) {
49                                 return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->string), ndr_get_array_length(ndr, &r->string));
50                         }
51                         NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->string, ndr_get_array_length(ndr, &r->string), sizeof(uint16_t), CH_UTF16));
52                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_string_0, 0);
53                 }
54                 if (r->string) {
55                         NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->string, r->size / 2));
56                 }
57                 if (r->string) {
58                         NDR_CHECK(ndr_check_array_length(ndr, (void*)&r->string, r->length / 2));
59                 }
60         }
61         return NDR_ERR_SUCCESS;
62 }
63
64 _PUBLIC_ void ndr_print_lsa_String(struct ndr_print *ndr, const char *name, const struct lsa_String *r)
65 {
66         ndr_print_struct(ndr, name, "lsa_String");
67         ndr->depth++;
68         ndr_print_uint16(ndr, "length", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?2 * strlen_m(r->string):r->length);
69         ndr_print_uint16(ndr, "size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?2 * strlen_m(r->string):r->size);
70         ndr_print_ptr(ndr, "string", r->string);
71         ndr->depth++;
72         if (r->string) {
73                 ndr_print_string(ndr, "string", r->string);
74         }
75         ndr->depth--;
76         ndr->depth--;
77 }
78
79 _PUBLIC_ enum ndr_err_code ndr_push_lsa_StringLarge(struct ndr_push *ndr, int ndr_flags, const struct lsa_StringLarge *r)
80 {
81         if (ndr_flags & NDR_SCALARS) {
82                 NDR_CHECK(ndr_push_align(ndr, 4));
83                 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, 2 * strlen_m(r->string)));
84                 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, 2 * strlen_m_term(r->string)));
85                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->string));
86         }
87         if (ndr_flags & NDR_BUFFERS) {
88                 if (r->string) {
89                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 2 * strlen_m_term(r->string) / 2));
90                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
91                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 2 * strlen_m(r->string) / 2));
92                         NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->string, 2 * strlen_m(r->string) / 2, sizeof(uint16_t), CH_UTF16));
93                 }
94         }
95         return NDR_ERR_SUCCESS;
96 }
97
98 _PUBLIC_ enum ndr_err_code ndr_pull_lsa_StringLarge(struct ndr_pull *ndr, int ndr_flags, struct lsa_StringLarge *r)
99 {
100         uint32_t _ptr_string;
101         TALLOC_CTX *_mem_save_string_0;
102         if (ndr_flags & NDR_SCALARS) {
103                 NDR_CHECK(ndr_pull_align(ndr, 4));
104                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->length));
105                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->size));
106                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_string));
107                 if (_ptr_string) {
108                         NDR_PULL_ALLOC(ndr, r->string);
109                 } else {
110                         r->string = NULL;
111                 }
112         }
113         if (ndr_flags & NDR_BUFFERS) {
114                 if (r->string) {
115                         _mem_save_string_0 = NDR_PULL_GET_MEM_CTX(ndr);
116                         NDR_PULL_SET_MEM_CTX(ndr, r->string, 0);
117                         NDR_CHECK(ndr_pull_array_size(ndr, &r->string));
118                         NDR_CHECK(ndr_pull_array_length(ndr, &r->string));
119                         if (ndr_get_array_length(ndr, &r->string) > ndr_get_array_size(ndr, &r->string)) {
120                                 return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->string), ndr_get_array_length(ndr, &r->string));
121                         }
122                         NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->string, ndr_get_array_length(ndr, &r->string), sizeof(uint16_t), CH_UTF16));
123                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_string_0, 0);
124                 }
125                 if (r->string) {
126                         NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->string, r->size / 2));
127                 }
128                 if (r->string) {
129                         NDR_CHECK(ndr_check_array_length(ndr, (void*)&r->string, r->length / 2));
130                 }
131         }
132         return NDR_ERR_SUCCESS;
133 }
134
135 _PUBLIC_ void ndr_print_lsa_StringLarge(struct ndr_print *ndr, const char *name, const struct lsa_StringLarge *r)
136 {
137         ndr_print_struct(ndr, name, "lsa_StringLarge");
138         ndr->depth++;
139         ndr_print_uint16(ndr, "length", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?2 * strlen_m(r->string):r->length);
140         ndr_print_uint16(ndr, "size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?2 * strlen_m_term(r->string):r->size);
141         ndr_print_ptr(ndr, "string", r->string);
142         ndr->depth++;
143         if (r->string) {
144                 ndr_print_string(ndr, "string", r->string);
145         }
146         ndr->depth--;
147         ndr->depth--;
148 }
149
150 _PUBLIC_ enum ndr_err_code ndr_push_lsa_Strings(struct ndr_push *ndr, int ndr_flags, const struct lsa_Strings *r)
151 {
152         uint32_t cntr_names_1;
153         if (ndr_flags & NDR_SCALARS) {
154                 NDR_CHECK(ndr_push_align(ndr, 4));
155                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count));
156                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->names));
157         }
158         if (ndr_flags & NDR_BUFFERS) {
159                 if (r->names) {
160                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count));
161                         for (cntr_names_1 = 0; cntr_names_1 < r->count; cntr_names_1++) {
162                                 NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->names[cntr_names_1]));
163                         }
164                         for (cntr_names_1 = 0; cntr_names_1 < r->count; cntr_names_1++) {
165                                 NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->names[cntr_names_1]));
166                         }
167                 }
168         }
169         return NDR_ERR_SUCCESS;
170 }
171
172 _PUBLIC_ enum ndr_err_code ndr_pull_lsa_Strings(struct ndr_pull *ndr, int ndr_flags, struct lsa_Strings *r)
173 {
174         uint32_t _ptr_names;
175         uint32_t cntr_names_1;
176         TALLOC_CTX *_mem_save_names_0;
177         TALLOC_CTX *_mem_save_names_1;
178         if (ndr_flags & NDR_SCALARS) {
179                 NDR_CHECK(ndr_pull_align(ndr, 4));
180                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->count));
181                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_names));
182                 if (_ptr_names) {
183                         NDR_PULL_ALLOC(ndr, r->names);
184                 } else {
185                         r->names = NULL;
186                 }
187         }
188         if (ndr_flags & NDR_BUFFERS) {
189                 if (r->names) {
190                         _mem_save_names_0 = NDR_PULL_GET_MEM_CTX(ndr);
191                         NDR_PULL_SET_MEM_CTX(ndr, r->names, 0);
192                         NDR_CHECK(ndr_pull_array_size(ndr, &r->names));
193                         NDR_PULL_ALLOC_N(ndr, r->names, ndr_get_array_size(ndr, &r->names));
194                         _mem_save_names_1 = NDR_PULL_GET_MEM_CTX(ndr);
195                         NDR_PULL_SET_MEM_CTX(ndr, r->names, 0);
196                         for (cntr_names_1 = 0; cntr_names_1 < r->count; cntr_names_1++) {
197                                 NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->names[cntr_names_1]));
198                         }
199                         for (cntr_names_1 = 0; cntr_names_1 < r->count; cntr_names_1++) {
200                                 NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->names[cntr_names_1]));
201                         }
202                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_names_1, 0);
203                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_names_0, 0);
204                 }
205                 if (r->names) {
206                         NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->names, r->count));
207                 }
208         }
209         return NDR_ERR_SUCCESS;
210 }
211
212 _PUBLIC_ void ndr_print_lsa_Strings(struct ndr_print *ndr, const char *name, const struct lsa_Strings *r)
213 {
214         uint32_t cntr_names_1;
215         ndr_print_struct(ndr, name, "lsa_Strings");
216         ndr->depth++;
217         ndr_print_uint32(ndr, "count", r->count);
218         ndr_print_ptr(ndr, "names", r->names);
219         ndr->depth++;
220         if (r->names) {
221                 ndr->print(ndr, "%s: ARRAY(%d)", "names", (int)r->count);
222                 ndr->depth++;
223                 for (cntr_names_1=0;cntr_names_1<r->count;cntr_names_1++) {
224                         char *idx_1=NULL;
225                         if (asprintf(&idx_1, "[%d]", cntr_names_1) != -1) {
226                                 ndr_print_lsa_String(ndr, "names", &r->names[cntr_names_1]);
227                                 free(idx_1);
228                         }
229                 }
230                 ndr->depth--;
231         }
232         ndr->depth--;
233         ndr->depth--;
234 }
235
236 _PUBLIC_ enum ndr_err_code ndr_push_lsa_AsciiString(struct ndr_push *ndr, int ndr_flags, const struct lsa_AsciiString *r)
237 {
238         if (ndr_flags & NDR_SCALARS) {
239                 NDR_CHECK(ndr_push_align(ndr, 4));
240                 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, strlen_m(r->string)));
241                 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, strlen_m(r->string)));
242                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->string));
243         }
244         if (ndr_flags & NDR_BUFFERS) {
245                 if (r->string) {
246                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, strlen_m(r->string)));
247                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
248                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, strlen_m(r->string)));
249                         NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->string, strlen_m(r->string), sizeof(uint8_t), CH_DOS));
250                 }
251         }
252         return NDR_ERR_SUCCESS;
253 }
254
255 _PUBLIC_ enum ndr_err_code ndr_pull_lsa_AsciiString(struct ndr_pull *ndr, int ndr_flags, struct lsa_AsciiString *r)
256 {
257         uint32_t _ptr_string;
258         TALLOC_CTX *_mem_save_string_0;
259         if (ndr_flags & NDR_SCALARS) {
260                 NDR_CHECK(ndr_pull_align(ndr, 4));
261                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->length));
262                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->size));
263                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_string));
264                 if (_ptr_string) {
265                         NDR_PULL_ALLOC(ndr, r->string);
266                 } else {
267                         r->string = NULL;
268                 }
269         }
270         if (ndr_flags & NDR_BUFFERS) {
271                 if (r->string) {
272                         _mem_save_string_0 = NDR_PULL_GET_MEM_CTX(ndr);
273                         NDR_PULL_SET_MEM_CTX(ndr, r->string, 0);
274                         NDR_CHECK(ndr_pull_array_size(ndr, &r->string));
275                         NDR_CHECK(ndr_pull_array_length(ndr, &r->string));
276                         if (ndr_get_array_length(ndr, &r->string) > ndr_get_array_size(ndr, &r->string)) {
277                                 return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->string), ndr_get_array_length(ndr, &r->string));
278                         }
279                         NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->string, ndr_get_array_length(ndr, &r->string), sizeof(uint8_t), CH_DOS));
280                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_string_0, 0);
281                 }
282                 if (r->string) {
283                         NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->string, r->size));
284                 }
285                 if (r->string) {
286                         NDR_CHECK(ndr_check_array_length(ndr, (void*)&r->string, r->length));
287                 }
288         }
289         return NDR_ERR_SUCCESS;
290 }
291
292 _PUBLIC_ void ndr_print_lsa_AsciiString(struct ndr_print *ndr, const char *name, const struct lsa_AsciiString *r)
293 {
294         ndr_print_struct(ndr, name, "lsa_AsciiString");
295         ndr->depth++;
296         ndr_print_uint16(ndr, "length", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?strlen_m(r->string):r->length);
297         ndr_print_uint16(ndr, "size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?strlen_m(r->string):r->size);
298         ndr_print_ptr(ndr, "string", r->string);
299         ndr->depth++;
300         if (r->string) {
301                 ndr_print_string(ndr, "string", r->string);
302         }
303         ndr->depth--;
304         ndr->depth--;
305 }
306
307 _PUBLIC_ enum ndr_err_code ndr_push_lsa_AsciiStringLarge(struct ndr_push *ndr, int ndr_flags, const struct lsa_AsciiStringLarge *r)
308 {
309         if (ndr_flags & NDR_SCALARS) {
310                 NDR_CHECK(ndr_push_align(ndr, 4));
311                 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, strlen_m(r->string)));
312                 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, strlen_m_term(r->string)));
313                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->string));
314         }
315         if (ndr_flags & NDR_BUFFERS) {
316                 if (r->string) {
317                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, strlen_m_term(r->string)));
318                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
319                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, strlen_m(r->string)));
320                         NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->string, strlen_m(r->string), sizeof(uint8_t), CH_DOS));
321                 }
322         }
323         return NDR_ERR_SUCCESS;
324 }
325
326 _PUBLIC_ enum ndr_err_code ndr_pull_lsa_AsciiStringLarge(struct ndr_pull *ndr, int ndr_flags, struct lsa_AsciiStringLarge *r)
327 {
328         uint32_t _ptr_string;
329         TALLOC_CTX *_mem_save_string_0;
330         if (ndr_flags & NDR_SCALARS) {
331                 NDR_CHECK(ndr_pull_align(ndr, 4));
332                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->length));
333                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->size));
334                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_string));
335                 if (_ptr_string) {
336                         NDR_PULL_ALLOC(ndr, r->string);
337                 } else {
338                         r->string = NULL;
339                 }
340         }
341         if (ndr_flags & NDR_BUFFERS) {
342                 if (r->string) {
343                         _mem_save_string_0 = NDR_PULL_GET_MEM_CTX(ndr);
344                         NDR_PULL_SET_MEM_CTX(ndr, r->string, 0);
345                         NDR_CHECK(ndr_pull_array_size(ndr, &r->string));
346                         NDR_CHECK(ndr_pull_array_length(ndr, &r->string));
347                         if (ndr_get_array_length(ndr, &r->string) > ndr_get_array_size(ndr, &r->string)) {
348                                 return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->string), ndr_get_array_length(ndr, &r->string));
349                         }
350                         NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->string, ndr_get_array_length(ndr, &r->string), sizeof(uint8_t), CH_DOS));
351                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_string_0, 0);
352                 }
353                 if (r->string) {
354                         NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->string, r->size));
355                 }
356                 if (r->string) {
357                         NDR_CHECK(ndr_check_array_length(ndr, (void*)&r->string, r->length));
358                 }
359         }
360         return NDR_ERR_SUCCESS;
361 }
362
363 _PUBLIC_ void ndr_print_lsa_AsciiStringLarge(struct ndr_print *ndr, const char *name, const struct lsa_AsciiStringLarge *r)
364 {
365         ndr_print_struct(ndr, name, "lsa_AsciiStringLarge");
366         ndr->depth++;
367         ndr_print_uint16(ndr, "length", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?strlen_m(r->string):r->length);
368         ndr_print_uint16(ndr, "size", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?strlen_m_term(r->string):r->size);
369         ndr_print_ptr(ndr, "string", r->string);
370         ndr->depth++;
371         if (r->string) {
372                 ndr_print_string(ndr, "string", r->string);
373         }
374         ndr->depth--;
375         ndr->depth--;
376 }
377
378 _PUBLIC_ enum ndr_err_code ndr_push_lsa_BinaryString(struct ndr_push *ndr, int ndr_flags, const struct lsa_BinaryString *r)
379 {
380         uint32_t cntr_array_1;
381         if (ndr_flags & NDR_SCALARS) {
382                 NDR_CHECK(ndr_push_align(ndr, 4));
383                 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->length));
384                 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->size));
385                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->array));
386         }
387         if (ndr_flags & NDR_BUFFERS) {
388                 if (r->array) {
389                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->size / 2));
390                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
391                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->length / 2));
392                         for (cntr_array_1 = 0; cntr_array_1 < r->length / 2; cntr_array_1++) {
393                                 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->array[cntr_array_1]));
394                         }
395                 }
396         }
397         return NDR_ERR_SUCCESS;
398 }
399
400 _PUBLIC_ enum ndr_err_code ndr_pull_lsa_BinaryString(struct ndr_pull *ndr, int ndr_flags, struct lsa_BinaryString *r)
401 {
402         uint32_t _ptr_array;
403         uint32_t cntr_array_1;
404         TALLOC_CTX *_mem_save_array_0;
405         TALLOC_CTX *_mem_save_array_1;
406         if (ndr_flags & NDR_SCALARS) {
407                 NDR_CHECK(ndr_pull_align(ndr, 4));
408                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->length));
409                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->size));
410                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_array));
411                 if (_ptr_array) {
412                         NDR_PULL_ALLOC(ndr, r->array);
413                 } else {
414                         r->array = NULL;
415                 }
416         }
417         if (ndr_flags & NDR_BUFFERS) {
418                 if (r->array) {
419                         _mem_save_array_0 = NDR_PULL_GET_MEM_CTX(ndr);
420                         NDR_PULL_SET_MEM_CTX(ndr, r->array, 0);
421                         NDR_CHECK(ndr_pull_array_size(ndr, &r->array));
422                         NDR_CHECK(ndr_pull_array_length(ndr, &r->array));
423                         if (ndr_get_array_length(ndr, &r->array) > ndr_get_array_size(ndr, &r->array)) {
424                                 return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->array), ndr_get_array_length(ndr, &r->array));
425                         }
426                         NDR_PULL_ALLOC_N(ndr, r->array, ndr_get_array_size(ndr, &r->array));
427                         _mem_save_array_1 = NDR_PULL_GET_MEM_CTX(ndr);
428                         NDR_PULL_SET_MEM_CTX(ndr, r->array, 0);
429                         for (cntr_array_1 = 0; cntr_array_1 < r->length / 2; cntr_array_1++) {
430                                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->array[cntr_array_1]));
431                         }
432                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_array_1, 0);
433                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_array_0, 0);
434                 }
435                 if (r->array) {
436                         NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->array, r->size / 2));
437                 }
438                 if (r->array) {
439                         NDR_CHECK(ndr_check_array_length(ndr, (void*)&r->array, r->length / 2));
440                 }
441         }
442         return NDR_ERR_SUCCESS;
443 }
444
445 _PUBLIC_ void ndr_print_lsa_BinaryString(struct ndr_print *ndr, const char *name, const struct lsa_BinaryString *r)
446 {
447         uint32_t cntr_array_1;
448         ndr_print_struct(ndr, name, "lsa_BinaryString");
449         ndr->depth++;
450         ndr_print_uint16(ndr, "length", r->length);
451         ndr_print_uint16(ndr, "size", r->size);
452         ndr_print_ptr(ndr, "array", r->array);
453         ndr->depth++;
454         if (r->array) {
455                 ndr->print(ndr, "%s: ARRAY(%d)", "array", (int)r->length / 2);
456                 ndr->depth++;
457                 for (cntr_array_1=0;cntr_array_1<r->length / 2;cntr_array_1++) {
458                         char *idx_1=NULL;
459                         if (asprintf(&idx_1, "[%d]", cntr_array_1) != -1) {
460                                 ndr_print_uint16(ndr, "array", r->array[cntr_array_1]);
461                                 free(idx_1);
462                         }
463                 }
464                 ndr->depth--;
465         }
466         ndr->depth--;
467         ndr->depth--;
468 }
469
470 static enum ndr_err_code ndr_push_lsa_LUID(struct ndr_push *ndr, int ndr_flags, const struct lsa_LUID *r)
471 {
472         if (ndr_flags & NDR_SCALARS) {
473                 NDR_CHECK(ndr_push_align(ndr, 4));
474                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->low));
475                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->high));
476         }
477         if (ndr_flags & NDR_BUFFERS) {
478         }
479         return NDR_ERR_SUCCESS;
480 }
481
482 static enum ndr_err_code ndr_pull_lsa_LUID(struct ndr_pull *ndr, int ndr_flags, struct lsa_LUID *r)
483 {
484         if (ndr_flags & NDR_SCALARS) {
485                 NDR_CHECK(ndr_pull_align(ndr, 4));
486                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->low));
487                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->high));
488         }
489         if (ndr_flags & NDR_BUFFERS) {
490         }
491         return NDR_ERR_SUCCESS;
492 }
493
494 _PUBLIC_ void ndr_print_lsa_LUID(struct ndr_print *ndr, const char *name, const struct lsa_LUID *r)
495 {
496         ndr_print_struct(ndr, name, "lsa_LUID");
497         ndr->depth++;
498         ndr_print_uint32(ndr, "low", r->low);
499         ndr_print_uint32(ndr, "high", r->high);
500         ndr->depth--;
501 }
502
503 static enum ndr_err_code ndr_push_lsa_PrivEntry(struct ndr_push *ndr, int ndr_flags, const struct lsa_PrivEntry *r)
504 {
505         if (ndr_flags & NDR_SCALARS) {
506                 NDR_CHECK(ndr_push_align(ndr, 4));
507                 NDR_CHECK(ndr_push_lsa_StringLarge(ndr, NDR_SCALARS, &r->name));
508                 NDR_CHECK(ndr_push_lsa_LUID(ndr, NDR_SCALARS, &r->luid));
509         }
510         if (ndr_flags & NDR_BUFFERS) {
511                 NDR_CHECK(ndr_push_lsa_StringLarge(ndr, NDR_BUFFERS, &r->name));
512         }
513         return NDR_ERR_SUCCESS;
514 }
515
516 static enum ndr_err_code ndr_pull_lsa_PrivEntry(struct ndr_pull *ndr, int ndr_flags, struct lsa_PrivEntry *r)
517 {
518         if (ndr_flags & NDR_SCALARS) {
519                 NDR_CHECK(ndr_pull_align(ndr, 4));
520                 NDR_CHECK(ndr_pull_lsa_StringLarge(ndr, NDR_SCALARS, &r->name));
521                 NDR_CHECK(ndr_pull_lsa_LUID(ndr, NDR_SCALARS, &r->luid));
522         }
523         if (ndr_flags & NDR_BUFFERS) {
524                 NDR_CHECK(ndr_pull_lsa_StringLarge(ndr, NDR_BUFFERS, &r->name));
525         }
526         return NDR_ERR_SUCCESS;
527 }
528
529 _PUBLIC_ void ndr_print_lsa_PrivEntry(struct ndr_print *ndr, const char *name, const struct lsa_PrivEntry *r)
530 {
531         ndr_print_struct(ndr, name, "lsa_PrivEntry");
532         ndr->depth++;
533         ndr_print_lsa_StringLarge(ndr, "name", &r->name);
534         ndr_print_lsa_LUID(ndr, "luid", &r->luid);
535         ndr->depth--;
536 }
537
538 static enum ndr_err_code ndr_push_lsa_PrivArray(struct ndr_push *ndr, int ndr_flags, const struct lsa_PrivArray *r)
539 {
540         uint32_t cntr_privs_1;
541         if (ndr_flags & NDR_SCALARS) {
542                 NDR_CHECK(ndr_push_align(ndr, 4));
543                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count));
544                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->privs));
545         }
546         if (ndr_flags & NDR_BUFFERS) {
547                 if (r->privs) {
548                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count));
549                         for (cntr_privs_1 = 0; cntr_privs_1 < r->count; cntr_privs_1++) {
550                                 NDR_CHECK(ndr_push_lsa_PrivEntry(ndr, NDR_SCALARS, &r->privs[cntr_privs_1]));
551                         }
552                         for (cntr_privs_1 = 0; cntr_privs_1 < r->count; cntr_privs_1++) {
553                                 NDR_CHECK(ndr_push_lsa_PrivEntry(ndr, NDR_BUFFERS, &r->privs[cntr_privs_1]));
554                         }
555                 }
556         }
557         return NDR_ERR_SUCCESS;
558 }
559
560 static enum ndr_err_code ndr_pull_lsa_PrivArray(struct ndr_pull *ndr, int ndr_flags, struct lsa_PrivArray *r)
561 {
562         uint32_t _ptr_privs;
563         uint32_t cntr_privs_1;
564         TALLOC_CTX *_mem_save_privs_0;
565         TALLOC_CTX *_mem_save_privs_1;
566         if (ndr_flags & NDR_SCALARS) {
567                 NDR_CHECK(ndr_pull_align(ndr, 4));
568                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->count));
569                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_privs));
570                 if (_ptr_privs) {
571                         NDR_PULL_ALLOC(ndr, r->privs);
572                 } else {
573                         r->privs = NULL;
574                 }
575         }
576         if (ndr_flags & NDR_BUFFERS) {
577                 if (r->privs) {
578                         _mem_save_privs_0 = NDR_PULL_GET_MEM_CTX(ndr);
579                         NDR_PULL_SET_MEM_CTX(ndr, r->privs, 0);
580                         NDR_CHECK(ndr_pull_array_size(ndr, &r->privs));
581                         NDR_PULL_ALLOC_N(ndr, r->privs, ndr_get_array_size(ndr, &r->privs));
582                         _mem_save_privs_1 = NDR_PULL_GET_MEM_CTX(ndr);
583                         NDR_PULL_SET_MEM_CTX(ndr, r->privs, 0);
584                         for (cntr_privs_1 = 0; cntr_privs_1 < r->count; cntr_privs_1++) {
585                                 NDR_CHECK(ndr_pull_lsa_PrivEntry(ndr, NDR_SCALARS, &r->privs[cntr_privs_1]));
586                         }
587                         for (cntr_privs_1 = 0; cntr_privs_1 < r->count; cntr_privs_1++) {
588                                 NDR_CHECK(ndr_pull_lsa_PrivEntry(ndr, NDR_BUFFERS, &r->privs[cntr_privs_1]));
589                         }
590                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_privs_1, 0);
591                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_privs_0, 0);
592                 }
593                 if (r->privs) {
594                         NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->privs, r->count));
595                 }
596         }
597         return NDR_ERR_SUCCESS;
598 }
599
600 _PUBLIC_ void ndr_print_lsa_PrivArray(struct ndr_print *ndr, const char *name, const struct lsa_PrivArray *r)
601 {
602         uint32_t cntr_privs_1;
603         ndr_print_struct(ndr, name, "lsa_PrivArray");
604         ndr->depth++;
605         ndr_print_uint32(ndr, "count", r->count);
606         ndr_print_ptr(ndr, "privs", r->privs);
607         ndr->depth++;
608         if (r->privs) {
609                 ndr->print(ndr, "%s: ARRAY(%d)", "privs", (int)r->count);
610                 ndr->depth++;
611                 for (cntr_privs_1=0;cntr_privs_1<r->count;cntr_privs_1++) {
612                         char *idx_1=NULL;
613                         if (asprintf(&idx_1, "[%d]", cntr_privs_1) != -1) {
614                                 ndr_print_lsa_PrivEntry(ndr, "privs", &r->privs[cntr_privs_1]);
615                                 free(idx_1);
616                         }
617                 }
618                 ndr->depth--;
619         }
620         ndr->depth--;
621         ndr->depth--;
622 }
623
624 static enum ndr_err_code ndr_push_lsa_QosInfo(struct ndr_push *ndr, int ndr_flags, const struct lsa_QosInfo *r)
625 {
626         if (ndr_flags & NDR_SCALARS) {
627                 NDR_CHECK(ndr_push_align(ndr, 4));
628                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->len));
629                 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->impersonation_level));
630                 NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->context_mode));
631                 NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->effective_only));
632         }
633         if (ndr_flags & NDR_BUFFERS) {
634         }
635         return NDR_ERR_SUCCESS;
636 }
637
638 static enum ndr_err_code ndr_pull_lsa_QosInfo(struct ndr_pull *ndr, int ndr_flags, struct lsa_QosInfo *r)
639 {
640         if (ndr_flags & NDR_SCALARS) {
641                 NDR_CHECK(ndr_pull_align(ndr, 4));
642                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->len));
643                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->impersonation_level));
644                 NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->context_mode));
645                 NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->effective_only));
646         }
647         if (ndr_flags & NDR_BUFFERS) {
648         }
649         return NDR_ERR_SUCCESS;
650 }
651
652 _PUBLIC_ void ndr_print_lsa_QosInfo(struct ndr_print *ndr, const char *name, const struct lsa_QosInfo *r)
653 {
654         ndr_print_struct(ndr, name, "lsa_QosInfo");
655         ndr->depth++;
656         ndr_print_uint32(ndr, "len", r->len);
657         ndr_print_uint16(ndr, "impersonation_level", r->impersonation_level);
658         ndr_print_uint8(ndr, "context_mode", r->context_mode);
659         ndr_print_uint8(ndr, "effective_only", r->effective_only);
660         ndr->depth--;
661 }
662
663 static enum ndr_err_code ndr_push_lsa_ObjectAttribute(struct ndr_push *ndr, int ndr_flags, const struct lsa_ObjectAttribute *r)
664 {
665         if (ndr_flags & NDR_SCALARS) {
666                 NDR_CHECK(ndr_push_align(ndr, 4));
667                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->len));
668                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->root_dir));
669                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->object_name));
670                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->attributes));
671                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->sec_desc));
672                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->sec_qos));
673         }
674         if (ndr_flags & NDR_BUFFERS) {
675                 if (r->root_dir) {
676                         NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, *r->root_dir));
677                 }
678                 if (r->object_name) {
679                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->object_name, CH_UTF16)));
680                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
681                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, ndr_charset_length(r->object_name, CH_UTF16)));
682                         NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, r->object_name, ndr_charset_length(r->object_name, CH_UTF16), sizeof(uint16_t), CH_UTF16));
683                 }
684                 if (r->sec_desc) {
685                         NDR_CHECK(ndr_push_security_descriptor(ndr, NDR_SCALARS|NDR_BUFFERS, r->sec_desc));
686                 }
687                 if (r->sec_qos) {
688                         NDR_CHECK(ndr_push_lsa_QosInfo(ndr, NDR_SCALARS, r->sec_qos));
689                 }
690         }
691         return NDR_ERR_SUCCESS;
692 }
693
694 static enum ndr_err_code ndr_pull_lsa_ObjectAttribute(struct ndr_pull *ndr, int ndr_flags, struct lsa_ObjectAttribute *r)
695 {
696         uint32_t _ptr_root_dir;
697         TALLOC_CTX *_mem_save_root_dir_0;
698         uint32_t _ptr_object_name;
699         TALLOC_CTX *_mem_save_object_name_0;
700         uint32_t _ptr_sec_desc;
701         TALLOC_CTX *_mem_save_sec_desc_0;
702         uint32_t _ptr_sec_qos;
703         TALLOC_CTX *_mem_save_sec_qos_0;
704         if (ndr_flags & NDR_SCALARS) {
705                 NDR_CHECK(ndr_pull_align(ndr, 4));
706                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->len));
707                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_root_dir));
708                 if (_ptr_root_dir) {
709                         NDR_PULL_ALLOC(ndr, r->root_dir);
710                 } else {
711                         r->root_dir = NULL;
712                 }
713                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_object_name));
714                 if (_ptr_object_name) {
715                         NDR_PULL_ALLOC(ndr, r->object_name);
716                 } else {
717                         r->object_name = NULL;
718                 }
719                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->attributes));
720                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_sec_desc));
721                 if (_ptr_sec_desc) {
722                         NDR_PULL_ALLOC(ndr, r->sec_desc);
723                 } else {
724                         r->sec_desc = NULL;
725                 }
726                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_sec_qos));
727                 if (_ptr_sec_qos) {
728                         NDR_PULL_ALLOC(ndr, r->sec_qos);
729                 } else {
730                         r->sec_qos = NULL;
731                 }
732         }
733         if (ndr_flags & NDR_BUFFERS) {
734                 if (r->root_dir) {
735                         _mem_save_root_dir_0 = NDR_PULL_GET_MEM_CTX(ndr);
736                         NDR_PULL_SET_MEM_CTX(ndr, r->root_dir, 0);
737                         NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, r->root_dir));
738                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_root_dir_0, 0);
739                 }
740                 if (r->object_name) {
741                         _mem_save_object_name_0 = NDR_PULL_GET_MEM_CTX(ndr);
742                         NDR_PULL_SET_MEM_CTX(ndr, r->object_name, 0);
743                         NDR_CHECK(ndr_pull_array_size(ndr, &r->object_name));
744                         NDR_CHECK(ndr_pull_array_length(ndr, &r->object_name));
745                         if (ndr_get_array_length(ndr, &r->object_name) > ndr_get_array_size(ndr, &r->object_name)) {
746                                 return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->object_name), ndr_get_array_length(ndr, &r->object_name));
747                         }
748                         NDR_CHECK(ndr_check_string_terminator(ndr, ndr_get_array_length(ndr, &r->object_name), sizeof(uint16_t)));
749                         NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->object_name, ndr_get_array_length(ndr, &r->object_name), sizeof(uint16_t), CH_UTF16));
750                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_object_name_0, 0);
751                 }
752                 if (r->sec_desc) {
753                         _mem_save_sec_desc_0 = NDR_PULL_GET_MEM_CTX(ndr);
754                         NDR_PULL_SET_MEM_CTX(ndr, r->sec_desc, 0);
755                         NDR_CHECK(ndr_pull_security_descriptor(ndr, NDR_SCALARS|NDR_BUFFERS, r->sec_desc));
756                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sec_desc_0, 0);
757                 }
758                 if (r->sec_qos) {
759                         _mem_save_sec_qos_0 = NDR_PULL_GET_MEM_CTX(ndr);
760                         NDR_PULL_SET_MEM_CTX(ndr, r->sec_qos, 0);
761                         NDR_CHECK(ndr_pull_lsa_QosInfo(ndr, NDR_SCALARS, r->sec_qos));
762                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sec_qos_0, 0);
763                 }
764         }
765         return NDR_ERR_SUCCESS;
766 }
767
768 _PUBLIC_ void ndr_print_lsa_ObjectAttribute(struct ndr_print *ndr, const char *name, const struct lsa_ObjectAttribute *r)
769 {
770         ndr_print_struct(ndr, name, "lsa_ObjectAttribute");
771         ndr->depth++;
772         ndr_print_uint32(ndr, "len", r->len);
773         ndr_print_ptr(ndr, "root_dir", r->root_dir);
774         ndr->depth++;
775         if (r->root_dir) {
776                 ndr_print_uint8(ndr, "root_dir", *r->root_dir);
777         }
778         ndr->depth--;
779         ndr_print_ptr(ndr, "object_name", r->object_name);
780         ndr->depth++;
781         if (r->object_name) {
782                 ndr_print_string(ndr, "object_name", r->object_name);
783         }
784         ndr->depth--;
785         ndr_print_uint32(ndr, "attributes", r->attributes);
786         ndr_print_ptr(ndr, "sec_desc", r->sec_desc);
787         ndr->depth++;
788         if (r->sec_desc) {
789                 ndr_print_security_descriptor(ndr, "sec_desc", r->sec_desc);
790         }
791         ndr->depth--;
792         ndr_print_ptr(ndr, "sec_qos", r->sec_qos);
793         ndr->depth++;
794         if (r->sec_qos) {
795                 ndr_print_lsa_QosInfo(ndr, "sec_qos", r->sec_qos);
796         }
797         ndr->depth--;
798         ndr->depth--;
799 }
800
801 _PUBLIC_ enum ndr_err_code ndr_push_lsa_PolicyAccessMask(struct ndr_push *ndr, int ndr_flags, uint32_t r)
802 {
803         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
804         return NDR_ERR_SUCCESS;
805 }
806
807 _PUBLIC_ enum ndr_err_code ndr_pull_lsa_PolicyAccessMask(struct ndr_pull *ndr, int ndr_flags, uint32_t *r)
808 {
809         uint32_t v;
810         NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
811         *r = v;
812         return NDR_ERR_SUCCESS;
813 }
814
815 _PUBLIC_ void ndr_print_lsa_PolicyAccessMask(struct ndr_print *ndr, const char *name, uint32_t r)
816 {
817         ndr_print_uint32(ndr, name, r);
818         ndr->depth++;
819         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "LSA_POLICY_VIEW_LOCAL_INFORMATION", LSA_POLICY_VIEW_LOCAL_INFORMATION, r);
820         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "LSA_POLICY_VIEW_AUDIT_INFORMATION", LSA_POLICY_VIEW_AUDIT_INFORMATION, r);
821         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "LSA_POLICY_GET_PRIVATE_INFORMATION", LSA_POLICY_GET_PRIVATE_INFORMATION, r);
822         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "LSA_POLICY_TRUST_ADMIN", LSA_POLICY_TRUST_ADMIN, r);
823         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "LSA_POLICY_CREATE_ACCOUNT", LSA_POLICY_CREATE_ACCOUNT, r);
824         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "LSA_POLICY_CREATE_SECRET", LSA_POLICY_CREATE_SECRET, r);
825         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "LSA_POLICY_CREATE_PRIVILEGE", LSA_POLICY_CREATE_PRIVILEGE, r);
826         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "LSA_POLICY_SET_DEFAULT_QUOTA_LIMITS", LSA_POLICY_SET_DEFAULT_QUOTA_LIMITS, r);
827         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "LSA_POLICY_SET_AUDIT_REQUIREMENTS", LSA_POLICY_SET_AUDIT_REQUIREMENTS, r);
828         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "LSA_POLICY_AUDIT_LOG_ADMIN", LSA_POLICY_AUDIT_LOG_ADMIN, r);
829         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "LSA_POLICY_SERVER_ADMIN", LSA_POLICY_SERVER_ADMIN, r);
830         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "LSA_POLICY_LOOKUP_NAMES", LSA_POLICY_LOOKUP_NAMES, r);
831         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "LSA_POLICY_NOTIFICATION", LSA_POLICY_NOTIFICATION, r);
832         ndr->depth--;
833 }
834
835 _PUBLIC_ enum ndr_err_code ndr_push_lsa_AccountAccessMask(struct ndr_push *ndr, int ndr_flags, uint32_t r)
836 {
837         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
838         return NDR_ERR_SUCCESS;
839 }
840
841 _PUBLIC_ enum ndr_err_code ndr_pull_lsa_AccountAccessMask(struct ndr_pull *ndr, int ndr_flags, uint32_t *r)
842 {
843         uint32_t v;
844         NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
845         *r = v;
846         return NDR_ERR_SUCCESS;
847 }
848
849 _PUBLIC_ void ndr_print_lsa_AccountAccessMask(struct ndr_print *ndr, const char *name, uint32_t r)
850 {
851         ndr_print_uint32(ndr, name, r);
852         ndr->depth++;
853         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "LSA_ACCOUNT_VIEW", LSA_ACCOUNT_VIEW, r);
854         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "LSA_ACCOUNT_ADJUST_PRIVILEGES", LSA_ACCOUNT_ADJUST_PRIVILEGES, r);
855         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "LSA_ACCOUNT_ADJUST_QUOTAS", LSA_ACCOUNT_ADJUST_QUOTAS, r);
856         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "LSA_ACCOUNT_ADJUST_SYSTEM_ACCESS", LSA_ACCOUNT_ADJUST_SYSTEM_ACCESS, r);
857         ndr->depth--;
858 }
859
860 _PUBLIC_ enum ndr_err_code ndr_push_lsa_SecretAccessMask(struct ndr_push *ndr, int ndr_flags, uint32_t r)
861 {
862         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
863         return NDR_ERR_SUCCESS;
864 }
865
866 _PUBLIC_ enum ndr_err_code ndr_pull_lsa_SecretAccessMask(struct ndr_pull *ndr, int ndr_flags, uint32_t *r)
867 {
868         uint32_t v;
869         NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
870         *r = v;
871         return NDR_ERR_SUCCESS;
872 }
873
874 _PUBLIC_ void ndr_print_lsa_SecretAccessMask(struct ndr_print *ndr, const char *name, uint32_t r)
875 {
876         ndr_print_uint32(ndr, name, r);
877         ndr->depth++;
878         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "LSA_SECRET_SET_VALUE", LSA_SECRET_SET_VALUE, r);
879         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "LSA_SECRET_QUERY_VALUE", LSA_SECRET_QUERY_VALUE, r);
880         ndr->depth--;
881 }
882
883 _PUBLIC_ enum ndr_err_code ndr_push_lsa_TrustedAccessMask(struct ndr_push *ndr, int ndr_flags, uint32_t r)
884 {
885         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
886         return NDR_ERR_SUCCESS;
887 }
888
889 _PUBLIC_ enum ndr_err_code ndr_pull_lsa_TrustedAccessMask(struct ndr_pull *ndr, int ndr_flags, uint32_t *r)
890 {
891         uint32_t v;
892         NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
893         *r = v;
894         return NDR_ERR_SUCCESS;
895 }
896
897 _PUBLIC_ void ndr_print_lsa_TrustedAccessMask(struct ndr_print *ndr, const char *name, uint32_t r)
898 {
899         ndr_print_uint32(ndr, name, r);
900         ndr->depth++;
901         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "LSA_TRUSTED_QUERY_DOMAIN_NAME", LSA_TRUSTED_QUERY_DOMAIN_NAME, r);
902         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "LSA_TRUSTED_QUERY_CONTROLLERS", LSA_TRUSTED_QUERY_CONTROLLERS, r);
903         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "LSA_TRUSTED_SET_CONTROLLERS", LSA_TRUSTED_SET_CONTROLLERS, r);
904         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "LSA_TRUSTED_QUERY_POSIX", LSA_TRUSTED_QUERY_POSIX, r);
905         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "LSA_TRUSTED_SET_POSIX", LSA_TRUSTED_SET_POSIX, r);
906         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "LSA_TRUSTED_SET_AUTH", LSA_TRUSTED_SET_AUTH, r);
907         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "LSA_TRUSTED_QUERY_AUTH", LSA_TRUSTED_QUERY_AUTH, r);
908         ndr->depth--;
909 }
910
911 static enum ndr_err_code ndr_push_lsa_AuditLogInfo(struct ndr_push *ndr, int ndr_flags, const struct lsa_AuditLogInfo *r)
912 {
913         if (ndr_flags & NDR_SCALARS) {
914                 NDR_CHECK(ndr_push_align(ndr, 8));
915                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->percent_full));
916                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->maximum_log_size));
917                 NDR_CHECK(ndr_push_hyper(ndr, NDR_SCALARS, r->retention_time));
918                 NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->shutdown_in_progress));
919                 NDR_CHECK(ndr_push_hyper(ndr, NDR_SCALARS, r->time_to_shutdown));
920                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->next_audit_record));
921         }
922         if (ndr_flags & NDR_BUFFERS) {
923         }
924         return NDR_ERR_SUCCESS;
925 }
926
927 static enum ndr_err_code ndr_pull_lsa_AuditLogInfo(struct ndr_pull *ndr, int ndr_flags, struct lsa_AuditLogInfo *r)
928 {
929         if (ndr_flags & NDR_SCALARS) {
930                 NDR_CHECK(ndr_pull_align(ndr, 8));
931                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->percent_full));
932                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->maximum_log_size));
933                 NDR_CHECK(ndr_pull_hyper(ndr, NDR_SCALARS, &r->retention_time));
934                 NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->shutdown_in_progress));
935                 NDR_CHECK(ndr_pull_hyper(ndr, NDR_SCALARS, &r->time_to_shutdown));
936                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->next_audit_record));
937         }
938         if (ndr_flags & NDR_BUFFERS) {
939         }
940         return NDR_ERR_SUCCESS;
941 }
942
943 _PUBLIC_ void ndr_print_lsa_AuditLogInfo(struct ndr_print *ndr, const char *name, const struct lsa_AuditLogInfo *r)
944 {
945         ndr_print_struct(ndr, name, "lsa_AuditLogInfo");
946         ndr->depth++;
947         ndr_print_uint32(ndr, "percent_full", r->percent_full);
948         ndr_print_uint32(ndr, "maximum_log_size", r->maximum_log_size);
949         ndr_print_hyper(ndr, "retention_time", r->retention_time);
950         ndr_print_uint8(ndr, "shutdown_in_progress", r->shutdown_in_progress);
951         ndr_print_hyper(ndr, "time_to_shutdown", r->time_to_shutdown);
952         ndr_print_uint32(ndr, "next_audit_record", r->next_audit_record);
953         ndr->depth--;
954 }
955
956 static enum ndr_err_code ndr_push_lsa_PolicyAuditPolicy(struct ndr_push *ndr, int ndr_flags, enum lsa_PolicyAuditPolicy r)
957 {
958         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
959         return NDR_ERR_SUCCESS;
960 }
961
962 static enum ndr_err_code ndr_pull_lsa_PolicyAuditPolicy(struct ndr_pull *ndr, int ndr_flags, enum lsa_PolicyAuditPolicy *r)
963 {
964         uint32_t v;
965         NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
966         *r = v;
967         return NDR_ERR_SUCCESS;
968 }
969
970 _PUBLIC_ void ndr_print_lsa_PolicyAuditPolicy(struct ndr_print *ndr, const char *name, enum lsa_PolicyAuditPolicy r)
971 {
972         const char *val = NULL;
973
974         switch (r) {
975                 case LSA_AUDIT_POLICY_NONE: val = "LSA_AUDIT_POLICY_NONE"; break;
976                 case LSA_AUDIT_POLICY_SUCCESS: val = "LSA_AUDIT_POLICY_SUCCESS"; break;
977                 case LSA_AUDIT_POLICY_FAILURE: val = "LSA_AUDIT_POLICY_FAILURE"; break;
978                 case LSA_AUDIT_POLICY_ALL: val = "LSA_AUDIT_POLICY_ALL"; break;
979                 case LSA_AUDIT_POLICY_CLEAR: val = "LSA_AUDIT_POLICY_CLEAR"; break;
980         }
981         ndr_print_enum(ndr, name, "ENUM", val, r);
982 }
983
984 static enum ndr_err_code ndr_push_lsa_AuditEventsInfo(struct ndr_push *ndr, int ndr_flags, const struct lsa_AuditEventsInfo *r)
985 {
986         uint32_t cntr_settings_1;
987         if (ndr_flags & NDR_SCALARS) {
988                 NDR_CHECK(ndr_push_align(ndr, 4));
989                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->auditing_mode));
990                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->settings));
991                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count));
992         }
993         if (ndr_flags & NDR_BUFFERS) {
994                 if (r->settings) {
995                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count));
996                         for (cntr_settings_1 = 0; cntr_settings_1 < r->count; cntr_settings_1++) {
997                                 NDR_CHECK(ndr_push_lsa_PolicyAuditPolicy(ndr, NDR_SCALARS, r->settings[cntr_settings_1]));
998                         }
999                 }
1000         }
1001         return NDR_ERR_SUCCESS;
1002 }
1003
1004 static enum ndr_err_code ndr_pull_lsa_AuditEventsInfo(struct ndr_pull *ndr, int ndr_flags, struct lsa_AuditEventsInfo *r)
1005 {
1006         uint32_t _ptr_settings;
1007         uint32_t cntr_settings_1;
1008         TALLOC_CTX *_mem_save_settings_0;
1009         TALLOC_CTX *_mem_save_settings_1;
1010         if (ndr_flags & NDR_SCALARS) {
1011                 NDR_CHECK(ndr_pull_align(ndr, 4));
1012                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->auditing_mode));
1013                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_settings));
1014                 if (_ptr_settings) {
1015                         NDR_PULL_ALLOC(ndr, r->settings);
1016                 } else {
1017                         r->settings = NULL;
1018                 }
1019                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->count));
1020         }
1021         if (ndr_flags & NDR_BUFFERS) {
1022                 if (r->settings) {
1023                         _mem_save_settings_0 = NDR_PULL_GET_MEM_CTX(ndr);
1024                         NDR_PULL_SET_MEM_CTX(ndr, r->settings, 0);
1025                         NDR_CHECK(ndr_pull_array_size(ndr, &r->settings));
1026                         NDR_PULL_ALLOC_N(ndr, r->settings, ndr_get_array_size(ndr, &r->settings));
1027                         _mem_save_settings_1 = NDR_PULL_GET_MEM_CTX(ndr);
1028                         NDR_PULL_SET_MEM_CTX(ndr, r->settings, 0);
1029                         for (cntr_settings_1 = 0; cntr_settings_1 < r->count; cntr_settings_1++) {
1030                                 NDR_CHECK(ndr_pull_lsa_PolicyAuditPolicy(ndr, NDR_SCALARS, &r->settings[cntr_settings_1]));
1031                         }
1032                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_settings_1, 0);
1033                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_settings_0, 0);
1034                 }
1035                 if (r->settings) {
1036                         NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->settings, r->count));
1037                 }
1038         }
1039         return NDR_ERR_SUCCESS;
1040 }
1041
1042 _PUBLIC_ void ndr_print_lsa_AuditEventsInfo(struct ndr_print *ndr, const char *name, const struct lsa_AuditEventsInfo *r)
1043 {
1044         uint32_t cntr_settings_1;
1045         ndr_print_struct(ndr, name, "lsa_AuditEventsInfo");
1046         ndr->depth++;
1047         ndr_print_uint32(ndr, "auditing_mode", r->auditing_mode);
1048         ndr_print_ptr(ndr, "settings", r->settings);
1049         ndr->depth++;
1050         if (r->settings) {
1051                 ndr->print(ndr, "%s: ARRAY(%d)", "settings", (int)r->count);
1052                 ndr->depth++;
1053                 for (cntr_settings_1=0;cntr_settings_1<r->count;cntr_settings_1++) {
1054                         char *idx_1=NULL;
1055                         if (asprintf(&idx_1, "[%d]", cntr_settings_1) != -1) {
1056                                 ndr_print_lsa_PolicyAuditPolicy(ndr, "settings", r->settings[cntr_settings_1]);
1057                                 free(idx_1);
1058                         }
1059                 }
1060                 ndr->depth--;
1061         }
1062         ndr->depth--;
1063         ndr_print_uint32(ndr, "count", r->count);
1064         ndr->depth--;
1065 }
1066
1067 static enum ndr_err_code ndr_push_lsa_DomainInfo(struct ndr_push *ndr, int ndr_flags, const struct lsa_DomainInfo *r)
1068 {
1069         if (ndr_flags & NDR_SCALARS) {
1070                 NDR_CHECK(ndr_push_align(ndr, 4));
1071                 NDR_CHECK(ndr_push_lsa_StringLarge(ndr, NDR_SCALARS, &r->name));
1072                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->sid));
1073         }
1074         if (ndr_flags & NDR_BUFFERS) {
1075                 NDR_CHECK(ndr_push_lsa_StringLarge(ndr, NDR_BUFFERS, &r->name));
1076                 if (r->sid) {
1077                         NDR_CHECK(ndr_push_dom_sid2(ndr, NDR_SCALARS|NDR_BUFFERS, r->sid));
1078                 }
1079         }
1080         return NDR_ERR_SUCCESS;
1081 }
1082
1083 static enum ndr_err_code ndr_pull_lsa_DomainInfo(struct ndr_pull *ndr, int ndr_flags, struct lsa_DomainInfo *r)
1084 {
1085         uint32_t _ptr_sid;
1086         TALLOC_CTX *_mem_save_sid_0;
1087         if (ndr_flags & NDR_SCALARS) {
1088                 NDR_CHECK(ndr_pull_align(ndr, 4));
1089                 NDR_CHECK(ndr_pull_lsa_StringLarge(ndr, NDR_SCALARS, &r->name));
1090                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_sid));
1091                 if (_ptr_sid) {
1092                         NDR_PULL_ALLOC(ndr, r->sid);
1093                 } else {
1094                         r->sid = NULL;
1095                 }
1096         }
1097         if (ndr_flags & NDR_BUFFERS) {
1098                 NDR_CHECK(ndr_pull_lsa_StringLarge(ndr, NDR_BUFFERS, &r->name));
1099                 if (r->sid) {
1100                         _mem_save_sid_0 = NDR_PULL_GET_MEM_CTX(ndr);
1101                         NDR_PULL_SET_MEM_CTX(ndr, r->sid, 0);
1102                         NDR_CHECK(ndr_pull_dom_sid2(ndr, NDR_SCALARS|NDR_BUFFERS, r->sid));
1103                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sid_0, 0);
1104                 }
1105         }
1106         return NDR_ERR_SUCCESS;
1107 }
1108
1109 _PUBLIC_ void ndr_print_lsa_DomainInfo(struct ndr_print *ndr, const char *name, const struct lsa_DomainInfo *r)
1110 {
1111         ndr_print_struct(ndr, name, "lsa_DomainInfo");
1112         ndr->depth++;
1113         ndr_print_lsa_StringLarge(ndr, "name", &r->name);
1114         ndr_print_ptr(ndr, "sid", r->sid);
1115         ndr->depth++;
1116         if (r->sid) {
1117                 ndr_print_dom_sid2(ndr, "sid", r->sid);
1118         }
1119         ndr->depth--;
1120         ndr->depth--;
1121 }
1122
1123 static enum ndr_err_code ndr_push_lsa_PDAccountInfo(struct ndr_push *ndr, int ndr_flags, const struct lsa_PDAccountInfo *r)
1124 {
1125         if (ndr_flags & NDR_SCALARS) {
1126                 NDR_CHECK(ndr_push_align(ndr, 4));
1127                 NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->name));
1128         }
1129         if (ndr_flags & NDR_BUFFERS) {
1130                 NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->name));
1131         }
1132         return NDR_ERR_SUCCESS;
1133 }
1134
1135 static enum ndr_err_code ndr_pull_lsa_PDAccountInfo(struct ndr_pull *ndr, int ndr_flags, struct lsa_PDAccountInfo *r)
1136 {
1137         if (ndr_flags & NDR_SCALARS) {
1138                 NDR_CHECK(ndr_pull_align(ndr, 4));
1139                 NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->name));
1140         }
1141         if (ndr_flags & NDR_BUFFERS) {
1142                 NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->name));
1143         }
1144         return NDR_ERR_SUCCESS;
1145 }
1146
1147 _PUBLIC_ void ndr_print_lsa_PDAccountInfo(struct ndr_print *ndr, const char *name, const struct lsa_PDAccountInfo *r)
1148 {
1149         ndr_print_struct(ndr, name, "lsa_PDAccountInfo");
1150         ndr->depth++;
1151         ndr_print_lsa_String(ndr, "name", &r->name);
1152         ndr->depth--;
1153 }
1154
1155 static enum ndr_err_code ndr_push_lsa_Role(struct ndr_push *ndr, int ndr_flags, enum lsa_Role r)
1156 {
1157         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
1158         return NDR_ERR_SUCCESS;
1159 }
1160
1161 static enum ndr_err_code ndr_pull_lsa_Role(struct ndr_pull *ndr, int ndr_flags, enum lsa_Role *r)
1162 {
1163         uint32_t v;
1164         NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
1165         *r = v;
1166         return NDR_ERR_SUCCESS;
1167 }
1168
1169 _PUBLIC_ void ndr_print_lsa_Role(struct ndr_print *ndr, const char *name, enum lsa_Role r)
1170 {
1171         const char *val = NULL;
1172
1173         switch (r) {
1174                 case LSA_ROLE_BACKUP: val = "LSA_ROLE_BACKUP"; break;
1175                 case LSA_ROLE_PRIMARY: val = "LSA_ROLE_PRIMARY"; break;
1176         }
1177         ndr_print_enum(ndr, name, "ENUM", val, r);
1178 }
1179
1180 static enum ndr_err_code ndr_push_lsa_ServerRole(struct ndr_push *ndr, int ndr_flags, const struct lsa_ServerRole *r)
1181 {
1182         if (ndr_flags & NDR_SCALARS) {
1183                 NDR_CHECK(ndr_push_align(ndr, 4));
1184                 NDR_CHECK(ndr_push_lsa_Role(ndr, NDR_SCALARS, r->role));
1185         }
1186         if (ndr_flags & NDR_BUFFERS) {
1187         }
1188         return NDR_ERR_SUCCESS;
1189 }
1190
1191 static enum ndr_err_code ndr_pull_lsa_ServerRole(struct ndr_pull *ndr, int ndr_flags, struct lsa_ServerRole *r)
1192 {
1193         if (ndr_flags & NDR_SCALARS) {
1194                 NDR_CHECK(ndr_pull_align(ndr, 4));
1195                 NDR_CHECK(ndr_pull_lsa_Role(ndr, NDR_SCALARS, &r->role));
1196         }
1197         if (ndr_flags & NDR_BUFFERS) {
1198         }
1199         return NDR_ERR_SUCCESS;
1200 }
1201
1202 _PUBLIC_ void ndr_print_lsa_ServerRole(struct ndr_print *ndr, const char *name, const struct lsa_ServerRole *r)
1203 {
1204         ndr_print_struct(ndr, name, "lsa_ServerRole");
1205         ndr->depth++;
1206         ndr_print_lsa_Role(ndr, "role", r->role);
1207         ndr->depth--;
1208 }
1209
1210 static enum ndr_err_code ndr_push_lsa_ReplicaSourceInfo(struct ndr_push *ndr, int ndr_flags, const struct lsa_ReplicaSourceInfo *r)
1211 {
1212         if (ndr_flags & NDR_SCALARS) {
1213                 NDR_CHECK(ndr_push_align(ndr, 4));
1214                 NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->source));
1215                 NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->account));
1216         }
1217         if (ndr_flags & NDR_BUFFERS) {
1218                 NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->source));
1219                 NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->account));
1220         }
1221         return NDR_ERR_SUCCESS;
1222 }
1223
1224 static enum ndr_err_code ndr_pull_lsa_ReplicaSourceInfo(struct ndr_pull *ndr, int ndr_flags, struct lsa_ReplicaSourceInfo *r)
1225 {
1226         if (ndr_flags & NDR_SCALARS) {
1227                 NDR_CHECK(ndr_pull_align(ndr, 4));
1228                 NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->source));
1229                 NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->account));
1230         }
1231         if (ndr_flags & NDR_BUFFERS) {
1232                 NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->source));
1233                 NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->account));
1234         }
1235         return NDR_ERR_SUCCESS;
1236 }
1237
1238 _PUBLIC_ void ndr_print_lsa_ReplicaSourceInfo(struct ndr_print *ndr, const char *name, const struct lsa_ReplicaSourceInfo *r)
1239 {
1240         ndr_print_struct(ndr, name, "lsa_ReplicaSourceInfo");
1241         ndr->depth++;
1242         ndr_print_lsa_String(ndr, "source", &r->source);
1243         ndr_print_lsa_String(ndr, "account", &r->account);
1244         ndr->depth--;
1245 }
1246
1247 static enum ndr_err_code ndr_push_lsa_DefaultQuotaInfo(struct ndr_push *ndr, int ndr_flags, const struct lsa_DefaultQuotaInfo *r)
1248 {
1249         if (ndr_flags & NDR_SCALARS) {
1250                 NDR_CHECK(ndr_push_align(ndr, 8));
1251                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->paged_pool));
1252                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->non_paged_pool));
1253                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->min_wss));
1254                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->max_wss));
1255                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->pagefile));
1256                 NDR_CHECK(ndr_push_hyper(ndr, NDR_SCALARS, r->unknown));
1257         }
1258         if (ndr_flags & NDR_BUFFERS) {
1259         }
1260         return NDR_ERR_SUCCESS;
1261 }
1262
1263 static enum ndr_err_code ndr_pull_lsa_DefaultQuotaInfo(struct ndr_pull *ndr, int ndr_flags, struct lsa_DefaultQuotaInfo *r)
1264 {
1265         if (ndr_flags & NDR_SCALARS) {
1266                 NDR_CHECK(ndr_pull_align(ndr, 8));
1267                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->paged_pool));
1268                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->non_paged_pool));
1269                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->min_wss));
1270                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->max_wss));
1271                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->pagefile));
1272                 NDR_CHECK(ndr_pull_hyper(ndr, NDR_SCALARS, &r->unknown));
1273         }
1274         if (ndr_flags & NDR_BUFFERS) {
1275         }
1276         return NDR_ERR_SUCCESS;
1277 }
1278
1279 _PUBLIC_ void ndr_print_lsa_DefaultQuotaInfo(struct ndr_print *ndr, const char *name, const struct lsa_DefaultQuotaInfo *r)
1280 {
1281         ndr_print_struct(ndr, name, "lsa_DefaultQuotaInfo");
1282         ndr->depth++;
1283         ndr_print_uint32(ndr, "paged_pool", r->paged_pool);
1284         ndr_print_uint32(ndr, "non_paged_pool", r->non_paged_pool);
1285         ndr_print_uint32(ndr, "min_wss", r->min_wss);
1286         ndr_print_uint32(ndr, "max_wss", r->max_wss);
1287         ndr_print_uint32(ndr, "pagefile", r->pagefile);
1288         ndr_print_hyper(ndr, "unknown", r->unknown);
1289         ndr->depth--;
1290 }
1291
1292 static enum ndr_err_code ndr_push_lsa_ModificationInfo(struct ndr_push *ndr, int ndr_flags, const struct lsa_ModificationInfo *r)
1293 {
1294         if (ndr_flags & NDR_SCALARS) {
1295                 NDR_CHECK(ndr_push_align(ndr, 8));
1296                 NDR_CHECK(ndr_push_hyper(ndr, NDR_SCALARS, r->modified_id));
1297                 NDR_CHECK(ndr_push_NTTIME_hyper(ndr, NDR_SCALARS, r->db_create_time));
1298         }
1299         if (ndr_flags & NDR_BUFFERS) {
1300         }
1301         return NDR_ERR_SUCCESS;
1302 }
1303
1304 static enum ndr_err_code ndr_pull_lsa_ModificationInfo(struct ndr_pull *ndr, int ndr_flags, struct lsa_ModificationInfo *r)
1305 {
1306         if (ndr_flags & NDR_SCALARS) {
1307                 NDR_CHECK(ndr_pull_align(ndr, 8));
1308                 NDR_CHECK(ndr_pull_hyper(ndr, NDR_SCALARS, &r->modified_id));
1309                 NDR_CHECK(ndr_pull_NTTIME_hyper(ndr, NDR_SCALARS, &r->db_create_time));
1310         }
1311         if (ndr_flags & NDR_BUFFERS) {
1312         }
1313         return NDR_ERR_SUCCESS;
1314 }
1315
1316 _PUBLIC_ void ndr_print_lsa_ModificationInfo(struct ndr_print *ndr, const char *name, const struct lsa_ModificationInfo *r)
1317 {
1318         ndr_print_struct(ndr, name, "lsa_ModificationInfo");
1319         ndr->depth++;
1320         ndr_print_hyper(ndr, "modified_id", r->modified_id);
1321         ndr_print_NTTIME_hyper(ndr, "db_create_time", r->db_create_time);
1322         ndr->depth--;
1323 }
1324
1325 static enum ndr_err_code ndr_push_lsa_AuditFullSetInfo(struct ndr_push *ndr, int ndr_flags, const struct lsa_AuditFullSetInfo *r)
1326 {
1327         if (ndr_flags & NDR_SCALARS) {
1328                 NDR_CHECK(ndr_push_align(ndr, 1));
1329                 NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->shutdown_on_full));
1330         }
1331         if (ndr_flags & NDR_BUFFERS) {
1332         }
1333         return NDR_ERR_SUCCESS;
1334 }
1335
1336 static enum ndr_err_code ndr_pull_lsa_AuditFullSetInfo(struct ndr_pull *ndr, int ndr_flags, struct lsa_AuditFullSetInfo *r)
1337 {
1338         if (ndr_flags & NDR_SCALARS) {
1339                 NDR_CHECK(ndr_pull_align(ndr, 1));
1340                 NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->shutdown_on_full));
1341         }
1342         if (ndr_flags & NDR_BUFFERS) {
1343         }
1344         return NDR_ERR_SUCCESS;
1345 }
1346
1347 _PUBLIC_ void ndr_print_lsa_AuditFullSetInfo(struct ndr_print *ndr, const char *name, const struct lsa_AuditFullSetInfo *r)
1348 {
1349         ndr_print_struct(ndr, name, "lsa_AuditFullSetInfo");
1350         ndr->depth++;
1351         ndr_print_uint8(ndr, "shutdown_on_full", r->shutdown_on_full);
1352         ndr->depth--;
1353 }
1354
1355 static enum ndr_err_code ndr_push_lsa_AuditFullQueryInfo(struct ndr_push *ndr, int ndr_flags, const struct lsa_AuditFullQueryInfo *r)
1356 {
1357         if (ndr_flags & NDR_SCALARS) {
1358                 NDR_CHECK(ndr_push_align(ndr, 1));
1359                 NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->shutdown_on_full));
1360                 NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r->log_is_full));
1361         }
1362         if (ndr_flags & NDR_BUFFERS) {
1363         }
1364         return NDR_ERR_SUCCESS;
1365 }
1366
1367 static enum ndr_err_code ndr_pull_lsa_AuditFullQueryInfo(struct ndr_pull *ndr, int ndr_flags, struct lsa_AuditFullQueryInfo *r)
1368 {
1369         if (ndr_flags & NDR_SCALARS) {
1370                 NDR_CHECK(ndr_pull_align(ndr, 1));
1371                 NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->shutdown_on_full));
1372                 NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->log_is_full));
1373         }
1374         if (ndr_flags & NDR_BUFFERS) {
1375         }
1376         return NDR_ERR_SUCCESS;
1377 }
1378
1379 _PUBLIC_ void ndr_print_lsa_AuditFullQueryInfo(struct ndr_print *ndr, const char *name, const struct lsa_AuditFullQueryInfo *r)
1380 {
1381         ndr_print_struct(ndr, name, "lsa_AuditFullQueryInfo");
1382         ndr->depth++;
1383         ndr_print_uint8(ndr, "shutdown_on_full", r->shutdown_on_full);
1384         ndr_print_uint8(ndr, "log_is_full", r->log_is_full);
1385         ndr->depth--;
1386 }
1387
1388 static enum ndr_err_code ndr_push_lsa_DnsDomainInfo(struct ndr_push *ndr, int ndr_flags, const struct lsa_DnsDomainInfo *r)
1389 {
1390         if (ndr_flags & NDR_SCALARS) {
1391                 NDR_CHECK(ndr_push_align(ndr, 4));
1392                 NDR_CHECK(ndr_push_lsa_StringLarge(ndr, NDR_SCALARS, &r->name));
1393                 NDR_CHECK(ndr_push_lsa_StringLarge(ndr, NDR_SCALARS, &r->dns_domain));
1394                 NDR_CHECK(ndr_push_lsa_StringLarge(ndr, NDR_SCALARS, &r->dns_forest));
1395                 NDR_CHECK(ndr_push_GUID(ndr, NDR_SCALARS, &r->domain_guid));
1396                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->sid));
1397         }
1398         if (ndr_flags & NDR_BUFFERS) {
1399                 NDR_CHECK(ndr_push_lsa_StringLarge(ndr, NDR_BUFFERS, &r->name));
1400                 NDR_CHECK(ndr_push_lsa_StringLarge(ndr, NDR_BUFFERS, &r->dns_domain));
1401                 NDR_CHECK(ndr_push_lsa_StringLarge(ndr, NDR_BUFFERS, &r->dns_forest));
1402                 if (r->sid) {
1403                         NDR_CHECK(ndr_push_dom_sid2(ndr, NDR_SCALARS|NDR_BUFFERS, r->sid));
1404                 }
1405         }
1406         return NDR_ERR_SUCCESS;
1407 }
1408
1409 static enum ndr_err_code ndr_pull_lsa_DnsDomainInfo(struct ndr_pull *ndr, int ndr_flags, struct lsa_DnsDomainInfo *r)
1410 {
1411         uint32_t _ptr_sid;
1412         TALLOC_CTX *_mem_save_sid_0;
1413         if (ndr_flags & NDR_SCALARS) {
1414                 NDR_CHECK(ndr_pull_align(ndr, 4));
1415                 NDR_CHECK(ndr_pull_lsa_StringLarge(ndr, NDR_SCALARS, &r->name));
1416                 NDR_CHECK(ndr_pull_lsa_StringLarge(ndr, NDR_SCALARS, &r->dns_domain));
1417                 NDR_CHECK(ndr_pull_lsa_StringLarge(ndr, NDR_SCALARS, &r->dns_forest));
1418                 NDR_CHECK(ndr_pull_GUID(ndr, NDR_SCALARS, &r->domain_guid));
1419                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_sid));
1420                 if (_ptr_sid) {
1421                         NDR_PULL_ALLOC(ndr, r->sid);
1422                 } else {
1423                         r->sid = NULL;
1424                 }
1425         }
1426         if (ndr_flags & NDR_BUFFERS) {
1427                 NDR_CHECK(ndr_pull_lsa_StringLarge(ndr, NDR_BUFFERS, &r->name));
1428                 NDR_CHECK(ndr_pull_lsa_StringLarge(ndr, NDR_BUFFERS, &r->dns_domain));
1429                 NDR_CHECK(ndr_pull_lsa_StringLarge(ndr, NDR_BUFFERS, &r->dns_forest));
1430                 if (r->sid) {
1431                         _mem_save_sid_0 = NDR_PULL_GET_MEM_CTX(ndr);
1432                         NDR_PULL_SET_MEM_CTX(ndr, r->sid, 0);
1433                         NDR_CHECK(ndr_pull_dom_sid2(ndr, NDR_SCALARS|NDR_BUFFERS, r->sid));
1434                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sid_0, 0);
1435                 }
1436         }
1437         return NDR_ERR_SUCCESS;
1438 }
1439
1440 _PUBLIC_ void ndr_print_lsa_DnsDomainInfo(struct ndr_print *ndr, const char *name, const struct lsa_DnsDomainInfo *r)
1441 {
1442         ndr_print_struct(ndr, name, "lsa_DnsDomainInfo");
1443         ndr->depth++;
1444         ndr_print_lsa_StringLarge(ndr, "name", &r->name);
1445         ndr_print_lsa_StringLarge(ndr, "dns_domain", &r->dns_domain);
1446         ndr_print_lsa_StringLarge(ndr, "dns_forest", &r->dns_forest);
1447         ndr_print_GUID(ndr, "domain_guid", &r->domain_guid);
1448         ndr_print_ptr(ndr, "sid", r->sid);
1449         ndr->depth++;
1450         if (r->sid) {
1451                 ndr_print_dom_sid2(ndr, "sid", r->sid);
1452         }
1453         ndr->depth--;
1454         ndr->depth--;
1455 }
1456
1457 static enum ndr_err_code ndr_push_lsa_PolicyInfo(struct ndr_push *ndr, int ndr_flags, enum lsa_PolicyInfo r)
1458 {
1459         NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r));
1460         return NDR_ERR_SUCCESS;
1461 }
1462
1463 static enum ndr_err_code ndr_pull_lsa_PolicyInfo(struct ndr_pull *ndr, int ndr_flags, enum lsa_PolicyInfo *r)
1464 {
1465         uint16_t v;
1466         NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v));
1467         *r = v;
1468         return NDR_ERR_SUCCESS;
1469 }
1470
1471 _PUBLIC_ void ndr_print_lsa_PolicyInfo(struct ndr_print *ndr, const char *name, enum lsa_PolicyInfo r)
1472 {
1473         const char *val = NULL;
1474
1475         switch (r) {
1476                 case LSA_POLICY_INFO_AUDIT_LOG: val = "LSA_POLICY_INFO_AUDIT_LOG"; break;
1477                 case LSA_POLICY_INFO_AUDIT_EVENTS: val = "LSA_POLICY_INFO_AUDIT_EVENTS"; break;
1478                 case LSA_POLICY_INFO_DOMAIN: val = "LSA_POLICY_INFO_DOMAIN"; break;
1479                 case LSA_POLICY_INFO_PD: val = "LSA_POLICY_INFO_PD"; break;
1480                 case LSA_POLICY_INFO_ACCOUNT_DOMAIN: val = "LSA_POLICY_INFO_ACCOUNT_DOMAIN"; break;
1481                 case LSA_POLICY_INFO_ROLE: val = "LSA_POLICY_INFO_ROLE"; break;
1482                 case LSA_POLICY_INFO_REPLICA: val = "LSA_POLICY_INFO_REPLICA"; break;
1483                 case LSA_POLICY_INFO_QUOTA: val = "LSA_POLICY_INFO_QUOTA"; break;
1484                 case LSA_POLICY_INFO_MOD: val = "LSA_POLICY_INFO_MOD"; break;
1485                 case LSA_POLICY_INFO_AUDIT_FULL_SET: val = "LSA_POLICY_INFO_AUDIT_FULL_SET"; break;
1486                 case LSA_POLICY_INFO_AUDIT_FULL_QUERY: val = "LSA_POLICY_INFO_AUDIT_FULL_QUERY"; break;
1487                 case LSA_POLICY_INFO_DNS: val = "LSA_POLICY_INFO_DNS"; break;
1488                 case LSA_POLICY_INFO_DNS_INT: val = "LSA_POLICY_INFO_DNS_INT"; break;
1489                 case LSA_POLICY_INFO_L_ACCOUNT_DOMAIN: val = "LSA_POLICY_INFO_L_ACCOUNT_DOMAIN"; break;
1490         }
1491         ndr_print_enum(ndr, name, "ENUM", val, r);
1492 }
1493
1494 static enum ndr_err_code ndr_push_lsa_PolicyInformation(struct ndr_push *ndr, int ndr_flags, const union lsa_PolicyInformation *r)
1495 {
1496         if (ndr_flags & NDR_SCALARS) {
1497                 int level = ndr_push_get_switch_value(ndr, r);
1498                 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, level));
1499                 switch (level) {
1500                         case LSA_POLICY_INFO_AUDIT_LOG: {
1501                                 NDR_CHECK(ndr_push_lsa_AuditLogInfo(ndr, NDR_SCALARS, &r->audit_log));
1502                         break; }
1503
1504                         case LSA_POLICY_INFO_AUDIT_EVENTS: {
1505                                 NDR_CHECK(ndr_push_lsa_AuditEventsInfo(ndr, NDR_SCALARS, &r->audit_events));
1506                         break; }
1507
1508                         case LSA_POLICY_INFO_DOMAIN: {
1509                                 NDR_CHECK(ndr_push_lsa_DomainInfo(ndr, NDR_SCALARS, &r->domain));
1510                         break; }
1511
1512                         case LSA_POLICY_INFO_PD: {
1513                                 NDR_CHECK(ndr_push_lsa_PDAccountInfo(ndr, NDR_SCALARS, &r->pd));
1514                         break; }
1515
1516                         case LSA_POLICY_INFO_ACCOUNT_DOMAIN: {
1517                                 NDR_CHECK(ndr_push_lsa_DomainInfo(ndr, NDR_SCALARS, &r->account_domain));
1518                         break; }
1519
1520                         case LSA_POLICY_INFO_ROLE: {
1521                                 NDR_CHECK(ndr_push_lsa_ServerRole(ndr, NDR_SCALARS, &r->role));
1522                         break; }
1523
1524                         case LSA_POLICY_INFO_REPLICA: {
1525                                 NDR_CHECK(ndr_push_lsa_ReplicaSourceInfo(ndr, NDR_SCALARS, &r->replica));
1526                         break; }
1527
1528                         case LSA_POLICY_INFO_QUOTA: {
1529                                 NDR_CHECK(ndr_push_lsa_DefaultQuotaInfo(ndr, NDR_SCALARS, &r->quota));
1530                         break; }
1531
1532                         case LSA_POLICY_INFO_MOD: {
1533                                 NDR_CHECK(ndr_push_lsa_ModificationInfo(ndr, NDR_SCALARS, &r->mod));
1534                         break; }
1535
1536                         case LSA_POLICY_INFO_AUDIT_FULL_SET: {
1537                                 NDR_CHECK(ndr_push_lsa_AuditFullSetInfo(ndr, NDR_SCALARS, &r->auditfullset));
1538                         break; }
1539
1540                         case LSA_POLICY_INFO_AUDIT_FULL_QUERY: {
1541                                 NDR_CHECK(ndr_push_lsa_AuditFullQueryInfo(ndr, NDR_SCALARS, &r->auditfullquery));
1542                         break; }
1543
1544                         case LSA_POLICY_INFO_DNS: {
1545                                 NDR_CHECK(ndr_push_lsa_DnsDomainInfo(ndr, NDR_SCALARS, &r->dns));
1546                         break; }
1547
1548                         case LSA_POLICY_INFO_DNS_INT: {
1549                                 NDR_CHECK(ndr_push_lsa_DnsDomainInfo(ndr, NDR_SCALARS, &r->dns));
1550                         break; }
1551
1552                         case LSA_POLICY_INFO_L_ACCOUNT_DOMAIN: {
1553                                 NDR_CHECK(ndr_push_lsa_DomainInfo(ndr, NDR_SCALARS, &r->l_account_domain));
1554                         break; }
1555
1556                         default:
1557                                 return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
1558                 }
1559         }
1560         if (ndr_flags & NDR_BUFFERS) {
1561                 int level = ndr_push_get_switch_value(ndr, r);
1562                 switch (level) {
1563                         case LSA_POLICY_INFO_AUDIT_LOG:
1564                         break;
1565
1566                         case LSA_POLICY_INFO_AUDIT_EVENTS:
1567                                 NDR_CHECK(ndr_push_lsa_AuditEventsInfo(ndr, NDR_BUFFERS, &r->audit_events));
1568                         break;
1569
1570                         case LSA_POLICY_INFO_DOMAIN:
1571                                 NDR_CHECK(ndr_push_lsa_DomainInfo(ndr, NDR_BUFFERS, &r->domain));
1572                         break;
1573
1574                         case LSA_POLICY_INFO_PD:
1575                                 NDR_CHECK(ndr_push_lsa_PDAccountInfo(ndr, NDR_BUFFERS, &r->pd));
1576                         break;
1577
1578                         case LSA_POLICY_INFO_ACCOUNT_DOMAIN:
1579                                 NDR_CHECK(ndr_push_lsa_DomainInfo(ndr, NDR_BUFFERS, &r->account_domain));
1580                         break;
1581
1582                         case LSA_POLICY_INFO_ROLE:
1583                         break;
1584
1585                         case LSA_POLICY_INFO_REPLICA:
1586                                 NDR_CHECK(ndr_push_lsa_ReplicaSourceInfo(ndr, NDR_BUFFERS, &r->replica));
1587                         break;
1588
1589                         case LSA_POLICY_INFO_QUOTA:
1590                         break;
1591
1592                         case LSA_POLICY_INFO_MOD:
1593                         break;
1594
1595                         case LSA_POLICY_INFO_AUDIT_FULL_SET:
1596                         break;
1597
1598                         case LSA_POLICY_INFO_AUDIT_FULL_QUERY:
1599                         break;
1600
1601                         case LSA_POLICY_INFO_DNS:
1602                                 NDR_CHECK(ndr_push_lsa_DnsDomainInfo(ndr, NDR_BUFFERS, &r->dns));
1603                         break;
1604
1605                         case LSA_POLICY_INFO_DNS_INT:
1606                                 NDR_CHECK(ndr_push_lsa_DnsDomainInfo(ndr, NDR_BUFFERS, &r->dns));
1607                         break;
1608
1609                         case LSA_POLICY_INFO_L_ACCOUNT_DOMAIN:
1610                                 NDR_CHECK(ndr_push_lsa_DomainInfo(ndr, NDR_BUFFERS, &r->l_account_domain));
1611                         break;
1612
1613                         default:
1614                                 return ndr_push_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
1615                 }
1616         }
1617         return NDR_ERR_SUCCESS;
1618 }
1619
1620 static enum ndr_err_code ndr_pull_lsa_PolicyInformation(struct ndr_pull *ndr, int ndr_flags, union lsa_PolicyInformation *r)
1621 {
1622         int level;
1623         uint16_t _level;
1624         level = ndr_pull_get_switch_value(ndr, r);
1625         if (ndr_flags & NDR_SCALARS) {
1626                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &_level));
1627                 if (_level != level) {
1628                         return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u for r", _level);
1629                 }
1630                 switch (level) {
1631                         case LSA_POLICY_INFO_AUDIT_LOG: {
1632                                 NDR_CHECK(ndr_pull_lsa_AuditLogInfo(ndr, NDR_SCALARS, &r->audit_log));
1633                         break; }
1634
1635                         case LSA_POLICY_INFO_AUDIT_EVENTS: {
1636                                 NDR_CHECK(ndr_pull_lsa_AuditEventsInfo(ndr, NDR_SCALARS, &r->audit_events));
1637                         break; }
1638
1639                         case LSA_POLICY_INFO_DOMAIN: {
1640                                 NDR_CHECK(ndr_pull_lsa_DomainInfo(ndr, NDR_SCALARS, &r->domain));
1641                         break; }
1642
1643                         case LSA_POLICY_INFO_PD: {
1644                                 NDR_CHECK(ndr_pull_lsa_PDAccountInfo(ndr, NDR_SCALARS, &r->pd));
1645                         break; }
1646
1647                         case LSA_POLICY_INFO_ACCOUNT_DOMAIN: {
1648                                 NDR_CHECK(ndr_pull_lsa_DomainInfo(ndr, NDR_SCALARS, &r->account_domain));
1649                         break; }
1650
1651                         case LSA_POLICY_INFO_ROLE: {
1652                                 NDR_CHECK(ndr_pull_lsa_ServerRole(ndr, NDR_SCALARS, &r->role));
1653                         break; }
1654
1655                         case LSA_POLICY_INFO_REPLICA: {
1656                                 NDR_CHECK(ndr_pull_lsa_ReplicaSourceInfo(ndr, NDR_SCALARS, &r->replica));
1657                         break; }
1658
1659                         case LSA_POLICY_INFO_QUOTA: {
1660                                 NDR_CHECK(ndr_pull_lsa_DefaultQuotaInfo(ndr, NDR_SCALARS, &r->quota));
1661                         break; }
1662
1663                         case LSA_POLICY_INFO_MOD: {
1664                                 NDR_CHECK(ndr_pull_lsa_ModificationInfo(ndr, NDR_SCALARS, &r->mod));
1665                         break; }
1666
1667                         case LSA_POLICY_INFO_AUDIT_FULL_SET: {
1668                                 NDR_CHECK(ndr_pull_lsa_AuditFullSetInfo(ndr, NDR_SCALARS, &r->auditfullset));
1669                         break; }
1670
1671                         case LSA_POLICY_INFO_AUDIT_FULL_QUERY: {
1672                                 NDR_CHECK(ndr_pull_lsa_AuditFullQueryInfo(ndr, NDR_SCALARS, &r->auditfullquery));
1673                         break; }
1674
1675                         case LSA_POLICY_INFO_DNS: {
1676                                 NDR_CHECK(ndr_pull_lsa_DnsDomainInfo(ndr, NDR_SCALARS, &r->dns));
1677                         break; }
1678
1679                         case LSA_POLICY_INFO_DNS_INT: {
1680                                 NDR_CHECK(ndr_pull_lsa_DnsDomainInfo(ndr, NDR_SCALARS, &r->dns));
1681                         break; }
1682
1683                         case LSA_POLICY_INFO_L_ACCOUNT_DOMAIN: {
1684                                 NDR_CHECK(ndr_pull_lsa_DomainInfo(ndr, NDR_SCALARS, &r->l_account_domain));
1685                         break; }
1686
1687                         default:
1688                                 return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
1689                 }
1690         }
1691         if (ndr_flags & NDR_BUFFERS) {
1692                 switch (level) {
1693                         case LSA_POLICY_INFO_AUDIT_LOG:
1694                         break;
1695
1696                         case LSA_POLICY_INFO_AUDIT_EVENTS:
1697                                 NDR_CHECK(ndr_pull_lsa_AuditEventsInfo(ndr, NDR_BUFFERS, &r->audit_events));
1698                         break;
1699
1700                         case LSA_POLICY_INFO_DOMAIN:
1701                                 NDR_CHECK(ndr_pull_lsa_DomainInfo(ndr, NDR_BUFFERS, &r->domain));
1702                         break;
1703
1704                         case LSA_POLICY_INFO_PD:
1705                                 NDR_CHECK(ndr_pull_lsa_PDAccountInfo(ndr, NDR_BUFFERS, &r->pd));
1706                         break;
1707
1708                         case LSA_POLICY_INFO_ACCOUNT_DOMAIN:
1709                                 NDR_CHECK(ndr_pull_lsa_DomainInfo(ndr, NDR_BUFFERS, &r->account_domain));
1710                         break;
1711
1712                         case LSA_POLICY_INFO_ROLE:
1713                         break;
1714
1715                         case LSA_POLICY_INFO_REPLICA:
1716                                 NDR_CHECK(ndr_pull_lsa_ReplicaSourceInfo(ndr, NDR_BUFFERS, &r->replica));
1717                         break;
1718
1719                         case LSA_POLICY_INFO_QUOTA:
1720                         break;
1721
1722                         case LSA_POLICY_INFO_MOD:
1723                         break;
1724
1725                         case LSA_POLICY_INFO_AUDIT_FULL_SET:
1726                         break;
1727
1728                         case LSA_POLICY_INFO_AUDIT_FULL_QUERY:
1729                         break;
1730
1731                         case LSA_POLICY_INFO_DNS:
1732                                 NDR_CHECK(ndr_pull_lsa_DnsDomainInfo(ndr, NDR_BUFFERS, &r->dns));
1733                         break;
1734
1735                         case LSA_POLICY_INFO_DNS_INT:
1736                                 NDR_CHECK(ndr_pull_lsa_DnsDomainInfo(ndr, NDR_BUFFERS, &r->dns));
1737                         break;
1738
1739                         case LSA_POLICY_INFO_L_ACCOUNT_DOMAIN:
1740                                 NDR_CHECK(ndr_pull_lsa_DomainInfo(ndr, NDR_BUFFERS, &r->l_account_domain));
1741                         break;
1742
1743                         default:
1744                                 return ndr_pull_error(ndr, NDR_ERR_BAD_SWITCH, "Bad switch value %u", level);
1745                 }
1746         }
1747         return NDR_ERR_SUCCESS;
1748 }
1749
1750 _PUBLIC_ void ndr_print_lsa_PolicyInformation(struct ndr_print *ndr, const char *name, const union lsa_PolicyInformation *r)
1751 {
1752         int level;
1753         level = ndr_print_get_switch_value(ndr, r);
1754         ndr_print_union(ndr, name, level, "lsa_PolicyInformation");
1755         switch (level) {
1756                 case LSA_POLICY_INFO_AUDIT_LOG:
1757                         ndr_print_lsa_AuditLogInfo(ndr, "audit_log", &r->audit_log);
1758                 break;
1759
1760                 case LSA_POLICY_INFO_AUDIT_EVENTS:
1761                         ndr_print_lsa_AuditEventsInfo(ndr, "audit_events", &r->audit_events);
1762                 break;
1763
1764                 case LSA_POLICY_INFO_DOMAIN:
1765                         ndr_print_lsa_DomainInfo(ndr, "domain", &r->domain);
1766                 break;
1767
1768                 case LSA_POLICY_INFO_PD:
1769                         ndr_print_lsa_PDAccountInfo(ndr, "pd", &r->pd);
1770                 break;
1771
1772                 case LSA_POLICY_INFO_ACCOUNT_DOMAIN:
1773                         ndr_print_lsa_DomainInfo(ndr, "account_domain", &r->account_domain);
1774                 break;
1775
1776                 case LSA_POLICY_INFO_ROLE:
1777                         ndr_print_lsa_ServerRole(ndr, "role", &r->role);
1778                 break;
1779
1780                 case LSA_POLICY_INFO_REPLICA:
1781                         ndr_print_lsa_ReplicaSourceInfo(ndr, "replica", &r->replica);
1782                 break;
1783
1784                 case LSA_POLICY_INFO_QUOTA:
1785                         ndr_print_lsa_DefaultQuotaInfo(ndr, "quota", &r->quota);
1786                 break;
1787
1788                 case LSA_POLICY_INFO_MOD:
1789                         ndr_print_lsa_ModificationInfo(ndr, "mod", &r->mod);
1790                 break;
1791
1792                 case LSA_POLICY_INFO_AUDIT_FULL_SET:
1793                         ndr_print_lsa_AuditFullSetInfo(ndr, "auditfullset", &r->auditfullset);
1794                 break;
1795
1796                 case LSA_POLICY_INFO_AUDIT_FULL_QUERY:
1797                         ndr_print_lsa_AuditFullQueryInfo(ndr, "auditfullquery", &r->auditfullquery);
1798                 break;
1799
1800                 case LSA_POLICY_INFO_DNS:
1801                         ndr_print_lsa_DnsDomainInfo(ndr, "dns", &r->dns);
1802                 break;
1803
1804                 case LSA_POLICY_INFO_DNS_INT:
1805                         ndr_print_lsa_DnsDomainInfo(ndr, "dns", &r->dns);
1806                 break;
1807
1808                 case LSA_POLICY_INFO_L_ACCOUNT_DOMAIN:
1809                         ndr_print_lsa_DomainInfo(ndr, "l_account_domain", &r->l_account_domain);
1810                 break;
1811
1812                 default:
1813                         ndr_print_bad_level(ndr, name, level);
1814         }
1815 }
1816
1817 static enum ndr_err_code ndr_push_lsa_SidPtr(struct ndr_push *ndr, int ndr_flags, const struct lsa_SidPtr *r)
1818 {
1819         if (ndr_flags & NDR_SCALARS) {
1820                 NDR_CHECK(ndr_push_align(ndr, 4));
1821                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->sid));
1822         }
1823         if (ndr_flags & NDR_BUFFERS) {
1824                 if (r->sid) {
1825                         NDR_CHECK(ndr_push_dom_sid2(ndr, NDR_SCALARS|NDR_BUFFERS, r->sid));
1826                 }
1827         }
1828         return NDR_ERR_SUCCESS;
1829 }
1830
1831 static enum ndr_err_code ndr_pull_lsa_SidPtr(struct ndr_pull *ndr, int ndr_flags, struct lsa_SidPtr *r)
1832 {
1833         uint32_t _ptr_sid;
1834         TALLOC_CTX *_mem_save_sid_0;
1835         if (ndr_flags & NDR_SCALARS) {
1836                 NDR_CHECK(ndr_pull_align(ndr, 4));
1837                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_sid));
1838                 if (_ptr_sid) {
1839                         NDR_PULL_ALLOC(ndr, r->sid);
1840                 } else {
1841                         r->sid = NULL;
1842                 }
1843         }
1844         if (ndr_flags & NDR_BUFFERS) {
1845                 if (r->sid) {
1846                         _mem_save_sid_0 = NDR_PULL_GET_MEM_CTX(ndr);
1847                         NDR_PULL_SET_MEM_CTX(ndr, r->sid, 0);
1848                         NDR_CHECK(ndr_pull_dom_sid2(ndr, NDR_SCALARS|NDR_BUFFERS, r->sid));
1849                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sid_0, 0);
1850                 }
1851         }
1852         return NDR_ERR_SUCCESS;
1853 }
1854
1855 _PUBLIC_ void ndr_print_lsa_SidPtr(struct ndr_print *ndr, const char *name, const struct lsa_SidPtr *r)
1856 {
1857         ndr_print_struct(ndr, name, "lsa_SidPtr");
1858         ndr->depth++;
1859         ndr_print_ptr(ndr, "sid", r->sid);
1860         ndr->depth++;
1861         if (r->sid) {
1862                 ndr_print_dom_sid2(ndr, "sid", r->sid);
1863         }
1864         ndr->depth--;
1865         ndr->depth--;
1866 }
1867
1868 _PUBLIC_ enum ndr_err_code ndr_push_lsa_SidArray(struct ndr_push *ndr, int ndr_flags, const struct lsa_SidArray *r)
1869 {
1870         uint32_t cntr_sids_1;
1871         if (ndr_flags & NDR_SCALARS) {
1872                 NDR_CHECK(ndr_push_align(ndr, 4));
1873                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->num_sids));
1874                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->sids));
1875         }
1876         if (ndr_flags & NDR_BUFFERS) {
1877                 if (r->sids) {
1878                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->num_sids));
1879                         for (cntr_sids_1 = 0; cntr_sids_1 < r->num_sids; cntr_sids_1++) {
1880                                 NDR_CHECK(ndr_push_lsa_SidPtr(ndr, NDR_SCALARS, &r->sids[cntr_sids_1]));
1881                         }
1882                         for (cntr_sids_1 = 0; cntr_sids_1 < r->num_sids; cntr_sids_1++) {
1883                                 NDR_CHECK(ndr_push_lsa_SidPtr(ndr, NDR_BUFFERS, &r->sids[cntr_sids_1]));
1884                         }
1885                 }
1886         }
1887         return NDR_ERR_SUCCESS;
1888 }
1889
1890 _PUBLIC_ enum ndr_err_code ndr_pull_lsa_SidArray(struct ndr_pull *ndr, int ndr_flags, struct lsa_SidArray *r)
1891 {
1892         uint32_t _ptr_sids;
1893         uint32_t cntr_sids_1;
1894         TALLOC_CTX *_mem_save_sids_0;
1895         TALLOC_CTX *_mem_save_sids_1;
1896         if (ndr_flags & NDR_SCALARS) {
1897                 NDR_CHECK(ndr_pull_align(ndr, 4));
1898                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->num_sids));
1899                 if (r->num_sids > 1000) {
1900                         return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range");
1901                 }
1902                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_sids));
1903                 if (_ptr_sids) {
1904                         NDR_PULL_ALLOC(ndr, r->sids);
1905                 } else {
1906                         r->sids = NULL;
1907                 }
1908         }
1909         if (ndr_flags & NDR_BUFFERS) {
1910                 if (r->sids) {
1911                         _mem_save_sids_0 = NDR_PULL_GET_MEM_CTX(ndr);
1912                         NDR_PULL_SET_MEM_CTX(ndr, r->sids, 0);
1913                         NDR_CHECK(ndr_pull_array_size(ndr, &r->sids));
1914                         NDR_PULL_ALLOC_N(ndr, r->sids, ndr_get_array_size(ndr, &r->sids));
1915                         _mem_save_sids_1 = NDR_PULL_GET_MEM_CTX(ndr);
1916                         NDR_PULL_SET_MEM_CTX(ndr, r->sids, 0);
1917                         for (cntr_sids_1 = 0; cntr_sids_1 < r->num_sids; cntr_sids_1++) {
1918                                 NDR_CHECK(ndr_pull_lsa_SidPtr(ndr, NDR_SCALARS, &r->sids[cntr_sids_1]));
1919                         }
1920                         for (cntr_sids_1 = 0; cntr_sids_1 < r->num_sids; cntr_sids_1++) {
1921                                 NDR_CHECK(ndr_pull_lsa_SidPtr(ndr, NDR_BUFFERS, &r->sids[cntr_sids_1]));
1922                         }
1923                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sids_1, 0);
1924                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sids_0, 0);
1925                 }
1926                 if (r->sids) {
1927                         NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->sids, r->num_sids));
1928                 }
1929         }
1930         return NDR_ERR_SUCCESS;
1931 }
1932
1933 _PUBLIC_ void ndr_print_lsa_SidArray(struct ndr_print *ndr, const char *name, const struct lsa_SidArray *r)
1934 {
1935         uint32_t cntr_sids_1;
1936         ndr_print_struct(ndr, name, "lsa_SidArray");
1937         ndr->depth++;
1938         ndr_print_uint32(ndr, "num_sids", r->num_sids);
1939         ndr_print_ptr(ndr, "sids", r->sids);
1940         ndr->depth++;
1941         if (r->sids) {
1942                 ndr->print(ndr, "%s: ARRAY(%d)", "sids", (int)r->num_sids);
1943                 ndr->depth++;
1944                 for (cntr_sids_1=0;cntr_sids_1<r->num_sids;cntr_sids_1++) {
1945                         char *idx_1=NULL;
1946                         if (asprintf(&idx_1, "[%d]", cntr_sids_1) != -1) {
1947                                 ndr_print_lsa_SidPtr(ndr, "sids", &r->sids[cntr_sids_1]);
1948                                 free(idx_1);
1949                         }
1950                 }
1951                 ndr->depth--;
1952         }
1953         ndr->depth--;
1954         ndr->depth--;
1955 }
1956
1957 static enum ndr_err_code ndr_push_lsa_DomainList(struct ndr_push *ndr, int ndr_flags, const struct lsa_DomainList *r)
1958 {
1959         uint32_t cntr_domains_1;
1960         if (ndr_flags & NDR_SCALARS) {
1961                 NDR_CHECK(ndr_push_align(ndr, 4));
1962                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count));
1963                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->domains));
1964         }
1965         if (ndr_flags & NDR_BUFFERS) {
1966                 if (r->domains) {
1967                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count));
1968                         for (cntr_domains_1 = 0; cntr_domains_1 < r->count; cntr_domains_1++) {
1969                                 NDR_CHECK(ndr_push_lsa_DomainInfo(ndr, NDR_SCALARS, &r->domains[cntr_domains_1]));
1970                         }
1971                         for (cntr_domains_1 = 0; cntr_domains_1 < r->count; cntr_domains_1++) {
1972                                 NDR_CHECK(ndr_push_lsa_DomainInfo(ndr, NDR_BUFFERS, &r->domains[cntr_domains_1]));
1973                         }
1974                 }
1975         }
1976         return NDR_ERR_SUCCESS;
1977 }
1978
1979 static enum ndr_err_code ndr_pull_lsa_DomainList(struct ndr_pull *ndr, int ndr_flags, struct lsa_DomainList *r)
1980 {
1981         uint32_t _ptr_domains;
1982         uint32_t cntr_domains_1;
1983         TALLOC_CTX *_mem_save_domains_0;
1984         TALLOC_CTX *_mem_save_domains_1;
1985         if (ndr_flags & NDR_SCALARS) {
1986                 NDR_CHECK(ndr_pull_align(ndr, 4));
1987                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->count));
1988                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_domains));
1989                 if (_ptr_domains) {
1990                         NDR_PULL_ALLOC(ndr, r->domains);
1991                 } else {
1992                         r->domains = NULL;
1993                 }
1994         }
1995         if (ndr_flags & NDR_BUFFERS) {
1996                 if (r->domains) {
1997                         _mem_save_domains_0 = NDR_PULL_GET_MEM_CTX(ndr);
1998                         NDR_PULL_SET_MEM_CTX(ndr, r->domains, 0);
1999                         NDR_CHECK(ndr_pull_array_size(ndr, &r->domains));
2000                         NDR_PULL_ALLOC_N(ndr, r->domains, ndr_get_array_size(ndr, &r->domains));
2001                         _mem_save_domains_1 = NDR_PULL_GET_MEM_CTX(ndr);
2002                         NDR_PULL_SET_MEM_CTX(ndr, r->domains, 0);
2003                         for (cntr_domains_1 = 0; cntr_domains_1 < r->count; cntr_domains_1++) {
2004                                 NDR_CHECK(ndr_pull_lsa_DomainInfo(ndr, NDR_SCALARS, &r->domains[cntr_domains_1]));
2005                         }
2006                         for (cntr_domains_1 = 0; cntr_domains_1 < r->count; cntr_domains_1++) {
2007                                 NDR_CHECK(ndr_pull_lsa_DomainInfo(ndr, NDR_BUFFERS, &r->domains[cntr_domains_1]));
2008                         }
2009                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domains_1, 0);
2010                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domains_0, 0);
2011                 }
2012                 if (r->domains) {
2013                         NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->domains, r->count));
2014                 }
2015         }
2016         return NDR_ERR_SUCCESS;
2017 }
2018
2019 _PUBLIC_ void ndr_print_lsa_DomainList(struct ndr_print *ndr, const char *name, const struct lsa_DomainList *r)
2020 {
2021         uint32_t cntr_domains_1;
2022         ndr_print_struct(ndr, name, "lsa_DomainList");
2023         ndr->depth++;
2024         ndr_print_uint32(ndr, "count", r->count);
2025         ndr_print_ptr(ndr, "domains", r->domains);
2026         ndr->depth++;
2027         if (r->domains) {
2028                 ndr->print(ndr, "%s: ARRAY(%d)", "domains", (int)r->count);
2029                 ndr->depth++;
2030                 for (cntr_domains_1=0;cntr_domains_1<r->count;cntr_domains_1++) {
2031                         char *idx_1=NULL;
2032                         if (asprintf(&idx_1, "[%d]", cntr_domains_1) != -1) {
2033                                 ndr_print_lsa_DomainInfo(ndr, "domains", &r->domains[cntr_domains_1]);
2034                                 free(idx_1);
2035                         }
2036                 }
2037                 ndr->depth--;
2038         }
2039         ndr->depth--;
2040         ndr->depth--;
2041 }
2042
2043 _PUBLIC_ enum ndr_err_code ndr_push_lsa_SidType(struct ndr_push *ndr, int ndr_flags, enum lsa_SidType r)
2044 {
2045         NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r));
2046         return NDR_ERR_SUCCESS;
2047 }
2048
2049 _PUBLIC_ enum ndr_err_code ndr_pull_lsa_SidType(struct ndr_pull *ndr, int ndr_flags, enum lsa_SidType *r)
2050 {
2051         uint16_t v;
2052         NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v));
2053         *r = v;
2054         return NDR_ERR_SUCCESS;
2055 }
2056
2057 _PUBLIC_ void ndr_print_lsa_SidType(struct ndr_print *ndr, const char *name, enum lsa_SidType r)
2058 {
2059         const char *val = NULL;
2060
2061         switch (r) {
2062                 case SID_NAME_USE_NONE: val = "SID_NAME_USE_NONE"; break;
2063                 case SID_NAME_USER: val = "SID_NAME_USER"; break;
2064                 case SID_NAME_DOM_GRP: val = "SID_NAME_DOM_GRP"; break;
2065                 case SID_NAME_DOMAIN: val = "SID_NAME_DOMAIN"; break;
2066                 case SID_NAME_ALIAS: val = "SID_NAME_ALIAS"; break;
2067                 case SID_NAME_WKN_GRP: val = "SID_NAME_WKN_GRP"; break;
2068                 case SID_NAME_DELETED: val = "SID_NAME_DELETED"; break;
2069                 case SID_NAME_INVALID: val = "SID_NAME_INVALID"; break;
2070                 case SID_NAME_UNKNOWN: val = "SID_NAME_UNKNOWN"; break;
2071                 case SID_NAME_COMPUTER: val = "SID_NAME_COMPUTER"; break;
2072         }
2073         ndr_print_enum(ndr, name, "ENUM", val, r);
2074 }
2075
2076 static enum ndr_err_code ndr_push_lsa_TranslatedSid(struct ndr_push *ndr, int ndr_flags, const struct lsa_TranslatedSid *r)
2077 {
2078         if (ndr_flags & NDR_SCALARS) {
2079                 NDR_CHECK(ndr_push_align(ndr, 4));
2080                 NDR_CHECK(ndr_push_lsa_SidType(ndr, NDR_SCALARS, r->sid_type));
2081                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->rid));
2082                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->sid_index));
2083         }
2084         if (ndr_flags & NDR_BUFFERS) {
2085         }
2086         return NDR_ERR_SUCCESS;
2087 }
2088
2089 static enum ndr_err_code ndr_pull_lsa_TranslatedSid(struct ndr_pull *ndr, int ndr_flags, struct lsa_TranslatedSid *r)
2090 {
2091         if (ndr_flags & NDR_SCALARS) {
2092                 NDR_CHECK(ndr_pull_align(ndr, 4));
2093                 NDR_CHECK(ndr_pull_lsa_SidType(ndr, NDR_SCALARS, &r->sid_type));
2094                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->rid));
2095                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->sid_index));
2096         }
2097         if (ndr_flags & NDR_BUFFERS) {
2098         }
2099         return NDR_ERR_SUCCESS;
2100 }
2101
2102 _PUBLIC_ void ndr_print_lsa_TranslatedSid(struct ndr_print *ndr, const char *name, const struct lsa_TranslatedSid *r)
2103 {
2104         ndr_print_struct(ndr, name, "lsa_TranslatedSid");
2105         ndr->depth++;
2106         ndr_print_lsa_SidType(ndr, "sid_type", r->sid_type);
2107         ndr_print_uint32(ndr, "rid", r->rid);
2108         ndr_print_uint32(ndr, "sid_index", r->sid_index);
2109         ndr->depth--;
2110 }
2111
2112 static enum ndr_err_code ndr_push_lsa_TransSidArray(struct ndr_push *ndr, int ndr_flags, const struct lsa_TransSidArray *r)
2113 {
2114         uint32_t cntr_sids_1;
2115         if (ndr_flags & NDR_SCALARS) {
2116                 NDR_CHECK(ndr_push_align(ndr, 4));
2117                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count));
2118                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->sids));
2119         }
2120         if (ndr_flags & NDR_BUFFERS) {
2121                 if (r->sids) {
2122                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count));
2123                         for (cntr_sids_1 = 0; cntr_sids_1 < r->count; cntr_sids_1++) {
2124                                 NDR_CHECK(ndr_push_lsa_TranslatedSid(ndr, NDR_SCALARS, &r->sids[cntr_sids_1]));
2125                         }
2126                 }
2127         }
2128         return NDR_ERR_SUCCESS;
2129 }
2130
2131 static enum ndr_err_code ndr_pull_lsa_TransSidArray(struct ndr_pull *ndr, int ndr_flags, struct lsa_TransSidArray *r)
2132 {
2133         uint32_t _ptr_sids;
2134         uint32_t cntr_sids_1;
2135         TALLOC_CTX *_mem_save_sids_0;
2136         TALLOC_CTX *_mem_save_sids_1;
2137         if (ndr_flags & NDR_SCALARS) {
2138                 NDR_CHECK(ndr_pull_align(ndr, 4));
2139                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->count));
2140                 if (r->count > 1000) {
2141                         return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range");
2142                 }
2143                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_sids));
2144                 if (_ptr_sids) {
2145                         NDR_PULL_ALLOC(ndr, r->sids);
2146                 } else {
2147                         r->sids = NULL;
2148                 }
2149         }
2150         if (ndr_flags & NDR_BUFFERS) {
2151                 if (r->sids) {
2152                         _mem_save_sids_0 = NDR_PULL_GET_MEM_CTX(ndr);
2153                         NDR_PULL_SET_MEM_CTX(ndr, r->sids, 0);
2154                         NDR_CHECK(ndr_pull_array_size(ndr, &r->sids));
2155                         NDR_PULL_ALLOC_N(ndr, r->sids, ndr_get_array_size(ndr, &r->sids));
2156                         _mem_save_sids_1 = NDR_PULL_GET_MEM_CTX(ndr);
2157                         NDR_PULL_SET_MEM_CTX(ndr, r->sids, 0);
2158                         for (cntr_sids_1 = 0; cntr_sids_1 < r->count; cntr_sids_1++) {
2159                                 NDR_CHECK(ndr_pull_lsa_TranslatedSid(ndr, NDR_SCALARS, &r->sids[cntr_sids_1]));
2160                         }
2161                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sids_1, 0);
2162                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sids_0, 0);
2163                 }
2164                 if (r->sids) {
2165                         NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->sids, r->count));
2166                 }
2167         }
2168         return NDR_ERR_SUCCESS;
2169 }
2170
2171 _PUBLIC_ void ndr_print_lsa_TransSidArray(struct ndr_print *ndr, const char *name, const struct lsa_TransSidArray *r)
2172 {
2173         uint32_t cntr_sids_1;
2174         ndr_print_struct(ndr, name, "lsa_TransSidArray");
2175         ndr->depth++;
2176         ndr_print_uint32(ndr, "count", r->count);
2177         ndr_print_ptr(ndr, "sids", r->sids);
2178         ndr->depth++;
2179         if (r->sids) {
2180                 ndr->print(ndr, "%s: ARRAY(%d)", "sids", (int)r->count);
2181                 ndr->depth++;
2182                 for (cntr_sids_1=0;cntr_sids_1<r->count;cntr_sids_1++) {
2183                         char *idx_1=NULL;
2184                         if (asprintf(&idx_1, "[%d]", cntr_sids_1) != -1) {
2185                                 ndr_print_lsa_TranslatedSid(ndr, "sids", &r->sids[cntr_sids_1]);
2186                                 free(idx_1);
2187                         }
2188                 }
2189                 ndr->depth--;
2190         }
2191         ndr->depth--;
2192         ndr->depth--;
2193 }
2194
2195 static enum ndr_err_code ndr_push_lsa_RefDomainList(struct ndr_push *ndr, int ndr_flags, const struct lsa_RefDomainList *r)
2196 {
2197         uint32_t cntr_domains_1;
2198         if (ndr_flags & NDR_SCALARS) {
2199                 NDR_CHECK(ndr_push_align(ndr, 4));
2200                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count));
2201                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->domains));
2202                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->max_size));
2203         }
2204         if (ndr_flags & NDR_BUFFERS) {
2205                 if (r->domains) {
2206                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count));
2207                         for (cntr_domains_1 = 0; cntr_domains_1 < r->count; cntr_domains_1++) {
2208                                 NDR_CHECK(ndr_push_lsa_DomainInfo(ndr, NDR_SCALARS, &r->domains[cntr_domains_1]));
2209                         }
2210                         for (cntr_domains_1 = 0; cntr_domains_1 < r->count; cntr_domains_1++) {
2211                                 NDR_CHECK(ndr_push_lsa_DomainInfo(ndr, NDR_BUFFERS, &r->domains[cntr_domains_1]));
2212                         }
2213                 }
2214         }
2215         return NDR_ERR_SUCCESS;
2216 }
2217
2218 static enum ndr_err_code ndr_pull_lsa_RefDomainList(struct ndr_pull *ndr, int ndr_flags, struct lsa_RefDomainList *r)
2219 {
2220         uint32_t _ptr_domains;
2221         uint32_t cntr_domains_1;
2222         TALLOC_CTX *_mem_save_domains_0;
2223         TALLOC_CTX *_mem_save_domains_1;
2224         if (ndr_flags & NDR_SCALARS) {
2225                 NDR_CHECK(ndr_pull_align(ndr, 4));
2226                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->count));
2227                 if (r->count > 1000) {
2228                         return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range");
2229                 }
2230                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_domains));
2231                 if (_ptr_domains) {
2232                         NDR_PULL_ALLOC(ndr, r->domains);
2233                 } else {
2234                         r->domains = NULL;
2235                 }
2236                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->max_size));
2237         }
2238         if (ndr_flags & NDR_BUFFERS) {
2239                 if (r->domains) {
2240                         _mem_save_domains_0 = NDR_PULL_GET_MEM_CTX(ndr);
2241                         NDR_PULL_SET_MEM_CTX(ndr, r->domains, 0);
2242                         NDR_CHECK(ndr_pull_array_size(ndr, &r->domains));
2243                         NDR_PULL_ALLOC_N(ndr, r->domains, ndr_get_array_size(ndr, &r->domains));
2244                         _mem_save_domains_1 = NDR_PULL_GET_MEM_CTX(ndr);
2245                         NDR_PULL_SET_MEM_CTX(ndr, r->domains, 0);
2246                         for (cntr_domains_1 = 0; cntr_domains_1 < r->count; cntr_domains_1++) {
2247                                 NDR_CHECK(ndr_pull_lsa_DomainInfo(ndr, NDR_SCALARS, &r->domains[cntr_domains_1]));
2248                         }
2249                         for (cntr_domains_1 = 0; cntr_domains_1 < r->count; cntr_domains_1++) {
2250                                 NDR_CHECK(ndr_pull_lsa_DomainInfo(ndr, NDR_BUFFERS, &r->domains[cntr_domains_1]));
2251                         }
2252                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domains_1, 0);
2253                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_domains_0, 0);
2254                 }
2255                 if (r->domains) {
2256                         NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->domains, r->count));
2257                 }
2258         }
2259         return NDR_ERR_SUCCESS;
2260 }
2261
2262 _PUBLIC_ void ndr_print_lsa_RefDomainList(struct ndr_print *ndr, const char *name, const struct lsa_RefDomainList *r)
2263 {
2264         uint32_t cntr_domains_1;
2265         ndr_print_struct(ndr, name, "lsa_RefDomainList");
2266         ndr->depth++;
2267         ndr_print_uint32(ndr, "count", r->count);
2268         ndr_print_ptr(ndr, "domains", r->domains);
2269         ndr->depth++;
2270         if (r->domains) {
2271                 ndr->print(ndr, "%s: ARRAY(%d)", "domains", (int)r->count);
2272                 ndr->depth++;
2273                 for (cntr_domains_1=0;cntr_domains_1<r->count;cntr_domains_1++) {
2274                         char *idx_1=NULL;
2275                         if (asprintf(&idx_1, "[%d]", cntr_domains_1) != -1) {
2276                                 ndr_print_lsa_DomainInfo(ndr, "domains", &r->domains[cntr_domains_1]);
2277                                 free(idx_1);
2278                         }
2279                 }
2280                 ndr->depth--;
2281         }
2282         ndr->depth--;
2283         ndr_print_uint32(ndr, "max_size", r->max_size);
2284         ndr->depth--;
2285 }
2286
2287 static enum ndr_err_code ndr_push_lsa_LookupNamesLevel(struct ndr_push *ndr, int ndr_flags, enum lsa_LookupNamesLevel r)
2288 {
2289         NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r));
2290         return NDR_ERR_SUCCESS;
2291 }
2292
2293 static enum ndr_err_code ndr_pull_lsa_LookupNamesLevel(struct ndr_pull *ndr, int ndr_flags, enum lsa_LookupNamesLevel *r)
2294 {
2295         uint16_t v;
2296         NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v));
2297         *r = v;
2298         return NDR_ERR_SUCCESS;
2299 }
2300
2301 _PUBLIC_ void ndr_print_lsa_LookupNamesLevel(struct ndr_print *ndr, const char *name, enum lsa_LookupNamesLevel r)
2302 {
2303         const char *val = NULL;
2304
2305         switch (r) {
2306                 case LSA_LOOKUP_NAMES_ALL: val = "LSA_LOOKUP_NAMES_ALL"; break;
2307                 case LSA_LOOKUP_NAMES_DOMAINS_ONLY: val = "LSA_LOOKUP_NAMES_DOMAINS_ONLY"; break;
2308                 case LSA_LOOKUP_NAMES_PRIMARY_DOMAIN_ONLY: val = "LSA_LOOKUP_NAMES_PRIMARY_DOMAIN_ONLY"; break;
2309                 case LSA_LOOKUP_NAMES_UPLEVEL_TRUSTS_ONLY: val = "LSA_LOOKUP_NAMES_UPLEVEL_TRUSTS_ONLY"; break;
2310                 case LSA_LOOKUP_NAMES_FOREST_TRUSTS_ONLY: val = "LSA_LOOKUP_NAMES_FOREST_TRUSTS_ONLY"; break;
2311                 case LSA_LOOKUP_NAMES_UPLEVEL_TRUSTS_ONLY2: val = "LSA_LOOKUP_NAMES_UPLEVEL_TRUSTS_ONLY2"; break;
2312                 case LSA_LOOKUP_NAMES_RODC_REFERRAL_TO_FULL_DC: val = "LSA_LOOKUP_NAMES_RODC_REFERRAL_TO_FULL_DC"; break;
2313         }
2314         ndr_print_enum(ndr, name, "ENUM", val, r);
2315 }
2316
2317 static enum ndr_err_code ndr_push_lsa_TranslatedName(struct ndr_push *ndr, int ndr_flags, const struct lsa_TranslatedName *r)
2318 {
2319         if (ndr_flags & NDR_SCALARS) {
2320                 NDR_CHECK(ndr_push_align(ndr, 4));
2321                 NDR_CHECK(ndr_push_lsa_SidType(ndr, NDR_SCALARS, r->sid_type));
2322                 NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->name));
2323                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->sid_index));
2324         }
2325         if (ndr_flags & NDR_BUFFERS) {
2326                 NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->name));
2327         }
2328         return NDR_ERR_SUCCESS;
2329 }
2330
2331 static enum ndr_err_code ndr_pull_lsa_TranslatedName(struct ndr_pull *ndr, int ndr_flags, struct lsa_TranslatedName *r)
2332 {
2333         if (ndr_flags & NDR_SCALARS) {
2334                 NDR_CHECK(ndr_pull_align(ndr, 4));
2335                 NDR_CHECK(ndr_pull_lsa_SidType(ndr, NDR_SCALARS, &r->sid_type));
2336                 NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->name));
2337                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->sid_index));
2338         }
2339         if (ndr_flags & NDR_BUFFERS) {
2340                 NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->name));
2341         }
2342         return NDR_ERR_SUCCESS;
2343 }
2344
2345 _PUBLIC_ void ndr_print_lsa_TranslatedName(struct ndr_print *ndr, const char *name, const struct lsa_TranslatedName *r)
2346 {
2347         ndr_print_struct(ndr, name, "lsa_TranslatedName");
2348         ndr->depth++;
2349         ndr_print_lsa_SidType(ndr, "sid_type", r->sid_type);
2350         ndr_print_lsa_String(ndr, "name", &r->name);
2351         ndr_print_uint32(ndr, "sid_index", r->sid_index);
2352         ndr->depth--;
2353 }
2354
2355 static enum ndr_err_code ndr_push_lsa_TransNameArray(struct ndr_push *ndr, int ndr_flags, const struct lsa_TransNameArray *r)
2356 {
2357         uint32_t cntr_names_1;
2358         if (ndr_flags & NDR_SCALARS) {
2359                 NDR_CHECK(ndr_push_align(ndr, 4));
2360                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count));
2361                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->names));
2362         }
2363         if (ndr_flags & NDR_BUFFERS) {
2364                 if (r->names) {
2365                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count));
2366                         for (cntr_names_1 = 0; cntr_names_1 < r->count; cntr_names_1++) {
2367                                 NDR_CHECK(ndr_push_lsa_TranslatedName(ndr, NDR_SCALARS, &r->names[cntr_names_1]));
2368                         }
2369                         for (cntr_names_1 = 0; cntr_names_1 < r->count; cntr_names_1++) {
2370                                 NDR_CHECK(ndr_push_lsa_TranslatedName(ndr, NDR_BUFFERS, &r->names[cntr_names_1]));
2371                         }
2372                 }
2373         }
2374         return NDR_ERR_SUCCESS;
2375 }
2376
2377 static enum ndr_err_code ndr_pull_lsa_TransNameArray(struct ndr_pull *ndr, int ndr_flags, struct lsa_TransNameArray *r)
2378 {
2379         uint32_t _ptr_names;
2380         uint32_t cntr_names_1;
2381         TALLOC_CTX *_mem_save_names_0;
2382         TALLOC_CTX *_mem_save_names_1;
2383         if (ndr_flags & NDR_SCALARS) {
2384                 NDR_CHECK(ndr_pull_align(ndr, 4));
2385                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->count));
2386                 if (r->count > 1000) {
2387                         return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range");
2388                 }
2389                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_names));
2390                 if (_ptr_names) {
2391                         NDR_PULL_ALLOC(ndr, r->names);
2392                 } else {
2393                         r->names = NULL;
2394                 }
2395         }
2396         if (ndr_flags & NDR_BUFFERS) {
2397                 if (r->names) {
2398                         _mem_save_names_0 = NDR_PULL_GET_MEM_CTX(ndr);
2399                         NDR_PULL_SET_MEM_CTX(ndr, r->names, 0);
2400                         NDR_CHECK(ndr_pull_array_size(ndr, &r->names));
2401                         NDR_PULL_ALLOC_N(ndr, r->names, ndr_get_array_size(ndr, &r->names));
2402                         _mem_save_names_1 = NDR_PULL_GET_MEM_CTX(ndr);
2403                         NDR_PULL_SET_MEM_CTX(ndr, r->names, 0);
2404                         for (cntr_names_1 = 0; cntr_names_1 < r->count; cntr_names_1++) {
2405                                 NDR_CHECK(ndr_pull_lsa_TranslatedName(ndr, NDR_SCALARS, &r->names[cntr_names_1]));
2406                         }
2407                         for (cntr_names_1 = 0; cntr_names_1 < r->count; cntr_names_1++) {
2408                                 NDR_CHECK(ndr_pull_lsa_TranslatedName(ndr, NDR_BUFFERS, &r->names[cntr_names_1]));
2409                         }
2410                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_names_1, 0);
2411                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_names_0, 0);
2412                 }
2413                 if (r->names) {
2414                         NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->names, r->count));
2415                 }
2416         }
2417         return NDR_ERR_SUCCESS;
2418 }
2419
2420 _PUBLIC_ void ndr_print_lsa_TransNameArray(struct ndr_print *ndr, const char *name, const struct lsa_TransNameArray *r)
2421 {
2422         uint32_t cntr_names_1;
2423         ndr_print_struct(ndr, name, "lsa_TransNameArray");
2424         ndr->depth++;
2425         ndr_print_uint32(ndr, "count", r->count);
2426         ndr_print_ptr(ndr, "names", r->names);
2427         ndr->depth++;
2428         if (r->names) {
2429                 ndr->print(ndr, "%s: ARRAY(%d)", "names", (int)r->count);
2430                 ndr->depth++;
2431                 for (cntr_names_1=0;cntr_names_1<r->count;cntr_names_1++) {
2432                         char *idx_1=NULL;
2433                         if (asprintf(&idx_1, "[%d]", cntr_names_1) != -1) {
2434                                 ndr_print_lsa_TranslatedName(ndr, "names", &r->names[cntr_names_1]);
2435                                 free(idx_1);
2436                         }
2437                 }
2438                 ndr->depth--;
2439         }
2440         ndr->depth--;
2441         ndr->depth--;
2442 }
2443
2444 static enum ndr_err_code ndr_push_lsa_LUIDAttribute(struct ndr_push *ndr, int ndr_flags, const struct lsa_LUIDAttribute *r)
2445 {
2446         if (ndr_flags & NDR_SCALARS) {
2447                 NDR_CHECK(ndr_push_align(ndr, 4));
2448                 NDR_CHECK(ndr_push_lsa_LUID(ndr, NDR_SCALARS, &r->luid));
2449                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->attribute));
2450         }
2451         if (ndr_flags & NDR_BUFFERS) {
2452         }
2453         return NDR_ERR_SUCCESS;
2454 }
2455
2456 static enum ndr_err_code ndr_pull_lsa_LUIDAttribute(struct ndr_pull *ndr, int ndr_flags, struct lsa_LUIDAttribute *r)
2457 {
2458         if (ndr_flags & NDR_SCALARS) {
2459                 NDR_CHECK(ndr_pull_align(ndr, 4));
2460                 NDR_CHECK(ndr_pull_lsa_LUID(ndr, NDR_SCALARS, &r->luid));
2461                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->attribute));
2462         }
2463         if (ndr_flags & NDR_BUFFERS) {
2464         }
2465         return NDR_ERR_SUCCESS;
2466 }
2467
2468 _PUBLIC_ void ndr_print_lsa_LUIDAttribute(struct ndr_print *ndr, const char *name, const struct lsa_LUIDAttribute *r)
2469 {
2470         ndr_print_struct(ndr, name, "lsa_LUIDAttribute");
2471         ndr->depth++;
2472         ndr_print_lsa_LUID(ndr, "luid", &r->luid);
2473         ndr_print_uint32(ndr, "attribute", r->attribute);
2474         ndr->depth--;
2475 }
2476
2477 static enum ndr_err_code ndr_push_lsa_PrivilegeSet(struct ndr_push *ndr, int ndr_flags, const struct lsa_PrivilegeSet *r)
2478 {
2479         uint32_t cntr_set_0;
2480         if (ndr_flags & NDR_SCALARS) {
2481                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count));
2482                 NDR_CHECK(ndr_push_align(ndr, 4));
2483                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->count));
2484                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->unknown));
2485                 for (cntr_set_0 = 0; cntr_set_0 < r->count; cntr_set_0++) {
2486                         NDR_CHECK(ndr_push_lsa_LUIDAttribute(ndr, NDR_SCALARS, &r->set[cntr_set_0]));
2487                 }
2488         }
2489         if (ndr_flags & NDR_BUFFERS) {
2490         }
2491         return NDR_ERR_SUCCESS;
2492 }
2493
2494 static enum ndr_err_code ndr_pull_lsa_PrivilegeSet(struct ndr_pull *ndr, int ndr_flags, struct lsa_PrivilegeSet *r)
2495 {
2496         uint32_t cntr_set_0;
2497         TALLOC_CTX *_mem_save_set_0;
2498         if (ndr_flags & NDR_SCALARS) {
2499                 NDR_CHECK(ndr_pull_array_size(ndr, &r->set));
2500                 NDR_CHECK(ndr_pull_align(ndr, 4));
2501                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->count));
2502                 if (r->count > 1000) {
2503                         return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range");
2504                 }
2505                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->unknown));
2506                 NDR_PULL_ALLOC_N(ndr, r->set, ndr_get_array_size(ndr, &r->set));
2507                 _mem_save_set_0 = NDR_PULL_GET_MEM_CTX(ndr);
2508                 NDR_PULL_SET_MEM_CTX(ndr, r->set, 0);
2509                 for (cntr_set_0 = 0; cntr_set_0 < r->count; cntr_set_0++) {
2510                         NDR_CHECK(ndr_pull_lsa_LUIDAttribute(ndr, NDR_SCALARS, &r->set[cntr_set_0]));
2511                 }
2512                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_set_0, 0);
2513                 if (r->set) {
2514                         NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->set, r->count));
2515                 }
2516         }
2517         if (ndr_flags & NDR_BUFFERS) {
2518         }
2519         return NDR_ERR_SUCCESS;
2520 }
2521
2522 _PUBLIC_ void ndr_print_lsa_PrivilegeSet(struct ndr_print *ndr, const char *name, const struct lsa_PrivilegeSet *r)
2523 {
2524         uint32_t cntr_set_0;
2525         ndr_print_struct(ndr, name, "lsa_PrivilegeSet");
2526         ndr->depth++;
2527         ndr_print_uint32(ndr, "count", r->count);
2528         ndr_print_uint32(ndr, "unknown", r->unknown);
2529         ndr->print(ndr, "%s: ARRAY(%d)", "set", (int)r->count);
2530         ndr->depth++;
2531         for (cntr_set_0=0;cntr_set_0<r->count;cntr_set_0++) {
2532                 char *idx_0=NULL;
2533                 if (asprintf(&idx_0, "[%d]", cntr_set_0) != -1) {
2534                         ndr_print_lsa_LUIDAttribute(ndr, "set", &r->set[cntr_set_0]);
2535                         free(idx_0);
2536                 }
2537         }
2538         ndr->depth--;
2539         ndr->depth--;
2540 }
2541
2542 static enum ndr_err_code ndr_push_lsa_DATA_BUF(struct ndr_push *ndr, int ndr_flags, const struct lsa_DATA_BUF *r)
2543 {
2544         {
2545                 uint32_t _flags_save_STRUCT = ndr->flags;
2546                 ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX);
2547                 if (ndr_flags & NDR_SCALARS) {
2548                         NDR_CHECK(ndr_push_align(ndr, 4));
2549                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->length));
2550                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->size));
2551                         NDR_CHECK(ndr_push_unique_ptr(ndr, r->data));
2552                 }
2553                 if (ndr_flags & NDR_BUFFERS) {
2554                         if (r->data) {
2555                                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->size));
2556                                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
2557                                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->length));
2558                                 NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->data, r->length));
2559                         }
2560                 }
2561                 ndr->flags = _flags_save_STRUCT;
2562         }
2563         return NDR_ERR_SUCCESS;
2564 }
2565
2566 static enum ndr_err_code ndr_pull_lsa_DATA_BUF(struct ndr_pull *ndr, int ndr_flags, struct lsa_DATA_BUF *r)
2567 {
2568         uint32_t _ptr_data;
2569         TALLOC_CTX *_mem_save_data_0;
2570         {
2571                 uint32_t _flags_save_STRUCT = ndr->flags;
2572                 ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX);
2573                 if (ndr_flags & NDR_SCALARS) {
2574                         NDR_CHECK(ndr_pull_align(ndr, 4));
2575                         NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->length));
2576                         NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->size));
2577                         NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_data));
2578                         if (_ptr_data) {
2579                                 NDR_PULL_ALLOC(ndr, r->data);
2580                         } else {
2581                                 r->data = NULL;
2582                         }
2583                 }
2584                 if (ndr_flags & NDR_BUFFERS) {
2585                         if (r->data) {
2586                                 _mem_save_data_0 = NDR_PULL_GET_MEM_CTX(ndr);
2587                                 NDR_PULL_SET_MEM_CTX(ndr, r->data, 0);
2588                                 NDR_CHECK(ndr_pull_array_size(ndr, &r->data));
2589                                 NDR_CHECK(ndr_pull_array_length(ndr, &r->data));
2590                                 if (ndr_get_array_length(ndr, &r->data) > ndr_get_array_size(ndr, &r->data)) {
2591                                         return ndr_pull_error(ndr, NDR_ERR_ARRAY_SIZE, "Bad array size %u should exceed array length %u", ndr_get_array_size(ndr, &r->data), ndr_get_array_length(ndr, &r->data));
2592                                 }
2593                                 NDR_PULL_ALLOC_N(ndr, r->data, ndr_get_array_size(ndr, &r->data));
2594                                 NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->data, ndr_get_array_length(ndr, &r->data)));
2595                                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_data_0, 0);
2596                         }
2597                         if (r->data) {
2598                                 NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->data, r->size));
2599                         }
2600                         if (r->data) {
2601                                 NDR_CHECK(ndr_check_array_length(ndr, (void*)&r->data, r->length));
2602                         }
2603                 }
2604                 ndr->flags = _flags_save_STRUCT;
2605         }
2606         return NDR_ERR_SUCCESS;
2607 }
2608
2609 _PUBLIC_ void ndr_print_lsa_DATA_BUF(struct ndr_print *ndr, const char *name, const struct lsa_DATA_BUF *r)
2610 {
2611         ndr_print_struct(ndr, name, "lsa_DATA_BUF");
2612         {
2613                 uint32_t _flags_save_STRUCT = ndr->flags;
2614                 ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX);
2615                 ndr->depth++;
2616                 ndr_print_uint32(ndr, "length", r->length);
2617                 ndr_print_uint32(ndr, "size", r->size);
2618                 ndr_print_ptr(ndr, "data", r->data);
2619                 ndr->depth++;
2620                 if (r->data) {
2621                         ndr_print_array_uint8(ndr, "data", r->data, r->length);
2622                 }
2623                 ndr->depth--;
2624                 ndr->depth--;
2625                 ndr->flags = _flags_save_STRUCT;
2626         }
2627 }
2628
2629 static enum ndr_err_code ndr_push_lsa_DATA_BUF2(struct ndr_push *ndr, int ndr_flags, const struct lsa_DATA_BUF2 *r)
2630 {
2631         {
2632                 uint32_t _flags_save_STRUCT = ndr->flags;
2633                 ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX);
2634                 if (ndr_flags & NDR_SCALARS) {
2635                         NDR_CHECK(ndr_push_align(ndr, 4));
2636                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->size));
2637                         NDR_CHECK(ndr_push_unique_ptr(ndr, r->data));
2638                 }
2639                 if (ndr_flags & NDR_BUFFERS) {
2640                         if (r->data) {
2641                                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->size));
2642                                 NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->data, r->size));
2643                         }
2644                 }
2645                 ndr->flags = _flags_save_STRUCT;
2646         }
2647         return NDR_ERR_SUCCESS;
2648 }
2649
2650 static enum ndr_err_code ndr_pull_lsa_DATA_BUF2(struct ndr_pull *ndr, int ndr_flags, struct lsa_DATA_BUF2 *r)
2651 {
2652         uint32_t _ptr_data;
2653         TALLOC_CTX *_mem_save_data_0;
2654         {
2655                 uint32_t _flags_save_STRUCT = ndr->flags;
2656                 ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX);
2657                 if (ndr_flags & NDR_SCALARS) {
2658                         NDR_CHECK(ndr_pull_align(ndr, 4));
2659                         NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->size));
2660                         if (r->size > 65536) {
2661                                 return ndr_pull_error(ndr, NDR_ERR_RANGE, "value out of range");
2662                         }
2663                         NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_data));
2664                         if (_ptr_data) {
2665                                 NDR_PULL_ALLOC(ndr, r->data);
2666                         } else {
2667                                 r->data = NULL;
2668                         }
2669                 }
2670                 if (ndr_flags & NDR_BUFFERS) {
2671                         if (r->data) {
2672                                 _mem_save_data_0 = NDR_PULL_GET_MEM_CTX(ndr);
2673                                 NDR_PULL_SET_MEM_CTX(ndr, r->data, 0);
2674                                 NDR_CHECK(ndr_pull_array_size(ndr, &r->data));
2675                                 NDR_PULL_ALLOC_N(ndr, r->data, ndr_get_array_size(ndr, &r->data));
2676                                 NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->data, ndr_get_array_size(ndr, &r->data)));
2677                                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_data_0, 0);
2678                         }
2679                         if (r->data) {
2680                                 NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->data, r->size));
2681                         }
2682                 }
2683                 ndr->flags = _flags_save_STRUCT;
2684         }
2685         return NDR_ERR_SUCCESS;
2686 }
2687
2688 _PUBLIC_ void ndr_print_lsa_DATA_BUF2(struct ndr_print *ndr, const char *name, const struct lsa_DATA_BUF2 *r)
2689 {
2690         ndr_print_struct(ndr, name, "lsa_DATA_BUF2");
2691         {
2692                 uint32_t _flags_save_STRUCT = ndr->flags;
2693                 ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX);
2694                 ndr->depth++;
2695                 ndr_print_uint32(ndr, "size", r->size);
2696                 ndr_print_ptr(ndr, "data", r->data);
2697                 ndr->depth++;
2698                 if (r->data) {
2699                         ndr_print_array_uint8(ndr, "data", r->data, r->size);
2700                 }
2701                 ndr->depth--;
2702                 ndr->depth--;
2703                 ndr->flags = _flags_save_STRUCT;
2704         }
2705 }
2706
2707 static enum ndr_err_code ndr_push_lsa_TrustDomInfoEnum(struct ndr_push *ndr, int ndr_flags, enum lsa_TrustDomInfoEnum r)
2708 {
2709         NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r));
2710         return NDR_ERR_SUCCESS;
2711 }
2712
2713 static enum ndr_err_code ndr_pull_lsa_TrustDomInfoEnum(struct ndr_pull *ndr, int ndr_flags, enum lsa_TrustDomInfoEnum *r)
2714 {
2715         uint16_t v;
2716         NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v));
2717         *r = v;
2718         return NDR_ERR_SUCCESS;
2719 }
2720
2721 _PUBLIC_ void ndr_print_lsa_TrustDomInfoEnum(struct ndr_print *ndr, const char *name, enum lsa_TrustDomInfoEnum r)
2722 {
2723         const char *val = NULL;
2724
2725         switch (r) {
2726                 case LSA_TRUSTED_DOMAIN_INFO_NAME: val = "LSA_TRUSTED_DOMAIN_INFO_NAME"; break;
2727                 case LSA_TRUSTED_DOMAIN_INFO_CONTROLLERS: val = "LSA_TRUSTED_DOMAIN_INFO_CONTROLLERS"; break;
2728                 case LSA_TRUSTED_DOMAIN_INFO_POSIX_OFFSET: val = "LSA_TRUSTED_DOMAIN_INFO_POSIX_OFFSET"; break;
2729                 case LSA_TRUSTED_DOMAIN_INFO_PASSWORD: val = "LSA_TRUSTED_DOMAIN_INFO_PASSWORD"; break;
2730                 case LSA_TRUSTED_DOMAIN_INFO_BASIC: val = "LSA_TRUSTED_DOMAIN_INFO_BASIC"; break;
2731                 case LSA_TRUSTED_DOMAIN_INFO_INFO_EX: val = "LSA_TRUSTED_DOMAIN_INFO_INFO_EX"; break;
2732                 case LSA_TRUSTED_DOMAIN_INFO_AUTH_INFO: val = "LSA_TRUSTED_DOMAIN_INFO_AUTH_INFO"; break;
2733                 case LSA_TRUSTED_DOMAIN_INFO_FULL_INFO: val = "LSA_TRUSTED_DOMAIN_INFO_FULL_INFO"; break;
2734                 case LSA_TRUSTED_DOMAIN_INFO_AUTH_INFO_INTERNAL: val = "LSA_TRUSTED_DOMAIN_INFO_AUTH_INFO_INTERNAL"; break;
2735                 case LSA_TRUSTED_DOMAIN_INFO_FULL_INFO_INTERNAL: val = "LSA_TRUSTED_DOMAIN_INFO_FULL_INFO_INTERNAL"; break;
2736                 case LSA_TRUSTED_DOMAIN_INFO_INFO_EX2_INTERNAL: val = "LSA_TRUSTED_DOMAIN_INFO_INFO_EX2_INTERNAL"; break;
2737                 case LSA_TRUSTED_DOMAIN_INFO_FULL_INFO_2_INTERNAL: val = "LSA_TRUSTED_DOMAIN_INFO_FULL_INFO_2_INTERNAL"; break;
2738                 case LSA_TRUSTED_DOMAIN_SUPPORTED_ENCRTYPION_TYPES: val = "LSA_TRUSTED_DOMAIN_SUPPORTED_ENCRTYPION_TYPES"; break;
2739         }
2740         ndr_print_enum(ndr, name, "ENUM", val, r);
2741 }
2742
2743 _PUBLIC_ enum ndr_err_code ndr_push_lsa_TrustDirection(struct ndr_push *ndr, int ndr_flags, uint32_t r)
2744 {
2745         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
2746         return NDR_ERR_SUCCESS;
2747 }
2748
2749 _PUBLIC_ enum ndr_err_code ndr_pull_lsa_TrustDirection(struct ndr_pull *ndr, int ndr_flags, uint32_t *r)
2750 {
2751         uint32_t v;
2752         NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
2753         *r = v;
2754         return NDR_ERR_SUCCESS;
2755 }
2756
2757 _PUBLIC_ void ndr_print_lsa_TrustDirection(struct ndr_print *ndr, const char *name, uint32_t r)
2758 {
2759         ndr_print_uint32(ndr, name, r);
2760         ndr->depth++;
2761         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "LSA_TRUST_DIRECTION_INBOUND", LSA_TRUST_DIRECTION_INBOUND, r);
2762         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "LSA_TRUST_DIRECTION_OUTBOUND", LSA_TRUST_DIRECTION_OUTBOUND, r);
2763         ndr->depth--;
2764 }
2765
2766 static enum ndr_err_code ndr_push_lsa_TrustType(struct ndr_push *ndr, int ndr_flags, enum lsa_TrustType r)
2767 {
2768         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
2769         return NDR_ERR_SUCCESS;
2770 }
2771
2772 static enum ndr_err_code ndr_pull_lsa_TrustType(struct ndr_pull *ndr, int ndr_flags, enum lsa_TrustType *r)
2773 {
2774         uint32_t v;
2775         NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
2776         *r = v;
2777         return NDR_ERR_SUCCESS;
2778 }
2779
2780 _PUBLIC_ void ndr_print_lsa_TrustType(struct ndr_print *ndr, const char *name, enum lsa_TrustType r)
2781 {
2782         const char *val = NULL;
2783
2784         switch (r) {
2785                 case LSA_TRUST_TYPE_DOWNLEVEL: val = "LSA_TRUST_TYPE_DOWNLEVEL"; break;
2786                 case LSA_TRUST_TYPE_UPLEVEL: val = "LSA_TRUST_TYPE_UPLEVEL"; break;
2787                 case LSA_TRUST_TYPE_MIT: val = "LSA_TRUST_TYPE_MIT"; break;
2788         }
2789         ndr_print_enum(ndr, name, "ENUM", val, r);
2790 }
2791
2792 _PUBLIC_ enum ndr_err_code ndr_push_lsa_TrustAttributes(struct ndr_push *ndr, int ndr_flags, uint32_t r)
2793 {
2794         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
2795         return NDR_ERR_SUCCESS;
2796 }
2797
2798 _PUBLIC_ enum ndr_err_code ndr_pull_lsa_TrustAttributes(struct ndr_pull *ndr, int ndr_flags, uint32_t *r)
2799 {
2800         uint32_t v;
2801         NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
2802         *r = v;
2803         return NDR_ERR_SUCCESS;
2804 }
2805
2806 _PUBLIC_ void ndr_print_lsa_TrustAttributes(struct ndr_print *ndr, const char *name, uint32_t r)
2807 {
2808         ndr_print_uint32(ndr, name, r);
2809         ndr->depth++;
2810         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "LSA_TRUST_ATTRIBUTE_NON_TRANSITIVE", LSA_TRUST_ATTRIBUTE_NON_TRANSITIVE, r);
2811         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "LSA_TRUST_ATTRIBUTE_UPLEVEL_ONLY", LSA_TRUST_ATTRIBUTE_UPLEVEL_ONLY, r);
2812         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "LSA_TRUST_ATTRIBUTE_QUARANTINED_DOMAIN", LSA_TRUST_ATTRIBUTE_QUARANTINED_DOMAIN, r);
2813         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "LSA_TRUST_ATTRIBUTE_FOREST_TRANSITIVE", LSA_TRUST_ATTRIBUTE_FOREST_TRANSITIVE, r);
2814         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "LSA_TRUST_ATTRIBUTE_CROSS_ORGANIZATION", LSA_TRUST_ATTRIBUTE_CROSS_ORGANIZATION, r);
2815         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "LSA_TRUST_ATTRIBUTE_WITHIN_FOREST", LSA_TRUST_ATTRIBUTE_WITHIN_FOREST, r);
2816         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "LSA_TRUST_ATTRIBUTE_TREAT_AS_EXTERNAL", LSA_TRUST_ATTRIBUTE_TREAT_AS_EXTERNAL, r);
2817         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "LSA_TRUST_ATTRIBUTE_USES_RC4_ENCRYPTION", LSA_TRUST_ATTRIBUTE_USES_RC4_ENCRYPTION, r);
2818         ndr->depth--;
2819 }
2820
2821 static enum ndr_err_code ndr_push_lsa_TrustDomainInfoName(struct ndr_push *ndr, int ndr_flags, const struct lsa_TrustDomainInfoName *r)
2822 {
2823         if (ndr_flags & NDR_SCALARS) {
2824                 NDR_CHECK(ndr_push_align(ndr, 4));
2825                 NDR_CHECK(ndr_push_lsa_StringLarge(ndr, NDR_SCALARS, &r->netbios_name));
2826         }
2827         if (ndr_flags & NDR_BUFFERS) {
2828                 NDR_CHECK(ndr_push_lsa_StringLarge(ndr, NDR_BUFFERS, &r->netbios_name));
2829         }
2830         return NDR_ERR_SUCCESS;
2831 }
2832
2833 static enum ndr_err_code ndr_pull_lsa_TrustDomainInfoName(struct ndr_pull *ndr, int ndr_flags, struct lsa_TrustDomainInfoName *r)
2834 {
2835         if (ndr_flags & NDR_SCALARS) {
2836                 NDR_CHECK(ndr_pull_align(ndr, 4));
2837                 NDR_CHECK(ndr_pull_lsa_StringLarge(ndr, NDR_SCALARS, &r->netbios_name));
2838         }
2839         if (ndr_flags & NDR_BUFFERS) {
2840                 NDR_CHECK(ndr_pull_lsa_StringLarge(ndr, NDR_BUFFERS, &r->netbios_name));
2841         }
2842         return NDR_ERR_SUCCESS;
2843 }
2844
2845 _PUBLIC_ void ndr_print_lsa_TrustDomainInfoName(struct ndr_print *ndr, const char *name, const struct lsa_TrustDomainInfoName *r)
2846 {
2847         ndr_print_struct(ndr, name, "lsa_TrustDomainInfoName");
2848         ndr->depth++;
2849         ndr_print_lsa_StringLarge(ndr, "netbios_name", &r->netbios_name);
2850         ndr->depth--;
2851 }
2852
2853 static enum ndr_err_code ndr_push_lsa_TrustDomainInfoControllers(struct ndr_push *ndr, int ndr_flags, const struct lsa_TrustDomainInfoControllers *r)
2854 {
2855         uint32_t cntr_netbios_names_1;
2856         if (ndr_flags & NDR_SCALARS) {
2857                 NDR_CHECK(ndr_push_align(ndr, 4));
2858                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->entries));
2859                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->netbios_names));
2860         }
2861         if (ndr_flags & NDR_BUFFERS) {
2862                 if (r->netbios_names) {
2863                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->entries));
2864                         for (cntr_netbios_names_1 = 0; cntr_netbios_names_1 < r->entries; cntr_netbios_names_1++) {
2865                                 NDR_CHECK(ndr_push_lsa_StringLarge(ndr, NDR_SCALARS, &r->netbios_names[cntr_netbios_names_1]));
2866                         }
2867                         for (cntr_netbios_names_1 = 0; cntr_netbios_names_1 < r->entries; cntr_netbios_names_1++) {
2868                                 NDR_CHECK(ndr_push_lsa_StringLarge(ndr, NDR_BUFFERS, &r->netbios_names[cntr_netbios_names_1]));
2869                         }
2870                 }
2871         }
2872         return NDR_ERR_SUCCESS;
2873 }
2874
2875 static enum ndr_err_code ndr_pull_lsa_TrustDomainInfoControllers(struct ndr_pull *ndr, int ndr_flags, struct lsa_TrustDomainInfoControllers *r)
2876 {
2877         uint32_t _ptr_netbios_names;
2878         uint32_t cntr_netbios_names_1;
2879         TALLOC_CTX *_mem_save_netbios_names_0;
2880         TALLOC_CTX *_mem_save_netbios_names_1;
2881         if (ndr_flags & NDR_SCALARS) {
2882                 NDR_CHECK(ndr_pull_align(ndr, 4));
2883                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->entries));
2884                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_netbios_names));
2885                 if (_ptr_netbios_names) {
2886                         NDR_PULL_ALLOC(ndr, r->netbios_names);
2887                 } else {
2888                         r->netbios_names = NULL;
2889                 }
2890         }
2891         if (ndr_flags & NDR_BUFFERS) {
2892                 if (r->netbios_names) {
2893                         _mem_save_netbios_names_0 = NDR_PULL_GET_MEM_CTX(ndr);
2894                         NDR_PULL_SET_MEM_CTX(ndr, r->netbios_names, 0);
2895                         NDR_CHECK(ndr_pull_array_size(ndr, &r->netbios_names));
2896                         NDR_PULL_ALLOC_N(ndr, r->netbios_names, ndr_get_array_size(ndr, &r->netbios_names));
2897                         _mem_save_netbios_names_1 = NDR_PULL_GET_MEM_CTX(ndr);
2898                         NDR_PULL_SET_MEM_CTX(ndr, r->netbios_names, 0);
2899                         for (cntr_netbios_names_1 = 0; cntr_netbios_names_1 < r->entries; cntr_netbios_names_1++) {
2900                                 NDR_CHECK(ndr_pull_lsa_StringLarge(ndr, NDR_SCALARS, &r->netbios_names[cntr_netbios_names_1]));
2901                         }
2902                         for (cntr_netbios_names_1 = 0; cntr_netbios_names_1 < r->entries; cntr_netbios_names_1++) {
2903                                 NDR_CHECK(ndr_pull_lsa_StringLarge(ndr, NDR_BUFFERS, &r->netbios_names[cntr_netbios_names_1]));
2904                         }
2905                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_netbios_names_1, 0);
2906                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_netbios_names_0, 0);
2907                 }
2908                 if (r->netbios_names) {
2909                         NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->netbios_names, r->entries));
2910                 }
2911         }
2912         return NDR_ERR_SUCCESS;
2913 }
2914
2915 _PUBLIC_ void ndr_print_lsa_TrustDomainInfoControllers(struct ndr_print *ndr, const char *name, const struct lsa_TrustDomainInfoControllers *r)
2916 {
2917         uint32_t cntr_netbios_names_1;
2918         ndr_print_struct(ndr, name, "lsa_TrustDomainInfoControllers");
2919         ndr->depth++;
2920         ndr_print_uint32(ndr, "entries", r->entries);
2921         ndr_print_ptr(ndr, "netbios_names", r->netbios_names);
2922         ndr->depth++;
2923         if (r->netbios_names) {
2924                 ndr->print(ndr, "%s: ARRAY(%d)", "netbios_names", (int)r->entries);
2925                 ndr->depth++;
2926                 for (cntr_netbios_names_1=0;cntr_netbios_names_1<r->entries;cntr_netbios_names_1++) {
2927                         char *idx_1=NULL;
2928                         if (asprintf(&idx_1, "[%d]", cntr_netbios_names_1) != -1) {
2929                                 ndr_print_lsa_StringLarge(ndr, "netbios_names", &r->netbios_names[cntr_netbios_names_1]);
2930                                 free(idx_1);
2931                         }
2932                 }
2933                 ndr->depth--;
2934         }
2935         ndr->depth--;
2936         ndr->depth--;
2937 }
2938
2939 static enum ndr_err_code ndr_push_lsa_TrustDomainInfoPosixOffset(struct ndr_push *ndr, int ndr_flags, const struct lsa_TrustDomainInfoPosixOffset *r)
2940 {
2941         if (ndr_flags & NDR_SCALARS) {
2942                 NDR_CHECK(ndr_push_align(ndr, 4));
2943                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->posix_offset));
2944         }
2945         if (ndr_flags & NDR_BUFFERS) {
2946         }
2947         return NDR_ERR_SUCCESS;
2948 }
2949
2950 static enum ndr_err_code ndr_pull_lsa_TrustDomainInfoPosixOffset(struct ndr_pull *ndr, int ndr_flags, struct lsa_TrustDomainInfoPosixOffset *r)
2951 {
2952         if (ndr_flags & NDR_SCALARS) {
2953                 NDR_CHECK(ndr_pull_align(ndr, 4));
2954                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->posix_offset));
2955         }
2956         if (ndr_flags & NDR_BUFFERS) {
2957         }
2958         return NDR_ERR_SUCCESS;
2959 }
2960
2961 _PUBLIC_ void ndr_print_lsa_TrustDomainInfoPosixOffset(struct ndr_print *ndr, const char *name, const struct lsa_TrustDomainInfoPosixOffset *r)
2962 {
2963         ndr_print_struct(ndr, name, "lsa_TrustDomainInfoPosixOffset");
2964         ndr->depth++;
2965         ndr_print_uint32(ndr, "posix_offset", r->posix_offset);
2966         ndr->depth--;
2967 }
2968
2969 static enum ndr_err_code ndr_push_lsa_TrustDomainInfoPassword(struct ndr_push *ndr, int ndr_flags, const struct lsa_TrustDomainInfoPassword *r)
2970 {
2971         if (ndr_flags & NDR_SCALARS) {
2972                 NDR_CHECK(ndr_push_align(ndr, 4));
2973                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->password));
2974                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->old_password));
2975         }
2976         if (ndr_flags & NDR_BUFFERS) {
2977                 if (r->password) {
2978                         NDR_CHECK(ndr_push_lsa_DATA_BUF(ndr, NDR_SCALARS|NDR_BUFFERS, r->password));
2979                 }
2980                 if (r->old_password) {
2981                         NDR_CHECK(ndr_push_lsa_DATA_BUF(ndr, NDR_SCALARS|NDR_BUFFERS, r->old_password));
2982                 }
2983         }
2984         return NDR_ERR_SUCCESS;
2985 }
2986
2987 static enum ndr_err_code ndr_pull_lsa_TrustDomainInfoPassword(struct ndr_pull *ndr, int ndr_flags, struct lsa_TrustDomainInfoPassword *r)
2988 {
2989         uint32_t _ptr_password;
2990         TALLOC_CTX *_mem_save_password_0;
2991         uint32_t _ptr_old_password;
2992         TALLOC_CTX *_mem_save_old_password_0;
2993         if (ndr_flags & NDR_SCALARS) {
2994                 NDR_CHECK(ndr_pull_align(ndr, 4));
2995                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_password));
2996                 if (_ptr_password) {
2997                         NDR_PULL_ALLOC(ndr, r->password);
2998                 } else {
2999                         r->password = NULL;
3000                 }
3001                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_old_password));
3002                 if (_ptr_old_password) {
3003                         NDR_PULL_ALLOC(ndr, r->old_password);
3004                 } else {
3005                         r->old_password = NULL;
3006                 }
3007         }
3008         if (ndr_flags & NDR_BUFFERS) {
3009                 if (r->password) {
3010                         _mem_save_password_0 = NDR_PULL_GET_MEM_CTX(ndr);
3011                         NDR_PULL_SET_MEM_CTX(ndr, r->password, 0);
3012                         NDR_CHECK(ndr_pull_lsa_DATA_BUF(ndr, NDR_SCALARS|NDR_BUFFERS, r->password));
3013                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_password_0, 0);
3014                 }
3015                 if (r->old_password) {
3016                         _mem_save_old_password_0 = NDR_PULL_GET_MEM_CTX(ndr);
3017                         NDR_PULL_SET_MEM_CTX(ndr, r->old_password, 0);
3018                         NDR_CHECK(ndr_pull_lsa_DATA_BUF(ndr, NDR_SCALARS|NDR_BUFFERS, r->old_password));
3019                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_old_password_0, 0);
3020                 }
3021         }
3022         return NDR_ERR_SUCCESS;
3023 }
3024
3025 _PUBLIC_ void ndr_print_lsa_TrustDomainInfoPassword(struct ndr_print *ndr, const char *name, const struct lsa_TrustDomainInfoPassword *r)
3026 {
3027         ndr_print_struct(ndr, name, "lsa_TrustDomainInfoPassword");
3028         ndr->depth++;
3029         ndr_print_ptr(ndr, "password", r->password);
3030         ndr->depth++;
3031         if (r->password) {
3032                 ndr_print_lsa_DATA_BUF(ndr, "password", r->password);
3033         }
3034         ndr->depth--;
3035         ndr_print_ptr(ndr, "old_password", r->old_password);
3036         ndr->depth++;
3037         if (r->old_password) {
3038                 ndr_print_lsa_DATA_BUF(ndr, "old_password", r->old_password);
3039         }
3040         ndr->depth--;
3041         ndr->depth--;
3042 }
3043
3044 static enum ndr_err_code ndr_push_lsa_TrustDomainInfoBasic(struct ndr_push *ndr, int ndr_flags, const struct lsa_TrustDomainInfoBasic *r)
3045 {
3046         if (ndr_flags & NDR_SCALARS) {
3047                 NDR_CHECK(ndr_push_align(ndr, 4));
3048                 NDR_CHECK(ndr_push_lsa_String(ndr, NDR_SCALARS, &r->netbios_name));
3049                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->sid));
3050         }
3051         if (ndr_flags & NDR_BUFFERS) {
3052                 NDR_CHECK(ndr_push_lsa_String(ndr, NDR_BUFFERS, &r->netbios_name));
3053                 if (r->sid) {
3054                         NDR_CHECK(ndr_push_dom_sid2(ndr, NDR_SCALARS|NDR_BUFFERS, r->sid));
3055                 }
3056         }
3057         return NDR_ERR_SUCCESS;
3058 }
3059
3060 static enum ndr_err_code ndr_pull_lsa_TrustDomainInfoBasic(struct ndr_pull *ndr, int ndr_flags, struct lsa_TrustDomainInfoBasic *r)
3061 {
3062         uint32_t _ptr_sid;
3063         TALLOC_CTX *_mem_save_sid_0;
3064         if (ndr_flags & NDR_SCALARS) {
3065                 NDR_CHECK(ndr_pull_align(ndr, 4));
3066                 NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_SCALARS, &r->netbios_name));
3067                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_sid));
3068                 if (_ptr_sid) {
3069                         NDR_PULL_ALLOC(ndr, r->sid);
3070                 } else {
3071                         r->sid = NULL;
3072                 }
3073         }
3074         if (ndr_flags & NDR_BUFFERS) {
3075                 NDR_CHECK(ndr_pull_lsa_String(ndr, NDR_BUFFERS, &r->netbios_name));
3076                 if (r->sid) {
3077                         _mem_save_sid_0 = NDR_PULL_GET_MEM_CTX(ndr);
3078                         NDR_PULL_SET_MEM_CTX(ndr, r->sid, 0);
3079                         NDR_CHECK(ndr_pull_dom_sid2(ndr, NDR_SCALARS|NDR_BUFFERS, r->sid));
3080                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sid_0, 0);
3081                 }
3082         }
3083         return NDR_ERR_SUCCESS;
3084 }
3085
3086 _PUBLIC_ void ndr_print_lsa_TrustDomainInfoBasic(struct ndr_print *ndr, const char *name, const struct lsa_TrustDomainInfoBasic *r)
3087 {
3088         ndr_print_struct(ndr, name, "lsa_TrustDomainInfoBasic");
3089         ndr->depth++;
3090         ndr_print_lsa_String(ndr, "netbios_name", &r->netbios_name);
3091         ndr_print_ptr(ndr, "sid", r->sid);
3092         ndr->depth++;
3093         if (r->sid) {
3094                 ndr_print_dom_sid2(ndr, "sid", r->sid);
3095         }
3096         ndr->depth--;
3097         ndr->depth--;
3098 }
3099
3100 static enum ndr_err_code ndr_push_lsa_TrustDomainInfoInfoEx(struct ndr_push *ndr, int ndr_flags, const struct lsa_TrustDomainInfoInfoEx *r)
3101 {
3102         if (ndr_flags & NDR_SCALARS) {
3103                 NDR_CHECK(ndr_push_align(ndr, 4));
3104                 NDR_CHECK(ndr_push_lsa_StringLarge(ndr, NDR_SCALARS, &r->domain_name));
3105                 NDR_CHECK(ndr_push_lsa_StringLarge(ndr, NDR_SCALARS, &r->netbios_name));
3106                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->sid));
3107                 NDR_CHECK(ndr_push_lsa_TrustDirection(ndr, NDR_SCALARS, r->trust_direction));
3108                 NDR_CHECK(ndr_push_lsa_TrustType(ndr, NDR_SCALARS, r->trust_type));
3109                 NDR_CHECK(ndr_push_lsa_TrustAttributes(ndr, NDR_SCALARS, r->trust_attributes));
3110         }
3111         if (ndr_flags & NDR_BUFFERS) {
3112                 NDR_CHECK(ndr_push_lsa_StringLarge(ndr, NDR_BUFFERS, &r->domain_name));
3113                 NDR_CHECK(ndr_push_lsa_StringLarge(ndr, NDR_BUFFERS, &r->netbios_name));
3114                 if (r->sid) {
3115                         NDR_CHECK(ndr_push_dom_sid2(ndr, NDR_SCALARS|NDR_BUFFERS, r->sid));
3116                 }
3117         }
3118         return NDR_ERR_SUCCESS;
3119 }
3120
3121 static enum ndr_err_code ndr_pull_lsa_TrustDomainInfoInfoEx(struct ndr_pull *ndr, int ndr_flags, struct lsa_TrustDomainInfoInfoEx *r)
3122 {
3123         uint32_t _ptr_sid;
3124         TALLOC_CTX *_mem_save_sid_0;
3125         if (ndr_flags & NDR_SCALARS) {
3126                 NDR_CHECK(ndr_pull_align(ndr, 4));
3127                 NDR_CHECK(ndr_pull_lsa_StringLarge(ndr, NDR_SCALARS, &r->domain_name));
3128                 NDR_CHECK(ndr_pull_lsa_StringLarge(ndr, NDR_SCALARS, &r->netbios_name));
3129                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_sid));
3130                 if (_ptr_sid) {
3131                         NDR_PULL_ALLOC(ndr, r->sid);
3132                 } else {
3133                         r->sid = NULL;
3134                 }
3135                 NDR_CHECK(ndr_pull_lsa_TrustDirection(ndr, NDR_SCALARS, &r->trust_direction));
3136                 NDR_CHECK(ndr_pull_lsa_TrustType(ndr, NDR_SCALARS, &r->trust_type));
3137                 NDR_CHECK(ndr_pull_lsa_TrustAttributes(ndr, NDR_SCALARS, &r->trust_attributes));
3138         }
3139         if (ndr_flags & NDR_BUFFERS) {
3140                 NDR_CHECK(ndr_pull_lsa_StringLarge(ndr, NDR_BUFFERS, &r->domain_name));
3141                 NDR_CHECK(ndr_pull_lsa_StringLarge(ndr, NDR_BUFFERS, &r->netbios_name));
3142                 if (r->sid) {
3143                         _mem_save_sid_0 = NDR_PULL_GET_MEM_CTX(ndr);
3144                         NDR_PULL_SET_MEM_CTX(ndr, r->sid, 0);
3145                         NDR_CHECK(ndr_pull_dom_sid2(ndr, NDR_SCALARS|NDR_BUFFERS, r->sid));
3146                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_sid_0, 0);
3147                 }
3148         }
3149         return NDR_ERR_SUCCESS;
3150 }
3151
3152 _PUBLIC_ void ndr_print_lsa_TrustDomainInfoInfoEx(struct ndr_print *ndr, const char *name, const struct lsa_TrustDomainInfoInfoEx *r)
3153 {
3154         ndr_print_struct(ndr, name, "lsa_TrustDomainInfoInfoEx");
3155         ndr->depth++;
3156         ndr_print_lsa_StringLarge(ndr, "domain_name", &r->domain_name);
3157         ndr_print_lsa_StringLarge(ndr, "netbios_name", &r->netbios_name);
3158         ndr_print_ptr(ndr, "sid", r->sid);
3159         ndr->depth++;
3160         if (r->sid) {
3161                 ndr_print_dom_sid2(ndr, "sid", r->sid);
3162         }
3163         ndr->depth--;
3164         ndr_print_lsa_TrustDirection(ndr, "trust_direction", r->trust_direction);
3165         ndr_print_lsa_TrustType(ndr, "trust_type", r->trust_type);
3166         ndr_print_lsa_TrustAttributes(ndr, "trust_attributes", r->trust_attributes);
3167         ndr->depth--;
3168 }
3169
3170 _PUBLIC_ enum ndr_err_code ndr_push_lsa_TrustAuthType(struct ndr_push *ndr, int ndr_flags, enum lsa_TrustAuthType r)
3171 {
3172         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
3173         return NDR_ERR_SUCCESS;
3174 }
3175
3176 _PUBLIC_ enum ndr_err_code ndr_pull_lsa_TrustAuthType(struct ndr_pull *ndr, int ndr_flags, enum lsa_TrustAuthType *r)
3177 {
3178         uint32_t v;
3179         NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
3180         *r = v;
3181         return NDR_ERR_SUCCESS;
3182 }
3183
3184 _PUBLIC_ void ndr_print_lsa_TrustAuthType(struct ndr_print *ndr, const char *name, enum lsa_TrustAuthType r)
3185 {
3186         const char *val = NULL;
3187
3188         switch (r) {
3189                 case TRUST_AUTH_TYPE_NONE: val = "TRUST_AUTH_TYPE_NONE"; break;
3190                 case TRUST_AUTH_TYPE_NT4OWF: val = "TRUST_AUTH_TYPE_NT4OWF"; break;
3191                 case TRUST_AUTH_TYPE_CLEAR: val = "TRUST_AUTH_TYPE_CLEAR"; break;
3192                 case TRUST_AUTH_TYPE_VERSION: val = "TRUST_AUTH_TYPE_VERSION"; break;
3193         }
3194         ndr_print_enum(ndr, name, "ENUM", val, r);
3195 }
3196
3197 static enum ndr_err_code ndr_push_lsa_TrustDomainInfoBuffer(struct ndr_push *ndr, int ndr_flags, const struct lsa_TrustDomainInfoBuffer *r)
3198 {
3199         if (ndr_flags & NDR_SCALARS) {
3200                 NDR_CHECK(ndr_push_align(ndr, 8));
3201                 NDR_CHECK(ndr_push_NTTIME_hyper(ndr, NDR_SCALARS, r->last_update_time));
3202                 NDR_CHECK(ndr_push_lsa_TrustAuthType(ndr, NDR_SCALARS, r->AuthType));
3203                 NDR_CHECK(ndr_push_lsa_DATA_BUF2(ndr, NDR_SCALARS, &r->data));
3204         }
3205         if (ndr_flags & NDR_BUFFERS) {
3206                 NDR_CHECK(ndr_push_lsa_DATA_BUF2(ndr, NDR_BUFFERS, &r->data));
3207         }
3208         return NDR_ERR_SUCCESS;
3209 }
3210
3211 static enum ndr_err_code ndr_pull_lsa_TrustDomainInfoBuffer(struct ndr_pull *ndr, int ndr_flags, struct lsa_TrustDomainInfoBuffer *r)
3212 {
3213         if (ndr_flags & NDR_SCALARS) {
3214                 NDR_CHECK(ndr_pull_align(ndr, 8));
3215                 NDR_CHECK(ndr_pull_NTTIME_hyper(ndr, NDR_SCALARS, &r->last_update_time));
3216                 NDR_CHECK(ndr_pull_lsa_TrustAuthType(ndr, NDR_SCALARS, &r->AuthType));
3217                 NDR_CHECK(ndr_pull_lsa_DATA_BUF2(ndr, NDR_SCALARS, &r->data));
3218         }
3219         if (ndr_flags & NDR_BUFFERS) {
3220                 NDR_CHECK(ndr_pull_lsa_DATA_BUF2(ndr, NDR_BUFFERS, &r->data));
3221         }
3222         return NDR_ERR_SUCCESS;
3223 }
3224
3225 _PUBLIC_ void ndr_print_lsa_TrustDomainInfoBuffer(struct ndr_print *ndr, const char *name, const struct lsa_TrustDomainInfoBuffer *r)
3226 {
3227         ndr_print_struct(ndr, name, "lsa_TrustDomainInfoBuffer");
3228         ndr->depth++;
3229         ndr_print_NTTIME_hyper(ndr, "last_update_time", r->last_update_time);
3230         ndr_print_lsa_TrustAuthType(ndr, "AuthType", r->AuthType);
3231         ndr_print_lsa_DATA_BUF2(ndr, "data", &r->data);
3232         ndr->depth--;
3233 }
3234
3235 static enum ndr_err_code ndr_push_lsa_TrustDomainInfoAuthInfo(struct ndr_push *ndr, int ndr_flags, const struct lsa_TrustDomainInfoAuthInfo *r)
3236 {
3237         if (ndr_flags & NDR_SCALARS) {
3238                 NDR_CHECK(ndr_push_align(ndr, 4));
3239                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->incoming_count));
3240                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->incoming_current_auth_info));
3241                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->incoming_previous_auth_info));
3242                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->outgoing_count));
3243                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->outgoing_current_auth_info));
3244                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->outgoing_previous_auth_info));
3245         }
3246         if (ndr_flags & NDR_BUFFERS) {
3247                 if (r->incoming_current_auth_info) {
3248                         NDR_CHECK(ndr_push_lsa_TrustDomainInfoBuffer(ndr, NDR_SCALARS|NDR_BUFFERS, r->incoming_current_auth_info));
3249                 }
3250                 if (r->incoming_previous_auth_info) {
3251                         NDR_CHECK(ndr_push_lsa_TrustDomainInfoBuffer(ndr, NDR_SCALARS|NDR_BUFFERS, r->incoming_previous_auth_info));
3252                 }
3253                 if (r->outgoing_current_auth_info) {
3254                         NDR_CHECK(ndr_push_lsa_TrustDomainInfoBuffer(ndr, NDR_SCALARS|NDR_BUFFERS, r->outgoing_current_auth_info));
3255                 }
3256                 if (r->outgoing_previous_auth_info) {
3257                         NDR_CHECK(ndr_push_lsa_TrustDomainInfoBuffer(ndr, NDR_SCALARS|NDR_BUFFERS, r->outgoing_previous_auth_info));
3258                 }
3259         }
3260         return NDR_ERR_SUCCESS;
3261 }
3262
3263 static enum ndr_err_code ndr_pull_lsa_TrustDomainInfoAuthInfo(struct ndr_pull *ndr, int ndr_flags, struct lsa_TrustDomainInfoAuthInfo *r)
3264 {
3265         uint32_t _ptr_incoming_current_auth_info;
3266         TALLOC_CTX *_mem_save_incoming_current_auth_info_0;
3267         uint32_t _ptr_incoming_previous_auth_info;
3268         TALLOC_CTX *_mem_save_incoming_previous_auth_info_0;
3269         uint32_t _ptr_outgoing_current_auth_info;
3270         TALLOC_CTX *_mem_save_outgoing_current_auth_info_0;
3271         uint32_t _ptr_outgoing_previous_auth_info;
3272         TALLOC_CTX *_mem_save_outgoing_previous_auth_info_0;
3273         if (ndr_flags & NDR_SCALARS) {
3274                 NDR_CHECK(ndr_pull_align(ndr, 4));
3275                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->incoming_count));
3276                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_incoming_current_auth_info));
3277                 if (_ptr_incoming_current_auth_info) {
3278                         NDR_PULL_ALLOC(ndr, r->incoming_current_auth_info);
3279                 } else {
3280                         r->incoming_current_auth_info = NULL;
3281                 }
3282                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_incoming_previous_auth_info));
3283                 if (_ptr_incoming_previous_auth_info) {
3284                         NDR_PULL_ALLOC(ndr, r->incoming_previous_auth_info);
3285                 } else {
3286                         r->incoming_previous_auth_info = NULL;
3287                 }
3288                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->outgoing_count));
3289                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_outgoing_current_auth_info));
3290                 if (_ptr_outgoing_current_auth_info) {
3291                         NDR_PULL_ALLOC(ndr, r->outgoing_current_auth_info);
3292                 } else {
3293                         r->outgoing_current_auth_info = NULL;
3294                 }
3295                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_outgoing_previous_auth_info));
3296                 if (_ptr_outgoing_previous_auth_info) {
3297                         NDR_PULL_ALLOC(ndr, r->outgoing_previous_auth_info);
3298                 } else {
3299                         r->outgoing_previous_auth_info = NULL;
3300                 }
3301         }
3302         if (ndr_flags & NDR_BUFFERS) {
3303                 if (r->incoming_current_auth_info) {
3304                         _mem_save_incoming_current_auth_info_0 = NDR_PULL_GET_MEM_CTX(ndr);
3305                         NDR_PULL_SET_MEM_CTX(ndr, r->incoming_current_auth_info, 0);
3306                         NDR_CHECK(ndr_pull_lsa_TrustDomainInfoBuffer(ndr, NDR_SCALARS|NDR_BUFFERS, r->incoming_current_auth_info));
3307                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_incoming_current_auth_info_0, 0);
3308                 }
3309                 if (r->incoming_previous_auth_info) {
3310                         _mem_save_incoming_previous_auth_info_0 = NDR_PULL_GET_MEM_CTX(ndr);
3311                         NDR_PULL_SET_MEM_CTX(ndr, r->incoming_previous_auth_info, 0);
3312                         NDR_CHECK(ndr_pull_lsa_TrustDomainInfoBuffer(ndr, NDR_SCALARS|NDR_BUFFERS, r->incoming_previous_auth_info));
3313                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_incoming_previous_auth_info_0, 0);
3314                 }
3315                 if (r->outgoing_current_auth_info) {
3316                         _mem_save_outgoing_current_auth_info_0 = NDR_PULL_GET_MEM_CTX(ndr);
3317                         NDR_PULL_SET_MEM_CTX(ndr, r->outgoing_current_auth_info, 0);
3318                         NDR_CHECK(ndr_pull_lsa_TrustDomainInfoBuffer(ndr, NDR_SCALARS|NDR_BUFFERS, r->outgoing_current_auth_info));
3319                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_outgoing_current_auth_info_0, 0);
3320                 }
3321                 if (r->outgoing_previous_auth_info) {
3322                         _mem_save_outgoing_previous_auth_info_0 = NDR_PULL_GET_MEM_CTX(ndr);
3323                         NDR_PULL_SET_MEM_CTX(ndr, r->outgoing_previous_auth_info, 0);
3324                         NDR_CHECK(ndr_pull_lsa_TrustDomainInfoBuffer(ndr, NDR_SCALARS|NDR_BUFFERS, r->outgoing_previous_auth_info));
3325                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_outgoing_previous_auth_info_0, 0);
3326                 }
3327         }
3328         return NDR_ERR_SUCCESS;
3329 }
3330
3331 _PUBLIC_ void ndr_print_lsa_TrustDomainInfoAuthInfo(struct ndr_print *ndr, const char *name, const struct lsa_TrustDomainInfoAuthInfo *r)
3332 {
3333         ndr_print_struct(ndr, name, "lsa_TrustDomainInfoAuthInfo");
3334         ndr->depth++;
3335         ndr_print_uint32(ndr, "incoming_count", r->incoming_count);
3336         ndr_print_ptr(ndr, "incoming_current_auth_info", r->incoming_current_auth_info);
3337         ndr->depth++;
3338         if (r->incoming_current_auth_info) {
3339                 ndr_print_lsa_TrustDomainInfoBuffer(ndr, "incoming_current_auth_info", r->incoming_current_auth_info);
3340         }
3341         ndr->depth--;
3342         ndr_print_ptr(ndr, "incoming_previous_auth_info", r->incoming_previous_auth_info);
3343         ndr->depth++;
3344         if (r->incoming_previous_auth_info) {
3345                 ndr_print_lsa_TrustDomainInfoBuffer(ndr, "incoming_previous_auth_info", r->incoming_previous_auth_info);
3346         }
3347         ndr->depth--;
3348         ndr_print_uint32(ndr, "outgoing_count", r->outgoing_count);
3349         ndr_print_ptr(ndr, "outgoing_current_auth_info", r->outgoing_current_auth_info);
3350         ndr->depth++;
3351         if (r->outgoing_current_auth_info) {
3352                 ndr_print_lsa_TrustDomainInfoBuffer(ndr, "outgoing_current_auth_info", r->outgoing_current_auth_info);
3353         }
3354         ndr->depth--;
3355         ndr_print_ptr(ndr, "outgoing_previous_auth_info", r->outgoing_previous_auth_info);
3356         ndr->depth++;
3357         if (r->outgoing_previous_auth_info) {
3358                 ndr_print_lsa_TrustDomainInfoBuffer(ndr, "outgoing_previous_auth_info", r->outgoing_previous_auth_info);
3359         }
3360         ndr->depth--;
3361         ndr->depth--;
3362 }
3363
3364 static enum ndr_err_code ndr_push_lsa_TrustDomainInfoFullInfo(struct ndr_push *ndr, int ndr_flags, const struct lsa_TrustDomainInfoFullInfo *r)
3365 {
3366         if (ndr_flags & NDR_SCALARS) {
3367                 NDR_CHECK(ndr_push_align(ndr, 4));
3368                 NDR_CHECK(ndr_push_lsa_TrustDomainInfoInfoEx(ndr, NDR_SCALARS, &r->info_ex));
3369                 NDR_CHECK(ndr_push_lsa_TrustDomainInfoPosixOffset(ndr, NDR_SCALARS, &r->posix_offset));
3370                 NDR_CHECK(ndr_push_lsa_TrustDomainInfoAuthInfo(ndr, NDR_SCALARS, &r->auth_info));
3371         }
3372         if (ndr_flags & NDR_BUFFERS) {
3373                 NDR_CHECK(ndr_push_lsa_TrustDomainInfoInfoEx(ndr, NDR_BUFFERS, &r->info_ex));
3374                 NDR_CHECK(ndr_push_lsa_TrustDomainInfoAuthInfo(ndr, NDR_BUFFERS, &r->auth_info));
3375         }
3376         return NDR_ERR_SUCCESS;
3377 }
3378
3379 static enum ndr_err_code ndr_pull_lsa_TrustDomainInfoFullInfo(struct ndr_pull *ndr, int ndr_flags, struct lsa_TrustDomainInfoFullInfo *r)
3380 {
3381         if (ndr_flags & NDR_SCALARS) {
3382                 NDR_CHECK(ndr_pull_align(ndr, 4));
3383                 NDR_CHECK(ndr_pull_lsa_TrustDomainInfoInfoEx(ndr, NDR_SCALARS, &r->info_ex));
3384                 NDR_CHECK(ndr_pull_lsa_TrustDomainInfoPosixOffset(ndr, NDR_SCALARS, &r->posix_offset));
3385                 NDR_CHECK(ndr_pull_lsa_TrustDomainInfoAuthInfo(ndr, NDR_SCALARS, &r->auth_info));
3386         }
3387         if (ndr_flags & NDR_BUFFERS) {
3388                 NDR_CHECK(ndr_pull_lsa_TrustDomainInfoInfoEx(ndr, NDR_BUFFERS, &r->info_ex));
3389                 NDR_CHECK(ndr_pull_lsa_TrustDomainInfoAuthInfo(ndr, NDR_BUFFERS, &r->auth_info));
3390         }
3391         return NDR_ERR_SUCCESS;
3392 }
3393
3394 _PUBLIC_ void ndr_print_lsa_TrustDomainInfoFullInfo(struct ndr_print *ndr, const char *name, const struct lsa_TrustDomainInfoFullInfo *r)
3395 {
3396         ndr_print_struct(ndr, name, "lsa_TrustDomainInfoFullInfo");
3397         ndr->depth++;
3398         ndr_print_lsa_TrustDomainInfoInfoEx(ndr, "info_ex", &r->info_ex);
3399         ndr_print_lsa_TrustDomainInfoPosixOffset(ndr, "posix_offset", &r->posix_offset);
3400         ndr_print_lsa_TrustDomainInfoAuthInfo(ndr, "auth_info", &r->auth_info);
3401         ndr->depth--;
3402 }
3403
3404 static enum ndr_err_code ndr_push_lsa_TrustDomainInfoAuthInfoInternal(struct ndr_push *ndr, int ndr_flags, const struct lsa_TrustDomainInfoAuthInfoInternal *r)
3405 {
3406         if (ndr_flags & NDR_SCALARS) {
3407                 NDR_CHECK(ndr_push_align(ndr, 4));
3408                 NDR_CHECK(ndr_push_lsa_DATA_BUF2(ndr, NDR_SCALARS, &r->auth_blob));
3409         }
3410         if (ndr_flags & NDR_BUFFERS) {
3411                 NDR_CHECK(ndr_push_lsa_DATA_BUF2(ndr, NDR_BUFFERS, &r->auth_blob));
3412         }
3413         return NDR_ERR_SUCCESS;
3414 }
3415
3416 static enum ndr_err_code ndr_pull_lsa_TrustDomainInfoAuthInfoInternal(struct ndr_pull *ndr, int ndr_flags, struct lsa_TrustDomainInfoAuthInfoInternal *r)
3417 {
3418         if (ndr_flags & NDR_SCALARS) {
3419                 NDR_CHECK(ndr_pull_align(ndr, 4));
3420                 NDR_CHECK(ndr_pull_lsa_DATA_BUF2(ndr, NDR_SCALARS, &r->auth_blob));
3421         }
3422         if (ndr_flags & NDR_BUFFERS) {
3423                 NDR_CHECK(ndr_pull_lsa_DATA_BUF2(ndr, NDR_BUFFERS, &r->auth_blob));
3424         }
3425         return NDR_ERR_SUCCESS;
3426 }
3427
3428 _PUBLIC_ void ndr_print_lsa_TrustDomainInfoAuthInfoInternal(struct ndr_print *ndr, const char *name, const struct lsa_TrustDomainInfoAuthInfoInternal *r)
3429 {
3430         ndr_print_struct(ndr, name, "lsa_TrustDomainInfoAuthInfoInternal");
3431         ndr->depth++;
3432         ndr_print_lsa_DATA_BUF2(ndr, "auth_blob", &r->auth_blob);
3433         ndr->depth--;
3434 }
3435
3436 static enum ndr_err_code ndr_push_lsa_TrustDomainInfoFullInfoInternal(struct ndr_push *ndr, int ndr_flags, const struct lsa_TrustDomainInfoFullInfoInternal *r)
3437 {
3438         if (ndr_flags & NDR_SCALARS) {
3439                 NDR_CHECK(ndr_push_align(ndr, 4));
3440                 NDR_CHECK(ndr_push_lsa_TrustDomainInfoInfoEx(ndr, NDR_SCALARS, &r->info_ex));
3441                 NDR_CHECK(ndr_push_lsa_TrustDomainInfoPosixOffset(ndr, NDR_SCALARS, &r->posix_offset));
3442                 NDR_CHECK(ndr_push_lsa_TrustDomainInfoAuthInfoInternal(ndr, NDR_SCALARS, &r->auth_info));
3443         }
3444         if (ndr_flags & NDR_BUFFERS) {
3445                 NDR_CHECK(ndr_push_lsa_TrustDomainInfoInfoEx(ndr, NDR_BUFFERS, &r->info_ex));
3446                 NDR_CHECK(ndr_push_lsa_TrustDomainInfoAuthInfoInternal(ndr, NDR_BUFFERS, &r->auth_info));
3447         }
3448         return NDR_ERR_SUCCESS;
3449 }
3450
3451 static enum ndr_err_code ndr_pull_lsa_TrustDomainInfoFullInfoInternal(struct ndr_pull *ndr, int ndr_flags, struct lsa_TrustDomainInfoFullInfoInternal *r)
3452 {
3453         if (ndr_flags & NDR_SCALARS) {
3454                 NDR_CHECK(ndr_pull_align(ndr, 4));
3455                 NDR_CHECK(ndr_pull_lsa_TrustDomainInfoInfoEx(ndr, NDR_SCALARS, &r->info_ex));
3456                 NDR_CHECK(ndr_pull_lsa_TrustDomainInfoPosixOffset(ndr, NDR_SCALARS, &r->posix_offset));
3457                 NDR_CHECK(ndr_pull_lsa_TrustDomainInfoAuthInfoInternal(ndr, NDR_SCALARS, &r->auth_info));
3458         }
3459         if (ndr_flags & NDR_BUFFERS) {
3460                 NDR_CHECK(ndr_pull_lsa_TrustDomainInfoInfoEx(ndr, NDR_BUFFERS, &r->info_ex));
3461                 NDR_CHECK(ndr_pull_lsa_TrustDomainInfoAuthInfoInternal(ndr, NDR_BUFFERS, &r->auth_info));
3462         }
3463         return NDR_ERR_SUCCESS;
3464 }
3465
3466 _PUBLIC_ void ndr_print_lsa_TrustDomainInfoFullInfoInternal(struct ndr_print *ndr, const char *name, const struct lsa_TrustDomainInfoFullInfoInternal *r)
3467 {
3468         ndr_print_struct(ndr, name, "lsa_TrustDomainInfoFullInfoInternal");
3469         ndr->depth++;
3470         ndr_print_lsa_TrustDomainInfoInfoEx(ndr, "info_ex", &r->info_ex);
3471         ndr_print_lsa_TrustDomainInfoPosixOffset(ndr, "posix_offset", &r->posix_offset);
3472         ndr_print_lsa_TrustDomainInfoAuthInfoInternal(ndr, "auth_info", &r->auth_info);
3473         ndr->depth--;
3474 }
3475
3476 static enum ndr_err_code ndr_push_lsa_TrustDomainInfoInfoEx2Internal(struct ndr_push *ndr, int ndr_flags, const struct lsa_TrustDomainInfoInfoEx2Internal *r)
3477 {
3478         if (ndr_flags & NDR_SCALARS) {
3479                 NDR_CHECK(ndr_push_align(ndr, 4));
3480                 NDR_CHECK(ndr_push_lsa_TrustDomainInfoInfoEx(ndr, NDR_SCALARS, &r->info_ex));
3481                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->forest_trust_length));
3482                 NDR_CHECK(ndr_push_unique_ptr(ndr, r->forest_trust_data));
3483         }
3484         if (ndr_flags & NDR_BUFFERS) {
3485                 NDR_CHECK(ndr_push_lsa_TrustDomainInfoInfoEx(ndr, NDR_BUFFERS, &r->info_ex));
3486                 if (r->forest_trust_data) {
3487                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->forest_trust_length));
3488                         NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->forest_trust_data, r->forest_trust_length));
3489                 }
3490         }
3491         return NDR_ERR_SUCCESS;
3492 }
3493
3494 static enum ndr_err_code ndr_pull_lsa_TrustDomainInfoInfoEx2Internal(struct ndr_pull *ndr, int ndr_flags, struct lsa_TrustDomainInfoInfoEx2Internal *r)
3495 {
3496         uint32_t _ptr_forest_trust_data;
3497         TALLOC_CTX *_mem_save_forest_trust_data_0;
3498         if (ndr_flags & NDR_SCALARS) {
3499                 NDR_CHECK(ndr_pull_align(ndr, 4));
3500                 NDR_CHECK(ndr_pull_lsa_TrustDomainInfoInfoEx(ndr, NDR_SCALARS, &r->info_ex));
3501                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->forest_trust_length));
3502                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_forest_trust_data));
3503                 if (_ptr_forest_trust_data) {
3504                         NDR_PULL_ALLOC(ndr, r->forest_trust_data);
3505                 } else {
3506                         r->forest_trust_data = NULL;
3507                 }
3508         }
3509         if (ndr_flags & NDR_BUFFERS) {
3510                 NDR_CHECK(ndr_pull_lsa_TrustDomainInfoInfoEx(ndr, NDR_BUFFERS, &r->info_ex));
3511                 if (r->forest_trust_data) {
3512                         _mem_save_forest_trust_data_0 = NDR_PULL_GET_MEM_CTX(ndr);
3513                         NDR_PULL_SET_MEM_CTX(ndr, r->forest_trust_data, 0);
3514                         NDR_CHECK(ndr_pull_array_size(ndr, &r->forest_trust_data));
3515                         NDR_PULL_ALLOC_N(ndr, r->forest_trust_data, ndr_get_array_size(ndr, &r->forest_trust_data));
3516                         NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->forest_trust_data, ndr_get_array_size(ndr, &r->forest_trust_data)));
3517                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_forest_trust_data_0, 0);
3518                 }
3519                 if (r->forest_trust_data) {
3520                         NDR_CHECK(ndr_check_array_size(ndr, (void*)&r->forest_trust_data, r->forest_trust_length));
3521                 }
3522         }
3523         return NDR_ERR_SUCCESS;
3524 }
3525
3526 _PUBLIC_ void ndr_print_lsa_TrustDomainInfoInfoEx2Internal(struct ndr_print *ndr, const char *name, const struct lsa_TrustDomainInfoInfoEx2Internal *r)
3527 {
3528         ndr_print_struct(ndr, name, "lsa_TrustDomainInfoInfoEx2Internal");
3529         ndr->depth++;
3530         ndr_print_lsa_TrustDomainInfoInfoEx(ndr, "info_ex", &r->info_ex);
3531         ndr_print_uint32(ndr, "forest_trust_length", r->forest_trust_length);
3532         ndr_print_ptr(ndr, "forest_trust_data", r->forest_trust_data);
3533         ndr->depth++;
3534         if (r->forest_trust_data) {
3535                 ndr_print_array_uint8(ndr, "forest_trust_data", r->forest_trust_data, r->forest_trust_length);
3536         }
3537         ndr->depth--;
3538         ndr->depth--;
3539 }
3540
3541 static enum ndr_err_code ndr_push_lsa_TrustDomainInfoFullInfo2Internal(struct ndr_push *ndr, int ndr_flags, const struct lsa_TrustDomainInfoFullInfo2Internal *r)
3542 {
3543         if (ndr_flags & NDR_SCALARS) {
3544                 NDR_CHECK(ndr_push_align(ndr, 4));
3545                 NDR_CHECK(ndr_push_lsa_TrustDomainInfoInfoEx2Internal(ndr, NDR_SCALARS, &r->info));
3546                 NDR_CHECK(ndr_push_lsa_TrustDomainInfoPosixOffset(ndr, NDR_SCALARS, &r->posix_offset));
3547                 NDR_CHECK(ndr_push_lsa_TrustDomainInfoAuthInfo(ndr, NDR_SCALARS, &r->auth_info));
3548         }
3549         if (ndr_flags & NDR_BUFFERS) {
3550                 NDR_CHECK(ndr_push_lsa_TrustDomainInfoInfoEx2Internal(ndr, NDR_BUFFERS, &r->info));
3551                 NDR_CHECK(ndr_push_lsa_TrustDomainInfoAuthInfo(ndr, NDR_BUFFERS, &r->auth_info));
3552         }
3553         return NDR_ERR_SUCCESS;
3554 }
3555
3556 static enum ndr_err_code ndr_pull_lsa_TrustDomainInfoFullInfo2Internal(struct ndr_pull *ndr, int ndr_flags, struct lsa_TrustDomainInfoFullInfo2Internal *r)
3557 {
3558         if (ndr_flags & NDR_SCALARS) {
3559                 NDR_CHECK(ndr_pull_align(ndr, 4));
3560                 NDR_CHECK(ndr_pull_lsa_TrustDomainInfoInfoEx2Internal(ndr, NDR_SCALARS, &r