1 /* parser auto-generated by pidl */
4 #include "../librpc/gen_ndr/ndr_ntlmssp.h"
6 static enum ndr_err_code
ndr_push_ntlmssp_MessageType(struct ndr_push
*ndr
, int ndr_flags
, enum ntlmssp_MessageType r
)
8 NDR_CHECK(ndr_push_enum_uint32(ndr
, NDR_SCALARS
, r
));
9 return NDR_ERR_SUCCESS
;
12 static enum ndr_err_code
ndr_pull_ntlmssp_MessageType(struct ndr_pull
*ndr
, int ndr_flags
, enum ntlmssp_MessageType
*r
)
15 NDR_CHECK(ndr_pull_enum_uint32(ndr
, NDR_SCALARS
, &v
));
17 return NDR_ERR_SUCCESS
;
20 _PUBLIC_
void ndr_print_ntlmssp_MessageType(struct ndr_print
*ndr
, const char *name
, enum ntlmssp_MessageType r
)
22 const char *val
= NULL
;
25 case NtLmNegotiate
: val
= "NtLmNegotiate"; break;
26 case NtLmChallenge
: val
= "NtLmChallenge"; break;
27 case NtLmAuthenticate
: val
= "NtLmAuthenticate"; break;
29 ndr_print_enum(ndr
, name
, "ENUM", val
, r
);
32 static enum ndr_err_code
ndr_push_NEGOTIATE(struct ndr_push
*ndr
, int ndr_flags
, uint32_t r
)
34 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
, r
));
35 return NDR_ERR_SUCCESS
;
38 static enum ndr_err_code
ndr_pull_NEGOTIATE(struct ndr_pull
*ndr
, int ndr_flags
, uint32_t *r
)
41 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &v
));
43 return NDR_ERR_SUCCESS
;
46 _PUBLIC_
void ndr_print_NEGOTIATE(struct ndr_print
*ndr
, const char *name
, uint32_t r
)
48 ndr_print_uint32(ndr
, name
, r
);
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
);
79 static enum ndr_err_code
ndr_push_ntlmssp_WindowsMajorVersion(struct ndr_push
*ndr
, int ndr_flags
, enum ntlmssp_WindowsMajorVersion r
)
81 NDR_CHECK(ndr_push_enum_uint8(ndr
, NDR_SCALARS
, r
));
82 return NDR_ERR_SUCCESS
;
85 static enum ndr_err_code
ndr_pull_ntlmssp_WindowsMajorVersion(struct ndr_pull
*ndr
, int ndr_flags
, enum ntlmssp_WindowsMajorVersion
*r
)
88 NDR_CHECK(ndr_pull_enum_uint8(ndr
, NDR_SCALARS
, &v
));
90 return NDR_ERR_SUCCESS
;
93 _PUBLIC_
void ndr_print_ntlmssp_WindowsMajorVersion(struct ndr_print
*ndr
, const char *name
, enum ntlmssp_WindowsMajorVersion r
)
95 const char *val
= NULL
;
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;
101 ndr_print_enum(ndr
, name
, "ENUM", val
, r
);
104 static enum ndr_err_code
ndr_push_ntlmssp_WindowsMinorVersion(struct ndr_push
*ndr
, int ndr_flags
, enum ntlmssp_WindowsMinorVersion r
)
106 NDR_CHECK(ndr_push_enum_uint8(ndr
, NDR_SCALARS
, r
));
107 return NDR_ERR_SUCCESS
;
110 static enum ndr_err_code
ndr_pull_ntlmssp_WindowsMinorVersion(struct ndr_pull
*ndr
, int ndr_flags
, enum ntlmssp_WindowsMinorVersion
*r
)
113 NDR_CHECK(ndr_pull_enum_uint8(ndr
, NDR_SCALARS
, &v
));
115 return NDR_ERR_SUCCESS
;
118 _PUBLIC_
void ndr_print_ntlmssp_WindowsMinorVersion(struct ndr_print
*ndr
, const char *name
, enum ntlmssp_WindowsMinorVersion r
)
120 const char *val
= NULL
;
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;
127 ndr_print_enum(ndr
, name
, "ENUM", val
, r
);
130 static enum ndr_err_code
ndr_push_ntlmssp_NTLMRevisionCurrent(struct ndr_push
*ndr
, int ndr_flags
, enum ntlmssp_NTLMRevisionCurrent r
)
132 NDR_CHECK(ndr_push_enum_uint8(ndr
, NDR_SCALARS
, r
));
133 return NDR_ERR_SUCCESS
;
136 static enum ndr_err_code
ndr_pull_ntlmssp_NTLMRevisionCurrent(struct ndr_pull
*ndr
, int ndr_flags
, enum ntlmssp_NTLMRevisionCurrent
*r
)
139 NDR_CHECK(ndr_pull_enum_uint8(ndr
, NDR_SCALARS
, &v
));
141 return NDR_ERR_SUCCESS
;
144 _PUBLIC_
void ndr_print_ntlmssp_NTLMRevisionCurrent(struct ndr_print
*ndr
, const char *name
, enum ntlmssp_NTLMRevisionCurrent r
)
146 const char *val
= NULL
;
149 case NTLMSSP_REVISION_W2K3_RC1
: val
= "NTLMSSP_REVISION_W2K3_RC1"; break;
150 case NTLMSSP_REVISION_W2K3
: val
= "NTLMSSP_REVISION_W2K3"; break;
152 ndr_print_enum(ndr
, name
, "ENUM", val
, r
);
155 static enum ndr_err_code
ndr_push_VERSION(struct ndr_push
*ndr
, int ndr_flags
, const struct VERSION
*r
)
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 NDR_CHECK(ndr_push_trailer_align(ndr
, 2));
166 if (ndr_flags
& NDR_BUFFERS
) {
168 return NDR_ERR_SUCCESS
;
171 static enum ndr_err_code
ndr_pull_VERSION(struct ndr_pull
*ndr
, int ndr_flags
, struct VERSION
*r
)
173 if (ndr_flags
& NDR_SCALARS
) {
174 NDR_CHECK(ndr_pull_align(ndr
, 2));
175 NDR_CHECK(ndr_pull_ntlmssp_WindowsMajorVersion(ndr
, NDR_SCALARS
, &r
->ProductMajorVersion
));
176 NDR_CHECK(ndr_pull_ntlmssp_WindowsMinorVersion(ndr
, NDR_SCALARS
, &r
->ProductMinorVersion
));
177 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->ProductBuild
));
178 NDR_CHECK(ndr_pull_array_uint8(ndr
, NDR_SCALARS
, r
->Reserved
, 3));
179 NDR_CHECK(ndr_pull_ntlmssp_NTLMRevisionCurrent(ndr
, NDR_SCALARS
, &r
->NTLMRevisionCurrent
));
180 NDR_CHECK(ndr_pull_trailer_align(ndr
, 2));
182 if (ndr_flags
& NDR_BUFFERS
) {
184 return NDR_ERR_SUCCESS
;
187 _PUBLIC_
void ndr_print_VERSION(struct ndr_print
*ndr
, const char *name
, const struct VERSION
*r
)
189 ndr_print_struct(ndr
, name
, "VERSION");
191 ndr_print_ntlmssp_WindowsMajorVersion(ndr
, "ProductMajorVersion", r
->ProductMajorVersion
);
192 ndr_print_ntlmssp_WindowsMinorVersion(ndr
, "ProductMinorVersion", r
->ProductMinorVersion
);
193 ndr_print_uint16(ndr
, "ProductBuild", r
->ProductBuild
);
194 ndr_print_array_uint8(ndr
, "Reserved", r
->Reserved
, 3);
195 ndr_print_ntlmssp_NTLMRevisionCurrent(ndr
, "NTLMRevisionCurrent", r
->NTLMRevisionCurrent
);
199 static enum ndr_err_code
ndr_push_ntlmssp_Version(struct ndr_push
*ndr
, int ndr_flags
, const union ntlmssp_Version
*r
)
201 if (ndr_flags
& NDR_SCALARS
) {
202 int level
= ndr_push_get_switch_value(ndr
, r
);
203 NDR_CHECK(ndr_push_union_align(ndr
, 2));
205 case NTLMSSP_NEGOTIATE_VERSION
: {
206 NDR_CHECK(ndr_push_VERSION(ndr
, NDR_SCALARS
, &r
->version
));
214 if (ndr_flags
& NDR_BUFFERS
) {
215 int level
= ndr_push_get_switch_value(ndr
, r
);
217 case NTLMSSP_NEGOTIATE_VERSION
:
225 return NDR_ERR_SUCCESS
;
228 static enum ndr_err_code
ndr_pull_ntlmssp_Version(struct ndr_pull
*ndr
, int ndr_flags
, union ntlmssp_Version
*r
)
231 level
= ndr_pull_get_switch_value(ndr
, r
);
232 if (ndr_flags
& NDR_SCALARS
) {
233 NDR_CHECK(ndr_pull_union_align(ndr
, 2));
235 case NTLMSSP_NEGOTIATE_VERSION
: {
236 NDR_CHECK(ndr_pull_VERSION(ndr
, NDR_SCALARS
, &r
->version
));
244 if (ndr_flags
& NDR_BUFFERS
) {
246 case NTLMSSP_NEGOTIATE_VERSION
:
254 return NDR_ERR_SUCCESS
;
257 _PUBLIC_
enum ndr_err_code
ndr_push_NEGOTIATE_MESSAGE(struct ndr_push
*ndr
, int ndr_flags
, const struct NEGOTIATE_MESSAGE
*r
)
259 if (ndr_flags
& NDR_SCALARS
) {
260 NDR_CHECK(ndr_push_align(ndr
, 5));
261 NDR_CHECK(ndr_push_charset(ndr
, NDR_SCALARS
, "NTLMSSP", 8, sizeof(uint8_t), CH_DOS
));
262 NDR_CHECK(ndr_push_ntlmssp_MessageType(ndr
, NDR_SCALARS
, NtLmNegotiate
));
263 NDR_CHECK(ndr_push_NEGOTIATE(ndr
, NDR_SCALARS
, r
->NegotiateFlags
));
264 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, strlen(r
->DomainName
)));
265 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, strlen(r
->DomainName
)));
267 uint32_t _flags_save_string
= ndr
->flags
;
268 ndr_set_flags(&ndr
->flags
, ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_OEM
));
269 NDR_CHECK(ndr_push_relative_ptr1(ndr
, r
->DomainName
));
270 ndr
->flags
= _flags_save_string
;
272 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, strlen(r
->Workstation
)));
273 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, strlen(r
->Workstation
)));
275 uint32_t _flags_save_string
= ndr
->flags
;
276 ndr_set_flags(&ndr
->flags
, ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_OEM
));
277 NDR_CHECK(ndr_push_relative_ptr1(ndr
, r
->Workstation
));
278 ndr
->flags
= _flags_save_string
;
280 NDR_CHECK(ndr_push_set_switch_value(ndr
, &r
->Version
, r
->NegotiateFlags
& NTLMSSP_NEGOTIATE_VERSION
));
281 NDR_CHECK(ndr_push_ntlmssp_Version(ndr
, NDR_SCALARS
, &r
->Version
));
282 NDR_CHECK(ndr_push_trailer_align(ndr
, 5));
284 if (ndr_flags
& NDR_BUFFERS
) {
286 uint32_t _flags_save_string
= ndr
->flags
;
287 ndr_set_flags(&ndr
->flags
, ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_OEM
));
289 NDR_CHECK(ndr_push_relative_ptr2_start(ndr
, r
->DomainName
));
291 struct ndr_push
*_ndr_DomainName
;
292 NDR_CHECK(ndr_push_subcontext_start(ndr
, &_ndr_DomainName
, 0, strlen(r
->DomainName
)));
293 NDR_CHECK(ndr_push_string(_ndr_DomainName
, NDR_SCALARS
, r
->DomainName
));
294 NDR_CHECK(ndr_push_subcontext_end(ndr
, _ndr_DomainName
, 0, strlen(r
->DomainName
)));
296 NDR_CHECK(ndr_push_relative_ptr2_end(ndr
, r
->DomainName
));
298 ndr
->flags
= _flags_save_string
;
301 uint32_t _flags_save_string
= ndr
->flags
;
302 ndr_set_flags(&ndr
->flags
, ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_OEM
));
303 if (r
->Workstation
) {
304 NDR_CHECK(ndr_push_relative_ptr2_start(ndr
, r
->Workstation
));
306 struct ndr_push
*_ndr_Workstation
;
307 NDR_CHECK(ndr_push_subcontext_start(ndr
, &_ndr_Workstation
, 0, strlen(r
->Workstation
)));
308 NDR_CHECK(ndr_push_string(_ndr_Workstation
, NDR_SCALARS
, r
->Workstation
));
309 NDR_CHECK(ndr_push_subcontext_end(ndr
, _ndr_Workstation
, 0, strlen(r
->Workstation
)));
311 NDR_CHECK(ndr_push_relative_ptr2_end(ndr
, r
->Workstation
));
313 ndr
->flags
= _flags_save_string
;
315 NDR_CHECK(ndr_push_ntlmssp_Version(ndr
, NDR_BUFFERS
, &r
->Version
));
317 return NDR_ERR_SUCCESS
;
320 _PUBLIC_
enum ndr_err_code
ndr_pull_NEGOTIATE_MESSAGE(struct ndr_pull
*ndr
, int ndr_flags
, struct NEGOTIATE_MESSAGE
*r
)
322 uint32_t _ptr_DomainName
;
323 TALLOC_CTX
*_mem_save_DomainName_0
;
324 uint32_t _ptr_Workstation
;
325 TALLOC_CTX
*_mem_save_Workstation_0
;
326 if (ndr_flags
& NDR_SCALARS
) {
327 NDR_CHECK(ndr_pull_align(ndr
, 5));
328 NDR_CHECK(ndr_pull_charset(ndr
, NDR_SCALARS
, &r
->Signature
, 8, sizeof(uint8_t), CH_DOS
));
329 NDR_CHECK(ndr_pull_ntlmssp_MessageType(ndr
, NDR_SCALARS
, &r
->MessageType
));
330 NDR_CHECK(ndr_pull_NEGOTIATE(ndr
, NDR_SCALARS
, &r
->NegotiateFlags
));
331 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->DomainNameLen
));
332 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->DomainNameMaxLen
));
334 uint32_t _flags_save_string
= ndr
->flags
;
335 ndr_set_flags(&ndr
->flags
, ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_OEM
));
336 NDR_CHECK(ndr_pull_generic_ptr(ndr
, &_ptr_DomainName
));
337 if (_ptr_DomainName
) {
338 NDR_PULL_ALLOC(ndr
, r
->DomainName
);
339 NDR_CHECK(ndr_pull_relative_ptr1(ndr
, r
->DomainName
, _ptr_DomainName
));
341 r
->DomainName
= NULL
;
343 ndr
->flags
= _flags_save_string
;
345 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->WorkstationLen
));
346 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->WorkstationMaxLen
));
348 uint32_t _flags_save_string
= ndr
->flags
;
349 ndr_set_flags(&ndr
->flags
, ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_OEM
));
350 NDR_CHECK(ndr_pull_generic_ptr(ndr
, &_ptr_Workstation
));
351 if (_ptr_Workstation
) {
352 NDR_PULL_ALLOC(ndr
, r
->Workstation
);
353 NDR_CHECK(ndr_pull_relative_ptr1(ndr
, r
->Workstation
, _ptr_Workstation
));
355 r
->Workstation
= NULL
;
357 ndr
->flags
= _flags_save_string
;
359 NDR_CHECK(ndr_pull_set_switch_value(ndr
, &r
->Version
, r
->NegotiateFlags
& NTLMSSP_NEGOTIATE_VERSION
));
360 NDR_CHECK(ndr_pull_ntlmssp_Version(ndr
, NDR_SCALARS
, &r
->Version
));
361 NDR_CHECK(ndr_pull_trailer_align(ndr
, 5));
363 if (ndr_flags
& NDR_BUFFERS
) {
365 uint32_t _flags_save_string
= ndr
->flags
;
366 ndr_set_flags(&ndr
->flags
, ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_OEM
));
368 uint32_t _relative_save_offset
;
369 _relative_save_offset
= ndr
->offset
;
370 NDR_CHECK(ndr_pull_relative_ptr2(ndr
, r
->DomainName
));
371 _mem_save_DomainName_0
= NDR_PULL_GET_MEM_CTX(ndr
);
372 NDR_PULL_SET_MEM_CTX(ndr
, r
->DomainName
, 0);
374 struct ndr_pull
*_ndr_DomainName
;
375 NDR_CHECK(ndr_pull_subcontext_start(ndr
, &_ndr_DomainName
, 0, r
->DomainNameLen
));
376 NDR_CHECK(ndr_pull_string(_ndr_DomainName
, NDR_SCALARS
, &r
->DomainName
));
377 NDR_CHECK(ndr_pull_subcontext_end(ndr
, _ndr_DomainName
, 0, r
->DomainNameLen
));
379 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_DomainName_0
, 0);
380 ndr
->offset
= _relative_save_offset
;
382 ndr
->flags
= _flags_save_string
;
385 uint32_t _flags_save_string
= ndr
->flags
;
386 ndr_set_flags(&ndr
->flags
, ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_OEM
));
387 if (r
->Workstation
) {
388 uint32_t _relative_save_offset
;
389 _relative_save_offset
= ndr
->offset
;
390 NDR_CHECK(ndr_pull_relative_ptr2(ndr
, r
->Workstation
));
391 _mem_save_Workstation_0
= NDR_PULL_GET_MEM_CTX(ndr
);
392 NDR_PULL_SET_MEM_CTX(ndr
, r
->Workstation
, 0);
394 struct ndr_pull
*_ndr_Workstation
;
395 NDR_CHECK(ndr_pull_subcontext_start(ndr
, &_ndr_Workstation
, 0, r
->WorkstationLen
));
396 NDR_CHECK(ndr_pull_string(_ndr_Workstation
, NDR_SCALARS
, &r
->Workstation
));
397 NDR_CHECK(ndr_pull_subcontext_end(ndr
, _ndr_Workstation
, 0, r
->WorkstationLen
));
399 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_Workstation_0
, 0);
400 ndr
->offset
= _relative_save_offset
;
402 ndr
->flags
= _flags_save_string
;
404 NDR_CHECK(ndr_pull_ntlmssp_Version(ndr
, NDR_BUFFERS
, &r
->Version
));
406 return NDR_ERR_SUCCESS
;
409 _PUBLIC_
void ndr_print_NEGOTIATE_MESSAGE(struct ndr_print
*ndr
, const char *name
, const struct NEGOTIATE_MESSAGE
*r
)
411 ndr_print_struct(ndr
, name
, "NEGOTIATE_MESSAGE");
413 ndr_print_string(ndr
, "Signature", (ndr
->flags
& LIBNDR_PRINT_SET_VALUES
)?"NTLMSSP":r
->Signature
);
414 ndr_print_ntlmssp_MessageType(ndr
, "MessageType", (ndr
->flags
& LIBNDR_PRINT_SET_VALUES
)?NtLmNegotiate
:r
->MessageType
);
415 ndr_print_NEGOTIATE(ndr
, "NegotiateFlags", r
->NegotiateFlags
);
416 ndr_print_uint16(ndr
, "DomainNameLen", (ndr
->flags
& LIBNDR_PRINT_SET_VALUES
)?strlen(r
->DomainName
):r
->DomainNameLen
);
417 ndr_print_uint16(ndr
, "DomainNameMaxLen", (ndr
->flags
& LIBNDR_PRINT_SET_VALUES
)?r
->DomainNameLen
:r
->DomainNameMaxLen
);
418 ndr_print_ptr(ndr
, "DomainName", r
->DomainName
);
421 ndr_print_string(ndr
, "DomainName", r
->DomainName
);
424 ndr_print_uint16(ndr
, "WorkstationLen", (ndr
->flags
& LIBNDR_PRINT_SET_VALUES
)?strlen(r
->Workstation
):r
->WorkstationLen
);
425 ndr_print_uint16(ndr
, "WorkstationMaxLen", (ndr
->flags
& LIBNDR_PRINT_SET_VALUES
)?r
->WorkstationLen
:r
->WorkstationMaxLen
);
426 ndr_print_ptr(ndr
, "Workstation", r
->Workstation
);
428 if (r
->Workstation
) {
429 ndr_print_string(ndr
, "Workstation", r
->Workstation
);
432 ndr_print_set_switch_value(ndr
, &r
->Version
, r
->NegotiateFlags
& NTLMSSP_NEGOTIATE_VERSION
);
433 ndr_print_ntlmssp_Version(ndr
, "Version", &r
->Version
);
437 static enum ndr_err_code
ndr_push_ntlmssp_AvId(struct ndr_push
*ndr
, int ndr_flags
, enum ntlmssp_AvId r
)
439 NDR_CHECK(ndr_push_enum_uint1632(ndr
, NDR_SCALARS
, r
));
440 return NDR_ERR_SUCCESS
;
443 static enum ndr_err_code
ndr_pull_ntlmssp_AvId(struct ndr_pull
*ndr
, int ndr_flags
, enum ntlmssp_AvId
*r
)
446 NDR_CHECK(ndr_pull_enum_uint1632(ndr
, NDR_SCALARS
, &v
));
448 return NDR_ERR_SUCCESS
;
451 _PUBLIC_
void ndr_print_ntlmssp_AvId(struct ndr_print
*ndr
, const char *name
, enum ntlmssp_AvId r
)
453 const char *val
= NULL
;
456 case MsvAvEOL
: val
= "MsvAvEOL"; break;
457 case MsvAvNbComputerName
: val
= "MsvAvNbComputerName"; break;
458 case MsvAvNbDomainName
: val
= "MsvAvNbDomainName"; break;
459 case MsvAvDnsComputerName
: val
= "MsvAvDnsComputerName"; break;
460 case MsvAvDnsDomainName
: val
= "MsvAvDnsDomainName"; break;
461 case MsvAvDnsTreeName
: val
= "MsvAvDnsTreeName"; break;
462 case MsvAvFlags
: val
= "MsvAvFlags"; break;
463 case MsvAvTimestamp
: val
= "MsvAvTimestamp"; break;
464 case MsAvRestrictions
: val
= "MsAvRestrictions"; break;
465 case MsvAvTargetName
: val
= "MsvAvTargetName"; break;
466 case MsvChannelBindings
: val
= "MsvChannelBindings"; break;
468 ndr_print_enum(ndr
, name
, "ENUM", val
, r
);
471 static enum ndr_err_code
ndr_push_Restriction_Encoding(struct ndr_push
*ndr
, int ndr_flags
, const struct Restriction_Encoding
*r
)
473 if (ndr_flags
& NDR_SCALARS
) {
474 NDR_CHECK(ndr_push_align(ndr
, 4));
475 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
, r
->Size
));
476 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
, 0));
477 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
, r
->IntegrityLevel
));
478 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
, r
->SubjectIntegrityLevel
));
479 NDR_CHECK(ndr_push_array_uint8(ndr
, NDR_SCALARS
, r
->MachineId
, 32));
480 NDR_CHECK(ndr_push_trailer_align(ndr
, 4));
482 if (ndr_flags
& NDR_BUFFERS
) {
484 return NDR_ERR_SUCCESS
;
487 static enum ndr_err_code
ndr_pull_Restriction_Encoding(struct ndr_pull
*ndr
, int ndr_flags
, struct Restriction_Encoding
*r
)
489 if (ndr_flags
& NDR_SCALARS
) {
490 NDR_CHECK(ndr_pull_align(ndr
, 4));
491 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &r
->Size
));
492 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &r
->Z4
));
493 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &r
->IntegrityLevel
));
494 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &r
->SubjectIntegrityLevel
));
495 NDR_CHECK(ndr_pull_array_uint8(ndr
, NDR_SCALARS
, r
->MachineId
, 32));
496 NDR_CHECK(ndr_pull_trailer_align(ndr
, 4));
498 if (ndr_flags
& NDR_BUFFERS
) {
500 return NDR_ERR_SUCCESS
;
503 _PUBLIC_
void ndr_print_Restriction_Encoding(struct ndr_print
*ndr
, const char *name
, const struct Restriction_Encoding
*r
)
505 ndr_print_struct(ndr
, name
, "Restriction_Encoding");
507 ndr_print_uint32(ndr
, "Size", r
->Size
);
508 ndr_print_uint32(ndr
, "Z4", (ndr
->flags
& LIBNDR_PRINT_SET_VALUES
)?0:r
->Z4
);
509 ndr_print_uint32(ndr
, "IntegrityLevel", r
->IntegrityLevel
);
510 ndr_print_uint32(ndr
, "SubjectIntegrityLevel", r
->SubjectIntegrityLevel
);
511 ndr_print_array_uint8(ndr
, "MachineId", r
->MachineId
, 32);
515 static enum ndr_err_code
ndr_push_ntlmssp_AvFlags(struct ndr_push
*ndr
, int ndr_flags
, uint32_t r
)
517 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
, r
));
518 return NDR_ERR_SUCCESS
;
521 static enum ndr_err_code
ndr_pull_ntlmssp_AvFlags(struct ndr_pull
*ndr
, int ndr_flags
, uint32_t *r
)
524 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &v
));
526 return NDR_ERR_SUCCESS
;
529 _PUBLIC_
void ndr_print_ntlmssp_AvFlags(struct ndr_print
*ndr
, const char *name
, uint32_t r
)
531 ndr_print_uint32(ndr
, name
, r
);
533 ndr_print_bitmap_flag(ndr
, sizeof(uint32_t), "NTLMSSP_AVFLAG_CONSTRAINTED_ACCOUNT", NTLMSSP_AVFLAG_CONSTRAINTED_ACCOUNT
, r
);
534 ndr_print_bitmap_flag(ndr
, sizeof(uint32_t), "NTLMSSP_AVFLAG_MIC_IN_AUTHENTICATE_MESSAGE", NTLMSSP_AVFLAG_MIC_IN_AUTHENTICATE_MESSAGE
, r
);
538 static enum ndr_err_code
ndr_push_ntlmssp_AvValue(struct ndr_push
*ndr
, int ndr_flags
, const union ntlmssp_AvValue
*r
)
541 uint32_t _flags_save_UNION
= ndr
->flags
;
542 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_NOALIGN
);
543 if (ndr_flags
& NDR_SCALARS
) {
544 int level
= ndr_push_get_switch_value(ndr
, r
);
545 NDR_CHECK(ndr_push_union_align(ndr
, 4));
550 case MsvAvNbComputerName
: {
552 uint32_t _flags_save_string
= ndr
->flags
;
553 ndr_set_flags(&ndr
->flags
, ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_UNICODE
));
554 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->AvNbComputerName
));
555 ndr
->flags
= _flags_save_string
;
559 case MsvAvNbDomainName
: {
561 uint32_t _flags_save_string
= ndr
->flags
;
562 ndr_set_flags(&ndr
->flags
, ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_UNICODE
));
563 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->AvNbDomainName
));
564 ndr
->flags
= _flags_save_string
;
568 case MsvAvDnsComputerName
: {
570 uint32_t _flags_save_string
= ndr
->flags
;
571 ndr_set_flags(&ndr
->flags
, ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_UNICODE
));
572 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->AvDnsComputerName
));
573 ndr
->flags
= _flags_save_string
;
577 case MsvAvDnsDomainName
: {
579 uint32_t _flags_save_string
= ndr
->flags
;
580 ndr_set_flags(&ndr
->flags
, ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_UNICODE
));
581 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->AvDnsDomainName
));
582 ndr
->flags
= _flags_save_string
;
586 case MsvAvDnsTreeName
: {
588 uint32_t _flags_save_string
= ndr
->flags
;
589 ndr_set_flags(&ndr
->flags
, ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_UNICODE
));
590 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->AvDnsTreeName
));
591 ndr
->flags
= _flags_save_string
;
596 NDR_CHECK(ndr_push_ntlmssp_AvFlags(ndr
, NDR_SCALARS
, r
->AvFlags
));
599 case MsvAvTimestamp
: {
600 NDR_CHECK(ndr_push_NTTIME(ndr
, NDR_SCALARS
, r
->AvTimestamp
));
603 case MsAvRestrictions
: {
604 NDR_CHECK(ndr_push_Restriction_Encoding(ndr
, NDR_SCALARS
, &r
->AvRestrictions
));
607 case MsvAvTargetName
: {
609 uint32_t _flags_save_string
= ndr
->flags
;
610 ndr_set_flags(&ndr
->flags
, ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_UNICODE
));
611 NDR_CHECK(ndr_push_string(ndr
, NDR_SCALARS
, r
->AvTargetName
));
612 ndr
->flags
= _flags_save_string
;
616 case MsvChannelBindings
: {
617 NDR_CHECK(ndr_push_array_uint8(ndr
, NDR_SCALARS
, r
->ChannelBindings
, 16));
622 uint32_t _flags_save_DATA_BLOB
= ndr
->flags
;
623 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_REMAINING
);
624 NDR_CHECK(ndr_push_DATA_BLOB(ndr
, NDR_SCALARS
, r
->blob
));
625 ndr
->flags
= _flags_save_DATA_BLOB
;
631 if (ndr_flags
& NDR_BUFFERS
) {
632 int level
= ndr_push_get_switch_value(ndr
, r
);
637 case MsvAvNbComputerName
:
640 case MsvAvNbDomainName
:
643 case MsvAvDnsComputerName
:
646 case MsvAvDnsDomainName
:
649 case MsvAvDnsTreeName
:
658 case MsAvRestrictions
:
661 case MsvAvTargetName
:
664 case MsvChannelBindings
:
672 ndr
->flags
= _flags_save_UNION
;
674 return NDR_ERR_SUCCESS
;
677 static enum ndr_err_code
ndr_pull_ntlmssp_AvValue(struct ndr_pull
*ndr
, int ndr_flags
, union ntlmssp_AvValue
*r
)
681 uint32_t _flags_save_UNION
= ndr
->flags
;
682 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_NOALIGN
);
683 level
= ndr_pull_get_switch_value(ndr
, r
);
684 if (ndr_flags
& NDR_SCALARS
) {
685 NDR_CHECK(ndr_pull_union_align(ndr
, 4));
690 case MsvAvNbComputerName
: {
692 uint32_t _flags_save_string
= ndr
->flags
;
693 ndr_set_flags(&ndr
->flags
, ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_UNICODE
));
694 NDR_CHECK(ndr_pull_string(ndr
, NDR_SCALARS
, &r
->AvNbComputerName
));
695 ndr
->flags
= _flags_save_string
;
699 case MsvAvNbDomainName
: {
701 uint32_t _flags_save_string
= ndr
->flags
;
702 ndr_set_flags(&ndr
->flags
, ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_UNICODE
));
703 NDR_CHECK(ndr_pull_string(ndr
, NDR_SCALARS
, &r
->AvNbDomainName
));
704 ndr
->flags
= _flags_save_string
;
708 case MsvAvDnsComputerName
: {
710 uint32_t _flags_save_string
= ndr
->flags
;
711 ndr_set_flags(&ndr
->flags
, ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_UNICODE
));
712 NDR_CHECK(ndr_pull_string(ndr
, NDR_SCALARS
, &r
->AvDnsComputerName
));
713 ndr
->flags
= _flags_save_string
;
717 case MsvAvDnsDomainName
: {
719 uint32_t _flags_save_string
= ndr
->flags
;
720 ndr_set_flags(&ndr
->flags
, ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_UNICODE
));
721 NDR_CHECK(ndr_pull_string(ndr
, NDR_SCALARS
, &r
->AvDnsDomainName
));
722 ndr
->flags
= _flags_save_string
;
726 case MsvAvDnsTreeName
: {
728 uint32_t _flags_save_string
= ndr
->flags
;
729 ndr_set_flags(&ndr
->flags
, ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_UNICODE
));
730 NDR_CHECK(ndr_pull_string(ndr
, NDR_SCALARS
, &r
->AvDnsTreeName
));
731 ndr
->flags
= _flags_save_string
;
736 NDR_CHECK(ndr_pull_ntlmssp_AvFlags(ndr
, NDR_SCALARS
, &r
->AvFlags
));
739 case MsvAvTimestamp
: {
740 NDR_CHECK(ndr_pull_NTTIME(ndr
, NDR_SCALARS
, &r
->AvTimestamp
));
743 case MsAvRestrictions
: {
744 NDR_CHECK(ndr_pull_Restriction_Encoding(ndr
, NDR_SCALARS
, &r
->AvRestrictions
));
747 case MsvAvTargetName
: {
749 uint32_t _flags_save_string
= ndr
->flags
;
750 ndr_set_flags(&ndr
->flags
, ndr_ntlmssp_negotiated_string_flags(NTLMSSP_NEGOTIATE_UNICODE
));
751 NDR_CHECK(ndr_pull_string(ndr
, NDR_SCALARS
, &r
->AvTargetName
));
752 ndr
->flags
= _flags_save_string
;
756 case MsvChannelBindings
: {
757 NDR_CHECK(ndr_pull_array_uint8(ndr
, NDR_SCALARS
, r
->ChannelBindings
, 16));
762 uint32_t _flags_save_DATA_BLOB
= ndr
->flags
;
763 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_REMAINING
);
764 NDR_CHECK(ndr_pull_DATA_BLOB(ndr
, NDR_SCALARS
, &r
->blob
));
765 ndr
->flags
= _flags_save_DATA_BLOB
;
771 if (ndr_flags
& NDR_BUFFERS
) {
776 case MsvAvNbComputerName
:
779 case MsvAvNbDomainName
:
782 case MsvAvDnsComputerName
:
785 case MsvAvDnsDomainName
:
788 case MsvAvDnsTreeName
:
797 case MsAvRestrictions
:
800 case MsvAvTargetName
:
803 case MsvChannelBindings
:
811 ndr
->flags
= _flags_save_UNION
;
813 return NDR_ERR_SUCCESS
;
816 _PUBLIC_
void ndr_print_ntlmssp_AvValue(struct ndr_print
*ndr
, const char *name
, const union ntlmssp_AvValue
*r
)
820 uint32_t _flags_save_UNION
= ndr
->flags
;
821 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_NOALIGN
);
822 level
= ndr_print_get_switch_value(ndr
, r
);
823 ndr_print_union(ndr
, name
, level
, "ntlmssp_AvValue");
828 case MsvAvNbComputerName
:
829 ndr_print_string(ndr
, "AvNbComputerName", r
->AvNbComputerName
);
832 case MsvAvNbDomainName
:
833 ndr_print_string(ndr
, "AvNbDomainName", r
->AvNbDomainName
);
836 case MsvAvDnsComputerName
:
837 ndr_print_string(ndr
, "AvDnsComputerName", r
->AvDnsComputerName
);
840 case MsvAvDnsDomainName
:
841 ndr_print_string(ndr
, "AvDnsDomainName", r
->AvDnsDomainName
);
844 case MsvAvDnsTreeName
:
845 ndr_print_string(ndr
, "AvDnsTreeName", r
->AvDnsTreeName
);
849 ndr_print_ntlmssp_AvFlags(ndr
, "AvFlags", r
->AvFlags
);
853 ndr_print_NTTIME(ndr
, "AvTimestamp", r
->AvTimestamp
);
856 case MsAvRestrictions
:
857 ndr_print_Restriction_Encoding(ndr
, "AvRestrictions", &r
->AvRestrictions
);
860 case MsvAvTargetName
:
861 ndr_print_string(ndr
, "AvTargetName", r
->AvTargetName
);
864 case MsvChannelBindings
:
865 ndr_print_array_uint8(ndr
, "ChannelBindings", r
->ChannelBindings
, 16);
869 ndr_print_DATA_BLOB(ndr
, "blob", r
->blob
);
873 ndr
->flags
= _flags_save_UNION
;
877 static size_t ndr_size_ntlmssp_AvValue(const union ntlmssp_AvValue
*r
, uint32_t level
, struct smb_iconv_convenience
*ic
, int flags
)
879 flags
|= LIBNDR_FLAG_NOALIGN
;
880 return ndr_size_union(r
, flags
, level
, (ndr_push_flags_fn_t
)ndr_push_ntlmssp_AvValue
, ic
);
883 _PUBLIC_
enum ndr_err_code
ndr_push_AV_PAIR(struct ndr_push
*ndr
, int ndr_flags
, const struct AV_PAIR
*r
)
886 uint32_t _flags_save_STRUCT
= ndr
->flags
;
887 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_NOALIGN
);
888 if (ndr_flags
& NDR_SCALARS
) {
889 NDR_CHECK(ndr_push_align(ndr
, 4));
890 NDR_CHECK(ndr_push_ntlmssp_AvId(ndr
, NDR_SCALARS
, r
->AvId
));
891 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, ndr_size_ntlmssp_AvValue(&r
->Value
, r
->AvId
, ndr
->iconv_convenience
, 0)));
893 struct ndr_push
*_ndr_Value
;
894 NDR_CHECK(ndr_push_subcontext_start(ndr
, &_ndr_Value
, 0, ndr_size_ntlmssp_AvValue(&r
->Value
, r
->AvId
, ndr
->iconv_convenience
, 0)));
895 NDR_CHECK(ndr_push_set_switch_value(_ndr_Value
, &r
->Value
, r
->AvId
));
896 NDR_CHECK(ndr_push_ntlmssp_AvValue(_ndr_Value
, NDR_SCALARS
|NDR_BUFFERS
, &r
->Value
));
897 NDR_CHECK(ndr_push_subcontext_end(ndr
, _ndr_Value
, 0, ndr_size_ntlmssp_AvValue(&r
->Value
, r
->AvId
, ndr
->iconv_convenience
, 0)));
899 NDR_CHECK(ndr_push_trailer_align(ndr
, 4));
901 if (ndr_flags
& NDR_BUFFERS
) {
903 ndr
->flags
= _flags_save_STRUCT
;
905 return NDR_ERR_SUCCESS
;
908 _PUBLIC_
enum ndr_err_code
ndr_pull_AV_PAIR(struct ndr_pull
*ndr
, int ndr_flags
, struct AV_PAIR
*r
)
911 uint32_t _flags_save_STRUCT
= ndr
->flags
;
912 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_NOALIGN
);
913 if (ndr_flags
& NDR_SCALARS
) {
914 NDR_CHECK(ndr_pull_align(ndr
, 4));
915 NDR_CHECK(ndr_pull_ntlmssp_AvId(ndr
, NDR_SCALARS
, &r
->AvId
));
916 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->AvLen
));
918 struct ndr_pull
*_ndr_Value
;
919 NDR_CHECK(ndr_pull_subcontext_start(ndr
, &_ndr_Value
, 0, r
->AvLen
));
920 NDR_CHECK(ndr_pull_set_switch_value(_ndr_Value
, &r
->Value
, r
->AvId
));
921 NDR_CHECK(ndr_pull_ntlmssp_AvValue(_ndr_Value
, NDR_SCALARS
|NDR_BUFFERS
, &r
->Value
));
922 NDR_CHECK(ndr_pull_subcontext_end(ndr
, _ndr_Value
, 0, r
->AvLen
));
924 NDR_CHECK(ndr_pull_trailer_align(ndr
, 4));
926 if (ndr_flags
& NDR_BUFFERS
) {
928 ndr
->flags
= _flags_save_STRUCT
;
930 return NDR_ERR_SUCCESS
;
933 _PUBLIC_
void ndr_print_AV_PAIR(struct ndr_print
*ndr
, const char *name
, const struct AV_PAIR
*r
)
935 ndr_print_struct(ndr
, name
, "AV_PAIR");
937 uint32_t _flags_save_STRUCT
= ndr
->flags
;
938 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_NOALIGN
);
940 ndr_print_ntlmssp_AvId(ndr
, "AvId", r
->AvId
);
941 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
);
942 ndr_print_set_switch_value(ndr
, &r
->Value
, r
->AvId
);
943 ndr_print_ntlmssp_AvValue(ndr
, "Value", &r
->Value
);
945 ndr
->flags
= _flags_save_STRUCT
;
949 _PUBLIC_
void ndr_print_AV_PAIR_LIST(struct ndr_print
*ndr
, const char *name
, const struct AV_PAIR_LIST
*r
)
951 uint32_t cntr_pair_0
;
952 ndr_print_struct(ndr
, name
, "AV_PAIR_LIST");
954 uint32_t _flags_save_STRUCT
= ndr
->flags
;
955 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_NOALIGN
);
957 ndr_print_uint32(ndr
, "count", r
->count
);
958 ndr
->print(ndr
, "%s: ARRAY(%d)", "pair", (int)r
->count
);
960 for (cntr_pair_0
=0;cntr_pair_0
<r
->count
;cntr_pair_0
++) {
962 if (asprintf(&idx_0
, "[%d]", cntr_pair_0
) != -1) {
963 ndr_print_AV_PAIR(ndr
, "pair", &r
->pair
[cntr_pair_0
]);
969 ndr
->flags
= _flags_save_STRUCT
;
973 static size_t ndr_size_AV_PAIR_LIST(const struct AV_PAIR_LIST
*r
, struct smb_iconv_convenience
*ic
, int flags
)
975 flags
|= LIBNDR_FLAG_NOALIGN
;
976 return ndr_size_struct(r
, flags
, (ndr_push_flags_fn_t
)ndr_push_AV_PAIR_LIST
, ic
);
979 _PUBLIC_
enum ndr_err_code
ndr_push_CHALLENGE_MESSAGE(struct ndr_push
*ndr
, int ndr_flags
, const struct CHALLENGE_MESSAGE
*r
)
982 uint32_t _flags_save_STRUCT
= ndr
->flags
;
983 ndr_set_flags(&ndr
->flags
, LIBNDR_PRINT_ARRAY_HEX
);
984 if (ndr_flags
& NDR_SCALARS
) {
985 NDR_CHECK(ndr_push_align(ndr
, 5));
986 NDR_CHECK(ndr_push_charset(ndr
, NDR_SCALARS
, "NTLMSSP", 8, sizeof(uint8_t), CH_DOS
));
987 NDR_CHECK(ndr_push_ntlmssp_MessageType(ndr
, NDR_SCALARS
, NtLmChallenge
));
988 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, ndr_ntlmssp_string_length(r
->NegotiateFlags
, r
->TargetName
)));
989 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, ndr_ntlmssp_string_length(r
->NegotiateFlags
, r
->TargetName
)));
991 uint32_t _flags_save_string
= ndr
->flags
;
992 ndr_set_flags(&ndr
->flags
, ndr_ntlmssp_negotiated_string_flags(r
->NegotiateFlags
));
993 NDR_CHECK(ndr_push_relative_ptr1(ndr
, r
->TargetName
));
994 ndr
->flags
= _flags_save_string
;
996 NDR_CHECK(ndr_push_NEGOTIATE(ndr
, NDR_SCALARS
, r
->NegotiateFlags
));
997 NDR_CHECK(ndr_push_array_uint8(ndr
, NDR_SCALARS
, r
->ServerChallenge
, 8));
998 NDR_CHECK(ndr_push_array_uint8(ndr
, NDR_SCALARS
, r
->Reserved
, 8));
999 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, ndr_size_AV_PAIR_LIST(r
->TargetInfo
, ndr
->iconv_convenience
, ndr
->flags
)));
1000 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, ndr_size_AV_PAIR_LIST(r
->TargetInfo
, ndr
->iconv_convenience
, ndr
->flags
)));
1001 NDR_CHECK(ndr_push_relative_ptr1(ndr
, r
->TargetInfo
));
1002 NDR_CHECK(ndr_push_set_switch_value(ndr
, &r
->Version
, r
->NegotiateFlags
& NTLMSSP_NEGOTIATE_VERSION
));
1003 NDR_CHECK(ndr_push_ntlmssp_Version(ndr
, NDR_SCALARS
, &r
->Version
));
1004 NDR_CHECK(ndr_push_trailer_align(ndr
, 5));
1006 if (ndr_flags
& NDR_BUFFERS
) {
1008 uint32_t _flags_save_string
= ndr
->flags
;
1009 ndr_set_flags(&ndr
->flags
, ndr_ntlmssp_negotiated_string_flags(r
->NegotiateFlags
));
1010 if (r
->TargetName
) {
1011 NDR_CHECK(ndr_push_relative_ptr2_start(ndr
, r
->TargetName
));
1013 struct ndr_push
*_ndr_TargetName
;
1014 NDR_CHECK(ndr_push_subcontext_start(ndr
, &_ndr_TargetName
, 0, ndr_ntlmssp_string_length(r
->NegotiateFlags
, r
->TargetName
)));
1015 NDR_CHECK(ndr_push_string(_ndr_TargetName
, NDR_SCALARS
, r
->TargetName
));
1016 NDR_CHECK(ndr_push_subcontext_end(ndr
, _ndr_TargetName
, 0, ndr_ntlmssp_string_length(r
->NegotiateFlags
, r
->TargetName
)));
1018 NDR_CHECK(ndr_push_relative_ptr2_end(ndr
, r
->TargetName
));
1020 ndr
->flags
= _flags_save_string
;
1022 if (r
->TargetInfo
) {
1023 NDR_CHECK(ndr_push_relative_ptr2_start(ndr
, r
->TargetInfo
));
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
)));
1030 NDR_CHECK(ndr_push_relative_ptr2_end(ndr
, r
->TargetInfo
));
1032 NDR_CHECK(ndr_push_ntlmssp_Version(ndr
, NDR_BUFFERS
, &r
->Version
));
1034 ndr
->flags
= _flags_save_STRUCT
;
1036 return NDR_ERR_SUCCESS
;
1039 _PUBLIC_
enum ndr_err_code
ndr_pull_CHALLENGE_MESSAGE(struct ndr_pull
*ndr
, int ndr_flags
, struct CHALLENGE_MESSAGE
*r
)
1041 uint32_t _ptr_TargetName
;
1042 TALLOC_CTX
*_mem_save_TargetName_0
;
1043 uint32_t _ptr_TargetInfo
;
1044 TALLOC_CTX
*_mem_save_TargetInfo_0
;
1046 uint32_t _flags_save_STRUCT
= ndr
->flags
;
1047 ndr_set_flags(&ndr
->flags
, LIBNDR_PRINT_ARRAY_HEX
);
1048 if (ndr_flags
& NDR_SCALARS
) {
1049 NDR_CHECK(ndr_pull_align(ndr
, 5));
1050 NDR_CHECK(ndr_pull_charset(ndr
, NDR_SCALARS
, &r
->Signature
, 8, sizeof(uint8_t), CH_DOS
));
1051 NDR_CHECK(ndr_pull_ntlmssp_MessageType(ndr
, NDR_SCALARS
, &r
->MessageType
));
1052 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->TargetNameLen
));
1053 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->TargetNameMaxLen
));
1055 uint32_t _flags_save_string
= ndr
->flags
;
1056 ndr_set_flags(&ndr
->flags
, ndr_ntlmssp_negotiated_string_flags(r
->NegotiateFlags
));
1057 NDR_CHECK(ndr_pull_generic_ptr(ndr
, &_ptr_TargetName
));
1058 if (_ptr_TargetName
) {
1059 NDR_PULL_ALLOC(ndr
, r
->TargetName
);
1060 NDR_CHECK(ndr_pull_relative_ptr1(ndr
, r
->TargetName
, _ptr_TargetName
));
1062 r
->TargetName
= NULL
;
1064 ndr
->flags
= _flags_save_string
;
1066 NDR_CHECK(ndr_pull_NEGOTIATE(ndr
, NDR_SCALARS
, &r
->NegotiateFlags
));
1067 NDR_CHECK(ndr_pull_array_uint8(ndr
, NDR_SCALARS
, r
->ServerChallenge
, 8));
1068 NDR_CHECK(ndr_pull_array_uint8(ndr
, NDR_SCALARS
, r
->Reserved
, 8));
1069 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->TargetInfoLen
));
1070 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->TargetNameInfoMaxLen
));
1071 NDR_CHECK(ndr_pull_generic_ptr(ndr
, &_ptr_TargetInfo
));
1072 if (_ptr_TargetInfo
) {
1073 NDR_PULL_ALLOC(ndr
, r
->TargetInfo
);
1074 NDR_CHECK(ndr_pull_relative_ptr1(ndr
, r
->TargetInfo
, _ptr_TargetInfo
));
1076 r
->TargetInfo
= NULL
;
1078 NDR_CHECK(ndr_pull_set_switch_value(ndr
, &r
->Version
, r
->NegotiateFlags
& NTLMSSP_NEGOTIATE_VERSION
));
1079 NDR_CHECK(ndr_pull_ntlmssp_Version(ndr
, NDR_SCALARS
, &r
->Version
));
1080 NDR_CHECK(ndr_pull_trailer_align(ndr
, 5));
1082 if (ndr_flags
& NDR_BUFFERS
) {
1084 uint32_t _flags_save_string
= ndr
->flags
;
1085 ndr_set_flags(&ndr
->flags
, ndr_ntlmssp_negotiated_string_flags(r
->NegotiateFlags
));
1086 if (r
->TargetName
) {
1087 uint32_t _relative_save_offset
;
1088 _relative_save_offset
= ndr
->offset
;
1089 NDR_CHECK(ndr_pull_relative_ptr2(ndr
, r
->TargetName
));
1090 _mem_save_TargetName_0
= NDR_PULL_GET_MEM_CTX(ndr
);
1091 NDR_PULL_SET_MEM_CTX(ndr
, r
->TargetName
, 0);
1093 struct ndr_pull
*_ndr_TargetName
;
1094 NDR_CHECK(ndr_pull_subcontext_start(ndr
, &_ndr_TargetName
, 0, r
->TargetNameLen
));
1095 NDR_CHECK(ndr_pull_string(_ndr_TargetName
, NDR_SCALARS
, &r
->TargetName
));
1096 NDR_CHECK(ndr_pull_subcontext_end(ndr
, _ndr_TargetName
, 0, r
->TargetNameLen
));
1098 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_TargetName_0
, 0);
1099 ndr
->offset
= _relative_save_offset
;
1101 ndr
->flags
= _flags_save_string
;
1103 if (r
->TargetInfo
) {
1104 uint32_t _relative_save_offset
;
1105 _relative_save_offset
= ndr
->offset
;
1106 NDR_CHECK(ndr_pull_relative_ptr2(ndr
, r
->TargetInfo
));
1107 _mem_save_TargetInfo_0
= NDR_PULL_GET_MEM_CTX(ndr
);
1108 NDR_PULL_SET_MEM_CTX(ndr
, r
->TargetInfo
, 0);
1110 struct ndr_pull
*_ndr_TargetInfo
;
1111 NDR_CHECK(ndr_pull_subcontext_start(ndr
, &_ndr_TargetInfo
, 0, r
->TargetInfoLen
));
1112 NDR_CHECK(ndr_pull_AV_PAIR_LIST(_ndr_TargetInfo
, NDR_SCALARS
|NDR_BUFFERS
, r
->TargetInfo
));
1113 NDR_CHECK(ndr_pull_subcontext_end(ndr
, _ndr_TargetInfo
, 0, r
->TargetInfoLen
));
1115 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_TargetInfo_0
, 0);
1116 ndr
->offset
= _relative_save_offset
;
1118 NDR_CHECK(ndr_pull_ntlmssp_Version(ndr
, NDR_BUFFERS
, &r
->Version
));
1120 ndr
->flags
= _flags_save_STRUCT
;
1122 return NDR_ERR_SUCCESS
;
1125 _PUBLIC_
void ndr_print_CHALLENGE_MESSAGE(struct ndr_print
*ndr
, const char *name
, const struct CHALLENGE_MESSAGE
*r
)
1127 ndr_print_struct(ndr
, name
, "CHALLENGE_MESSAGE");
1129 uint32_t _flags_save_STRUCT
= ndr
->flags
;
1130 ndr_set_flags(&ndr
->flags
, LIBNDR_PRINT_ARRAY_HEX
);
1132 ndr_print_string(ndr
, "Signature", (ndr
->flags
& LIBNDR_PRINT_SET_VALUES
)?"NTLMSSP":r
->Signature
);
1133 ndr_print_ntlmssp_MessageType(ndr
, "MessageType", (ndr
->flags
& LIBNDR_PRINT_SET_VALUES
)?NtLmChallenge
:r
->MessageType
);
1134 ndr_print_uint16(ndr
, "TargetNameLen", (ndr
->flags
& LIBNDR_PRINT_SET_VALUES
)?ndr_ntlmssp_string_length(r
->NegotiateFlags
, r
->TargetName
):r
->TargetNameLen
);
1135 ndr_print_uint16(ndr
, "TargetNameMaxLen", (ndr
->flags
& LIBNDR_PRINT_SET_VALUES
)?r
->TargetNameLen
:r
->TargetNameMaxLen
);
1136 ndr_print_ptr(ndr
, "TargetName", r
->TargetName
);
1138 if (r
->TargetName
) {
1139 ndr_print_string(ndr
, "TargetName", r
->TargetName
);
1142 ndr_print_NEGOTIATE(ndr
, "NegotiateFlags", r
->NegotiateFlags
);
1143 ndr_print_array_uint8(ndr
, "ServerChallenge", r
->ServerChallenge
, 8);
1144 ndr_print_array_uint8(ndr
, "Reserved", r
->Reserved
, 8);
1145 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
);
1146 ndr_print_uint16(ndr
, "TargetNameInfoMaxLen", (ndr
->flags
& LIBNDR_PRINT_SET_VALUES
)?r
->TargetInfoLen
:r
->TargetNameInfoMaxLen
);
1147 ndr_print_ptr(ndr
, "TargetInfo", r
->TargetInfo
);
1149 if (r
->TargetInfo
) {
1150 ndr_print_AV_PAIR_LIST(ndr
, "TargetInfo", r
->TargetInfo
);
1153 ndr_print_set_switch_value(ndr
, &r
->Version
, r
->NegotiateFlags
& NTLMSSP_NEGOTIATE_VERSION
);
1154 ndr_print_ntlmssp_Version(ndr
, "Version", &r
->Version
);
1156 ndr
->flags
= _flags_save_STRUCT
;
1160 _PUBLIC_
enum ndr_err_code
ndr_push_LM_RESPONSE(struct ndr_push
*ndr
, int ndr_flags
, const struct LM_RESPONSE
*r
)
1163 uint32_t _flags_save_STRUCT
= ndr
->flags
;
1164 ndr_set_flags(&ndr
->flags
, LIBNDR_PRINT_ARRAY_HEX
);
1165 if (ndr_flags
& NDR_SCALARS
) {
1166 NDR_CHECK(ndr_push_align(ndr
, 1));
1167 NDR_CHECK(ndr_push_array_uint8(ndr
, NDR_SCALARS
, r
->Response
, 24));
1168 NDR_CHECK(ndr_push_trailer_align(ndr
, 1));
1170 if (ndr_flags
& NDR_BUFFERS
) {
1172 ndr
->flags
= _flags_save_STRUCT
;
1174 return NDR_ERR_SUCCESS
;
1177 _PUBLIC_
enum ndr_err_code
ndr_pull_LM_RESPONSE(struct ndr_pull
*ndr
, int ndr_flags
, struct LM_RESPONSE
*r
)
1180 uint32_t _flags_save_STRUCT
= ndr
->flags
;
1181 ndr_set_flags(&ndr
->flags
, LIBNDR_PRINT_ARRAY_HEX
);
1182 if (ndr_flags
& NDR_SCALARS
) {
1183 NDR_CHECK(ndr_pull_align(ndr
, 1));
1184 NDR_CHECK(ndr_pull_array_uint8(ndr
, NDR_SCALARS
, r
->Response
, 24));
1185 NDR_CHECK(ndr_pull_trailer_align(ndr
, 1));
1187 if (ndr_flags
& NDR_BUFFERS
) {
1189 ndr
->flags
= _flags_save_STRUCT
;
1191 return NDR_ERR_SUCCESS
;
1194 _PUBLIC_
void ndr_print_LM_RESPONSE(struct ndr_print
*ndr
, const char *name
, const struct LM_RESPONSE
*r
)
1196 ndr_print_struct(ndr
, name
, "LM_RESPONSE");
1198 uint32_t _flags_save_STRUCT
= ndr
->flags
;
1199 ndr_set_flags(&ndr
->flags
, LIBNDR_PRINT_ARRAY_HEX
);
1201 ndr_print_array_uint8(ndr
, "Response", r
->Response
, 24);
1203 ndr
->flags
= _flags_save_STRUCT
;
1207 _PUBLIC_
enum ndr_err_code
ndr_push_LMv2_RESPONSE(struct ndr_push
*ndr
, int ndr_flags
, const struct LMv2_RESPONSE
*r
)
1210 uint32_t _flags_save_STRUCT
= ndr
->flags
;
1211 ndr_set_flags(&ndr
->flags
, LIBNDR_PRINT_ARRAY_HEX
);
1212 if (ndr_flags
& NDR_SCALARS
) {
1213 NDR_CHECK(ndr_push_align(ndr
, 1));
1214 NDR_CHECK(ndr_push_array_uint8(ndr
, NDR_SCALARS
, r
->Response
, 16));
1215 NDR_CHECK(ndr_push_array_uint8(ndr
, NDR_SCALARS
, r
->ChallengeFromClient
, 8));
1216 NDR_CHECK(ndr_push_trailer_align(ndr
, 1));
1218 if (ndr_flags
& NDR_BUFFERS
) {
1220 ndr
->flags
= _flags_save_STRUCT
;
1222 return NDR_ERR_SUCCESS
;
1225 _PUBLIC_
enum ndr_err_code
ndr_pull_LMv2_RESPONSE(struct ndr_pull
*ndr
, int ndr_flags
, struct LMv2_RESPONSE
*r
)
1228 uint32_t _flags_save_STRUCT
= ndr
->flags
;
1229 ndr_set_flags(&ndr
->flags
, LIBNDR_PRINT_ARRAY_HEX
);
1230 if (ndr_flags
& NDR_SCALARS
) {
1231 NDR_CHECK(ndr_pull_align(ndr
, 1));
1232 NDR_CHECK(ndr_pull_array_uint8(ndr
, NDR_SCALARS
, r
->Response
, 16));
1233 NDR_CHECK(ndr_pull_array_uint8(ndr
, NDR_SCALARS
, r
->ChallengeFromClient
, 8));
1234 NDR_CHECK(ndr_pull_trailer_align(ndr
, 1));
1236 if (ndr_flags
& NDR_BUFFERS
) {
1238 ndr
->flags
= _flags_save_STRUCT
;
1240 return NDR_ERR_SUCCESS
;
1243 _PUBLIC_
void ndr_print_LMv2_RESPONSE(struct ndr_print
*ndr
, const char *name
, const struct LMv2_RESPONSE
*r
)
1245 ndr_print_struct(ndr
, name
, "LMv2_RESPONSE");
1247 uint32_t _flags_save_STRUCT
= ndr
->flags
;
1248 ndr_set_flags(&ndr
->flags
, LIBNDR_PRINT_ARRAY_HEX
);
1250 ndr_print_array_uint8(ndr
, "Response", r
->Response
, 16);
1251 ndr_print_array_uint8(ndr
, "ChallengeFromClient", r
->ChallengeFromClient
, 8);
1253 ndr
->flags
= _flags_save_STRUCT
;
1257 static enum ndr_err_code
ndr_push_ntlmssp_LM_RESPONSE(struct ndr_push
*ndr
, int ndr_flags
, const union ntlmssp_LM_RESPONSE
*r
)
1259 if (ndr_flags
& NDR_SCALARS
) {
1260 int level
= ndr_push_get_switch_value(ndr
, r
);
1261 NDR_CHECK(ndr_push_union_align(ndr
, 1));
1264 NDR_CHECK(ndr_push_LM_RESPONSE(ndr
, NDR_SCALARS
, &r
->v1
));
1272 if (ndr_flags
& NDR_BUFFERS
) {
1273 int level
= ndr_push_get_switch_value(ndr
, r
);
1283 return NDR_ERR_SUCCESS
;
1286 static enum ndr_err_code
ndr_pull_ntlmssp_LM_RESPONSE(struct ndr_pull
*ndr
, int ndr_flags
, union ntlmssp_LM_RESPONSE
*r
)
1289 level
= ndr_pull_get_switch_value(ndr
, r
);
1290 if (ndr_flags
& NDR_SCALARS
) {
1291 NDR_CHECK(ndr_pull_union_align(ndr
, 1));
1294 NDR_CHECK(ndr_pull_LM_RESPONSE(ndr
, NDR_SCALARS
, &r
->v1
));
1302 if (ndr_flags
& NDR_BUFFERS
) {
1312 return NDR_ERR_SUCCESS
;
1315 _PUBLIC_
void ndr_print_ntlmssp_LM_RESPONSE(struct ndr_print
*ndr
, const char *name
, const union ntlmssp_LM_RESPONSE
*r
)
1318 level
= ndr_print_get_switch_value(ndr
, r
);
1319 ndr_print_union(ndr
, name
, level
, "ntlmssp_LM_RESPONSE");
1322 ndr_print_LM_RESPONSE(ndr
, "v1", &r
->v1
);
1331 _PUBLIC_
enum ndr_err_code
ndr_push_NTLM_RESPONSE(struct ndr_push
*ndr
, int ndr_flags
, const struct NTLM_RESPONSE
*r
)
1334 uint32_t _flags_save_STRUCT
= ndr
->flags
;
1335 ndr_set_flags(&ndr
->flags
, LIBNDR_PRINT_ARRAY_HEX
);
1336 if (ndr_flags
& NDR_SCALARS
) {
1337 NDR_CHECK(ndr_push_align(ndr
, 1));
1338 NDR_CHECK(ndr_push_array_uint8(ndr
, NDR_SCALARS
, r
->Response
, 24));
1339 NDR_CHECK(ndr_push_trailer_align(ndr
, 1));
1341 if (ndr_flags
& NDR_BUFFERS
) {
1343 ndr
->flags
= _flags_save_STRUCT
;
1345 return NDR_ERR_SUCCESS
;
1348 _PUBLIC_
enum ndr_err_code
ndr_pull_NTLM_RESPONSE(struct ndr_pull
*ndr
, int ndr_flags
, struct NTLM_RESPONSE
*r
)
1351 uint32_t _flags_save_STRUCT
= ndr
->flags
;
1352 ndr_set_flags(&ndr
->flags
, LIBNDR_PRINT_ARRAY_HEX
);
1353 if (ndr_flags
& NDR_SCALARS
) {
1354 NDR_CHECK(ndr_pull_align(ndr
, 1));
1355 NDR_CHECK(ndr_pull_array_uint8(ndr
, NDR_SCALARS
, r
->Response
, 24));
1356 NDR_CHECK(ndr_pull_trailer_align(ndr
, 1));
1358 if (ndr_flags
& NDR_BUFFERS
) {
1360 ndr
->flags
= _flags_save_STRUCT
;
1362 return NDR_ERR_SUCCESS
;
1365 _PUBLIC_
void ndr_print_NTLM_RESPONSE(struct ndr_print
*ndr
, const char *name
, const struct NTLM_RESPONSE
*r
)
1367 ndr_print_struct(ndr
, name
, "NTLM_RESPONSE");
1369 uint32_t _flags_save_STRUCT
= ndr
->flags
;
1370 ndr_set_flags(&ndr
->flags
, LIBNDR_PRINT_ARRAY_HEX
);
1372 ndr_print_array_uint8(ndr
, "Response", r
->Response
, 24);
1374 ndr
->flags
= _flags_save_STRUCT
;
1378 static enum ndr_err_code
ndr_push_NTLMv2_CLIENT_CHALLENGE(struct ndr_push
*ndr
, int ndr_flags
, const struct NTLMv2_CLIENT_CHALLENGE
*r
)
1381 uint32_t _flags_save_STRUCT
= ndr
->flags
;
1382 ndr_set_flags(&ndr
->flags
, LIBNDR_PRINT_ARRAY_HEX
);
1383 if (ndr_flags
& NDR_SCALARS
) {
1384 NDR_CHECK(ndr_push_align(ndr
, 4));
1385 NDR_CHECK(ndr_push_uint8(ndr
, NDR_SCALARS
, 1));
1386 NDR_CHECK(ndr_push_uint8(ndr
, NDR_SCALARS
, 1));
1387 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->Reserved1
));
1388 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
, r
->Reserved2
));
1389 NDR_CHECK(ndr_push_NTTIME(ndr
, NDR_SCALARS
, r
->TimeStamp
));
1390 NDR_CHECK(ndr_push_array_uint8(ndr
, NDR_SCALARS
, r
->ChallengeFromClient
, 8));
1391 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
, r
->Reserved3
));
1393 uint32_t _flags_save_AV_PAIR_LIST
= ndr
->flags
;
1394 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_REMAINING
);
1396 struct ndr_push
*_ndr_AvPairs
;
1397 NDR_CHECK(ndr_push_subcontext_start(ndr
, &_ndr_AvPairs
, 0, -1));
1398 NDR_CHECK(ndr_push_AV_PAIR_LIST(_ndr_AvPairs
, NDR_SCALARS
|NDR_BUFFERS
, &r
->AvPairs
));
1399 NDR_CHECK(ndr_push_subcontext_end(ndr
, _ndr_AvPairs
, 0, -1));
1401 ndr
->flags
= _flags_save_AV_PAIR_LIST
;
1403 NDR_CHECK(ndr_push_trailer_align(ndr
, 4));
1405 if (ndr_flags
& NDR_BUFFERS
) {
1407 uint32_t _flags_save_AV_PAIR_LIST
= ndr
->flags
;
1408 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_REMAINING
);
1409 ndr
->flags
= _flags_save_AV_PAIR_LIST
;
1412 ndr
->flags
= _flags_save_STRUCT
;
1414 return NDR_ERR_SUCCESS
;
1417 static enum ndr_err_code
ndr_pull_NTLMv2_CLIENT_CHALLENGE(struct ndr_pull
*ndr
, int ndr_flags
, struct NTLMv2_CLIENT_CHALLENGE
*r
)
1420 uint32_t _flags_save_STRUCT
= ndr
->flags
;
1421 ndr_set_flags(&ndr
->flags
, LIBNDR_PRINT_ARRAY_HEX
);
1422 if (ndr_flags
& NDR_SCALARS
) {
1423 NDR_CHECK(ndr_pull_align(ndr
, 4));
1424 NDR_CHECK(ndr_pull_uint8(ndr
, NDR_SCALARS
, &r
->RespType
));
1425 NDR_CHECK(ndr_pull_uint8(ndr
, NDR_SCALARS
, &r
->HiRespType
));
1426 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->Reserved1
));
1427 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &r
->Reserved2
));
1428 NDR_CHECK(ndr_pull_NTTIME(ndr
, NDR_SCALARS
, &r
->TimeStamp
));
1429 NDR_CHECK(ndr_pull_array_uint8(ndr
, NDR_SCALARS
, r
->ChallengeFromClient
, 8));
1430 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &r
->Reserved3
));
1432 uint32_t _flags_save_AV_PAIR_LIST
= ndr
->flags
;
1433 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_REMAINING
);
1435 struct ndr_pull
*_ndr_AvPairs
;
1436 NDR_CHECK(ndr_pull_subcontext_start(ndr
, &_ndr_AvPairs
, 0, -1));
1437 NDR_CHECK(ndr_pull_AV_PAIR_LIST(_ndr_AvPairs
, NDR_SCALARS
|NDR_BUFFERS
, &r
->AvPairs
));
1438 NDR_CHECK(ndr_pull_subcontext_end(ndr
, _ndr_AvPairs
, 0, -1));
1440 ndr
->flags
= _flags_save_AV_PAIR_LIST
;
1442 NDR_CHECK(ndr_pull_trailer_align(ndr
, 4));
1444 if (ndr_flags
& NDR_BUFFERS
) {
1446 uint32_t _flags_save_AV_PAIR_LIST
= ndr
->flags
;
1447 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_REMAINING
);
1448 ndr
->flags
= _flags_save_AV_PAIR_LIST
;
1451 ndr
->flags
= _flags_save_STRUCT
;
1453 return NDR_ERR_SUCCESS
;
1456 _PUBLIC_
void ndr_print_NTLMv2_CLIENT_CHALLENGE(struct ndr_print
*ndr
, const char *name
, const struct NTLMv2_CLIENT_CHALLENGE
*r
)
1458 ndr_print_struct(ndr
, name
, "NTLMv2_CLIENT_CHALLENGE");
1460 uint32_t _flags_save_STRUCT
= ndr
->flags
;
1461 ndr_set_flags(&ndr
->flags
, LIBNDR_PRINT_ARRAY_HEX
);
1463 ndr_print_uint8(ndr
, "RespType", (ndr
->flags
& LIBNDR_PRINT_SET_VALUES
)?1:r
->RespType
);
1464 ndr_print_uint8(ndr
, "HiRespType", (ndr
->flags
& LIBNDR_PRINT_SET_VALUES
)?1:r
->HiRespType
);
1465 ndr_print_uint16(ndr
, "Reserved1", r
->Reserved1
);
1466 ndr_print_uint32(ndr
, "Reserved2", r
->Reserved2
);
1467 ndr_print_NTTIME(ndr
, "TimeStamp", r
->TimeStamp
);
1468 ndr_print_array_uint8(ndr
, "ChallengeFromClient", r
->ChallengeFromClient
, 8);
1469 ndr_print_uint32(ndr
, "Reserved3", r
->Reserved3
);
1470 ndr_print_AV_PAIR_LIST(ndr
, "AvPairs", &r
->AvPairs
);
1472 ndr
->flags
= _flags_save_STRUCT
;
1476 _PUBLIC_
enum ndr_err_code
ndr_push_NTLMv2_RESPONSE(struct ndr_push
*ndr
, int ndr_flags
, const struct NTLMv2_RESPONSE
*r
)
1479 uint32_t _flags_save_STRUCT
= ndr
->flags
;
1480 ndr_set_flags(&ndr
->flags
, LIBNDR_PRINT_ARRAY_HEX
);
1481 if (ndr_flags
& NDR_SCALARS
) {
1482 NDR_CHECK(ndr_push_align(ndr
, 4));
1483 NDR_CHECK(ndr_push_array_uint8(ndr
, NDR_SCALARS
, r
->Response
, 16));
1484 NDR_CHECK(ndr_push_NTLMv2_CLIENT_CHALLENGE(ndr
, NDR_SCALARS
, &r
->Challenge
));
1485 NDR_CHECK(ndr_push_trailer_align(ndr
, 4));
1487 if (ndr_flags
& NDR_BUFFERS
) {
1488 NDR_CHECK(ndr_push_NTLMv2_CLIENT_CHALLENGE(ndr
, NDR_BUFFERS
, &r
->Challenge
));
1490 ndr
->flags
= _flags_save_STRUCT
;
1492 return NDR_ERR_SUCCESS
;
1495 _PUBLIC_
enum ndr_err_code
ndr_pull_NTLMv2_RESPONSE(struct ndr_pull
*ndr
, int ndr_flags
, struct NTLMv2_RESPONSE
*r
)
1498 uint32_t _flags_save_STRUCT
= ndr
->flags
;
1499 ndr_set_flags(&ndr
->flags
, LIBNDR_PRINT_ARRAY_HEX
);
1500 if (ndr_flags
& NDR_SCALARS
) {
1501 NDR_CHECK(ndr_pull_align(ndr
, 4));
1502 NDR_CHECK(ndr_pull_array_uint8(ndr
, NDR_SCALARS
, r
->Response
, 16));
1503 NDR_CHECK(ndr_pull_NTLMv2_CLIENT_CHALLENGE(ndr
, NDR_SCALARS
, &r
->Challenge
));
1504 NDR_CHECK(ndr_pull_trailer_align(ndr
, 4));
1506 if (ndr_flags
& NDR_BUFFERS
) {
1507 NDR_CHECK(ndr_pull_NTLMv2_CLIENT_CHALLENGE(ndr
, NDR_BUFFERS
, &r
->Challenge
));
1509 ndr
->flags
= _flags_save_STRUCT
;
1511 return NDR_ERR_SUCCESS
;
1514 _PUBLIC_
void ndr_print_NTLMv2_RESPONSE(struct ndr_print
*ndr
, const char *name
, const struct NTLMv2_RESPONSE
*r
)
1516 ndr_print_struct(ndr
, name
, "NTLMv2_RESPONSE");
1518 uint32_t _flags_save_STRUCT
= ndr
->flags
;
1519 ndr_set_flags(&ndr
->flags
, LIBNDR_PRINT_ARRAY_HEX
);
1521 ndr_print_array_uint8(ndr
, "Response", r
->Response
, 16);
1522 ndr_print_NTLMv2_CLIENT_CHALLENGE(ndr
, "Challenge", &r
->Challenge
);
1524 ndr
->flags
= _flags_save_STRUCT
;
1528 _PUBLIC_
enum ndr_err_code
ndr_push_ntlmssp_NTLM_RESPONSE(struct ndr_push
*ndr
, int ndr_flags
, const union ntlmssp_NTLM_RESPONSE
*r
)
1530 if (ndr_flags
& NDR_SCALARS
) {
1531 int level
= ndr_push_get_switch_value(ndr
, r
);
1532 NDR_CHECK(ndr_push_union_align(ndr
, 4));
1538 NDR_CHECK(ndr_push_NTLM_RESPONSE(ndr
, NDR_SCALARS
, &r
->v1
));
1542 NDR_CHECK(ndr_push_NTLMv2_RESPONSE(ndr
, NDR_SCALARS
, &r
->v2
));
1547 if (ndr_flags
& NDR_BUFFERS
) {
1548 int level
= ndr_push_get_switch_value(ndr
, r
);
1557 NDR_CHECK(ndr_push_NTLMv2_RESPONSE(ndr
, NDR_BUFFERS
, &r
->v2
));
1562 return NDR_ERR_SUCCESS
;
1565 _PUBLIC_
enum ndr_err_code
ndr_pull_ntlmssp_NTLM_RESPONSE(struct ndr_pull
*ndr
, int ndr_flags
, union ntlmssp_NTLM_RESPONSE
*r
)
1568 level
= ndr_pull_get_switch_value(ndr
, r
);
1569 if (ndr_flags
& NDR_SCALARS
) {
1570 NDR_CHECK(ndr_pull_union_align(ndr
, 4));
1576 NDR_CHECK(ndr_pull_NTLM_RESPONSE(ndr
, NDR_SCALARS
, &r
->v1
));
1580 NDR_CHECK(ndr_pull_NTLMv2_RESPONSE(ndr
, NDR_SCALARS
, &r
->v2
));
1585 if (ndr_flags
& NDR_BUFFERS
) {
1594 NDR_CHECK(ndr_pull_NTLMv2_RESPONSE(ndr
, NDR_BUFFERS
, &r
->v2
));
1599 return NDR_ERR_SUCCESS
;
1602 _PUBLIC_
void ndr_print_ntlmssp_NTLM_RESPONSE(struct ndr_print
*ndr
, const char *name
, const union ntlmssp_NTLM_RESPONSE
*r
)
1605 level
= ndr_print_get_switch_value(ndr
, r
);
1606 ndr_print_union(ndr
, name
, level
, "ntlmssp_NTLM_RESPONSE");
1612 ndr_print_NTLM_RESPONSE(ndr
, "v1", &r
->v1
);
1616 ndr_print_NTLMv2_RESPONSE(ndr
, "v2", &r
->v2
);
1622 _PUBLIC_
enum ndr_err_code
ndr_push_AUTHENTICATE_MESSAGE(struct ndr_push
*ndr
, int ndr_flags
, const struct AUTHENTICATE_MESSAGE
*r
)
1625 uint32_t _flags_save_STRUCT
= ndr
->flags
;
1626 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_REMAINING
);
1627 if (ndr_flags
& NDR_SCALARS
) {
1628 NDR_CHECK(ndr_push_align(ndr
, 5));
1629 NDR_CHECK(ndr_push_charset(ndr
, NDR_SCALARS
, "NTLMSSP", 8, sizeof(uint8_t), CH_DOS
));
1630 NDR_CHECK(ndr_push_ntlmssp_MessageType(ndr
, NDR_SCALARS
, NtLmAuthenticate
));
1631 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->LmChallengeResponseLen
));
1632 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->LmChallengeResponseLen
));
1633 NDR_CHECK(ndr_push_relative_ptr1(ndr
, r
->LmChallengeResponse
));
1634 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->NtChallengeResponseLen
));
1635 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->NtChallengeResponseLen
));
1636 NDR_CHECK(ndr_push_relative_ptr1(ndr
, r
->NtChallengeResponse
));
1637 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, ndr_ntlmssp_string_length(r
->NegotiateFlags
, r
->DomainName
)));
1638 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, ndr_ntlmssp_string_length(r
->NegotiateFlags
, r
->DomainName
)));
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
->DomainName
));
1643 ndr
->flags
= _flags_save_string
;
1645 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, ndr_ntlmssp_string_length(r
->NegotiateFlags
, r
->UserName
)));
1646 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, ndr_ntlmssp_string_length(r
->NegotiateFlags
, r
->UserName
)));
1648 uint32_t _flags_save_string
= ndr
->flags
;
1649 ndr_set_flags(&ndr
->flags
, ndr_ntlmssp_negotiated_string_flags(r
->NegotiateFlags
));
1650 NDR_CHECK(ndr_push_relative_ptr1(ndr
, r
->UserName
));
1651 ndr
->flags
= _flags_save_string
;
1653 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, ndr_ntlmssp_string_length(r
->NegotiateFlags
, r
->Workstation
)));
1654 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, ndr_ntlmssp_string_length(r
->NegotiateFlags
, r
->Workstation
)));
1656 uint32_t _flags_save_string
= ndr
->flags
;
1657 ndr_set_flags(&ndr
->flags
, ndr_ntlmssp_negotiated_string_flags(r
->NegotiateFlags
));
1658 NDR_CHECK(ndr_push_relative_ptr1(ndr
, r
->Workstation
));
1659 ndr
->flags
= _flags_save_string
;
1661 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->EncryptedRandomSessionKey
->length
));
1662 NDR_CHECK(ndr_push_uint16(ndr
, NDR_SCALARS
, r
->EncryptedRandomSessionKey
->length
));
1663 NDR_CHECK(ndr_push_relative_ptr1(ndr
, r
->EncryptedRandomSessionKey
));
1664 NDR_CHECK(ndr_push_NEGOTIATE(ndr
, NDR_SCALARS
, r
->NegotiateFlags
));
1665 NDR_CHECK(ndr_push_set_switch_value(ndr
, &r
->Version
, r
->NegotiateFlags
& NTLMSSP_NEGOTIATE_VERSION
));
1666 NDR_CHECK(ndr_push_ntlmssp_Version(ndr
, NDR_SCALARS
, &r
->Version
));
1667 NDR_CHECK(ndr_push_trailer_align(ndr
, 5));
1669 if (ndr_flags
& NDR_BUFFERS
) {
1670 if (r
->LmChallengeResponse
) {
1671 NDR_CHECK(ndr_push_relative_ptr2_start(ndr
, r
->LmChallengeResponse
));
1673 struct ndr_push
*_ndr_LmChallengeResponse
;
1674 NDR_CHECK(ndr_push_subcontext_start(ndr
, &_ndr_LmChallengeResponse
, 0, r
->LmChallengeResponseLen
));
1675 NDR_CHECK(ndr_push_set_switch_value(_ndr_LmChallengeResponse
, r
->LmChallengeResponse
, r
->LmChallengeResponseLen
));
1676 NDR_CHECK(ndr_push_ntlmssp_LM_RESPONSE(_ndr_LmChallengeResponse
, NDR_SCALARS
|NDR_BUFFERS
, r
->LmChallengeResponse
));
1677 NDR_CHECK(ndr_push_subcontext_end(ndr
, _ndr_LmChallengeResponse
, 0, r
->LmChallengeResponseLen
));
1679 NDR_CHECK(ndr_push_relative_ptr2_end(ndr
, r
->LmChallengeResponse
));
1681 if (r
->NtChallengeResponse
) {
1682 NDR_CHECK(ndr_push_relative_ptr2_start(ndr
, r
->NtChallengeResponse
));
1684 struct ndr_push
*_ndr_NtChallengeResponse
;
1685 NDR_CHECK(ndr_push_subcontext_start(ndr
, &_ndr_NtChallengeResponse
, 0, r
->NtChallengeResponseLen
));
1686 NDR_CHECK(ndr_push_set_switch_value(_ndr_NtChallengeResponse
, r
->NtChallengeResponse
, r
->NtChallengeResponseLen
));
1687 NDR_CHECK(ndr_push_ntlmssp_NTLM_RESPONSE(_ndr_NtChallengeResponse
, NDR_SCALARS
|NDR_BUFFERS
, r
->NtChallengeResponse
));
1688 NDR_CHECK(ndr_push_subcontext_end(ndr
, _ndr_NtChallengeResponse
, 0, r
->NtChallengeResponseLen
));
1690 NDR_CHECK(ndr_push_relative_ptr2_end(ndr
, r
->NtChallengeResponse
));
1693 uint32_t _flags_save_string
= ndr
->flags
;
1694 ndr_set_flags(&ndr
->flags
, ndr_ntlmssp_negotiated_string_flags(r
->NegotiateFlags
));
1695 if (r
->DomainName
) {
1696 NDR_CHECK(ndr_push_relative_ptr2_start(ndr
, r
->DomainName
));
1698 struct ndr_push
*_ndr_DomainName
;
1699 NDR_CHECK(ndr_push_subcontext_start(ndr
, &_ndr_DomainName
, 0, ndr_ntlmssp_string_length(r
->NegotiateFlags
, r
->DomainName
)));
1700 NDR_CHECK(ndr_push_string(_ndr_DomainName
, NDR_SCALARS
, r
->DomainName
));
1701 NDR_CHECK(ndr_push_subcontext_end(ndr
, _ndr_DomainName
, 0, ndr_ntlmssp_string_length(r
->NegotiateFlags
, r
->DomainName
)));
1703 NDR_CHECK(ndr_push_relative_ptr2_end(ndr
, r
->DomainName
));
1705 ndr
->flags
= _flags_save_string
;
1708 uint32_t _flags_save_string
= ndr
->flags
;
1709 ndr_set_flags(&ndr
->flags
, ndr_ntlmssp_negotiated_string_flags(r
->NegotiateFlags
));
1711 NDR_CHECK(ndr_push_relative_ptr2_start(ndr
, r
->UserName
));
1713 struct ndr_push
*_ndr_UserName
;
1714 NDR_CHECK(ndr_push_subcontext_start(ndr
, &_ndr_UserName
, 0, ndr_ntlmssp_string_length(r
->NegotiateFlags
, r
->UserName
)));
1715 NDR_CHECK(ndr_push_string(_ndr_UserName
, NDR_SCALARS
, r
->UserName
));
1716 NDR_CHECK(ndr_push_subcontext_end(ndr
, _ndr_UserName
, 0, ndr_ntlmssp_string_length(r
->NegotiateFlags
, r
->UserName
)));
1718 NDR_CHECK(ndr_push_relative_ptr2_end(ndr
, r
->UserName
));
1720 ndr
->flags
= _flags_save_string
;
1723 uint32_t _flags_save_string
= ndr
->flags
;
1724 ndr_set_flags(&ndr
->flags
, ndr_ntlmssp_negotiated_string_flags(r
->NegotiateFlags
));
1725 if (r
->Workstation
) {
1726 NDR_CHECK(ndr_push_relative_ptr2_start(ndr
, r
->Workstation
));
1728 struct ndr_push
*_ndr_Workstation
;
1729 NDR_CHECK(ndr_push_subcontext_start(ndr
, &_ndr_Workstation
, 0, ndr_ntlmssp_string_length(r
->NegotiateFlags
, r
->Workstation
)));
1730 NDR_CHECK(ndr_push_string(_ndr_Workstation
, NDR_SCALARS
, r
->Workstation
));
1731 NDR_CHECK(ndr_push_subcontext_end(ndr
, _ndr_Workstation
, 0, ndr_ntlmssp_string_length(r
->NegotiateFlags
, r
->Workstation
)));
1733 NDR_CHECK(ndr_push_relative_ptr2_end(ndr
, r
->Workstation
));
1735 ndr
->flags
= _flags_save_string
;
1737 if (r
->EncryptedRandomSessionKey
) {
1738 NDR_CHECK(ndr_push_relative_ptr2_start(ndr
, r
->EncryptedRandomSessionKey
));
1740 struct ndr_push
*_ndr_EncryptedRandomSessionKey
;
1741 NDR_CHECK(ndr_push_subcontext_start(ndr
, &_ndr_EncryptedRandomSessionKey
, 0, r
->EncryptedRandomSessionKey
->length
));
1742 NDR_CHECK(ndr_push_DATA_BLOB(_ndr_EncryptedRandomSessionKey
, NDR_SCALARS
, *r
->EncryptedRandomSessionKey
));
1743 NDR_CHECK(ndr_push_subcontext_end(ndr
, _ndr_EncryptedRandomSessionKey
, 0, r
->EncryptedRandomSessionKey
->length
));
1745 NDR_CHECK(ndr_push_relative_ptr2_end(ndr
, r
->EncryptedRandomSessionKey
));
1747 NDR_CHECK(ndr_push_ntlmssp_Version(ndr
, NDR_BUFFERS
, &r
->Version
));
1749 ndr
->flags
= _flags_save_STRUCT
;
1751 return NDR_ERR_SUCCESS
;
1754 _PUBLIC_
enum ndr_err_code
ndr_pull_AUTHENTICATE_MESSAGE(struct ndr_pull
*ndr
, int ndr_flags
, struct AUTHENTICATE_MESSAGE
*r
)
1756 uint32_t _ptr_LmChallengeResponse
;
1757 TALLOC_CTX
*_mem_save_LmChallengeResponse_0
;
1758 uint32_t _ptr_NtChallengeResponse
;
1759 TALLOC_CTX
*_mem_save_NtChallengeResponse_0
;
1760 uint32_t _ptr_DomainName
;
1761 TALLOC_CTX
*_mem_save_DomainName_0
;
1762 uint32_t _ptr_UserName
;
1763 TALLOC_CTX
*_mem_save_UserName_0
;
1764 uint32_t _ptr_Workstation
;
1765 TALLOC_CTX
*_mem_save_Workstation_0
;
1766 uint32_t _ptr_EncryptedRandomSessionKey
;
1767 TALLOC_CTX
*_mem_save_EncryptedRandomSessionKey_0
;
1769 uint32_t _flags_save_STRUCT
= ndr
->flags
;
1770 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_REMAINING
);
1771 if (ndr_flags
& NDR_SCALARS
) {
1772 NDR_CHECK(ndr_pull_align(ndr
, 5));
1773 NDR_CHECK(ndr_pull_charset(ndr
, NDR_SCALARS
, &r
->Signature
, 8, sizeof(uint8_t), CH_DOS
));
1774 NDR_CHECK(ndr_pull_ntlmssp_MessageType(ndr
, NDR_SCALARS
, &r
->MessageType
));
1775 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->LmChallengeResponseLen
));
1776 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->LmChallengeResponseMaxLen
));
1777 NDR_CHECK(ndr_pull_generic_ptr(ndr
, &_ptr_LmChallengeResponse
));
1778 if (_ptr_LmChallengeResponse
) {
1779 NDR_PULL_ALLOC(ndr
, r
->LmChallengeResponse
);
1780 NDR_CHECK(ndr_pull_relative_ptr1(ndr
, r
->LmChallengeResponse
, _ptr_LmChallengeResponse
));
1782 r
->LmChallengeResponse
= NULL
;
1784 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->NtChallengeResponseLen
));
1785 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->NtChallengeResponseMaxLen
));
1786 NDR_CHECK(ndr_pull_generic_ptr(ndr
, &_ptr_NtChallengeResponse
));
1787 if (_ptr_NtChallengeResponse
) {
1788 NDR_PULL_ALLOC(ndr
, r
->NtChallengeResponse
);
1789 NDR_CHECK(ndr_pull_relative_ptr1(ndr
, r
->NtChallengeResponse
, _ptr_NtChallengeResponse
));
1791 r
->NtChallengeResponse
= NULL
;
1793 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->DomainNameLen
));
1794 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->DomainNameMaxLen
));
1796 uint32_t _flags_save_string
= ndr
->flags
;
1797 ndr_set_flags(&ndr
->flags
, ndr_ntlmssp_negotiated_string_flags(r
->NegotiateFlags
));
1798 NDR_CHECK(ndr_pull_generic_ptr(ndr
, &_ptr_DomainName
));
1799 if (_ptr_DomainName
) {
1800 NDR_PULL_ALLOC(ndr
, r
->DomainName
);
1801 NDR_CHECK(ndr_pull_relative_ptr1(ndr
, r
->DomainName
, _ptr_DomainName
));
1803 r
->DomainName
= NULL
;
1805 ndr
->flags
= _flags_save_string
;
1807 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->UserNameLen
));
1808 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->UserNameMaxLen
));
1810 uint32_t _flags_save_string
= ndr
->flags
;
1811 ndr_set_flags(&ndr
->flags
, ndr_ntlmssp_negotiated_string_flags(r
->NegotiateFlags
));
1812 NDR_CHECK(ndr_pull_generic_ptr(ndr
, &_ptr_UserName
));
1813 if (_ptr_UserName
) {
1814 NDR_PULL_ALLOC(ndr
, r
->UserName
);
1815 NDR_CHECK(ndr_pull_relative_ptr1(ndr
, r
->UserName
, _ptr_UserName
));
1819 ndr
->flags
= _flags_save_string
;
1821 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->WorkstationLen
));
1822 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->WorkstationMaxLen
));
1824 uint32_t _flags_save_string
= ndr
->flags
;
1825 ndr_set_flags(&ndr
->flags
, ndr_ntlmssp_negotiated_string_flags(r
->NegotiateFlags
));
1826 NDR_CHECK(ndr_pull_generic_ptr(ndr
, &_ptr_Workstation
));
1827 if (_ptr_Workstation
) {
1828 NDR_PULL_ALLOC(ndr
, r
->Workstation
);
1829 NDR_CHECK(ndr_pull_relative_ptr1(ndr
, r
->Workstation
, _ptr_Workstation
));
1831 r
->Workstation
= NULL
;
1833 ndr
->flags
= _flags_save_string
;
1835 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->EncryptedRandomSessionKeyLen
));
1836 NDR_CHECK(ndr_pull_uint16(ndr
, NDR_SCALARS
, &r
->EncryptedRandomSessionKeyMaxLen
));
1837 NDR_CHECK(ndr_pull_generic_ptr(ndr
, &_ptr_EncryptedRandomSessionKey
));
1838 if (_ptr_EncryptedRandomSessionKey
) {
1839 NDR_PULL_ALLOC(ndr
, r
->EncryptedRandomSessionKey
);
1840 NDR_CHECK(ndr_pull_relative_ptr1(ndr
, r
->EncryptedRandomSessionKey
, _ptr_EncryptedRandomSessionKey
));
1842 r
->EncryptedRandomSessionKey
= NULL
;
1844 NDR_CHECK(ndr_pull_NEGOTIATE(ndr
, NDR_SCALARS
, &r
->NegotiateFlags
));
1845 NDR_CHECK(ndr_pull_set_switch_value(ndr
, &r
->Version
, r
->NegotiateFlags
& NTLMSSP_NEGOTIATE_VERSION
));
1846 NDR_CHECK(ndr_pull_ntlmssp_Version(ndr
, NDR_SCALARS
, &r
->Version
));
1847 NDR_CHECK(ndr_pull_trailer_align(ndr
, 5));
1849 if (ndr_flags
& NDR_BUFFERS
) {
1850 if (r
->LmChallengeResponse
) {
1851 uint32_t _relative_save_offset
;
1852 _relative_save_offset
= ndr
->offset
;
1853 NDR_CHECK(ndr_pull_relative_ptr2(ndr
, r
->LmChallengeResponse
));
1854 _mem_save_LmChallengeResponse_0
= NDR_PULL_GET_MEM_CTX(ndr
);
1855 NDR_PULL_SET_MEM_CTX(ndr
, r
->LmChallengeResponse
, 0);
1857 struct ndr_pull
*_ndr_LmChallengeResponse
;
1858 NDR_CHECK(ndr_pull_subcontext_start(ndr
, &_ndr_LmChallengeResponse
, 0, r
->LmChallengeResponseLen
));
1859 NDR_CHECK(ndr_pull_set_switch_value(_ndr_LmChallengeResponse
, r
->LmChallengeResponse
, r
->LmChallengeResponseLen
));
1860 NDR_CHECK(ndr_pull_ntlmssp_LM_RESPONSE(_ndr_LmChallengeResponse
, NDR_SCALARS
|NDR_BUFFERS
, r
->LmChallengeResponse
));
1861 NDR_CHECK(ndr_pull_subcontext_end(ndr
, _ndr_LmChallengeResponse
, 0, r
->LmChallengeResponseLen
));
1863 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_LmChallengeResponse_0
, 0);
1864 ndr
->offset
= _relative_save_offset
;
1866 if (r
->NtChallengeResponse
) {
1867 uint32_t _relative_save_offset
;
1868 _relative_save_offset
= ndr
->offset
;
1869 NDR_CHECK(ndr_pull_relative_ptr2(ndr
, r
->NtChallengeResponse
));
1870 _mem_save_NtChallengeResponse_0
= NDR_PULL_GET_MEM_CTX(ndr
);
1871 NDR_PULL_SET_MEM_CTX(ndr
, r
->NtChallengeResponse
, 0);
1873 struct ndr_pull
*_ndr_NtChallengeResponse
;
1874 NDR_CHECK(ndr_pull_subcontext_start(ndr
, &_ndr_NtChallengeResponse
, 0, r
->NtChallengeResponseMaxLen
));
1875 NDR_CHECK(ndr_pull_set_switch_value(_ndr_NtChallengeResponse
, r
->NtChallengeResponse
, r
->NtChallengeResponseLen
));
1876 NDR_CHECK(ndr_pull_ntlmssp_NTLM_RESPONSE(_ndr_NtChallengeResponse
, NDR_SCALARS
|NDR_BUFFERS
, r
->NtChallengeResponse
));
1877 NDR_CHECK(ndr_pull_subcontext_end(ndr
, _ndr_NtChallengeResponse
, 0, r
->NtChallengeResponseMaxLen
));
1879 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_NtChallengeResponse_0
, 0);
1880 ndr
->offset
= _relative_save_offset
;
1883 uint32_t _flags_save_string
= ndr
->flags
;
1884 ndr_set_flags(&ndr
->flags
, ndr_ntlmssp_negotiated_string_flags(r
->NegotiateFlags
));
1885 if (r
->DomainName
) {
1886 uint32_t _relative_save_offset
;
1887 _relative_save_offset
= ndr
->offset
;
1888 NDR_CHECK(ndr_pull_relative_ptr2(ndr
, r
->DomainName
));
1889 _mem_save_DomainName_0
= NDR_PULL_GET_MEM_CTX(ndr
);
1890 NDR_PULL_SET_MEM_CTX(ndr
, r
->DomainName
, 0);
1892 struct ndr_pull
*_ndr_DomainName
;
1893 NDR_CHECK(ndr_pull_subcontext_start(ndr
, &_ndr_DomainName
, 0, r
->DomainNameLen
));
1894 NDR_CHECK(ndr_pull_string(_ndr_DomainName
, NDR_SCALARS
, &r
->DomainName
));
1895 NDR_CHECK(ndr_pull_subcontext_end(ndr
, _ndr_DomainName
, 0, r
->DomainNameLen
));
1897 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_DomainName_0
, 0);
1898 ndr
->offset
= _relative_save_offset
;
1900 ndr
->flags
= _flags_save_string
;
1903 uint32_t _flags_save_string
= ndr
->flags
;
1904 ndr_set_flags(&ndr
->flags
, ndr_ntlmssp_negotiated_string_flags(r
->NegotiateFlags
));
1906 uint32_t _relative_save_offset
;
1907 _relative_save_offset
= ndr
->offset
;
1908 NDR_CHECK(ndr_pull_relative_ptr2(ndr
, r
->UserName
));
1909 _mem_save_UserName_0
= NDR_PULL_GET_MEM_CTX(ndr
);
1910 NDR_PULL_SET_MEM_CTX(ndr
, r
->UserName
, 0);
1912 struct ndr_pull
*_ndr_UserName
;
1913 NDR_CHECK(ndr_pull_subcontext_start(ndr
, &_ndr_UserName
, 0, r
->UserNameLen
));
1914 NDR_CHECK(ndr_pull_string(_ndr_UserName
, NDR_SCALARS
, &r
->UserName
));
1915 NDR_CHECK(ndr_pull_subcontext_end(ndr
, _ndr_UserName
, 0, r
->UserNameLen
));
1917 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_UserName_0
, 0);
1918 ndr
->offset
= _relative_save_offset
;
1920 ndr
->flags
= _flags_save_string
;
1923 uint32_t _flags_save_string
= ndr
->flags
;
1924 ndr_set_flags(&ndr
->flags
, ndr_ntlmssp_negotiated_string_flags(r
->NegotiateFlags
));
1925 if (r
->Workstation
) {
1926 uint32_t _relative_save_offset
;
1927 _relative_save_offset
= ndr
->offset
;
1928 NDR_CHECK(ndr_pull_relative_ptr2(ndr
, r
->Workstation
));
1929 _mem_save_Workstation_0
= NDR_PULL_GET_MEM_CTX(ndr
);
1930 NDR_PULL_SET_MEM_CTX(ndr
, r
->Workstation
, 0);
1932 struct ndr_pull
*_ndr_Workstation
;
1933 NDR_CHECK(ndr_pull_subcontext_start(ndr
, &_ndr_Workstation
, 0, r
->WorkstationLen
));
1934 NDR_CHECK(ndr_pull_string(_ndr_Workstation
, NDR_SCALARS
, &r
->Workstation
));
1935 NDR_CHECK(ndr_pull_subcontext_end(ndr
, _ndr_Workstation
, 0, r
->WorkstationLen
));
1937 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_Workstation_0
, 0);
1938 ndr
->offset
= _relative_save_offset
;
1940 ndr
->flags
= _flags_save_string
;
1942 if (r
->EncryptedRandomSessionKey
) {
1943 uint32_t _relative_save_offset
;
1944 _relative_save_offset
= ndr
->offset
;
1945 NDR_CHECK(ndr_pull_relative_ptr2(ndr
, r
->EncryptedRandomSessionKey
));
1946 _mem_save_EncryptedRandomSessionKey_0
= NDR_PULL_GET_MEM_CTX(ndr
);
1947 NDR_PULL_SET_MEM_CTX(ndr
, r
->EncryptedRandomSessionKey
, 0);
1949 struct ndr_pull
*_ndr_EncryptedRandomSessionKey
;
1950 NDR_CHECK(ndr_pull_subcontext_start(ndr
, &_ndr_EncryptedRandomSessionKey
, 0, r
->EncryptedRandomSessionKeyLen
));
1951 NDR_CHECK(ndr_pull_DATA_BLOB(_ndr_EncryptedRandomSessionKey
, NDR_SCALARS
, r
->EncryptedRandomSessionKey
));
1952 NDR_CHECK(ndr_pull_subcontext_end(ndr
, _ndr_EncryptedRandomSessionKey
, 0, r
->EncryptedRandomSessionKeyLen
));
1954 NDR_PULL_SET_MEM_CTX(ndr
, _mem_save_EncryptedRandomSessionKey_0
, 0);
1955 ndr
->offset
= _relative_save_offset
;
1957 NDR_CHECK(ndr_pull_ntlmssp_Version(ndr
, NDR_BUFFERS
, &r
->Version
));
1959 ndr
->flags
= _flags_save_STRUCT
;
1961 return NDR_ERR_SUCCESS
;
1964 _PUBLIC_
void ndr_print_AUTHENTICATE_MESSAGE(struct ndr_print
*ndr
, const char *name
, const struct AUTHENTICATE_MESSAGE
*r
)
1966 ndr_print_struct(ndr
, name
, "AUTHENTICATE_MESSAGE");
1968 uint32_t _flags_save_STRUCT
= ndr
->flags
;
1969 ndr_set_flags(&ndr
->flags
, LIBNDR_FLAG_REMAINING
);
1971 ndr_print_string(ndr
, "Signature", (ndr
->flags
& LIBNDR_PRINT_SET_VALUES
)?"NTLMSSP":r
->Signature
);
1972 ndr_print_ntlmssp_MessageType(ndr
, "MessageType", (ndr
->flags
& LIBNDR_PRINT_SET_VALUES
)?NtLmAuthenticate
:r
->MessageType
);
1973 ndr_print_uint16(ndr
, "LmChallengeResponseLen", r
->LmChallengeResponseLen
);
1974 ndr_print_uint16(ndr
, "LmChallengeResponseMaxLen", (ndr
->flags
& LIBNDR_PRINT_SET_VALUES
)?r
->LmChallengeResponseLen
:r
->LmChallengeResponseMaxLen
);
1975 ndr_print_ptr(ndr
, "LmChallengeResponse", r
->LmChallengeResponse
);
1977 if (r
->LmChallengeResponse
) {
1978 ndr_print_set_switch_value(ndr
, r
->LmChallengeResponse
, r
->LmChallengeResponseLen
);
1979 ndr_print_ntlmssp_LM_RESPONSE(ndr
, "LmChallengeResponse", r
->LmChallengeResponse
);
1982 ndr_print_uint16(ndr
, "NtChallengeResponseLen", r
->NtChallengeResponseLen
);
1983 ndr_print_uint16(ndr
, "NtChallengeResponseMaxLen", (ndr
->flags
& LIBNDR_PRINT_SET_VALUES
)?r
->NtChallengeResponseLen
:r
->NtChallengeResponseMaxLen
);
1984 ndr_print_ptr(ndr
, "NtChallengeResponse", r
->NtChallengeResponse
);
1986 if (r
->NtChallengeResponse
) {
1987 ndr_print_set_switch_value(ndr
, r
->NtChallengeResponse
, r
->NtChallengeResponseLen
);
1988 ndr_print_ntlmssp_NTLM_RESPONSE(ndr
, "NtChallengeResponse", r
->NtChallengeResponse
);
1991 ndr_print_uint16(ndr
, "DomainNameLen", (ndr
->flags
& LIBNDR_PRINT_SET_VALUES
)?ndr_ntlmssp_string_length(r
->NegotiateFlags
, r
->DomainName
):r
->DomainNameLen
);
1992 ndr_print_uint16(ndr
, "DomainNameMaxLen", (ndr
->flags
& LIBNDR_PRINT_SET_VALUES
)?r
->DomainNameLen
:r
->DomainNameMaxLen
);
1993 ndr_print_ptr(ndr
, "DomainName", r
->DomainName
);
1995 if (r
->DomainName
) {
1996 ndr_print_string(ndr
, "DomainName", r
->DomainName
);
1999 ndr_print_uint16(ndr
, "UserNameLen", (ndr
->flags
& LIBNDR_PRINT_SET_VALUES
)?ndr_ntlmssp_string_length(r
->NegotiateFlags
, r
->UserName
):r
->UserNameLen
);
2000 ndr_print_uint16(ndr
, "UserNameMaxLen", (ndr
->flags
& LIBNDR_PRINT_SET_VALUES
)?r
->UserNameLen
:r
->UserNameMaxLen
);
2001 ndr_print_ptr(ndr
, "UserName", r
->UserName
);
2004 ndr_print_string(ndr
, "UserName", r
->UserName
);
2007 ndr_print_uint16(ndr
, "WorkstationLen", (ndr
->flags
& LIBNDR_PRINT_SET_VALUES
)?ndr_ntlmssp_string_length(r
->NegotiateFlags
, r
->Workstation
):r
->WorkstationLen
);
2008 ndr_print_uint16(ndr
, "WorkstationMaxLen", (ndr
->flags
& LIBNDR_PRINT_SET_VALUES
)?r
->WorkstationLen
:r
->WorkstationMaxLen
);
2009 ndr_print_ptr(ndr
, "Workstation", r
->Workstation
);
2011 if (r
->Workstation
) {
2012 ndr_print_string(ndr
, "Workstation", r
->Workstation
);
2015 ndr_print_uint16(ndr
, "EncryptedRandomSessionKeyLen", (ndr
->flags
& LIBNDR_PRINT_SET_VALUES
)?r
->EncryptedRandomSessionKey
->length
:r
->EncryptedRandomSessionKeyLen
);
2016 ndr_print_uint16(ndr
, "EncryptedRandomSessionKeyMaxLen", (ndr
->flags
& LIBNDR_PRINT_SET_VALUES
)?r
->EncryptedRandomSessionKeyLen
:r
->EncryptedRandomSessionKeyMaxLen
);
2017 ndr_print_ptr(ndr
, "EncryptedRandomSessionKey", r
->EncryptedRandomSessionKey
);
2019 if (r
->EncryptedRandomSessionKey
) {
2020 ndr_print_DATA_BLOB(ndr
, "EncryptedRandomSessionKey", *r
->EncryptedRandomSessionKey
);
2023 ndr_print_NEGOTIATE(ndr
, "NegotiateFlags", r
->NegotiateFlags
);
2024 ndr_print_set_switch_value(ndr
, &r
->Version
, r
->NegotiateFlags
& NTLMSSP_NEGOTIATE_VERSION
);
2025 ndr_print_ntlmssp_Version(ndr
, "Version", &r
->Version
);
2027 ndr
->flags
= _flags_save_STRUCT
;
2031 _PUBLIC_
enum ndr_err_code
ndr_push_NTLMSSP_MESSAGE_SIGNATURE(struct ndr_push
*ndr
, int ndr_flags
, const struct NTLMSSP_MESSAGE_SIGNATURE
*r
)
2033 if (ndr_flags
& NDR_SCALARS
) {
2034 NDR_CHECK(ndr_push_align(ndr
, 4));
2035 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
, NTLMSSP_SIGN_VERSION
));
2036 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
, r
->RandomPad
));
2037 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
, r
->Checksum
));
2038 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
, r
->SeqNum
));
2039 NDR_CHECK(ndr_push_trailer_align(ndr
, 4));
2041 if (ndr_flags
& NDR_BUFFERS
) {
2043 return NDR_ERR_SUCCESS
;
2046 _PUBLIC_
enum ndr_err_code
ndr_pull_NTLMSSP_MESSAGE_SIGNATURE(struct ndr_pull
*ndr
, int ndr_flags
, struct NTLMSSP_MESSAGE_SIGNATURE
*r
)
2048 if (ndr_flags
& NDR_SCALARS
) {
2049 NDR_CHECK(ndr_pull_align(ndr
, 4));
2050 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &r
->Version
));
2051 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &r
->RandomPad
));
2052 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &r
->Checksum
));
2053 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &r
->SeqNum
));
2054 NDR_CHECK(ndr_pull_trailer_align(ndr
, 4));
2056 if (ndr_flags
& NDR_BUFFERS
) {
2058 return NDR_ERR_SUCCESS
;
2061 _PUBLIC_
void ndr_print_NTLMSSP_MESSAGE_SIGNATURE(struct ndr_print
*ndr
, const char *name
, const struct NTLMSSP_MESSAGE_SIGNATURE
*r
)
2063 ndr_print_struct(ndr
, name
, "NTLMSSP_MESSAGE_SIGNATURE");
2065 ndr_print_uint32(ndr
, "Version", (ndr
->flags
& LIBNDR_PRINT_SET_VALUES
)?NTLMSSP_SIGN_VERSION
:r
->Version
);
2066 ndr_print_uint32(ndr
, "RandomPad", r
->RandomPad
);
2067 ndr_print_uint32(ndr
, "Checksum", r
->Checksum
);
2068 ndr_print_uint32(ndr
, "SeqNum", r
->SeqNum
);
2072 _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
)
2075 uint32_t _flags_save_STRUCT
= ndr
->flags
;
2076 ndr_set_flags(&ndr
->flags
, LIBNDR_PRINT_ARRAY_HEX
);
2077 if (ndr_flags
& NDR_SCALARS
) {
2078 NDR_CHECK(ndr_push_align(ndr
, 4));
2079 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
, NTLMSSP_SIGN_VERSION
));
2080 NDR_CHECK(ndr_push_array_uint8(ndr
, NDR_SCALARS
, r
->Checksum
, 8));
2081 NDR_CHECK(ndr_push_uint32(ndr
, NDR_SCALARS
, r
->SeqNum
));
2082 NDR_CHECK(ndr_push_trailer_align(ndr
, 4));
2084 if (ndr_flags
& NDR_BUFFERS
) {
2086 ndr
->flags
= _flags_save_STRUCT
;
2088 return NDR_ERR_SUCCESS
;
2091 _PUBLIC_
enum ndr_err_code
ndr_pull_NTLMSSP_MESSAGE_SIGNATURE_NTLMv2(struct ndr_pull
*ndr
, int ndr_flags
, struct NTLMSSP_MESSAGE_SIGNATURE_NTLMv2
*r
)
2094 uint32_t _flags_save_STRUCT
= ndr
->flags
;
2095 ndr_set_flags(&ndr
->flags
, LIBNDR_PRINT_ARRAY_HEX
);
2096 if (ndr_flags
& NDR_SCALARS
) {
2097 NDR_CHECK(ndr_pull_align(ndr
, 4));
2098 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &r
->Version
));
2099 NDR_CHECK(ndr_pull_array_uint8(ndr
, NDR_SCALARS
, r
->Checksum
, 8));
2100 NDR_CHECK(ndr_pull_uint32(ndr
, NDR_SCALARS
, &r
->SeqNum
));
2101 NDR_CHECK(ndr_pull_trailer_align(ndr
, 4));
2103 if (ndr_flags
& NDR_BUFFERS
) {
2105 ndr
->flags
= _flags_save_STRUCT
;
2107 return NDR_ERR_SUCCESS
;
2110 _PUBLIC_
void ndr_print_NTLMSSP_MESSAGE_SIGNATURE_NTLMv2(struct ndr_print
*ndr
, const char *name
, const struct NTLMSSP_MESSAGE_SIGNATURE_NTLMv2
*r
)
2112 ndr_print_struct(ndr
, name
, "NTLMSSP_MESSAGE_SIGNATURE_NTLMv2");
2114 uint32_t _flags_save_STRUCT
= ndr
->flags
;
2115 ndr_set_flags(&ndr
->flags
, LIBNDR_PRINT_ARRAY_HEX
);
2117 ndr_print_uint32(ndr
, "Version", (ndr
->flags
& LIBNDR_PRINT_SET_VALUES
)?NTLMSSP_SIGN_VERSION
:r
->Version
);
2118 ndr_print_array_uint8(ndr
, "Checksum", r
->Checksum
, 8);
2119 ndr_print_uint32(ndr
, "SeqNum", r
->SeqNum
);
2121 ndr
->flags
= _flags_save_STRUCT
;
2125 static enum ndr_err_code
ndr_push_decode_NEGOTIATE_MESSAGE(struct ndr_push
*ndr
, int flags
, const struct decode_NEGOTIATE_MESSAGE
*r
)
2127 if (flags
& NDR_IN
) {
2128 NDR_CHECK(ndr_push_NEGOTIATE_MESSAGE(ndr
, NDR_SCALARS
|NDR_BUFFERS
, &r
->in
.negotiate
));
2130 if (flags
& NDR_OUT
) {
2132 return NDR_ERR_SUCCESS
;
2135 static enum ndr_err_code
ndr_pull_decode_NEGOTIATE_MESSAGE(struct ndr_pull
*ndr
, int flags
, struct decode_NEGOTIATE_MESSAGE
*r
)
2137 if (flags
& NDR_IN
) {
2138 NDR_CHECK(ndr_pull_NEGOTIATE_MESSAGE(ndr
, NDR_SCALARS
|NDR_BUFFERS
, &r
->in
.negotiate
));
2140 if (flags
& NDR_OUT
) {
2142 return NDR_ERR_SUCCESS
;
2145 _PUBLIC_
void ndr_print_decode_NEGOTIATE_MESSAGE(struct ndr_print
*ndr
, const char *name
, int flags
, const struct decode_NEGOTIATE_MESSAGE
*r
)
2147 ndr_print_struct(ndr
, name
, "decode_NEGOTIATE_MESSAGE");
2149 if (flags
& NDR_SET_VALUES
) {
2150 ndr
->flags
|= LIBNDR_PRINT_SET_VALUES
;
2152 if (flags
& NDR_IN
) {
2153 ndr_print_struct(ndr
, "in", "decode_NEGOTIATE_MESSAGE");
2155 ndr_print_NEGOTIATE_MESSAGE(ndr
, "negotiate", &r
->in
.negotiate
);
2158 if (flags
& NDR_OUT
) {
2159 ndr_print_struct(ndr
, "out", "decode_NEGOTIATE_MESSAGE");
2166 static enum ndr_err_code
ndr_push_decode_CHALLENGE_MESSAGE(struct ndr_push
*ndr
, int flags
, const struct decode_CHALLENGE_MESSAGE
*r
)
2168 if (flags
& NDR_IN
) {
2169 NDR_CHECK(ndr_push_CHALLENGE_MESSAGE(ndr
, NDR_SCALARS
|NDR_BUFFERS
, &r
->in
.challenge
));
2171 if (flags
& NDR_OUT
) {
2173 return NDR_ERR_SUCCESS
;
2176 static enum ndr_err_code
ndr_pull_decode_CHALLENGE_MESSAGE(struct ndr_pull
*ndr
, int flags
, struct decode_CHALLENGE_MESSAGE
*r
)
2178 if (flags
& NDR_IN
) {
2179 NDR_CHECK(ndr_pull_CHALLENGE_MESSAGE(ndr
, NDR_SCALARS
|NDR_BUFFERS
, &r
->in
.challenge
));
2181 if (flags
& NDR_OUT
) {
2183 return NDR_ERR_SUCCESS
;
2186 _PUBLIC_
void ndr_print_decode_CHALLENGE_MESSAGE(struct ndr_print
*ndr
, const char *name
, int flags
, const struct decode_CHALLENGE_MESSAGE
*r
)
2188 ndr_print_struct(ndr
, name
, "decode_CHALLENGE_MESSAGE");
2190 if (flags
& NDR_SET_VALUES
) {
2191 ndr
->flags
|= LIBNDR_PRINT_SET_VALUES
;
2193 if (flags
& NDR_IN
) {
2194 ndr_print_struct(ndr
, "in", "decode_CHALLENGE_MESSAGE");
2196 ndr_print_CHALLENGE_MESSAGE(ndr
, "challenge", &r
->in
.challenge
);
2199 if (flags
& NDR_OUT
) {
2200 ndr_print_struct(ndr
, "out", "decode_CHALLENGE_MESSAGE");
2207 static enum ndr_err_code
ndr_push_decode_AUTHENTICATE_MESSAGE(struct ndr_push
*ndr
, int flags
, const struct decode_AUTHENTICATE_MESSAGE
*r
)
2209 if (flags
& NDR_IN
) {
2210 NDR_CHECK(ndr_push_AUTHENTICATE_MESSAGE(ndr
, NDR_SCALARS
|NDR_BUFFERS
, &r
->in
.authenticate
));
2212 if (flags
& NDR_OUT
) {
2214 return NDR_ERR_SUCCESS
;
2217 static enum ndr_err_code
ndr_pull_decode_AUTHENTICATE_MESSAGE(struct ndr_pull
*ndr
, int flags
, struct decode_AUTHENTICATE_MESSAGE
*r
)
2219 if (flags
& NDR_IN
) {
2220 NDR_CHECK(ndr_pull_AUTHENTICATE_MESSAGE(ndr
, NDR_SCALARS
|NDR_BUFFERS
, &r
->in
.authenticate
));
2222 if (flags
& NDR_OUT
) {
2224 return NDR_ERR_SUCCESS
;
2227 _PUBLIC_
void ndr_print_decode_AUTHENTICATE_MESSAGE(struct ndr_print
*ndr
, const char *name
, int flags
, const struct decode_AUTHENTICATE_MESSAGE
*r
)
2229 ndr_print_struct(ndr
, name
, "decode_AUTHENTICATE_MESSAGE");
2231 if (flags
& NDR_SET_VALUES
) {
2232 ndr
->flags
|= LIBNDR_PRINT_SET_VALUES
;
2234 if (flags
& NDR_IN
) {
2235 ndr_print_struct(ndr
, "in", "decode_AUTHENTICATE_MESSAGE");
2237 ndr_print_AUTHENTICATE_MESSAGE(ndr
, "authenticate", &r
->in
.authenticate
);
2240 if (flags
& NDR_OUT
) {
2241 ndr_print_struct(ndr
, "out", "decode_AUTHENTICATE_MESSAGE");
2248 static enum ndr_err_code
ndr_push_decode_NTLMv2_CLIENT_CHALLENGE(struct ndr_push
*ndr
, int flags
, const struct decode_NTLMv2_CLIENT_CHALLENGE
*r
)
2250 if (flags
& NDR_IN
) {
2251 NDR_CHECK(ndr_push_NTLMv2_CLIENT_CHALLENGE(ndr
, NDR_SCALARS
|NDR_BUFFERS
, &r
->in
.challenge
));
2253 if (flags
& NDR_OUT
) {
2255 return NDR_ERR_SUCCESS
;
2258 static enum ndr_err_code
ndr_pull_decode_NTLMv2_CLIENT_CHALLENGE(struct ndr_pull
*ndr
, int flags
, struct decode_NTLMv2_CLIENT_CHALLENGE
*r
)
2260 if (flags
& NDR_IN
) {
2261 NDR_CHECK(ndr_pull_NTLMv2_CLIENT_CHALLENGE(ndr
, NDR_SCALARS
|NDR_BUFFERS
, &r
->in
.challenge
));
2263 if (flags
& NDR_OUT
) {
2265 return NDR_ERR_SUCCESS
;
2268 _PUBLIC_
void ndr_print_decode_NTLMv2_CLIENT_CHALLENGE(struct ndr_print
*ndr
, const char *name
, int flags
, const struct decode_NTLMv2_CLIENT_CHALLENGE
*r
)
2270 ndr_print_struct(ndr
, name
, "decode_NTLMv2_CLIENT_CHALLENGE");
2272 if (flags
& NDR_SET_VALUES
) {
2273 ndr
->flags
|= LIBNDR_PRINT_SET_VALUES
;
2275 if (flags
& NDR_IN
) {
2276 ndr_print_struct(ndr
, "in", "decode_NTLMv2_CLIENT_CHALLENGE");
2278 ndr_print_NTLMv2_CLIENT_CHALLENGE(ndr
, "challenge", &r
->in
.challenge
);
2281 if (flags
& NDR_OUT
) {
2282 ndr_print_struct(ndr
, "out", "decode_NTLMv2_CLIENT_CHALLENGE");
2289 static const struct ndr_interface_call ntlmssp_calls
[] = {
2291 "decode_NEGOTIATE_MESSAGE",
2292 sizeof(struct decode_NEGOTIATE_MESSAGE
),
2293 (ndr_push_flags_fn_t
) ndr_push_decode_NEGOTIATE_MESSAGE
,
2294 (ndr_pull_flags_fn_t
) ndr_pull_decode_NEGOTIATE_MESSAGE
,
2295 (ndr_print_function_t
) ndr_print_decode_NEGOTIATE_MESSAGE
,
2299 "decode_CHALLENGE_MESSAGE",
2300 sizeof(struct decode_CHALLENGE_MESSAGE
),
2301 (ndr_push_flags_fn_t
) ndr_push_decode_CHALLENGE_MESSAGE
,
2302 (ndr_pull_flags_fn_t
) ndr_pull_decode_CHALLENGE_MESSAGE
,
2303 (ndr_print_function_t
) ndr_print_decode_CHALLENGE_MESSAGE
,
2307 "decode_AUTHENTICATE_MESSAGE",
2308 sizeof(struct decode_AUTHENTICATE_MESSAGE
),
2309 (ndr_push_flags_fn_t
) ndr_push_decode_AUTHENTICATE_MESSAGE
,
2310 (ndr_pull_flags_fn_t
) ndr_pull_decode_AUTHENTICATE_MESSAGE
,
2311 (ndr_print_function_t
) ndr_print_decode_AUTHENTICATE_MESSAGE
,
2315 "decode_NTLMv2_CLIENT_CHALLENGE",
2316 sizeof(struct decode_NTLMv2_CLIENT_CHALLENGE
),
2317 (ndr_push_flags_fn_t
) ndr_push_decode_NTLMv2_CLIENT_CHALLENGE
,
2318 (ndr_pull_flags_fn_t
) ndr_pull_decode_NTLMv2_CLIENT_CHALLENGE
,
2319 (ndr_print_function_t
) ndr_print_decode_NTLMv2_CLIENT_CHALLENGE
,
2322 { NULL
, 0, NULL
, NULL
, NULL
, false }
2325 static const char * const ntlmssp_endpoint_strings
[] = {
2326 "ncacn_np:[\\pipe\\ntlmssp]",
2329 static const struct ndr_interface_string_array ntlmssp_endpoints
= {
2331 .names
= ntlmssp_endpoint_strings
2334 static const char * const ntlmssp_authservice_strings
[] = {
2338 static const struct ndr_interface_string_array ntlmssp_authservices
= {
2340 .names
= ntlmssp_authservice_strings
2344 const struct ndr_interface_table ndr_table_ntlmssp
= {
2347 {0x6e746c6d,0x7373,0x700a,{0x00,0x00},{0x00,0x00,0x00,0x00}},
2350 .helpstring
= NDR_NTLMSSP_HELPSTRING
,
2352 .calls
= ntlmssp_calls
,
2353 .endpoints
= &ntlmssp_endpoints
,
2354 .authservices
= &ntlmssp_authservices