ntlmssp: add some void decode calls (useful for ndrdump).
[ira/wip.git] / librpc / gen_ndr / ndr_ntlmssp.c
1 /* parser auto-generated by pidl */
2
3 #include "includes.h"
4 #include "../librpc/gen_ndr/ndr_ntlmssp.h"
5
6 static enum ndr_err_code ndr_push_ntlmssp_MessageType(struct ndr_push *ndr, int ndr_flags, enum ntlmssp_MessageType r)
7 {
8         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
9         return NDR_ERR_SUCCESS;
10 }
11
12 static enum ndr_err_code ndr_pull_ntlmssp_MessageType(struct ndr_pull *ndr, int ndr_flags, enum ntlmssp_MessageType *r)
13 {
14         uint32_t v;
15         NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
16         *r = v;
17         return NDR_ERR_SUCCESS;
18 }
19
20 _PUBLIC_ void ndr_print_ntlmssp_MessageType(struct ndr_print *ndr, const char *name, enum ntlmssp_MessageType r)
21 {
22         const char *val = NULL;
23
24         switch (r) {
25                 case NtLmNegotiate: val = "NtLmNegotiate"; break;
26                 case NtLmChallenge: val = "NtLmChallenge"; break;
27                 case NtLmAuthenticate: val = "NtLmAuthenticate"; break;
28         }
29         ndr_print_enum(ndr, name, "ENUM", val, r);
30 }
31
32 static enum ndr_err_code ndr_push_NEGOTIATE(struct ndr_push *ndr, int ndr_flags, uint32_t r)
33 {
34         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
35         return NDR_ERR_SUCCESS;
36 }
37
38 static enum ndr_err_code ndr_pull_NEGOTIATE(struct ndr_pull *ndr, int ndr_flags, uint32_t *r)
39 {
40         uint32_t v;
41         NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
42         *r = v;
43         return NDR_ERR_SUCCESS;
44 }
45
46 _PUBLIC_ void ndr_print_NEGOTIATE(struct ndr_print *ndr, const char *name, uint32_t r)
47 {
48         ndr_print_uint32(ndr, name, r);
49         ndr->depth++;
50         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NTLMSSP_NEGOTIATE_UNICODE", NTLMSSP_NEGOTIATE_UNICODE, r);
51         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NTLMSSP_NEGOTIATE_OEM", NTLMSSP_NEGOTIATE_OEM, r);
52         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NTLMSSP_REQUEST_TARGET", NTLMSSP_REQUEST_TARGET, r);
53         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NTLMSSP_NEGOTIATE_SIGN", NTLMSSP_NEGOTIATE_SIGN, r);
54         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NTLMSSP_NEGOTIATE_SEAL", NTLMSSP_NEGOTIATE_SEAL, r);
55         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NTLMSSP_NEGOTIATE_DATAGRAM", NTLMSSP_NEGOTIATE_DATAGRAM, r);
56         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NTLMSSP_NEGOTIATE_LM_KEY", NTLMSSP_NEGOTIATE_LM_KEY, r);
57         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NTLMSSP_NEGOTIATE_NETWARE", NTLMSSP_NEGOTIATE_NETWARE, r);
58         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NTLMSSP_NEGOTIATE_NTLM", NTLMSSP_NEGOTIATE_NTLM, r);
59         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NTLMSSP_NEGOTIATE_NT_ONLY", NTLMSSP_NEGOTIATE_NT_ONLY, r);
60         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NTLMSSP_ANONYMOUS", NTLMSSP_ANONYMOUS, r);
61         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NTLMSSP_NEGOTIATE_OEM_DOMAIN_SUPPLIED", NTLMSSP_NEGOTIATE_OEM_DOMAIN_SUPPLIED, r);
62         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NTLMSSP_NEGOTIATE_OEM_WORKSTATION_SUPPLIED", NTLMSSP_NEGOTIATE_OEM_WORKSTATION_SUPPLIED, r);
63         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NTLMSSP_NEGOTIATE_THIS_IS_LOCAL_CALL", NTLMSSP_NEGOTIATE_THIS_IS_LOCAL_CALL, r);
64         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NTLMSSP_NEGOTIATE_ALWAYS_SIGN", NTLMSSP_NEGOTIATE_ALWAYS_SIGN, r);
65         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NTLMSSP_TARGET_TYPE_DOMAIN", NTLMSSP_TARGET_TYPE_DOMAIN, r);
66         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NTLMSSP_TARGET_TYPE_SERVER", NTLMSSP_TARGET_TYPE_SERVER, r);
67         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NTLMSSP_TARGET_TYPE_SHARE", NTLMSSP_TARGET_TYPE_SHARE, r);
68         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NTLMSSP_NEGOTIATE_EXTENDED_SESSIONSECURITY", NTLMSSP_NEGOTIATE_EXTENDED_SESSIONSECURITY, r);
69         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NTLMSSP_NEGOTIATE_IDENTIFY", NTLMSSP_NEGOTIATE_IDENTIFY, r);
70         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NTLMSSP_REQUEST_NON_NT_SESSION_KEY", NTLMSSP_REQUEST_NON_NT_SESSION_KEY, r);
71         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NTLMSSP_NEGOTIATE_TARGET_INFO", NTLMSSP_NEGOTIATE_TARGET_INFO, r);
72         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NTLMSSP_NEGOTIATE_VERSION", NTLMSSP_NEGOTIATE_VERSION, r);
73         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NTLMSSP_NEGOTIATE_128", NTLMSSP_NEGOTIATE_128, r);
74         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NTLMSSP_NEGOTIATE_KEY_EXCH", NTLMSSP_NEGOTIATE_KEY_EXCH, r);
75         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NTLMSSP_NEGOTIATE_56", NTLMSSP_NEGOTIATE_56, r);
76         ndr->depth--;
77 }
78
79 static enum ndr_err_code ndr_push_ntlmssp_WindowsMajorVersion(struct ndr_push *ndr, int ndr_flags, enum ntlmssp_WindowsMajorVersion r)
80 {
81         NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r));
82         return NDR_ERR_SUCCESS;
83 }
84
85 static enum ndr_err_code ndr_pull_ntlmssp_WindowsMajorVersion(struct ndr_pull *ndr, int ndr_flags, enum ntlmssp_WindowsMajorVersion *r)
86 {
87         uint8_t v;
88         NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &v));
89         *r = v;
90         return NDR_ERR_SUCCESS;
91 }
92
93 _PUBLIC_ void ndr_print_ntlmssp_WindowsMajorVersion(struct ndr_print *ndr, const char *name, enum ntlmssp_WindowsMajorVersion r)
94 {
95         const char *val = NULL;
96
97         switch (r) {
98                 case NTLMSSP_WINDOWS_MAJOR_VERSION_5: val = "NTLMSSP_WINDOWS_MAJOR_VERSION_5"; break;
99                 case NTLMSSP_WINDOWS_MAJOR_VERSION_6: val = "NTLMSSP_WINDOWS_MAJOR_VERSION_6"; break;
100         }
101         ndr_print_enum(ndr, name, "ENUM", val, r);
102 }
103
104 static enum ndr_err_code ndr_push_ntlmssp_WindowsMinorVersion(struct ndr_push *ndr, int ndr_flags, enum ntlmssp_WindowsMinorVersion r)
105 {
106         NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r));
107         return NDR_ERR_SUCCESS;
108 }
109
110 static enum ndr_err_code ndr_pull_ntlmssp_WindowsMinorVersion(struct ndr_pull *ndr, int ndr_flags, enum ntlmssp_WindowsMinorVersion *r)
111 {
112         uint8_t v;
113         NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &v));
114         *r = v;
115         return NDR_ERR_SUCCESS;
116 }
117
118 _PUBLIC_ void ndr_print_ntlmssp_WindowsMinorVersion(struct ndr_print *ndr, const char *name, enum ntlmssp_WindowsMinorVersion r)
119 {
120         const char *val = NULL;
121
122         switch (r) {
123                 case NTLMSSP_WINDOWS_MINOR_VERSION_0: val = "NTLMSSP_WINDOWS_MINOR_VERSION_0"; break;
124                 case NTLMSSP_WINDOWS_MINOR_VERSION_1: val = "NTLMSSP_WINDOWS_MINOR_VERSION_1"; break;
125                 case NTLMSSP_WINDOWS_MINOR_VERSION_2: val = "NTLMSSP_WINDOWS_MINOR_VERSION_2"; break;
126         }
127         ndr_print_enum(ndr, name, "ENUM", val, r);
128 }
129
130 static enum ndr_err_code ndr_push_ntlmssp_NTLMRevisionCurrent(struct ndr_push *ndr, int ndr_flags, enum ntlmssp_NTLMRevisionCurrent r)
131 {
132         NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, r));
133         return NDR_ERR_SUCCESS;
134 }
135
136 static enum ndr_err_code ndr_pull_ntlmssp_NTLMRevisionCurrent(struct ndr_pull *ndr, int ndr_flags, enum ntlmssp_NTLMRevisionCurrent *r)
137 {
138         uint8_t v;
139         NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &v));
140         *r = v;
141         return NDR_ERR_SUCCESS;
142 }
143
144 _PUBLIC_ void ndr_print_ntlmssp_NTLMRevisionCurrent(struct ndr_print *ndr, const char *name, enum ntlmssp_NTLMRevisionCurrent r)
145 {
146         const char *val = NULL;
147
148         switch (r) {
149                 case NTLMSSP_REVISION_W2K3_RC1: val = "NTLMSSP_REVISION_W2K3_RC1"; break;
150                 case NTLMSSP_REVISION_W2K3: val = "NTLMSSP_REVISION_W2K3"; break;
151         }
152         ndr_print_enum(ndr, name, "ENUM", val, r);
153 }
154
155 static enum ndr_err_code ndr_push_VERSION(struct ndr_push *ndr, int ndr_flags, const struct VERSION *r)
156 {
157         if (ndr_flags & NDR_SCALARS) {
158                 NDR_CHECK(ndr_push_align(ndr, 2));
159                 NDR_CHECK(ndr_push_ntlmssp_WindowsMajorVersion(ndr, NDR_SCALARS, r->ProductMajorVersion));
160                 NDR_CHECK(ndr_push_ntlmssp_WindowsMinorVersion(ndr, NDR_SCALARS, r->ProductMinorVersion));
161                 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->ProductBuild));
162                 NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->Reserved, 3));
163                 NDR_CHECK(ndr_push_ntlmssp_NTLMRevisionCurrent(ndr, NDR_SCALARS, r->NTLMRevisionCurrent));
164         }
165         if (ndr_flags & NDR_BUFFERS) {
166         }
167         return NDR_ERR_SUCCESS;
168 }
169
170 static enum ndr_err_code ndr_pull_VERSION(struct ndr_pull *ndr, int ndr_flags, struct VERSION *r)
171 {
172         if (ndr_flags & NDR_SCALARS) {
173                 NDR_CHECK(ndr_pull_align(ndr, 2));
174                 NDR_CHECK(ndr_pull_ntlmssp_WindowsMajorVersion(ndr, NDR_SCALARS, &r->ProductMajorVersion));
175                 NDR_CHECK(ndr_pull_ntlmssp_WindowsMinorVersion(ndr, NDR_SCALARS, &r->ProductMinorVersion));
176                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->ProductBuild));
177                 NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->Reserved, 3));
178                 NDR_CHECK(ndr_pull_ntlmssp_NTLMRevisionCurrent(ndr, NDR_SCALARS, &r->NTLMRevisionCurrent));
179         }
180         if (ndr_flags & NDR_BUFFERS) {
181         }
182         return NDR_ERR_SUCCESS;
183 }
184
185 _PUBLIC_ void ndr_print_VERSION(struct ndr_print *ndr, const char *name, const struct VERSION *r)
186 {
187         ndr_print_struct(ndr, name, "VERSION");
188         ndr->depth++;
189         ndr_print_ntlmssp_WindowsMajorVersion(ndr, "ProductMajorVersion", r->ProductMajorVersion);
190         ndr_print_ntlmssp_WindowsMinorVersion(ndr, "ProductMinorVersion", r->ProductMinorVersion);
191         ndr_print_uint16(ndr, "ProductBuild", r->ProductBuild);
192         ndr_print_array_uint8(ndr, "Reserved", r->Reserved, 3);
193         ndr_print_ntlmssp_NTLMRevisionCurrent(ndr, "NTLMRevisionCurrent", r->NTLMRevisionCurrent);
194         ndr->depth--;
195 }
196
197 static enum ndr_err_code ndr_push_ntlmssp_Version(struct ndr_push *ndr, int ndr_flags, const union ntlmssp_Version *r)
198 {
199         if (ndr_flags & NDR_SCALARS) {
200                 int level = ndr_push_get_switch_value(ndr, r);
201                 switch (level) {
202                         case NTLMSSP_NEGOTIATE_VERSION: {
203                                 NDR_CHECK(ndr_push_VERSION(ndr, NDR_SCALARS, &r->version));
204                         break; }
205
206                         default: {
207                         break; }
208
209                 }
210         }
211         if (ndr_flags & NDR_BUFFERS) {
212                 int level = ndr_push_get_switch_value(ndr, r);
213                 switch (level) {
214                         case NTLMSSP_NEGOTIATE_VERSION:
215                         break;
216
217                         default:
218                         break;
219
220                 }
221         }
222         return NDR_ERR_SUCCESS;
223 }
224
225 static enum ndr_err_code ndr_pull_ntlmssp_Version(struct ndr_pull *ndr, int ndr_flags, union ntlmssp_Version *r)
226 {
227         int level;
228         level = ndr_pull_get_switch_value(ndr, r);
229         if (ndr_flags & NDR_SCALARS) {
230                 switch (level) {
231                         case NTLMSSP_NEGOTIATE_VERSION: {
232                                 NDR_CHECK(ndr_pull_VERSION(ndr, NDR_SCALARS, &r->version));
233                         break; }
234
235                         default: {
236                         break; }
237
238                 }
239         }
240         if (ndr_flags & NDR_BUFFERS) {
241                 switch (level) {
242                         case NTLMSSP_NEGOTIATE_VERSION:
243                         break;
244
245                         default:
246                         break;
247
248                 }
249         }
250         return NDR_ERR_SUCCESS;
251 }
252
253 _PUBLIC_ void ndr_print_ntlmssp_Version(struct ndr_print *ndr, const char *name, const union ntlmssp_Version *r)
254 {
255         int level;
256         level = ndr_print_get_switch_value(ndr, r);
257         ndr_print_union(ndr, name, level, "ntlmssp_Version");
258         switch (level) {
259                 case NTLMSSP_NEGOTIATE_VERSION:
260                         ndr_print_VERSION(ndr, "version", &r->version);
261                 break;
262
263                 default:
264                 break;
265
266         }
267 }
268
269 _PUBLIC_ enum ndr_err_code ndr_push_NEGOTIATE_MESSAGE(struct ndr_push *ndr, int ndr_flags, const struct NEGOTIATE_MESSAGE *r)
270 {
271         if (ndr_flags & NDR_SCALARS) {
272                 NDR_CHECK(ndr_push_align(ndr, 4));
273                 NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, "NTLMSSP", 8, sizeof(uint8_t), CH_DOS));
274                 NDR_CHECK(ndr_push_ntlmssp_MessageType(ndr, NDR_SCALARS, NtLmNegotiate));
275                 NDR_CHECK(ndr_push_NEGOTIATE(ndr, NDR_SCALARS, r->NegotiateFlags));
276                 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, strlen(r->DomainName)));
277                 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, strlen(r->DomainName)));
278                 {
279                         uint32_t _flags_save_string = ndr->flags;
280                         ndr_set_flags(&ndr->flags, ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_OEM));
281                         NDR_CHECK(ndr_push_relative_ptr1(ndr, r->DomainName));
282                         ndr->flags = _flags_save_string;
283                 }
284                 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, strlen(r->Workstation)));
285                 NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, strlen(r->Workstation)));
286                 {
287                         uint32_t _flags_save_string = ndr->flags;
288                         ndr_set_flags(&ndr->flags, ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_OEM));
289                         NDR_CHECK(ndr_push_relative_ptr1(ndr, r->Workstation));
290                         ndr->flags = _flags_save_string;
291                 }
292                 NDR_CHECK(ndr_push_set_switch_value(ndr, &r->Version, r->NegotiateFlags & NTLMSSP_NEGOTIATE_VERSION));
293                 NDR_CHECK(ndr_push_ntlmssp_Version(ndr, NDR_SCALARS, &r->Version));
294         }
295         if (ndr_flags & NDR_BUFFERS) {
296                 {
297                         uint32_t _flags_save_string = ndr->flags;
298                         ndr_set_flags(&ndr->flags, ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_OEM));
299                         if (r->DomainName) {
300                                 NDR_CHECK(ndr_push_relative_ptr2(ndr, r->DomainName));
301                                 {
302                                         struct ndr_push *_ndr_DomainName;
303                                         NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_DomainName, 0, strlen(r->DomainName)));
304                                         NDR_CHECK(ndr_push_string(_ndr_DomainName, NDR_SCALARS, r->DomainName));
305                                         NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_DomainName, 0, strlen(r->DomainName)));
306                                 }
307                         }
308                         ndr->flags = _flags_save_string;
309                 }
310                 {
311                         uint32_t _flags_save_string = ndr->flags;
312                         ndr_set_flags(&ndr->flags, ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_OEM));
313                         if (r->Workstation) {
314                                 NDR_CHECK(ndr_push_relative_ptr2(ndr, r->Workstation));
315                                 {
316                                         struct ndr_push *_ndr_Workstation;
317                                         NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_Workstation, 0, strlen(r->Workstation)));
318                                         NDR_CHECK(ndr_push_string(_ndr_Workstation, NDR_SCALARS, r->Workstation));
319                                         NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_Workstation, 0, strlen(r->Workstation)));
320                                 }
321                         }
322                         ndr->flags = _flags_save_string;
323                 }
324                 NDR_CHECK(ndr_push_ntlmssp_Version(ndr, NDR_BUFFERS, &r->Version));
325         }
326         return NDR_ERR_SUCCESS;
327 }
328
329 _PUBLIC_ enum ndr_err_code ndr_pull_NEGOTIATE_MESSAGE(struct ndr_pull *ndr, int ndr_flags, struct NEGOTIATE_MESSAGE *r)
330 {
331         uint32_t _ptr_DomainName;
332         TALLOC_CTX *_mem_save_DomainName_0;
333         uint32_t _ptr_Workstation;
334         TALLOC_CTX *_mem_save_Workstation_0;
335         if (ndr_flags & NDR_SCALARS) {
336                 NDR_CHECK(ndr_pull_align(ndr, 4));
337                 NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->Signature, 8, sizeof(uint8_t), CH_DOS));
338                 NDR_CHECK(ndr_pull_ntlmssp_MessageType(ndr, NDR_SCALARS, &r->MessageType));
339                 NDR_CHECK(ndr_pull_NEGOTIATE(ndr, NDR_SCALARS, &r->NegotiateFlags));
340                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->DomainNameLen));
341                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->DomainNameMaxLen));
342                 {
343                         uint32_t _flags_save_string = ndr->flags;
344                         ndr_set_flags(&ndr->flags, ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_OEM));
345                         NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_DomainName));
346                         if (_ptr_DomainName) {
347                                 NDR_PULL_ALLOC(ndr, r->DomainName);
348                                 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->DomainName, _ptr_DomainName));
349                         } else {
350                                 r->DomainName = NULL;
351                         }
352                         ndr->flags = _flags_save_string;
353                 }
354                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->WorkstationLen));
355                 NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->WorkstationMaxLen));
356                 {
357                         uint32_t _flags_save_string = ndr->flags;
358                         ndr_set_flags(&ndr->flags, ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_OEM));
359                         NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_Workstation));
360                         if (_ptr_Workstation) {
361                                 NDR_PULL_ALLOC(ndr, r->Workstation);
362                                 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->Workstation, _ptr_Workstation));
363                         } else {
364                                 r->Workstation = NULL;
365                         }
366                         ndr->flags = _flags_save_string;
367                 }
368                 NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->Version, r->NegotiateFlags & NTLMSSP_NEGOTIATE_VERSION));
369                 NDR_CHECK(ndr_pull_ntlmssp_Version(ndr, NDR_SCALARS, &r->Version));
370         }
371         if (ndr_flags & NDR_BUFFERS) {
372                 {
373                         uint32_t _flags_save_string = ndr->flags;
374                         ndr_set_flags(&ndr->flags, ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_OEM));
375                         if (r->DomainName) {
376                                 uint32_t _relative_save_offset;
377                                 _relative_save_offset = ndr->offset;
378                                 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->DomainName));
379                                 _mem_save_DomainName_0 = NDR_PULL_GET_MEM_CTX(ndr);
380                                 NDR_PULL_SET_MEM_CTX(ndr, r->DomainName, 0);
381                                 {
382                                         struct ndr_pull *_ndr_DomainName;
383                                         NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_DomainName, 0, r->DomainNameLen));
384                                         NDR_CHECK(ndr_pull_string(_ndr_DomainName, NDR_SCALARS, &r->DomainName));
385                                         NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_DomainName, 0, r->DomainNameLen));
386                                 }
387                                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_DomainName_0, 0);
388                                 ndr->offset = _relative_save_offset;
389                         }
390                         ndr->flags = _flags_save_string;
391                 }
392                 {
393                         uint32_t _flags_save_string = ndr->flags;
394                         ndr_set_flags(&ndr->flags, ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_OEM));
395                         if (r->Workstation) {
396                                 uint32_t _relative_save_offset;
397                                 _relative_save_offset = ndr->offset;
398                                 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->Workstation));
399                                 _mem_save_Workstation_0 = NDR_PULL_GET_MEM_CTX(ndr);
400                                 NDR_PULL_SET_MEM_CTX(ndr, r->Workstation, 0);
401                                 {
402                                         struct ndr_pull *_ndr_Workstation;
403                                         NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_Workstation, 0, r->WorkstationLen));
404                                         NDR_CHECK(ndr_pull_string(_ndr_Workstation, NDR_SCALARS, &r->Workstation));
405                                         NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_Workstation, 0, r->WorkstationLen));
406                                 }
407                                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_Workstation_0, 0);
408                                 ndr->offset = _relative_save_offset;
409                         }
410                         ndr->flags = _flags_save_string;
411                 }
412                 NDR_CHECK(ndr_pull_ntlmssp_Version(ndr, NDR_BUFFERS, &r->Version));
413         }
414         return NDR_ERR_SUCCESS;
415 }
416
417 _PUBLIC_ void ndr_print_NEGOTIATE_MESSAGE(struct ndr_print *ndr, const char *name, const struct NEGOTIATE_MESSAGE *r)
418 {
419         ndr_print_struct(ndr, name, "NEGOTIATE_MESSAGE");
420         ndr->depth++;
421         ndr_print_string(ndr, "Signature", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?"NTLMSSP":r->Signature);
422         ndr_print_ntlmssp_MessageType(ndr, "MessageType", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?NtLmNegotiate:r->MessageType);
423         ndr_print_NEGOTIATE(ndr, "NegotiateFlags", r->NegotiateFlags);
424         ndr_print_uint16(ndr, "DomainNameLen", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?strlen(r->DomainName):r->DomainNameLen);
425         ndr_print_uint16(ndr, "DomainNameMaxLen", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?r->DomainNameLen:r->DomainNameMaxLen);
426         ndr_print_ptr(ndr, "DomainName", r->DomainName);
427         ndr->depth++;
428         if (r->DomainName) {
429                 ndr_print_string(ndr, "DomainName", r->DomainName);
430         }
431         ndr->depth--;
432         ndr_print_uint16(ndr, "WorkstationLen", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?strlen(r->Workstation):r->WorkstationLen);
433         ndr_print_uint16(ndr, "WorkstationMaxLen", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?r->WorkstationLen:r->WorkstationMaxLen);
434         ndr_print_ptr(ndr, "Workstation", r->Workstation);
435         ndr->depth++;
436         if (r->Workstation) {
437                 ndr_print_string(ndr, "Workstation", r->Workstation);
438         }
439         ndr->depth--;
440         ndr_print_set_switch_value(ndr, &r->Version, r->NegotiateFlags & NTLMSSP_NEGOTIATE_VERSION);
441         ndr_print_ntlmssp_Version(ndr, "Version", &r->Version);
442         ndr->depth--;
443 }
444
445 static enum ndr_err_code ndr_push_ntlmssp_AvId(struct ndr_push *ndr, int ndr_flags, enum ntlmssp_AvId r)
446 {
447         NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r));
448         return NDR_ERR_SUCCESS;
449 }
450
451 static enum ndr_err_code ndr_pull_ntlmssp_AvId(struct ndr_pull *ndr, int ndr_flags, enum ntlmssp_AvId *r)
452 {
453         uint16_t v;
454         NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &v));
455         *r = v;
456         return NDR_ERR_SUCCESS;
457 }
458
459 _PUBLIC_ void ndr_print_ntlmssp_AvId(struct ndr_print *ndr, const char *name, enum ntlmssp_AvId r)
460 {
461         const char *val = NULL;
462
463         switch (r) {
464                 case MsvAvEOL: val = "MsvAvEOL"; break;
465                 case MsvAvNbComputerName: val = "MsvAvNbComputerName"; break;
466                 case MsvAvNbDomainName: val = "MsvAvNbDomainName"; break;
467                 case MsvAvDnsComputerName: val = "MsvAvDnsComputerName"; break;
468                 case MsvAvDnsDomainName: val = "MsvAvDnsDomainName"; break;
469                 case MsvAvDnsTreeName: val = "MsvAvDnsTreeName"; break;
470                 case MsvAvFlags: val = "MsvAvFlags"; break;
471                 case MsvAvTimestamp: val = "MsvAvTimestamp"; break;
472                 case MsAvRestrictions: val = "MsAvRestrictions"; break;
473                 case MsvAvTargetName: val = "MsvAvTargetName"; break;
474                 case MsvChannelBindings: val = "MsvChannelBindings"; break;
475         }
476         ndr_print_enum(ndr, name, "ENUM", val, r);
477 }
478
479 static enum ndr_err_code ndr_push_Restriction_Encoding(struct ndr_push *ndr, int ndr_flags, const struct Restriction_Encoding *r)
480 {
481         if (ndr_flags & NDR_SCALARS) {
482                 NDR_CHECK(ndr_push_align(ndr, 4));
483                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->Size));
484                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, 0));
485                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->IntegrityLevel));
486                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->SubjectIntegrityLevel));
487                 NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->MachineId, 32));
488         }
489         if (ndr_flags & NDR_BUFFERS) {
490         }
491         return NDR_ERR_SUCCESS;
492 }
493
494 static enum ndr_err_code ndr_pull_Restriction_Encoding(struct ndr_pull *ndr, int ndr_flags, struct Restriction_Encoding *r)
495 {
496         if (ndr_flags & NDR_SCALARS) {
497                 NDR_CHECK(ndr_pull_align(ndr, 4));
498                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->Size));
499                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->Z4));
500                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->IntegrityLevel));
501                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->SubjectIntegrityLevel));
502                 NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->MachineId, 32));
503         }
504         if (ndr_flags & NDR_BUFFERS) {
505         }
506         return NDR_ERR_SUCCESS;
507 }
508
509 _PUBLIC_ void ndr_print_Restriction_Encoding(struct ndr_print *ndr, const char *name, const struct Restriction_Encoding *r)
510 {
511         ndr_print_struct(ndr, name, "Restriction_Encoding");
512         ndr->depth++;
513         ndr_print_uint32(ndr, "Size", r->Size);
514         ndr_print_uint32(ndr, "Z4", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?0:r->Z4);
515         ndr_print_uint32(ndr, "IntegrityLevel", r->IntegrityLevel);
516         ndr_print_uint32(ndr, "SubjectIntegrityLevel", r->SubjectIntegrityLevel);
517         ndr_print_array_uint8(ndr, "MachineId", r->MachineId, 32);
518         ndr->depth--;
519 }
520
521 static enum ndr_err_code ndr_push_ntlmssp_AvFlags(struct ndr_push *ndr, int ndr_flags, uint32_t r)
522 {
523         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r));
524         return NDR_ERR_SUCCESS;
525 }
526
527 static enum ndr_err_code ndr_pull_ntlmssp_AvFlags(struct ndr_pull *ndr, int ndr_flags, uint32_t *r)
528 {
529         uint32_t v;
530         NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &v));
531         *r = v;
532         return NDR_ERR_SUCCESS;
533 }
534
535 _PUBLIC_ void ndr_print_ntlmssp_AvFlags(struct ndr_print *ndr, const char *name, uint32_t r)
536 {
537         ndr_print_uint32(ndr, name, r);
538         ndr->depth++;
539         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NTLMSSP_AVFLAG_CONSTRAINTED_ACCOUNT", NTLMSSP_AVFLAG_CONSTRAINTED_ACCOUNT, r);
540         ndr_print_bitmap_flag(ndr, sizeof(uint32_t), "NTLMSSP_AVFLAG_MIC_IN_AUTHENTICATE_MESSAGE", NTLMSSP_AVFLAG_MIC_IN_AUTHENTICATE_MESSAGE, r);
541         ndr->depth--;
542 }
543
544 static enum ndr_err_code ndr_push_ntlmssp_AvValue(struct ndr_push *ndr, int ndr_flags, const union ntlmssp_AvValue *r)
545 {
546         {
547                 uint32_t _flags_save_UNION = ndr->flags;
548                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
549                 if (ndr_flags & NDR_SCALARS) {
550                         int level = ndr_push_get_switch_value(ndr, r);
551                         switch (level) {
552                                 case MsvAvEOL: {
553                                 break; }
554
555                                 case MsvAvNbComputerName: {
556                                         {
557                                                 uint32_t _flags_save_string = ndr->flags;
558                                                 ndr_set_flags(&ndr->flags, ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_UNICODE));
559                                                 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->AvNbComputerName));
560                                                 ndr->flags = _flags_save_string;
561                                         }
562                                 break; }
563
564                                 case MsvAvNbDomainName: {
565                                         {
566                                                 uint32_t _flags_save_string = ndr->flags;
567                                                 ndr_set_flags(&ndr->flags, ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_UNICODE));
568                                                 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->AvNbDomainName));
569                                                 ndr->flags = _flags_save_string;
570                                         }
571                                 break; }
572
573                                 case MsvAvDnsComputerName: {
574                                         {
575                                                 uint32_t _flags_save_string = ndr->flags;
576                                                 ndr_set_flags(&ndr->flags, ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_UNICODE));
577                                                 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->AvDnsComputerName));
578                                                 ndr->flags = _flags_save_string;
579                                         }
580                                 break; }
581
582                                 case MsvAvDnsDomainName: {
583                                         {
584                                                 uint32_t _flags_save_string = ndr->flags;
585                                                 ndr_set_flags(&ndr->flags, ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_UNICODE));
586                                                 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->AvDnsDomainName));
587                                                 ndr->flags = _flags_save_string;
588                                         }
589                                 break; }
590
591                                 case MsvAvDnsTreeName: {
592                                         {
593                                                 uint32_t _flags_save_string = ndr->flags;
594                                                 ndr_set_flags(&ndr->flags, ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_UNICODE));
595                                                 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->AvDnsTreeName));
596                                                 ndr->flags = _flags_save_string;
597                                         }
598                                 break; }
599
600                                 case MsvAvFlags: {
601                                         NDR_CHECK(ndr_push_ntlmssp_AvFlags(ndr, NDR_SCALARS, r->AvFlags));
602                                 break; }
603
604                                 case MsvAvTimestamp: {
605                                         NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->AvTimestamp));
606                                 break; }
607
608                                 case MsAvRestrictions: {
609                                         NDR_CHECK(ndr_push_Restriction_Encoding(ndr, NDR_SCALARS, &r->AvRestrictions));
610                                 break; }
611
612                                 case MsvAvTargetName: {
613                                         {
614                                                 uint32_t _flags_save_string = ndr->flags;
615                                                 ndr_set_flags(&ndr->flags, ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_UNICODE));
616                                                 NDR_CHECK(ndr_push_string(ndr, NDR_SCALARS, r->AvTargetName));
617                                                 ndr->flags = _flags_save_string;
618                                         }
619                                 break; }
620
621                                 case MsvChannelBindings: {
622                                         NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->ChannelBindings, 16));
623                                 break; }
624
625                                 default: {
626                                         {
627                                                 uint32_t _flags_save_DATA_BLOB = ndr->flags;
628                                                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING);
629                                                 NDR_CHECK(ndr_push_DATA_BLOB(ndr, NDR_SCALARS, r->blob));
630                                                 ndr->flags = _flags_save_DATA_BLOB;
631                                         }
632                                 break; }
633
634                         }
635                 }
636                 if (ndr_flags & NDR_BUFFERS) {
637                         int level = ndr_push_get_switch_value(ndr, r);
638                         switch (level) {
639                                 case MsvAvEOL:
640                                 break;
641
642                                 case MsvAvNbComputerName:
643                                 break;
644
645                                 case MsvAvNbDomainName:
646                                 break;
647
648                                 case MsvAvDnsComputerName:
649                                 break;
650
651                                 case MsvAvDnsDomainName:
652                                 break;
653
654                                 case MsvAvDnsTreeName:
655                                 break;
656
657                                 case MsvAvFlags:
658                                 break;
659
660                                 case MsvAvTimestamp:
661                                 break;
662
663                                 case MsAvRestrictions:
664                                 break;
665
666                                 case MsvAvTargetName:
667                                 break;
668
669                                 case MsvChannelBindings:
670                                 break;
671
672                                 default:
673                                 break;
674
675                         }
676                 }
677                 ndr->flags = _flags_save_UNION;
678         }
679         return NDR_ERR_SUCCESS;
680 }
681
682 static enum ndr_err_code ndr_pull_ntlmssp_AvValue(struct ndr_pull *ndr, int ndr_flags, union ntlmssp_AvValue *r)
683 {
684         int level;
685         {
686                 uint32_t _flags_save_UNION = ndr->flags;
687                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
688                 level = ndr_pull_get_switch_value(ndr, r);
689                 if (ndr_flags & NDR_SCALARS) {
690                         switch (level) {
691                                 case MsvAvEOL: {
692                                 break; }
693
694                                 case MsvAvNbComputerName: {
695                                         {
696                                                 uint32_t _flags_save_string = ndr->flags;
697                                                 ndr_set_flags(&ndr->flags, ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_UNICODE));
698                                                 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->AvNbComputerName));
699                                                 ndr->flags = _flags_save_string;
700                                         }
701                                 break; }
702
703                                 case MsvAvNbDomainName: {
704                                         {
705                                                 uint32_t _flags_save_string = ndr->flags;
706                                                 ndr_set_flags(&ndr->flags, ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_UNICODE));
707                                                 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->AvNbDomainName));
708                                                 ndr->flags = _flags_save_string;
709                                         }
710                                 break; }
711
712                                 case MsvAvDnsComputerName: {
713                                         {
714                                                 uint32_t _flags_save_string = ndr->flags;
715                                                 ndr_set_flags(&ndr->flags, ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_UNICODE));
716                                                 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->AvDnsComputerName));
717                                                 ndr->flags = _flags_save_string;
718                                         }
719                                 break; }
720
721                                 case MsvAvDnsDomainName: {
722                                         {
723                                                 uint32_t _flags_save_string = ndr->flags;
724                                                 ndr_set_flags(&ndr->flags, ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_UNICODE));
725                                                 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->AvDnsDomainName));
726                                                 ndr->flags = _flags_save_string;
727                                         }
728                                 break; }
729
730                                 case MsvAvDnsTreeName: {
731                                         {
732                                                 uint32_t _flags_save_string = ndr->flags;
733                                                 ndr_set_flags(&ndr->flags, ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_UNICODE));
734                                                 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->AvDnsTreeName));
735                                                 ndr->flags = _flags_save_string;
736                                         }
737                                 break; }
738
739                                 case MsvAvFlags: {
740                                         NDR_CHECK(ndr_pull_ntlmssp_AvFlags(ndr, NDR_SCALARS, &r->AvFlags));
741                                 break; }
742
743                                 case MsvAvTimestamp: {
744                                         NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->AvTimestamp));
745                                 break; }
746
747                                 case MsAvRestrictions: {
748                                         NDR_CHECK(ndr_pull_Restriction_Encoding(ndr, NDR_SCALARS, &r->AvRestrictions));
749                                 break; }
750
751                                 case MsvAvTargetName: {
752                                         {
753                                                 uint32_t _flags_save_string = ndr->flags;
754                                                 ndr_set_flags(&ndr->flags, ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_UNICODE));
755                                                 NDR_CHECK(ndr_pull_string(ndr, NDR_SCALARS, &r->AvTargetName));
756                                                 ndr->flags = _flags_save_string;
757                                         }
758                                 break; }
759
760                                 case MsvChannelBindings: {
761                                         NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->ChannelBindings, 16));
762                                 break; }
763
764                                 default: {
765                                         {
766                                                 uint32_t _flags_save_DATA_BLOB = ndr->flags;
767                                                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING);
768                                                 NDR_CHECK(ndr_pull_DATA_BLOB(ndr, NDR_SCALARS, &r->blob));
769                                                 ndr->flags = _flags_save_DATA_BLOB;
770                                         }
771                                 break; }
772
773                         }
774                 }
775                 if (ndr_flags & NDR_BUFFERS) {
776                         switch (level) {
777                                 case MsvAvEOL:
778                                 break;
779
780                                 case MsvAvNbComputerName:
781                                 break;
782
783                                 case MsvAvNbDomainName:
784                                 break;
785
786                                 case MsvAvDnsComputerName:
787                                 break;
788
789                                 case MsvAvDnsDomainName:
790                                 break;
791
792                                 case MsvAvDnsTreeName:
793                                 break;
794
795                                 case MsvAvFlags:
796                                 break;
797
798                                 case MsvAvTimestamp:
799                                 break;
800
801                                 case MsAvRestrictions:
802                                 break;
803
804                                 case MsvAvTargetName:
805                                 break;
806
807                                 case MsvChannelBindings:
808                                 break;
809
810                                 default:
811                                 break;
812
813                         }
814                 }
815                 ndr->flags = _flags_save_UNION;
816         }
817         return NDR_ERR_SUCCESS;
818 }
819
820 _PUBLIC_ void ndr_print_ntlmssp_AvValue(struct ndr_print *ndr, const char *name, const union ntlmssp_AvValue *r)
821 {
822         int level;
823         {
824                 uint32_t _flags_save_UNION = ndr->flags;
825                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
826                 level = ndr_print_get_switch_value(ndr, r);
827                 ndr_print_union(ndr, name, level, "ntlmssp_AvValue");
828                 switch (level) {
829                         case MsvAvEOL:
830                         break;
831
832                         case MsvAvNbComputerName:
833                                 ndr_print_string(ndr, "AvNbComputerName", r->AvNbComputerName);
834                         break;
835
836                         case MsvAvNbDomainName:
837                                 ndr_print_string(ndr, "AvNbDomainName", r->AvNbDomainName);
838                         break;
839
840                         case MsvAvDnsComputerName:
841                                 ndr_print_string(ndr, "AvDnsComputerName", r->AvDnsComputerName);
842                         break;
843
844                         case MsvAvDnsDomainName:
845                                 ndr_print_string(ndr, "AvDnsDomainName", r->AvDnsDomainName);
846                         break;
847
848                         case MsvAvDnsTreeName:
849                                 ndr_print_string(ndr, "AvDnsTreeName", r->AvDnsTreeName);
850                         break;
851
852                         case MsvAvFlags:
853                                 ndr_print_ntlmssp_AvFlags(ndr, "AvFlags", r->AvFlags);
854                         break;
855
856                         case MsvAvTimestamp:
857                                 ndr_print_NTTIME(ndr, "AvTimestamp", r->AvTimestamp);
858                         break;
859
860                         case MsAvRestrictions:
861                                 ndr_print_Restriction_Encoding(ndr, "AvRestrictions", &r->AvRestrictions);
862                         break;
863
864                         case MsvAvTargetName:
865                                 ndr_print_string(ndr, "AvTargetName", r->AvTargetName);
866                         break;
867
868                         case MsvChannelBindings:
869                                 ndr_print_array_uint8(ndr, "ChannelBindings", r->ChannelBindings, 16);
870                         break;
871
872                         default:
873                                 ndr_print_DATA_BLOB(ndr, "blob", r->blob);
874                         break;
875
876                 }
877                 ndr->flags = _flags_save_UNION;
878         }
879 }
880
881 static size_t ndr_size_ntlmssp_AvValue(const union ntlmssp_AvValue *r, uint32_t level, struct smb_iconv_convenience *ic, int flags)
882 {
883         flags |= LIBNDR_FLAG_NOALIGN;
884         return ndr_size_union(r, flags, level, (ndr_push_flags_fn_t)ndr_push_ntlmssp_AvValue, ic);
885 }
886
887 _PUBLIC_ enum ndr_err_code ndr_push_AV_PAIR(struct ndr_push *ndr, int ndr_flags, const struct AV_PAIR *r)
888 {
889         {
890                 uint32_t _flags_save_STRUCT = ndr->flags;
891                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
892                 if (ndr_flags & NDR_SCALARS) {
893                         NDR_CHECK(ndr_push_align(ndr, 4));
894                         NDR_CHECK(ndr_push_ntlmssp_AvId(ndr, NDR_SCALARS, r->AvId));
895                         NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, ndr_size_ntlmssp_AvValue(&r->Value, r->AvId, ndr->iconv_convenience, 0)));
896                         {
897                                 struct ndr_push *_ndr_Value;
898                                 NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_Value, 0, ndr_size_ntlmssp_AvValue(&r->Value, r->AvId, ndr->iconv_convenience, 0)));
899                                 NDR_CHECK(ndr_push_set_switch_value(_ndr_Value, &r->Value, r->AvId));
900                                 NDR_CHECK(ndr_push_ntlmssp_AvValue(_ndr_Value, NDR_SCALARS|NDR_BUFFERS, &r->Value));
901                                 NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_Value, 0, ndr_size_ntlmssp_AvValue(&r->Value, r->AvId, ndr->iconv_convenience, 0)));
902                         }
903                 }
904                 if (ndr_flags & NDR_BUFFERS) {
905                 }
906                 ndr->flags = _flags_save_STRUCT;
907         }
908         return NDR_ERR_SUCCESS;
909 }
910
911 _PUBLIC_ enum ndr_err_code ndr_pull_AV_PAIR(struct ndr_pull *ndr, int ndr_flags, struct AV_PAIR *r)
912 {
913         {
914                 uint32_t _flags_save_STRUCT = ndr->flags;
915                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
916                 if (ndr_flags & NDR_SCALARS) {
917                         NDR_CHECK(ndr_pull_align(ndr, 4));
918                         NDR_CHECK(ndr_pull_ntlmssp_AvId(ndr, NDR_SCALARS, &r->AvId));
919                         NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->AvLen));
920                         {
921                                 struct ndr_pull *_ndr_Value;
922                                 NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_Value, 0, r->AvLen));
923                                 NDR_CHECK(ndr_pull_set_switch_value(_ndr_Value, &r->Value, r->AvId));
924                                 NDR_CHECK(ndr_pull_ntlmssp_AvValue(_ndr_Value, NDR_SCALARS|NDR_BUFFERS, &r->Value));
925                                 NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_Value, 0, r->AvLen));
926                         }
927                 }
928                 if (ndr_flags & NDR_BUFFERS) {
929                 }
930                 ndr->flags = _flags_save_STRUCT;
931         }
932         return NDR_ERR_SUCCESS;
933 }
934
935 _PUBLIC_ void ndr_print_AV_PAIR(struct ndr_print *ndr, const char *name, const struct AV_PAIR *r)
936 {
937         ndr_print_struct(ndr, name, "AV_PAIR");
938         {
939                 uint32_t _flags_save_STRUCT = ndr->flags;
940                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
941                 ndr->depth++;
942                 ndr_print_ntlmssp_AvId(ndr, "AvId", r->AvId);
943                 ndr_print_uint16(ndr, "AvLen", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?ndr_size_ntlmssp_AvValue(&r->Value, r->AvId, ndr->iconv_convenience, 0):r->AvLen);
944                 ndr_print_set_switch_value(ndr, &r->Value, r->AvId);
945                 ndr_print_ntlmssp_AvValue(ndr, "Value", &r->Value);
946                 ndr->depth--;
947                 ndr->flags = _flags_save_STRUCT;
948         }
949 }
950
951 _PUBLIC_ void ndr_print_AV_PAIR_LIST(struct ndr_print *ndr, const char *name, const struct AV_PAIR_LIST *r)
952 {
953         uint32_t cntr_pair_0;
954         ndr_print_struct(ndr, name, "AV_PAIR_LIST");
955         {
956                 uint32_t _flags_save_STRUCT = ndr->flags;
957                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_NOALIGN);
958                 ndr->depth++;
959                 ndr_print_uint32(ndr, "count", r->count);
960                 ndr->print(ndr, "%s: ARRAY(%d)", "pair", (int)r->count);
961                 ndr->depth++;
962                 for (cntr_pair_0=0;cntr_pair_0<r->count;cntr_pair_0++) {
963                         char *idx_0=NULL;
964                         if (asprintf(&idx_0, "[%d]", cntr_pair_0) != -1) {
965                                 ndr_print_AV_PAIR(ndr, "pair", &r->pair[cntr_pair_0]);
966                                 free(idx_0);
967                         }
968                 }
969                 ndr->depth--;
970                 ndr->depth--;
971                 ndr->flags = _flags_save_STRUCT;
972         }
973 }
974
975 static size_t ndr_size_AV_PAIR_LIST(const struct AV_PAIR_LIST *r, struct smb_iconv_convenience *ic, int flags)
976 {
977         flags |= LIBNDR_FLAG_NOALIGN;
978         return ndr_size_struct(r, flags, (ndr_push_flags_fn_t)ndr_push_AV_PAIR_LIST, ic);
979 }
980
981 _PUBLIC_ enum ndr_err_code ndr_push_CHALLENGE_MESSAGE(struct ndr_push *ndr, int ndr_flags, const struct CHALLENGE_MESSAGE *r)
982 {
983         {
984                 uint32_t _flags_save_STRUCT = ndr->flags;
985                 ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX);
986                 if (ndr_flags & NDR_SCALARS) {
987                         NDR_CHECK(ndr_push_align(ndr, 4));
988                         NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, "NTLMSSP", 8, sizeof(uint8_t), CH_DOS));
989                         NDR_CHECK(ndr_push_ntlmssp_MessageType(ndr, NDR_SCALARS, NtLmChallenge));
990                         NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, ndr_ntlmssp_string_length(r->NegotiateFlags, r->TargetName)));
991                         NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, ndr_ntlmssp_string_length(r->NegotiateFlags, r->TargetName)));
992                         {
993                                 uint32_t _flags_save_string = ndr->flags;
994                                 ndr_set_flags(&ndr->flags, ndr_ntlmssp_negotiated_string_flags(r->NegotiateFlags));
995                                 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->TargetName));
996                                 ndr->flags = _flags_save_string;
997                         }
998                         NDR_CHECK(ndr_push_NEGOTIATE(ndr, NDR_SCALARS, r->NegotiateFlags));
999                         NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->ServerChallenge, 8));
1000                         NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->Reserved, 8));
1001                         NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, ndr_size_AV_PAIR_LIST(r->TargetInfo, ndr->iconv_convenience, ndr->flags)));
1002                         NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, ndr_size_AV_PAIR_LIST(r->TargetInfo, ndr->iconv_convenience, ndr->flags)));
1003                         NDR_CHECK(ndr_push_relative_ptr1(ndr, r->TargetInfo));
1004                         NDR_CHECK(ndr_push_set_switch_value(ndr, &r->Version, r->NegotiateFlags & NTLMSSP_NEGOTIATE_VERSION));
1005                         NDR_CHECK(ndr_push_ntlmssp_Version(ndr, NDR_SCALARS, &r->Version));
1006                 }
1007                 if (ndr_flags & NDR_BUFFERS) {
1008                         {
1009                                 uint32_t _flags_save_string = ndr->flags;
1010                                 ndr_set_flags(&ndr->flags, ndr_ntlmssp_negotiated_string_flags(r->NegotiateFlags));
1011                                 if (r->TargetName) {
1012                                         NDR_CHECK(ndr_push_relative_ptr2(ndr, r->TargetName));
1013                                         {
1014                                                 struct ndr_push *_ndr_TargetName;
1015                                                 NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_TargetName, 0, ndr_ntlmssp_string_length(r->NegotiateFlags, r->TargetName)));
1016                                                 NDR_CHECK(ndr_push_string(_ndr_TargetName, NDR_SCALARS, r->TargetName));
1017                                                 NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_TargetName, 0, ndr_ntlmssp_string_length(r->NegotiateFlags, r->TargetName)));
1018                                         }
1019                                 }
1020                                 ndr->flags = _flags_save_string;
1021                         }
1022                         if (r->TargetInfo) {
1023                                 NDR_CHECK(ndr_push_relative_ptr2(ndr, r->TargetInfo));
1024                                 {
1025                                         struct ndr_push *_ndr_TargetInfo;
1026                                         NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_TargetInfo, 0, ndr_size_AV_PAIR_LIST(r->TargetInfo, ndr->iconv_convenience, ndr->flags)));
1027                                         NDR_CHECK(ndr_push_AV_PAIR_LIST(_ndr_TargetInfo, NDR_SCALARS|NDR_BUFFERS, r->TargetInfo));
1028                                         NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_TargetInfo, 0, ndr_size_AV_PAIR_LIST(r->TargetInfo, ndr->iconv_convenience, ndr->flags)));
1029                                 }
1030                         }
1031                         NDR_CHECK(ndr_push_ntlmssp_Version(ndr, NDR_BUFFERS, &r->Version));
1032                 }
1033                 ndr->flags = _flags_save_STRUCT;
1034         }
1035         return NDR_ERR_SUCCESS;
1036 }
1037
1038 _PUBLIC_ enum ndr_err_code ndr_pull_CHALLENGE_MESSAGE(struct ndr_pull *ndr, int ndr_flags, struct CHALLENGE_MESSAGE *r)
1039 {
1040         uint32_t _ptr_TargetName;
1041         TALLOC_CTX *_mem_save_TargetName_0;
1042         uint32_t _ptr_TargetInfo;
1043         TALLOC_CTX *_mem_save_TargetInfo_0;
1044         {
1045                 uint32_t _flags_save_STRUCT = ndr->flags;
1046                 ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX);
1047                 if (ndr_flags & NDR_SCALARS) {
1048                         NDR_CHECK(ndr_pull_align(ndr, 4));
1049                         NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->Signature, 8, sizeof(uint8_t), CH_DOS));
1050                         NDR_CHECK(ndr_pull_ntlmssp_MessageType(ndr, NDR_SCALARS, &r->MessageType));
1051                         NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->TargetNameLen));
1052                         NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->TargetNameMaxLen));
1053                         {
1054                                 uint32_t _flags_save_string = ndr->flags;
1055                                 ndr_set_flags(&ndr->flags, ndr_ntlmssp_negotiated_string_flags(r->NegotiateFlags));
1056                                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_TargetName));
1057                                 if (_ptr_TargetName) {
1058                                         NDR_PULL_ALLOC(ndr, r->TargetName);
1059                                         NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->TargetName, _ptr_TargetName));
1060                                 } else {
1061                                         r->TargetName = NULL;
1062                                 }
1063                                 ndr->flags = _flags_save_string;
1064                         }
1065                         NDR_CHECK(ndr_pull_NEGOTIATE(ndr, NDR_SCALARS, &r->NegotiateFlags));
1066                         NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->ServerChallenge, 8));
1067                         NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->Reserved, 8));
1068                         NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->TargetInfoLen));
1069                         NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->TargetNameInfoMaxLen));
1070                         NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_TargetInfo));
1071                         if (_ptr_TargetInfo) {
1072                                 NDR_PULL_ALLOC(ndr, r->TargetInfo);
1073                                 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->TargetInfo, _ptr_TargetInfo));
1074                         } else {
1075                                 r->TargetInfo = NULL;
1076                         }
1077                         NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->Version, r->NegotiateFlags & NTLMSSP_NEGOTIATE_VERSION));
1078                         NDR_CHECK(ndr_pull_ntlmssp_Version(ndr, NDR_SCALARS, &r->Version));
1079                 }
1080                 if (ndr_flags & NDR_BUFFERS) {
1081                         {
1082                                 uint32_t _flags_save_string = ndr->flags;
1083                                 ndr_set_flags(&ndr->flags, ndr_ntlmssp_negotiated_string_flags(r->NegotiateFlags));
1084                                 if (r->TargetName) {
1085                                         uint32_t _relative_save_offset;
1086                                         _relative_save_offset = ndr->offset;
1087                                         NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->TargetName));
1088                                         _mem_save_TargetName_0 = NDR_PULL_GET_MEM_CTX(ndr);
1089                                         NDR_PULL_SET_MEM_CTX(ndr, r->TargetName, 0);
1090                                         {
1091                                                 struct ndr_pull *_ndr_TargetName;
1092                                                 NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_TargetName, 0, r->TargetNameLen));
1093                                                 NDR_CHECK(ndr_pull_string(_ndr_TargetName, NDR_SCALARS, &r->TargetName));
1094                                                 NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_TargetName, 0, r->TargetNameLen));
1095                                         }
1096                                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_TargetName_0, 0);
1097                                         ndr->offset = _relative_save_offset;
1098                                 }
1099                                 ndr->flags = _flags_save_string;
1100                         }
1101                         if (r->TargetInfo) {
1102                                 uint32_t _relative_save_offset;
1103                                 _relative_save_offset = ndr->offset;
1104                                 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->TargetInfo));
1105                                 _mem_save_TargetInfo_0 = NDR_PULL_GET_MEM_CTX(ndr);
1106                                 NDR_PULL_SET_MEM_CTX(ndr, r->TargetInfo, 0);
1107                                 {
1108                                         struct ndr_pull *_ndr_TargetInfo;
1109                                         NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_TargetInfo, 0, r->TargetInfoLen));
1110                                         NDR_CHECK(ndr_pull_AV_PAIR_LIST(_ndr_TargetInfo, NDR_SCALARS|NDR_BUFFERS, r->TargetInfo));
1111                                         NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_TargetInfo, 0, r->TargetInfoLen));
1112                                 }
1113                                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_TargetInfo_0, 0);
1114                                 ndr->offset = _relative_save_offset;
1115                         }
1116                         NDR_CHECK(ndr_pull_ntlmssp_Version(ndr, NDR_BUFFERS, &r->Version));
1117                 }
1118                 ndr->flags = _flags_save_STRUCT;
1119         }
1120         return NDR_ERR_SUCCESS;
1121 }
1122
1123 _PUBLIC_ void ndr_print_CHALLENGE_MESSAGE(struct ndr_print *ndr, const char *name, const struct CHALLENGE_MESSAGE *r)
1124 {
1125         ndr_print_struct(ndr, name, "CHALLENGE_MESSAGE");
1126         {
1127                 uint32_t _flags_save_STRUCT = ndr->flags;
1128                 ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX);
1129                 ndr->depth++;
1130                 ndr_print_string(ndr, "Signature", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?"NTLMSSP":r->Signature);
1131                 ndr_print_ntlmssp_MessageType(ndr, "MessageType", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?NtLmChallenge:r->MessageType);
1132                 ndr_print_uint16(ndr, "TargetNameLen", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?ndr_ntlmssp_string_length(r->NegotiateFlags, r->TargetName):r->TargetNameLen);
1133                 ndr_print_uint16(ndr, "TargetNameMaxLen", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?r->TargetNameLen:r->TargetNameMaxLen);
1134                 ndr_print_ptr(ndr, "TargetName", r->TargetName);
1135                 ndr->depth++;
1136                 if (r->TargetName) {
1137                         ndr_print_string(ndr, "TargetName", r->TargetName);
1138                 }
1139                 ndr->depth--;
1140                 ndr_print_NEGOTIATE(ndr, "NegotiateFlags", r->NegotiateFlags);
1141                 ndr_print_array_uint8(ndr, "ServerChallenge", r->ServerChallenge, 8);
1142                 ndr_print_array_uint8(ndr, "Reserved", r->Reserved, 8);
1143                 ndr_print_uint16(ndr, "TargetInfoLen", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?ndr_size_AV_PAIR_LIST(r->TargetInfo, ndr->iconv_convenience, ndr->flags):r->TargetInfoLen);
1144                 ndr_print_uint16(ndr, "TargetNameInfoMaxLen", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?r->TargetInfoLen:r->TargetNameInfoMaxLen);
1145                 ndr_print_ptr(ndr, "TargetInfo", r->TargetInfo);
1146                 ndr->depth++;
1147                 if (r->TargetInfo) {
1148                         ndr_print_AV_PAIR_LIST(ndr, "TargetInfo", r->TargetInfo);
1149                 }
1150                 ndr->depth--;
1151                 ndr_print_set_switch_value(ndr, &r->Version, r->NegotiateFlags & NTLMSSP_NEGOTIATE_VERSION);
1152                 ndr_print_ntlmssp_Version(ndr, "Version", &r->Version);
1153                 ndr->depth--;
1154                 ndr->flags = _flags_save_STRUCT;
1155         }
1156 }
1157
1158 _PUBLIC_ enum ndr_err_code ndr_push_LM_RESPONSE(struct ndr_push *ndr, int ndr_flags, const struct LM_RESPONSE *r)
1159 {
1160         {
1161                 uint32_t _flags_save_STRUCT = ndr->flags;
1162                 ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX);
1163                 if (ndr_flags & NDR_SCALARS) {
1164                         NDR_CHECK(ndr_push_align(ndr, 1));
1165                         NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->Response, 24));
1166                 }
1167                 if (ndr_flags & NDR_BUFFERS) {
1168                 }
1169                 ndr->flags = _flags_save_STRUCT;
1170         }
1171         return NDR_ERR_SUCCESS;
1172 }
1173
1174 _PUBLIC_ enum ndr_err_code ndr_pull_LM_RESPONSE(struct ndr_pull *ndr, int ndr_flags, struct LM_RESPONSE *r)
1175 {
1176         {
1177                 uint32_t _flags_save_STRUCT = ndr->flags;
1178                 ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX);
1179                 if (ndr_flags & NDR_SCALARS) {
1180                         NDR_CHECK(ndr_pull_align(ndr, 1));
1181                         NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->Response, 24));
1182                 }
1183                 if (ndr_flags & NDR_BUFFERS) {
1184                 }
1185                 ndr->flags = _flags_save_STRUCT;
1186         }
1187         return NDR_ERR_SUCCESS;
1188 }
1189
1190 _PUBLIC_ void ndr_print_LM_RESPONSE(struct ndr_print *ndr, const char *name, const struct LM_RESPONSE *r)
1191 {
1192         ndr_print_struct(ndr, name, "LM_RESPONSE");
1193         {
1194                 uint32_t _flags_save_STRUCT = ndr->flags;
1195                 ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX);
1196                 ndr->depth++;
1197                 ndr_print_array_uint8(ndr, "Response", r->Response, 24);
1198                 ndr->depth--;
1199                 ndr->flags = _flags_save_STRUCT;
1200         }
1201 }
1202
1203 _PUBLIC_ enum ndr_err_code ndr_push_LMv2_RESPONSE(struct ndr_push *ndr, int ndr_flags, const struct LMv2_RESPONSE *r)
1204 {
1205         {
1206                 uint32_t _flags_save_STRUCT = ndr->flags;
1207                 ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX);
1208                 if (ndr_flags & NDR_SCALARS) {
1209                         NDR_CHECK(ndr_push_align(ndr, 1));
1210                         NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->Response, 16));
1211                         NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->ChallengeFromClient, 8));
1212                 }
1213                 if (ndr_flags & NDR_BUFFERS) {
1214                 }
1215                 ndr->flags = _flags_save_STRUCT;
1216         }
1217         return NDR_ERR_SUCCESS;
1218 }
1219
1220 _PUBLIC_ enum ndr_err_code ndr_pull_LMv2_RESPONSE(struct ndr_pull *ndr, int ndr_flags, struct LMv2_RESPONSE *r)
1221 {
1222         {
1223                 uint32_t _flags_save_STRUCT = ndr->flags;
1224                 ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX);
1225                 if (ndr_flags & NDR_SCALARS) {
1226                         NDR_CHECK(ndr_pull_align(ndr, 1));
1227                         NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->Response, 16));
1228                         NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->ChallengeFromClient, 8));
1229                 }
1230                 if (ndr_flags & NDR_BUFFERS) {
1231                 }
1232                 ndr->flags = _flags_save_STRUCT;
1233         }
1234         return NDR_ERR_SUCCESS;
1235 }
1236
1237 _PUBLIC_ void ndr_print_LMv2_RESPONSE(struct ndr_print *ndr, const char *name, const struct LMv2_RESPONSE *r)
1238 {
1239         ndr_print_struct(ndr, name, "LMv2_RESPONSE");
1240         {
1241                 uint32_t _flags_save_STRUCT = ndr->flags;
1242                 ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX);
1243                 ndr->depth++;
1244                 ndr_print_array_uint8(ndr, "Response", r->Response, 16);
1245                 ndr_print_array_uint8(ndr, "ChallengeFromClient", r->ChallengeFromClient, 8);
1246                 ndr->depth--;
1247                 ndr->flags = _flags_save_STRUCT;
1248         }
1249 }
1250
1251 static enum ndr_err_code ndr_push_ntlmssp_LM_RESPONSE(struct ndr_push *ndr, int ndr_flags, const union ntlmssp_LM_RESPONSE *r)
1252 {
1253         if (ndr_flags & NDR_SCALARS) {
1254                 int level = ndr_push_get_switch_value(ndr, r);
1255                 switch (level) {
1256                         case 24: {
1257                                 NDR_CHECK(ndr_push_LM_RESPONSE(ndr, NDR_SCALARS, &r->v1));
1258                         break; }
1259
1260                         default: {
1261                         break; }
1262
1263                 }
1264         }
1265         if (ndr_flags & NDR_BUFFERS) {
1266                 int level = ndr_push_get_switch_value(ndr, r);
1267                 switch (level) {
1268                         case 24:
1269                         break;
1270
1271                         default:
1272                         break;
1273
1274                 }
1275         }
1276         return NDR_ERR_SUCCESS;
1277 }
1278
1279 static enum ndr_err_code ndr_pull_ntlmssp_LM_RESPONSE(struct ndr_pull *ndr, int ndr_flags, union ntlmssp_LM_RESPONSE *r)
1280 {
1281         int level;
1282         level = ndr_pull_get_switch_value(ndr, r);
1283         if (ndr_flags & NDR_SCALARS) {
1284                 switch (level) {
1285                         case 24: {
1286                                 NDR_CHECK(ndr_pull_LM_RESPONSE(ndr, NDR_SCALARS, &r->v1));
1287                         break; }
1288
1289                         default: {
1290                         break; }
1291
1292                 }
1293         }
1294         if (ndr_flags & NDR_BUFFERS) {
1295                 switch (level) {
1296                         case 24:
1297                         break;
1298
1299                         default:
1300                         break;
1301
1302                 }
1303         }
1304         return NDR_ERR_SUCCESS;
1305 }
1306
1307 _PUBLIC_ void ndr_print_ntlmssp_LM_RESPONSE(struct ndr_print *ndr, const char *name, const union ntlmssp_LM_RESPONSE *r)
1308 {
1309         int level;
1310         level = ndr_print_get_switch_value(ndr, r);
1311         ndr_print_union(ndr, name, level, "ntlmssp_LM_RESPONSE");
1312         switch (level) {
1313                 case 24:
1314                         ndr_print_LM_RESPONSE(ndr, "v1", &r->v1);
1315                 break;
1316
1317                 default:
1318                 break;
1319
1320         }
1321 }
1322
1323 _PUBLIC_ enum ndr_err_code ndr_push_NTLM_RESPONSE(struct ndr_push *ndr, int ndr_flags, const struct NTLM_RESPONSE *r)
1324 {
1325         {
1326                 uint32_t _flags_save_STRUCT = ndr->flags;
1327                 ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX);
1328                 if (ndr_flags & NDR_SCALARS) {
1329                         NDR_CHECK(ndr_push_align(ndr, 1));
1330                         NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->Response, 24));
1331                 }
1332                 if (ndr_flags & NDR_BUFFERS) {
1333                 }
1334                 ndr->flags = _flags_save_STRUCT;
1335         }
1336         return NDR_ERR_SUCCESS;
1337 }
1338
1339 _PUBLIC_ enum ndr_err_code ndr_pull_NTLM_RESPONSE(struct ndr_pull *ndr, int ndr_flags, struct NTLM_RESPONSE *r)
1340 {
1341         {
1342                 uint32_t _flags_save_STRUCT = ndr->flags;
1343                 ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX);
1344                 if (ndr_flags & NDR_SCALARS) {
1345                         NDR_CHECK(ndr_pull_align(ndr, 1));
1346                         NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->Response, 24));
1347                 }
1348                 if (ndr_flags & NDR_BUFFERS) {
1349                 }
1350                 ndr->flags = _flags_save_STRUCT;
1351         }
1352         return NDR_ERR_SUCCESS;
1353 }
1354
1355 _PUBLIC_ void ndr_print_NTLM_RESPONSE(struct ndr_print *ndr, const char *name, const struct NTLM_RESPONSE *r)
1356 {
1357         ndr_print_struct(ndr, name, "NTLM_RESPONSE");
1358         {
1359                 uint32_t _flags_save_STRUCT = ndr->flags;
1360                 ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX);
1361                 ndr->depth++;
1362                 ndr_print_array_uint8(ndr, "Response", r->Response, 24);
1363                 ndr->depth--;
1364                 ndr->flags = _flags_save_STRUCT;
1365         }
1366 }
1367
1368 static enum ndr_err_code ndr_push_NTLMv2_CLIENT_CHALLENGE(struct ndr_push *ndr, int ndr_flags, const struct NTLMv2_CLIENT_CHALLENGE *r)
1369 {
1370         {
1371                 uint32_t _flags_save_STRUCT = ndr->flags;
1372                 ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX);
1373                 if (ndr_flags & NDR_SCALARS) {
1374                         NDR_CHECK(ndr_push_align(ndr, 4));
1375                         NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, 1));
1376                         NDR_CHECK(ndr_push_uint8(ndr, NDR_SCALARS, 1));
1377                         NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->Reserved1));
1378                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->Reserved2));
1379                         NDR_CHECK(ndr_push_NTTIME(ndr, NDR_SCALARS, r->TimeStamp));
1380                         NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->ChallengeFromClient, 8));
1381                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->Reserved3));
1382                         {
1383                                 uint32_t _flags_save_AV_PAIR_LIST = ndr->flags;
1384                                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING);
1385                                 {
1386                                         struct ndr_push *_ndr_AvPairs;
1387                                         NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_AvPairs, 0, -1));
1388                                         NDR_CHECK(ndr_push_AV_PAIR_LIST(_ndr_AvPairs, NDR_SCALARS|NDR_BUFFERS, &r->AvPairs));
1389                                         NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_AvPairs, 0, -1));
1390                                 }
1391                                 ndr->flags = _flags_save_AV_PAIR_LIST;
1392                         }
1393                 }
1394                 if (ndr_flags & NDR_BUFFERS) {
1395                         {
1396                                 uint32_t _flags_save_AV_PAIR_LIST = ndr->flags;
1397                                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING);
1398                                 ndr->flags = _flags_save_AV_PAIR_LIST;
1399                         }
1400                 }
1401                 ndr->flags = _flags_save_STRUCT;
1402         }
1403         return NDR_ERR_SUCCESS;
1404 }
1405
1406 static enum ndr_err_code ndr_pull_NTLMv2_CLIENT_CHALLENGE(struct ndr_pull *ndr, int ndr_flags, struct NTLMv2_CLIENT_CHALLENGE *r)
1407 {
1408         {
1409                 uint32_t _flags_save_STRUCT = ndr->flags;
1410                 ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX);
1411                 if (ndr_flags & NDR_SCALARS) {
1412                         NDR_CHECK(ndr_pull_align(ndr, 4));
1413                         NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->RespType));
1414                         NDR_CHECK(ndr_pull_uint8(ndr, NDR_SCALARS, &r->HiRespType));
1415                         NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->Reserved1));
1416                         NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->Reserved2));
1417                         NDR_CHECK(ndr_pull_NTTIME(ndr, NDR_SCALARS, &r->TimeStamp));
1418                         NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->ChallengeFromClient, 8));
1419                         NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->Reserved3));
1420                         {
1421                                 uint32_t _flags_save_AV_PAIR_LIST = ndr->flags;
1422                                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING);
1423                                 {
1424                                         struct ndr_pull *_ndr_AvPairs;
1425                                         NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_AvPairs, 0, -1));
1426                                         NDR_CHECK(ndr_pull_AV_PAIR_LIST(_ndr_AvPairs, NDR_SCALARS|NDR_BUFFERS, &r->AvPairs));
1427                                         NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_AvPairs, 0, -1));
1428                                 }
1429                                 ndr->flags = _flags_save_AV_PAIR_LIST;
1430                         }
1431                 }
1432                 if (ndr_flags & NDR_BUFFERS) {
1433                         {
1434                                 uint32_t _flags_save_AV_PAIR_LIST = ndr->flags;
1435                                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING);
1436                                 ndr->flags = _flags_save_AV_PAIR_LIST;
1437                         }
1438                 }
1439                 ndr->flags = _flags_save_STRUCT;
1440         }
1441         return NDR_ERR_SUCCESS;
1442 }
1443
1444 _PUBLIC_ void ndr_print_NTLMv2_CLIENT_CHALLENGE(struct ndr_print *ndr, const char *name, const struct NTLMv2_CLIENT_CHALLENGE *r)
1445 {
1446         ndr_print_struct(ndr, name, "NTLMv2_CLIENT_CHALLENGE");
1447         {
1448                 uint32_t _flags_save_STRUCT = ndr->flags;
1449                 ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX);
1450                 ndr->depth++;
1451                 ndr_print_uint8(ndr, "RespType", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?1:r->RespType);
1452                 ndr_print_uint8(ndr, "HiRespType", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?1:r->HiRespType);
1453                 ndr_print_uint16(ndr, "Reserved1", r->Reserved1);
1454                 ndr_print_uint32(ndr, "Reserved2", r->Reserved2);
1455                 ndr_print_NTTIME(ndr, "TimeStamp", r->TimeStamp);
1456                 ndr_print_array_uint8(ndr, "ChallengeFromClient", r->ChallengeFromClient, 8);
1457                 ndr_print_uint32(ndr, "Reserved3", r->Reserved3);
1458                 ndr_print_AV_PAIR_LIST(ndr, "AvPairs", &r->AvPairs);
1459                 ndr->depth--;
1460                 ndr->flags = _flags_save_STRUCT;
1461         }
1462 }
1463
1464 _PUBLIC_ enum ndr_err_code ndr_push_NTLMv2_RESPONSE(struct ndr_push *ndr, int ndr_flags, const struct NTLMv2_RESPONSE *r)
1465 {
1466         {
1467                 uint32_t _flags_save_STRUCT = ndr->flags;
1468                 ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX);
1469                 if (ndr_flags & NDR_SCALARS) {
1470                         NDR_CHECK(ndr_push_align(ndr, 4));
1471                         NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->Response, 16));
1472                         NDR_CHECK(ndr_push_NTLMv2_CLIENT_CHALLENGE(ndr, NDR_SCALARS, &r->Challenge));
1473                 }
1474                 if (ndr_flags & NDR_BUFFERS) {
1475                         NDR_CHECK(ndr_push_NTLMv2_CLIENT_CHALLENGE(ndr, NDR_BUFFERS, &r->Challenge));
1476                 }
1477                 ndr->flags = _flags_save_STRUCT;
1478         }
1479         return NDR_ERR_SUCCESS;
1480 }
1481
1482 _PUBLIC_ enum ndr_err_code ndr_pull_NTLMv2_RESPONSE(struct ndr_pull *ndr, int ndr_flags, struct NTLMv2_RESPONSE *r)
1483 {
1484         {
1485                 uint32_t _flags_save_STRUCT = ndr->flags;
1486                 ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX);
1487                 if (ndr_flags & NDR_SCALARS) {
1488                         NDR_CHECK(ndr_pull_align(ndr, 4));
1489                         NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->Response, 16));
1490                         NDR_CHECK(ndr_pull_NTLMv2_CLIENT_CHALLENGE(ndr, NDR_SCALARS, &r->Challenge));
1491                 }
1492                 if (ndr_flags & NDR_BUFFERS) {
1493                         NDR_CHECK(ndr_pull_NTLMv2_CLIENT_CHALLENGE(ndr, NDR_BUFFERS, &r->Challenge));
1494                 }
1495                 ndr->flags = _flags_save_STRUCT;
1496         }
1497         return NDR_ERR_SUCCESS;
1498 }
1499
1500 _PUBLIC_ void ndr_print_NTLMv2_RESPONSE(struct ndr_print *ndr, const char *name, const struct NTLMv2_RESPONSE *r)
1501 {
1502         ndr_print_struct(ndr, name, "NTLMv2_RESPONSE");
1503         {
1504                 uint32_t _flags_save_STRUCT = ndr->flags;
1505                 ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX);
1506                 ndr->depth++;
1507                 ndr_print_array_uint8(ndr, "Response", r->Response, 16);
1508                 ndr_print_NTLMv2_CLIENT_CHALLENGE(ndr, "Challenge", &r->Challenge);
1509                 ndr->depth--;
1510                 ndr->flags = _flags_save_STRUCT;
1511         }
1512 }
1513
1514 _PUBLIC_ enum ndr_err_code ndr_push_ntlmssp_NTLM_RESPONSE(struct ndr_push *ndr, int ndr_flags, const union ntlmssp_NTLM_RESPONSE *r)
1515 {
1516         if (ndr_flags & NDR_SCALARS) {
1517                 int level = ndr_push_get_switch_value(ndr, r);
1518                 switch (level) {
1519                         case 0: {
1520                         break; }
1521
1522                         case 0x18: {
1523                                 NDR_CHECK(ndr_push_NTLM_RESPONSE(ndr, NDR_SCALARS, &r->v1));
1524                         break; }
1525
1526                         default: {
1527                                 NDR_CHECK(ndr_push_NTLMv2_RESPONSE(ndr, NDR_SCALARS, &r->v2));
1528                         break; }
1529
1530                 }
1531         }
1532         if (ndr_flags & NDR_BUFFERS) {
1533                 int level = ndr_push_get_switch_value(ndr, r);
1534                 switch (level) {
1535                         case 0:
1536                         break;
1537
1538                         case 0x18:
1539                         break;
1540
1541                         default:
1542                                 NDR_CHECK(ndr_push_NTLMv2_RESPONSE(ndr, NDR_BUFFERS, &r->v2));
1543                         break;
1544
1545                 }
1546         }
1547         return NDR_ERR_SUCCESS;
1548 }
1549
1550 _PUBLIC_ enum ndr_err_code ndr_pull_ntlmssp_NTLM_RESPONSE(struct ndr_pull *ndr, int ndr_flags, union ntlmssp_NTLM_RESPONSE *r)
1551 {
1552         int level;
1553         level = ndr_pull_get_switch_value(ndr, r);
1554         if (ndr_flags & NDR_SCALARS) {
1555                 switch (level) {
1556                         case 0: {
1557                         break; }
1558
1559                         case 0x18: {
1560                                 NDR_CHECK(ndr_pull_NTLM_RESPONSE(ndr, NDR_SCALARS, &r->v1));
1561                         break; }
1562
1563                         default: {
1564                                 NDR_CHECK(ndr_pull_NTLMv2_RESPONSE(ndr, NDR_SCALARS, &r->v2));
1565                         break; }
1566
1567                 }
1568         }
1569         if (ndr_flags & NDR_BUFFERS) {
1570                 switch (level) {
1571                         case 0:
1572                         break;
1573
1574                         case 0x18:
1575                         break;
1576
1577                         default:
1578                                 NDR_CHECK(ndr_pull_NTLMv2_RESPONSE(ndr, NDR_BUFFERS, &r->v2));
1579                         break;
1580
1581                 }
1582         }
1583         return NDR_ERR_SUCCESS;
1584 }
1585
1586 _PUBLIC_ void ndr_print_ntlmssp_NTLM_RESPONSE(struct ndr_print *ndr, const char *name, const union ntlmssp_NTLM_RESPONSE *r)
1587 {
1588         int level;
1589         level = ndr_print_get_switch_value(ndr, r);
1590         ndr_print_union(ndr, name, level, "ntlmssp_NTLM_RESPONSE");
1591         switch (level) {
1592                 case 0:
1593                 break;
1594
1595                 case 0x18:
1596                         ndr_print_NTLM_RESPONSE(ndr, "v1", &r->v1);
1597                 break;
1598
1599                 default:
1600                         ndr_print_NTLMv2_RESPONSE(ndr, "v2", &r->v2);
1601                 break;
1602
1603         }
1604 }
1605
1606 _PUBLIC_ enum ndr_err_code ndr_push_AUTHENTICATE_MESSAGE(struct ndr_push *ndr, int ndr_flags, const struct AUTHENTICATE_MESSAGE *r)
1607 {
1608         {
1609                 uint32_t _flags_save_STRUCT = ndr->flags;
1610                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING);
1611                 if (ndr_flags & NDR_SCALARS) {
1612                         NDR_CHECK(ndr_push_align(ndr, 4));
1613                         NDR_CHECK(ndr_push_charset(ndr, NDR_SCALARS, "NTLMSSP", 8, sizeof(uint8_t), CH_DOS));
1614                         NDR_CHECK(ndr_push_ntlmssp_MessageType(ndr, NDR_SCALARS, NtLmAuthenticate));
1615                         NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->LmChallengeResponseLen));
1616                         NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->LmChallengeResponseLen));
1617                         NDR_CHECK(ndr_push_relative_ptr1(ndr, r->LmChallengeResponse));
1618                         NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->NtChallengeResponseLen));
1619                         NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->NtChallengeResponseLen));
1620                         NDR_CHECK(ndr_push_relative_ptr1(ndr, r->NtChallengeResponse));
1621                         NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, ndr_ntlmssp_string_length(r->NegotiateFlags, r->DomainName)));
1622                         NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, ndr_ntlmssp_string_length(r->NegotiateFlags, r->DomainName)));
1623                         {
1624                                 uint32_t _flags_save_string = ndr->flags;
1625                                 ndr_set_flags(&ndr->flags, ndr_ntlmssp_negotiated_string_flags(r->NegotiateFlags));
1626                                 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->DomainName));
1627                                 ndr->flags = _flags_save_string;
1628                         }
1629                         NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, ndr_ntlmssp_string_length(r->NegotiateFlags, r->UserName)));
1630                         NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, ndr_ntlmssp_string_length(r->NegotiateFlags, r->UserName)));
1631                         {
1632                                 uint32_t _flags_save_string = ndr->flags;
1633                                 ndr_set_flags(&ndr->flags, ndr_ntlmssp_negotiated_string_flags(r->NegotiateFlags));
1634                                 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->UserName));
1635                                 ndr->flags = _flags_save_string;
1636                         }
1637                         NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, ndr_ntlmssp_string_length(r->NegotiateFlags, r->Workstation)));
1638                         NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, ndr_ntlmssp_string_length(r->NegotiateFlags, r->Workstation)));
1639                         {
1640                                 uint32_t _flags_save_string = ndr->flags;
1641                                 ndr_set_flags(&ndr->flags, ndr_ntlmssp_negotiated_string_flags(r->NegotiateFlags));
1642                                 NDR_CHECK(ndr_push_relative_ptr1(ndr, r->Workstation));
1643                                 ndr->flags = _flags_save_string;
1644                         }
1645                         NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->EncryptedRandomSessionKey->length));
1646                         NDR_CHECK(ndr_push_uint16(ndr, NDR_SCALARS, r->EncryptedRandomSessionKey->length));
1647                         NDR_CHECK(ndr_push_relative_ptr1(ndr, r->EncryptedRandomSessionKey));
1648                         NDR_CHECK(ndr_push_NEGOTIATE(ndr, NDR_SCALARS, r->NegotiateFlags));
1649                         NDR_CHECK(ndr_push_set_switch_value(ndr, &r->Version, r->NegotiateFlags & NTLMSSP_NEGOTIATE_VERSION));
1650                         NDR_CHECK(ndr_push_ntlmssp_Version(ndr, NDR_SCALARS, &r->Version));
1651                 }
1652                 if (ndr_flags & NDR_BUFFERS) {
1653                         if (r->LmChallengeResponse) {
1654                                 NDR_CHECK(ndr_push_relative_ptr2(ndr, r->LmChallengeResponse));
1655                                 {
1656                                         struct ndr_push *_ndr_LmChallengeResponse;
1657                                         NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_LmChallengeResponse, 0, r->LmChallengeResponseLen));
1658                                         NDR_CHECK(ndr_push_set_switch_value(_ndr_LmChallengeResponse, r->LmChallengeResponse, r->LmChallengeResponseLen));
1659                                         NDR_CHECK(ndr_push_ntlmssp_LM_RESPONSE(_ndr_LmChallengeResponse, NDR_SCALARS|NDR_BUFFERS, r->LmChallengeResponse));
1660                                         NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_LmChallengeResponse, 0, r->LmChallengeResponseLen));
1661                                 }
1662                         }
1663                         if (r->NtChallengeResponse) {
1664                                 NDR_CHECK(ndr_push_relative_ptr2(ndr, r->NtChallengeResponse));
1665                                 {
1666                                         struct ndr_push *_ndr_NtChallengeResponse;
1667                                         NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_NtChallengeResponse, 0, r->NtChallengeResponseLen));
1668                                         NDR_CHECK(ndr_push_set_switch_value(_ndr_NtChallengeResponse, r->NtChallengeResponse, r->NtChallengeResponseLen));
1669                                         NDR_CHECK(ndr_push_ntlmssp_NTLM_RESPONSE(_ndr_NtChallengeResponse, NDR_SCALARS|NDR_BUFFERS, r->NtChallengeResponse));
1670                                         NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_NtChallengeResponse, 0, r->NtChallengeResponseLen));
1671                                 }
1672                         }
1673                         {
1674                                 uint32_t _flags_save_string = ndr->flags;
1675                                 ndr_set_flags(&ndr->flags, ndr_ntlmssp_negotiated_string_flags(r->NegotiateFlags));
1676                                 if (r->DomainName) {
1677                                         NDR_CHECK(ndr_push_relative_ptr2(ndr, r->DomainName));
1678                                         {
1679                                                 struct ndr_push *_ndr_DomainName;
1680                                                 NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_DomainName, 0, ndr_ntlmssp_string_length(r->NegotiateFlags, r->DomainName)));
1681                                                 NDR_CHECK(ndr_push_string(_ndr_DomainName, NDR_SCALARS, r->DomainName));
1682                                                 NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_DomainName, 0, ndr_ntlmssp_string_length(r->NegotiateFlags, r->DomainName)));
1683                                         }
1684                                 }
1685                                 ndr->flags = _flags_save_string;
1686                         }
1687                         {
1688                                 uint32_t _flags_save_string = ndr->flags;
1689                                 ndr_set_flags(&ndr->flags, ndr_ntlmssp_negotiated_string_flags(r->NegotiateFlags));
1690                                 if (r->UserName) {
1691                                         NDR_CHECK(ndr_push_relative_ptr2(ndr, r->UserName));
1692                                         {
1693                                                 struct ndr_push *_ndr_UserName;
1694                                                 NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_UserName, 0, ndr_ntlmssp_string_length(r->NegotiateFlags, r->UserName)));
1695                                                 NDR_CHECK(ndr_push_string(_ndr_UserName, NDR_SCALARS, r->UserName));
1696                                                 NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_UserName, 0, ndr_ntlmssp_string_length(r->NegotiateFlags, r->UserName)));
1697                                         }
1698                                 }
1699                                 ndr->flags = _flags_save_string;
1700                         }
1701                         {
1702                                 uint32_t _flags_save_string = ndr->flags;
1703                                 ndr_set_flags(&ndr->flags, ndr_ntlmssp_negotiated_string_flags(r->NegotiateFlags));
1704                                 if (r->Workstation) {
1705                                         NDR_CHECK(ndr_push_relative_ptr2(ndr, r->Workstation));
1706                                         {
1707                                                 struct ndr_push *_ndr_Workstation;
1708                                                 NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_Workstation, 0, ndr_ntlmssp_string_length(r->NegotiateFlags, r->Workstation)));
1709                                                 NDR_CHECK(ndr_push_string(_ndr_Workstation, NDR_SCALARS, r->Workstation));
1710                                                 NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_Workstation, 0, ndr_ntlmssp_string_length(r->NegotiateFlags, r->Workstation)));
1711                                         }
1712                                 }
1713                                 ndr->flags = _flags_save_string;
1714                         }
1715                         if (r->EncryptedRandomSessionKey) {
1716                                 NDR_CHECK(ndr_push_relative_ptr2(ndr, r->EncryptedRandomSessionKey));
1717                                 {
1718                                         struct ndr_push *_ndr_EncryptedRandomSessionKey;
1719                                         NDR_CHECK(ndr_push_subcontext_start(ndr, &_ndr_EncryptedRandomSessionKey, 0, r->EncryptedRandomSessionKey->length));
1720                                         NDR_CHECK(ndr_push_DATA_BLOB(_ndr_EncryptedRandomSessionKey, NDR_SCALARS, *r->EncryptedRandomSessionKey));
1721                                         NDR_CHECK(ndr_push_subcontext_end(ndr, _ndr_EncryptedRandomSessionKey, 0, r->EncryptedRandomSessionKey->length));
1722                                 }
1723                         }
1724                         NDR_CHECK(ndr_push_ntlmssp_Version(ndr, NDR_BUFFERS, &r->Version));
1725                 }
1726                 ndr->flags = _flags_save_STRUCT;
1727         }
1728         return NDR_ERR_SUCCESS;
1729 }
1730
1731 _PUBLIC_ enum ndr_err_code ndr_pull_AUTHENTICATE_MESSAGE(struct ndr_pull *ndr, int ndr_flags, struct AUTHENTICATE_MESSAGE *r)
1732 {
1733         uint32_t _ptr_LmChallengeResponse;
1734         TALLOC_CTX *_mem_save_LmChallengeResponse_0;
1735         uint32_t _ptr_NtChallengeResponse;
1736         TALLOC_CTX *_mem_save_NtChallengeResponse_0;
1737         uint32_t _ptr_DomainName;
1738         TALLOC_CTX *_mem_save_DomainName_0;
1739         uint32_t _ptr_UserName;
1740         TALLOC_CTX *_mem_save_UserName_0;
1741         uint32_t _ptr_Workstation;
1742         TALLOC_CTX *_mem_save_Workstation_0;
1743         uint32_t _ptr_EncryptedRandomSessionKey;
1744         TALLOC_CTX *_mem_save_EncryptedRandomSessionKey_0;
1745         {
1746                 uint32_t _flags_save_STRUCT = ndr->flags;
1747                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING);
1748                 if (ndr_flags & NDR_SCALARS) {
1749                         NDR_CHECK(ndr_pull_align(ndr, 4));
1750                         NDR_CHECK(ndr_pull_charset(ndr, NDR_SCALARS, &r->Signature, 8, sizeof(uint8_t), CH_DOS));
1751                         NDR_CHECK(ndr_pull_ntlmssp_MessageType(ndr, NDR_SCALARS, &r->MessageType));
1752                         NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->LmChallengeResponseLen));
1753                         NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->LmChallengeResponseMaxLen));
1754                         NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_LmChallengeResponse));
1755                         if (_ptr_LmChallengeResponse) {
1756                                 NDR_PULL_ALLOC(ndr, r->LmChallengeResponse);
1757                                 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->LmChallengeResponse, _ptr_LmChallengeResponse));
1758                         } else {
1759                                 r->LmChallengeResponse = NULL;
1760                         }
1761                         NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->NtChallengeResponseLen));
1762                         NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->NtChallengeResponseMaxLen));
1763                         NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_NtChallengeResponse));
1764                         if (_ptr_NtChallengeResponse) {
1765                                 NDR_PULL_ALLOC(ndr, r->NtChallengeResponse);
1766                                 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->NtChallengeResponse, _ptr_NtChallengeResponse));
1767                         } else {
1768                                 r->NtChallengeResponse = NULL;
1769                         }
1770                         NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->DomainNameLen));
1771                         NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->DomainNameMaxLen));
1772                         {
1773                                 uint32_t _flags_save_string = ndr->flags;
1774                                 ndr_set_flags(&ndr->flags, ndr_ntlmssp_negotiated_string_flags(r->NegotiateFlags));
1775                                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_DomainName));
1776                                 if (_ptr_DomainName) {
1777                                         NDR_PULL_ALLOC(ndr, r->DomainName);
1778                                         NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->DomainName, _ptr_DomainName));
1779                                 } else {
1780                                         r->DomainName = NULL;
1781                                 }
1782                                 ndr->flags = _flags_save_string;
1783                         }
1784                         NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->UserNameLen));
1785                         NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->UserNameMaxLen));
1786                         {
1787                                 uint32_t _flags_save_string = ndr->flags;
1788                                 ndr_set_flags(&ndr->flags, ndr_ntlmssp_negotiated_string_flags(r->NegotiateFlags));
1789                                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_UserName));
1790                                 if (_ptr_UserName) {
1791                                         NDR_PULL_ALLOC(ndr, r->UserName);
1792                                         NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->UserName, _ptr_UserName));
1793                                 } else {
1794                                         r->UserName = NULL;
1795                                 }
1796                                 ndr->flags = _flags_save_string;
1797                         }
1798                         NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->WorkstationLen));
1799                         NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->WorkstationMaxLen));
1800                         {
1801                                 uint32_t _flags_save_string = ndr->flags;
1802                                 ndr_set_flags(&ndr->flags, ndr_ntlmssp_negotiated_string_flags(r->NegotiateFlags));
1803                                 NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_Workstation));
1804                                 if (_ptr_Workstation) {
1805                                         NDR_PULL_ALLOC(ndr, r->Workstation);
1806                                         NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->Workstation, _ptr_Workstation));
1807                                 } else {
1808                                         r->Workstation = NULL;
1809                                 }
1810                                 ndr->flags = _flags_save_string;
1811                         }
1812                         NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->EncryptedRandomSessionKeyLen));
1813                         NDR_CHECK(ndr_pull_uint16(ndr, NDR_SCALARS, &r->EncryptedRandomSessionKeyMaxLen));
1814                         NDR_CHECK(ndr_pull_generic_ptr(ndr, &_ptr_EncryptedRandomSessionKey));
1815                         if (_ptr_EncryptedRandomSessionKey) {
1816                                 NDR_PULL_ALLOC(ndr, r->EncryptedRandomSessionKey);
1817                                 NDR_CHECK(ndr_pull_relative_ptr1(ndr, r->EncryptedRandomSessionKey, _ptr_EncryptedRandomSessionKey));
1818                         } else {
1819                                 r->EncryptedRandomSessionKey = NULL;
1820                         }
1821                         NDR_CHECK(ndr_pull_NEGOTIATE(ndr, NDR_SCALARS, &r->NegotiateFlags));
1822                         NDR_CHECK(ndr_pull_set_switch_value(ndr, &r->Version, r->NegotiateFlags & NTLMSSP_NEGOTIATE_VERSION));
1823                         NDR_CHECK(ndr_pull_ntlmssp_Version(ndr, NDR_SCALARS, &r->Version));
1824                 }
1825                 if (ndr_flags & NDR_BUFFERS) {
1826                         if (r->LmChallengeResponse) {
1827                                 uint32_t _relative_save_offset;
1828                                 _relative_save_offset = ndr->offset;
1829                                 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->LmChallengeResponse));
1830                                 _mem_save_LmChallengeResponse_0 = NDR_PULL_GET_MEM_CTX(ndr);
1831                                 NDR_PULL_SET_MEM_CTX(ndr, r->LmChallengeResponse, 0);
1832                                 {
1833                                         struct ndr_pull *_ndr_LmChallengeResponse;
1834                                         NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_LmChallengeResponse, 0, r->LmChallengeResponseLen));
1835                                         NDR_CHECK(ndr_pull_set_switch_value(_ndr_LmChallengeResponse, r->LmChallengeResponse, r->LmChallengeResponseLen));
1836                                         NDR_CHECK(ndr_pull_ntlmssp_LM_RESPONSE(_ndr_LmChallengeResponse, NDR_SCALARS|NDR_BUFFERS, r->LmChallengeResponse));
1837                                         NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_LmChallengeResponse, 0, r->LmChallengeResponseLen));
1838                                 }
1839                                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_LmChallengeResponse_0, 0);
1840                                 ndr->offset = _relative_save_offset;
1841                         }
1842                         if (r->NtChallengeResponse) {
1843                                 uint32_t _relative_save_offset;
1844                                 _relative_save_offset = ndr->offset;
1845                                 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->NtChallengeResponse));
1846                                 _mem_save_NtChallengeResponse_0 = NDR_PULL_GET_MEM_CTX(ndr);
1847                                 NDR_PULL_SET_MEM_CTX(ndr, r->NtChallengeResponse, 0);
1848                                 {
1849                                         struct ndr_pull *_ndr_NtChallengeResponse;
1850                                         NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_NtChallengeResponse, 0, r->NtChallengeResponseMaxLen));
1851                                         NDR_CHECK(ndr_pull_set_switch_value(_ndr_NtChallengeResponse, r->NtChallengeResponse, r->NtChallengeResponseLen));
1852                                         NDR_CHECK(ndr_pull_ntlmssp_NTLM_RESPONSE(_ndr_NtChallengeResponse, NDR_SCALARS|NDR_BUFFERS, r->NtChallengeResponse));
1853                                         NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_NtChallengeResponse, 0, r->NtChallengeResponseMaxLen));
1854                                 }
1855                                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_NtChallengeResponse_0, 0);
1856                                 ndr->offset = _relative_save_offset;
1857                         }
1858                         {
1859                                 uint32_t _flags_save_string = ndr->flags;
1860                                 ndr_set_flags(&ndr->flags, ndr_ntlmssp_negotiated_string_flags(r->NegotiateFlags));
1861                                 if (r->DomainName) {
1862                                         uint32_t _relative_save_offset;
1863                                         _relative_save_offset = ndr->offset;
1864                                         NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->DomainName));
1865                                         _mem_save_DomainName_0 = NDR_PULL_GET_MEM_CTX(ndr);
1866                                         NDR_PULL_SET_MEM_CTX(ndr, r->DomainName, 0);
1867                                         {
1868                                                 struct ndr_pull *_ndr_DomainName;
1869                                                 NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_DomainName, 0, r->DomainNameLen));
1870                                                 NDR_CHECK(ndr_pull_string(_ndr_DomainName, NDR_SCALARS, &r->DomainName));
1871                                                 NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_DomainName, 0, r->DomainNameLen));
1872                                         }
1873                                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_DomainName_0, 0);
1874                                         ndr->offset = _relative_save_offset;
1875                                 }
1876                                 ndr->flags = _flags_save_string;
1877                         }
1878                         {
1879                                 uint32_t _flags_save_string = ndr->flags;
1880                                 ndr_set_flags(&ndr->flags, ndr_ntlmssp_negotiated_string_flags(r->NegotiateFlags));
1881                                 if (r->UserName) {
1882                                         uint32_t _relative_save_offset;
1883                                         _relative_save_offset = ndr->offset;
1884                                         NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->UserName));
1885                                         _mem_save_UserName_0 = NDR_PULL_GET_MEM_CTX(ndr);
1886                                         NDR_PULL_SET_MEM_CTX(ndr, r->UserName, 0);
1887                                         {
1888                                                 struct ndr_pull *_ndr_UserName;
1889                                                 NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_UserName, 0, r->UserNameLen));
1890                                                 NDR_CHECK(ndr_pull_string(_ndr_UserName, NDR_SCALARS, &r->UserName));
1891                                                 NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_UserName, 0, r->UserNameLen));
1892                                         }
1893                                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_UserName_0, 0);
1894                                         ndr->offset = _relative_save_offset;
1895                                 }
1896                                 ndr->flags = _flags_save_string;
1897                         }
1898                         {
1899                                 uint32_t _flags_save_string = ndr->flags;
1900                                 ndr_set_flags(&ndr->flags, ndr_ntlmssp_negotiated_string_flags(r->NegotiateFlags));
1901                                 if (r->Workstation) {
1902                                         uint32_t _relative_save_offset;
1903                                         _relative_save_offset = ndr->offset;
1904                                         NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->Workstation));
1905                                         _mem_save_Workstation_0 = NDR_PULL_GET_MEM_CTX(ndr);
1906                                         NDR_PULL_SET_MEM_CTX(ndr, r->Workstation, 0);
1907                                         {
1908                                                 struct ndr_pull *_ndr_Workstation;
1909                                                 NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_Workstation, 0, r->WorkstationLen));
1910                                                 NDR_CHECK(ndr_pull_string(_ndr_Workstation, NDR_SCALARS, &r->Workstation));
1911                                                 NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_Workstation, 0, r->WorkstationLen));
1912                                         }
1913                                         NDR_PULL_SET_MEM_CTX(ndr, _mem_save_Workstation_0, 0);
1914                                         ndr->offset = _relative_save_offset;
1915                                 }
1916                                 ndr->flags = _flags_save_string;
1917                         }
1918                         if (r->EncryptedRandomSessionKey) {
1919                                 uint32_t _relative_save_offset;
1920                                 _relative_save_offset = ndr->offset;
1921                                 NDR_CHECK(ndr_pull_relative_ptr2(ndr, r->EncryptedRandomSessionKey));
1922                                 _mem_save_EncryptedRandomSessionKey_0 = NDR_PULL_GET_MEM_CTX(ndr);
1923                                 NDR_PULL_SET_MEM_CTX(ndr, r->EncryptedRandomSessionKey, 0);
1924                                 {
1925                                         struct ndr_pull *_ndr_EncryptedRandomSessionKey;
1926                                         NDR_CHECK(ndr_pull_subcontext_start(ndr, &_ndr_EncryptedRandomSessionKey, 0, r->EncryptedRandomSessionKeyLen));
1927                                         NDR_CHECK(ndr_pull_DATA_BLOB(_ndr_EncryptedRandomSessionKey, NDR_SCALARS, r->EncryptedRandomSessionKey));
1928                                         NDR_CHECK(ndr_pull_subcontext_end(ndr, _ndr_EncryptedRandomSessionKey, 0, r->EncryptedRandomSessionKeyLen));
1929                                 }
1930                                 NDR_PULL_SET_MEM_CTX(ndr, _mem_save_EncryptedRandomSessionKey_0, 0);
1931                                 ndr->offset = _relative_save_offset;
1932                         }
1933                         NDR_CHECK(ndr_pull_ntlmssp_Version(ndr, NDR_BUFFERS, &r->Version));
1934                 }
1935                 ndr->flags = _flags_save_STRUCT;
1936         }
1937         return NDR_ERR_SUCCESS;
1938 }
1939
1940 _PUBLIC_ void ndr_print_AUTHENTICATE_MESSAGE(struct ndr_print *ndr, const char *name, const struct AUTHENTICATE_MESSAGE *r)
1941 {
1942         ndr_print_struct(ndr, name, "AUTHENTICATE_MESSAGE");
1943         {
1944                 uint32_t _flags_save_STRUCT = ndr->flags;
1945                 ndr_set_flags(&ndr->flags, LIBNDR_FLAG_REMAINING);
1946                 ndr->depth++;
1947                 ndr_print_string(ndr, "Signature", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?"NTLMSSP":r->Signature);
1948                 ndr_print_ntlmssp_MessageType(ndr, "MessageType", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?NtLmAuthenticate:r->MessageType);
1949                 ndr_print_uint16(ndr, "LmChallengeResponseLen", r->LmChallengeResponseLen);
1950                 ndr_print_uint16(ndr, "LmChallengeResponseMaxLen", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?r->LmChallengeResponseLen:r->LmChallengeResponseMaxLen);
1951                 ndr_print_ptr(ndr, "LmChallengeResponse", r->LmChallengeResponse);
1952                 ndr->depth++;
1953                 if (r->LmChallengeResponse) {
1954                         ndr_print_set_switch_value(ndr, r->LmChallengeResponse, r->LmChallengeResponseLen);
1955                         ndr_print_ntlmssp_LM_RESPONSE(ndr, "LmChallengeResponse", r->LmChallengeResponse);
1956                 }
1957                 ndr->depth--;
1958                 ndr_print_uint16(ndr, "NtChallengeResponseLen", r->NtChallengeResponseLen);
1959                 ndr_print_uint16(ndr, "NtChallengeResponseMaxLen", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?r->NtChallengeResponseLen:r->NtChallengeResponseMaxLen);
1960                 ndr_print_ptr(ndr, "NtChallengeResponse", r->NtChallengeResponse);
1961                 ndr->depth++;
1962                 if (r->NtChallengeResponse) {
1963                         ndr_print_set_switch_value(ndr, r->NtChallengeResponse, r->NtChallengeResponseLen);
1964                         ndr_print_ntlmssp_NTLM_RESPONSE(ndr, "NtChallengeResponse", r->NtChallengeResponse);
1965                 }
1966                 ndr->depth--;
1967                 ndr_print_uint16(ndr, "DomainNameLen", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?ndr_ntlmssp_string_length(r->NegotiateFlags, r->DomainName):r->DomainNameLen);
1968                 ndr_print_uint16(ndr, "DomainNameMaxLen", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?r->DomainNameLen:r->DomainNameMaxLen);
1969                 ndr_print_ptr(ndr, "DomainName", r->DomainName);
1970                 ndr->depth++;
1971                 if (r->DomainName) {
1972                         ndr_print_string(ndr, "DomainName", r->DomainName);
1973                 }
1974                 ndr->depth--;
1975                 ndr_print_uint16(ndr, "UserNameLen", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?ndr_ntlmssp_string_length(r->NegotiateFlags, r->UserName):r->UserNameLen);
1976                 ndr_print_uint16(ndr, "UserNameMaxLen", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?r->UserNameLen:r->UserNameMaxLen);
1977                 ndr_print_ptr(ndr, "UserName", r->UserName);
1978                 ndr->depth++;
1979                 if (r->UserName) {
1980                         ndr_print_string(ndr, "UserName", r->UserName);
1981                 }
1982                 ndr->depth--;
1983                 ndr_print_uint16(ndr, "WorkstationLen", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?ndr_ntlmssp_string_length(r->NegotiateFlags, r->Workstation):r->WorkstationLen);
1984                 ndr_print_uint16(ndr, "WorkstationMaxLen", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?r->WorkstationLen:r->WorkstationMaxLen);
1985                 ndr_print_ptr(ndr, "Workstation", r->Workstation);
1986                 ndr->depth++;
1987                 if (r->Workstation) {
1988                         ndr_print_string(ndr, "Workstation", r->Workstation);
1989                 }
1990                 ndr->depth--;
1991                 ndr_print_uint16(ndr, "EncryptedRandomSessionKeyLen", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?r->EncryptedRandomSessionKey->length:r->EncryptedRandomSessionKeyLen);
1992                 ndr_print_uint16(ndr, "EncryptedRandomSessionKeyMaxLen", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?r->EncryptedRandomSessionKeyLen:r->EncryptedRandomSessionKeyMaxLen);
1993                 ndr_print_ptr(ndr, "EncryptedRandomSessionKey", r->EncryptedRandomSessionKey);
1994                 ndr->depth++;
1995                 if (r->EncryptedRandomSessionKey) {
1996                         ndr_print_DATA_BLOB(ndr, "EncryptedRandomSessionKey", *r->EncryptedRandomSessionKey);
1997                 }
1998                 ndr->depth--;
1999                 ndr_print_NEGOTIATE(ndr, "NegotiateFlags", r->NegotiateFlags);
2000                 ndr_print_set_switch_value(ndr, &r->Version, r->NegotiateFlags & NTLMSSP_NEGOTIATE_VERSION);
2001                 ndr_print_ntlmssp_Version(ndr, "Version", &r->Version);
2002                 ndr->depth--;
2003                 ndr->flags = _flags_save_STRUCT;
2004         }
2005 }
2006
2007 _PUBLIC_ enum ndr_err_code ndr_push_NTLMSSP_MESSAGE_SIGNATURE(struct ndr_push *ndr, int ndr_flags, const struct NTLMSSP_MESSAGE_SIGNATURE *r)
2008 {
2009         if (ndr_flags & NDR_SCALARS) {
2010                 NDR_CHECK(ndr_push_align(ndr, 4));
2011                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, NTLMSSP_SIGN_VERSION));
2012                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->RandomPad));
2013                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->Checksum));
2014                 NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->SeqNum));
2015         }
2016         if (ndr_flags & NDR_BUFFERS) {
2017         }
2018         return NDR_ERR_SUCCESS;
2019 }
2020
2021 _PUBLIC_ enum ndr_err_code ndr_pull_NTLMSSP_MESSAGE_SIGNATURE(struct ndr_pull *ndr, int ndr_flags, struct NTLMSSP_MESSAGE_SIGNATURE *r)
2022 {
2023         if (ndr_flags & NDR_SCALARS) {
2024                 NDR_CHECK(ndr_pull_align(ndr, 4));
2025                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->Version));
2026                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->RandomPad));
2027                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->Checksum));
2028                 NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->SeqNum));
2029         }
2030         if (ndr_flags & NDR_BUFFERS) {
2031         }
2032         return NDR_ERR_SUCCESS;
2033 }
2034
2035 _PUBLIC_ void ndr_print_NTLMSSP_MESSAGE_SIGNATURE(struct ndr_print *ndr, const char *name, const struct NTLMSSP_MESSAGE_SIGNATURE *r)
2036 {
2037         ndr_print_struct(ndr, name, "NTLMSSP_MESSAGE_SIGNATURE");
2038         ndr->depth++;
2039         ndr_print_uint32(ndr, "Version", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?NTLMSSP_SIGN_VERSION:r->Version);
2040         ndr_print_uint32(ndr, "RandomPad", r->RandomPad);
2041         ndr_print_uint32(ndr, "Checksum", r->Checksum);
2042         ndr_print_uint32(ndr, "SeqNum", r->SeqNum);
2043         ndr->depth--;
2044 }
2045
2046 _PUBLIC_ enum ndr_err_code ndr_push_NTLMSSP_MESSAGE_SIGNATURE_NTLMv2(struct ndr_push *ndr, int ndr_flags, const struct NTLMSSP_MESSAGE_SIGNATURE_NTLMv2 *r)
2047 {
2048         {
2049                 uint32_t _flags_save_STRUCT = ndr->flags;
2050                 ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX);
2051                 if (ndr_flags & NDR_SCALARS) {
2052                         NDR_CHECK(ndr_push_align(ndr, 4));
2053                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, NTLMSSP_SIGN_VERSION));
2054                         NDR_CHECK(ndr_push_array_uint8(ndr, NDR_SCALARS, r->Checksum, 8));
2055                         NDR_CHECK(ndr_push_uint32(ndr, NDR_SCALARS, r->SeqNum));
2056                 }
2057                 if (ndr_flags & NDR_BUFFERS) {
2058                 }
2059                 ndr->flags = _flags_save_STRUCT;
2060         }
2061         return NDR_ERR_SUCCESS;
2062 }
2063
2064 _PUBLIC_ enum ndr_err_code ndr_pull_NTLMSSP_MESSAGE_SIGNATURE_NTLMv2(struct ndr_pull *ndr, int ndr_flags, struct NTLMSSP_MESSAGE_SIGNATURE_NTLMv2 *r)
2065 {
2066         {
2067                 uint32_t _flags_save_STRUCT = ndr->flags;
2068                 ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX);
2069                 if (ndr_flags & NDR_SCALARS) {
2070                         NDR_CHECK(ndr_pull_align(ndr, 4));
2071                         NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->Version));
2072                         NDR_CHECK(ndr_pull_array_uint8(ndr, NDR_SCALARS, r->Checksum, 8));
2073                         NDR_CHECK(ndr_pull_uint32(ndr, NDR_SCALARS, &r->SeqNum));
2074                 }
2075                 if (ndr_flags & NDR_BUFFERS) {
2076                 }
2077                 ndr->flags = _flags_save_STRUCT;
2078         }
2079         return NDR_ERR_SUCCESS;
2080 }
2081
2082 _PUBLIC_ void ndr_print_NTLMSSP_MESSAGE_SIGNATURE_NTLMv2(struct ndr_print *ndr, const char *name, const struct NTLMSSP_MESSAGE_SIGNATURE_NTLMv2 *r)
2083 {
2084         ndr_print_struct(ndr, name, "NTLMSSP_MESSAGE_SIGNATURE_NTLMv2");
2085         {
2086                 uint32_t _flags_save_STRUCT = ndr->flags;
2087                 ndr_set_flags(&ndr->flags, LIBNDR_PRINT_ARRAY_HEX);
2088                 ndr->depth++;
2089                 ndr_print_uint32(ndr, "Version", (ndr->flags & LIBNDR_PRINT_SET_VALUES)?NTLMSSP_SIGN_VERSION:r->Version);
2090                 ndr_print_array_uint8(ndr, "Checksum", r->Checksum, 8);
2091                 ndr_print_uint32(ndr, "SeqNum", r->SeqNum);
2092                 ndr->depth--;
2093                 ndr->flags = _flags_save_STRUCT;
2094         }
2095 }
2096
2097 static enum ndr_err_code ndr_push_decode_NEGOTIATE_MESSAGE(struct ndr_push *ndr, int flags, const struct decode_NEGOTIATE_MESSAGE *r)
2098 {
2099         if (flags & NDR_IN) {
2100                 NDR_CHECK(ndr_push_NEGOTIATE_MESSAGE(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.negotiate));
2101         }
2102         if (flags & NDR_OUT) {
2103         }
2104         return NDR_ERR_SUCCESS;
2105 }
2106
2107 static enum ndr_err_code ndr_pull_decode_NEGOTIATE_MESSAGE(struct ndr_pull *ndr, int flags, struct decode_NEGOTIATE_MESSAGE *r)
2108 {
2109         if (flags & NDR_IN) {
2110                 NDR_CHECK(ndr_pull_NEGOTIATE_MESSAGE(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.negotiate));
2111         }
2112         if (flags & NDR_OUT) {
2113         }
2114         return NDR_ERR_SUCCESS;
2115 }
2116
2117 _PUBLIC_ void ndr_print_decode_NEGOTIATE_MESSAGE(struct ndr_print *ndr, const char *name, int flags, const struct decode_NEGOTIATE_MESSAGE *r)
2118 {
2119         ndr_print_struct(ndr, name, "decode_NEGOTIATE_MESSAGE");
2120         ndr->depth++;
2121         if (flags & NDR_SET_VALUES) {
2122                 ndr->flags |= LIBNDR_PRINT_SET_VALUES;
2123         }
2124         if (flags & NDR_IN) {
2125                 ndr_print_struct(ndr, "in", "decode_NEGOTIATE_MESSAGE");
2126                 ndr->depth++;
2127                 ndr_print_NEGOTIATE_MESSAGE(ndr, "negotiate", &r->in.negotiate);
2128                 ndr->depth--;
2129         }
2130         if (flags & NDR_OUT) {
2131                 ndr_print_struct(ndr, "out", "decode_NEGOTIATE_MESSAGE");
2132                 ndr->depth++;
2133                 ndr->depth--;
2134         }
2135         ndr->depth--;
2136 }
2137
2138 static enum ndr_err_code ndr_push_decode_CHALLENGE_MESSAGE(struct ndr_push *ndr, int flags, const struct decode_CHALLENGE_MESSAGE *r)
2139 {
2140         if (flags & NDR_IN) {
2141                 NDR_CHECK(ndr_push_CHALLENGE_MESSAGE(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.challenge));
2142         }
2143         if (flags & NDR_OUT) {
2144         }
2145         return NDR_ERR_SUCCESS;
2146 }
2147
2148 static enum ndr_err_code ndr_pull_decode_CHALLENGE_MESSAGE(struct ndr_pull *ndr, int flags, struct decode_CHALLENGE_MESSAGE *r)
2149 {
2150         if (flags & NDR_IN) {
2151                 NDR_CHECK(ndr_pull_CHALLENGE_MESSAGE(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.challenge));
2152         }
2153         if (flags & NDR_OUT) {
2154         }
2155         return NDR_ERR_SUCCESS;
2156 }
2157
2158 _PUBLIC_ void ndr_print_decode_CHALLENGE_MESSAGE(struct ndr_print *ndr, const char *name, int flags, const struct decode_CHALLENGE_MESSAGE *r)
2159 {
2160         ndr_print_struct(ndr, name, "decode_CHALLENGE_MESSAGE");
2161         ndr->depth++;
2162         if (flags & NDR_SET_VALUES) {
2163                 ndr->flags |= LIBNDR_PRINT_SET_VALUES;
2164         }
2165         if (flags & NDR_IN) {
2166                 ndr_print_struct(ndr, "in", "decode_CHALLENGE_MESSAGE");
2167                 ndr->depth++;
2168                 ndr_print_CHALLENGE_MESSAGE(ndr, "challenge", &r->in.challenge);
2169                 ndr->depth--;
2170         }
2171         if (flags & NDR_OUT) {
2172                 ndr_print_struct(ndr, "out", "decode_CHALLENGE_MESSAGE");
2173                 ndr->depth++;
2174                 ndr->depth--;
2175         }
2176         ndr->depth--;
2177 }
2178
2179 static enum ndr_err_code ndr_push_decode_AUTHENTICATE_MESSAGE(struct ndr_push *ndr, int flags, const struct decode_AUTHENTICATE_MESSAGE *r)
2180 {
2181         if (flags & NDR_IN) {
2182                 NDR_CHECK(ndr_push_AUTHENTICATE_MESSAGE(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.authenticate));
2183         }
2184         if (flags & NDR_OUT) {
2185         }
2186         return NDR_ERR_SUCCESS;
2187 }
2188
2189 static enum ndr_err_code ndr_pull_decode_AUTHENTICATE_MESSAGE(struct ndr_pull *ndr, int flags, struct decode_AUTHENTICATE_MESSAGE *r)
2190 {
2191         if (flags & NDR_IN) {
2192                 NDR_CHECK(ndr_pull_AUTHENTICATE_MESSAGE(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.authenticate));
2193         }
2194         if (flags & NDR_OUT) {
2195         }
2196         return NDR_ERR_SUCCESS;
2197 }
2198
2199 _PUBLIC_ void ndr_print_decode_AUTHENTICATE_MESSAGE(struct ndr_print *ndr, const char *name, int flags, const struct decode_AUTHENTICATE_MESSAGE *r)
2200 {
2201         ndr_print_struct(ndr, name, "decode_AUTHENTICATE_MESSAGE");
2202         ndr->depth++;
2203         if (flags & NDR_SET_VALUES) {
2204                 ndr->flags |= LIBNDR_PRINT_SET_VALUES;
2205         }
2206         if (flags & NDR_IN) {
2207                 ndr_print_struct(ndr, "in", "decode_AUTHENTICATE_MESSAGE");
2208                 ndr->depth++;
2209                 ndr_print_AUTHENTICATE_MESSAGE(ndr, "authenticate", &r->in.authenticate);
2210                 ndr->depth--;
2211         }
2212         if (flags & NDR_OUT) {
2213                 ndr_print_struct(ndr, "out", "decode_AUTHENTICATE_MESSAGE");
2214                 ndr->depth++;
2215                 ndr->depth--;
2216         }
2217         ndr->depth--;
2218 }
2219
2220 static enum ndr_err_code ndr_push_decode_NTLMv2_CLIENT_CHALLENGE(struct ndr_push *ndr, int flags, const struct decode_NTLMv2_CLIENT_CHALLENGE *r)
2221 {
2222         if (flags & NDR_IN) {
2223                 NDR_CHECK(ndr_push_NTLMv2_CLIENT_CHALLENGE(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.challenge));
2224         }
2225         if (flags & NDR_OUT) {
2226         }
2227         return NDR_ERR_SUCCESS;
2228 }
2229
2230 static enum ndr_err_code ndr_pull_decode_NTLMv2_CLIENT_CHALLENGE(struct ndr_pull *ndr, int flags, struct decode_NTLMv2_CLIENT_CHALLENGE *r)
2231 {
2232         if (flags & NDR_IN) {
2233                 NDR_CHECK(ndr_pull_NTLMv2_CLIENT_CHALLENGE(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.challenge));
2234         }
2235         if (flags & NDR_OUT) {
2236         }
2237         return NDR_ERR_SUCCESS;
2238 }
2239
2240 _PUBLIC_ void ndr_print_decode_NTLMv2_CLIENT_CHALLENGE(struct ndr_print *ndr, const char *name, int flags, const struct decode_NTLMv2_CLIENT_CHALLENGE *r)
2241 {
2242         ndr_print_struct(ndr, name, "decode_NTLMv2_CLIENT_CHALLENGE");
2243         ndr->depth++;
2244         if (flags & NDR_SET_VALUES) {
2245                 ndr->flags |= LIBNDR_PRINT_SET_VALUES;
2246         }
2247         if (flags & NDR_IN) {
2248                 ndr_print_struct(ndr, "in", "decode_NTLMv2_CLIENT_CHALLENGE");
2249                 ndr->depth++;
2250                 ndr_print_NTLMv2_CLIENT_CHALLENGE(ndr, "challenge", &r->in.challenge);
2251                 ndr->depth--;
2252         }
2253         if (flags & NDR_OUT) {
2254                 ndr_print_struct(ndr, "out", "decode_NTLMv2_CLIENT_CHALLENGE");
2255                 ndr->depth++;
2256                 ndr->depth--;
2257         }
2258         ndr->depth--;
2259 }
2260
2261 static const struct ndr_interface_call ntlmssp_calls[] = {
2262         {
2263                 "decode_NEGOTIATE_MESSAGE",
2264                 sizeof(struct decode_NEGOTIATE_MESSAGE),
2265                 (ndr_push_flags_fn_t) ndr_push_decode_NEGOTIATE_MESSAGE,
2266                 (ndr_pull_flags_fn_t) ndr_pull_decode_NEGOTIATE_MESSAGE,
2267                 (ndr_print_function_t) ndr_print_decode_NEGOTIATE_MESSAGE,
2268                 false,
2269         },
2270         {
2271                 "decode_CHALLENGE_MESSAGE",
2272                 sizeof(struct decode_CHALLENGE_MESSAGE),
2273                 (ndr_push_flags_fn_t) ndr_push_decode_CHALLENGE_MESSAGE,
2274                 (ndr_pull_flags_fn_t) ndr_pull_decode_CHALLENGE_MESSAGE,
2275                 (ndr_print_function_t) ndr_print_decode_CHALLENGE_MESSAGE,
2276                 false,
2277         },
2278         {
2279                 "decode_AUTHENTICATE_MESSAGE",
2280                 sizeof(struct decode_AUTHENTICATE_MESSAGE),
2281                 (ndr_push_flags_fn_t) ndr_push_decode_AUTHENTICATE_MESSAGE,
2282                 (ndr_pull_flags_fn_t) ndr_pull_decode_AUTHENTICATE_MESSAGE,
2283                 (ndr_print_function_t) ndr_print_decode_AUTHENTICATE_MESSAGE,
2284                 false,
2285         },
2286         {
2287                 "decode_NTLMv2_CLIENT_CHALLENGE",
2288                 sizeof(struct decode_NTLMv2_CLIENT_CHALLENGE),
2289                 (ndr_push_flags_fn_t) ndr_push_decode_NTLMv2_CLIENT_CHALLENGE,
2290                 (ndr_pull_flags_fn_t) ndr_pull_decode_NTLMv2_CLIENT_CHALLENGE,
2291                 (ndr_print_function_t) ndr_print_decode_NTLMv2_CLIENT_CHALLENGE,
2292                 false,
2293         },
2294         { NULL, 0, NULL, NULL, NULL, false }
2295 };
2296
2297 static const char * const ntlmssp_endpoint_strings[] = {
2298         "ncacn_np:[\\pipe\\ntlmssp]",
2299 };
2300
2301 static const struct ndr_interface_string_array ntlmssp_endpoints = {
2302         .count  = 1,
2303         .names  = ntlmssp_endpoint_strings
2304 };
2305
2306 static const char * const ntlmssp_authservice_strings[] = {
2307         "host",
2308 };
2309
2310 static const struct ndr_interface_string_array ntlmssp_authservices = {
2311         .count  = 1,
2312         .names  = ntlmssp_authservice_strings
2313 };
2314
2315
2316 const struct ndr_interface_table ndr_table_ntlmssp = {
2317         .name           = "ntlmssp",
2318         .syntax_id      = {
2319                 {0x6e746c6d,0x7373,0x700a,{0x00,0x00},{0x00,0x00,0x00,0x00}},
2320                 NDR_NTLMSSP_VERSION
2321         },
2322         .helpstring     = NDR_NTLMSSP_HELPSTRING,
2323         .num_calls      = 4,
2324         .calls          = ntlmssp_calls,
2325         .endpoints      = &ntlmssp_endpoints,
2326         .authservices   = &ntlmssp_authservices
2327 };
2328