From 2b16380a0e22cc455f698e59cd94bfd899c989d0 Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Thu, 3 Sep 2009 02:06:34 +0200 Subject: ntlmssp: add some void decode calls (useful for ndrdump). Guenther --- librpc/gen_ndr/ndr_ntlmssp.c | 232 +++++++++++++++++++++++++++++++++++++++++++ librpc/gen_ndr/ndr_ntlmssp.h | 19 +++- librpc/gen_ndr/ntlmssp.h | 32 ++++++ 3 files changed, 282 insertions(+), 1 deletion(-) (limited to 'librpc/gen_ndr') diff --git a/librpc/gen_ndr/ndr_ntlmssp.c b/librpc/gen_ndr/ndr_ntlmssp.c index 549b4dec6f..b593d9e7e3 100644 --- a/librpc/gen_ndr/ndr_ntlmssp.c +++ b/librpc/gen_ndr/ndr_ntlmssp.c @@ -2094,3 +2094,235 @@ _PUBLIC_ void ndr_print_NTLMSSP_MESSAGE_SIGNATURE_NTLMv2(struct ndr_print *ndr, } } +static enum ndr_err_code ndr_push_decode_NEGOTIATE_MESSAGE(struct ndr_push *ndr, int flags, const struct decode_NEGOTIATE_MESSAGE *r) +{ + if (flags & NDR_IN) { + NDR_CHECK(ndr_push_NEGOTIATE_MESSAGE(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.negotiate)); + } + if (flags & NDR_OUT) { + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_decode_NEGOTIATE_MESSAGE(struct ndr_pull *ndr, int flags, struct decode_NEGOTIATE_MESSAGE *r) +{ + if (flags & NDR_IN) { + NDR_CHECK(ndr_pull_NEGOTIATE_MESSAGE(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.negotiate)); + } + if (flags & NDR_OUT) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_decode_NEGOTIATE_MESSAGE(struct ndr_print *ndr, const char *name, int flags, const struct decode_NEGOTIATE_MESSAGE *r) +{ + ndr_print_struct(ndr, name, "decode_NEGOTIATE_MESSAGE"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "decode_NEGOTIATE_MESSAGE"); + ndr->depth++; + ndr_print_NEGOTIATE_MESSAGE(ndr, "negotiate", &r->in.negotiate); + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "decode_NEGOTIATE_MESSAGE"); + ndr->depth++; + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_decode_CHALLENGE_MESSAGE(struct ndr_push *ndr, int flags, const struct decode_CHALLENGE_MESSAGE *r) +{ + if (flags & NDR_IN) { + NDR_CHECK(ndr_push_CHALLENGE_MESSAGE(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.challenge)); + } + if (flags & NDR_OUT) { + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_decode_CHALLENGE_MESSAGE(struct ndr_pull *ndr, int flags, struct decode_CHALLENGE_MESSAGE *r) +{ + if (flags & NDR_IN) { + NDR_CHECK(ndr_pull_CHALLENGE_MESSAGE(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.challenge)); + } + if (flags & NDR_OUT) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_decode_CHALLENGE_MESSAGE(struct ndr_print *ndr, const char *name, int flags, const struct decode_CHALLENGE_MESSAGE *r) +{ + ndr_print_struct(ndr, name, "decode_CHALLENGE_MESSAGE"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "decode_CHALLENGE_MESSAGE"); + ndr->depth++; + ndr_print_CHALLENGE_MESSAGE(ndr, "challenge", &r->in.challenge); + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "decode_CHALLENGE_MESSAGE"); + ndr->depth++; + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_decode_AUTHENTICATE_MESSAGE(struct ndr_push *ndr, int flags, const struct decode_AUTHENTICATE_MESSAGE *r) +{ + if (flags & NDR_IN) { + NDR_CHECK(ndr_push_AUTHENTICATE_MESSAGE(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.authenticate)); + } + if (flags & NDR_OUT) { + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_decode_AUTHENTICATE_MESSAGE(struct ndr_pull *ndr, int flags, struct decode_AUTHENTICATE_MESSAGE *r) +{ + if (flags & NDR_IN) { + NDR_CHECK(ndr_pull_AUTHENTICATE_MESSAGE(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.authenticate)); + } + if (flags & NDR_OUT) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_decode_AUTHENTICATE_MESSAGE(struct ndr_print *ndr, const char *name, int flags, const struct decode_AUTHENTICATE_MESSAGE *r) +{ + ndr_print_struct(ndr, name, "decode_AUTHENTICATE_MESSAGE"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "decode_AUTHENTICATE_MESSAGE"); + ndr->depth++; + ndr_print_AUTHENTICATE_MESSAGE(ndr, "authenticate", &r->in.authenticate); + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "decode_AUTHENTICATE_MESSAGE"); + ndr->depth++; + ndr->depth--; + } + ndr->depth--; +} + +static enum ndr_err_code ndr_push_decode_NTLMv2_CLIENT_CHALLENGE(struct ndr_push *ndr, int flags, const struct decode_NTLMv2_CLIENT_CHALLENGE *r) +{ + if (flags & NDR_IN) { + NDR_CHECK(ndr_push_NTLMv2_CLIENT_CHALLENGE(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.challenge)); + } + if (flags & NDR_OUT) { + } + return NDR_ERR_SUCCESS; +} + +static enum ndr_err_code ndr_pull_decode_NTLMv2_CLIENT_CHALLENGE(struct ndr_pull *ndr, int flags, struct decode_NTLMv2_CLIENT_CHALLENGE *r) +{ + if (flags & NDR_IN) { + NDR_CHECK(ndr_pull_NTLMv2_CLIENT_CHALLENGE(ndr, NDR_SCALARS|NDR_BUFFERS, &r->in.challenge)); + } + if (flags & NDR_OUT) { + } + return NDR_ERR_SUCCESS; +} + +_PUBLIC_ void ndr_print_decode_NTLMv2_CLIENT_CHALLENGE(struct ndr_print *ndr, const char *name, int flags, const struct decode_NTLMv2_CLIENT_CHALLENGE *r) +{ + ndr_print_struct(ndr, name, "decode_NTLMv2_CLIENT_CHALLENGE"); + ndr->depth++; + if (flags & NDR_SET_VALUES) { + ndr->flags |= LIBNDR_PRINT_SET_VALUES; + } + if (flags & NDR_IN) { + ndr_print_struct(ndr, "in", "decode_NTLMv2_CLIENT_CHALLENGE"); + ndr->depth++; + ndr_print_NTLMv2_CLIENT_CHALLENGE(ndr, "challenge", &r->in.challenge); + ndr->depth--; + } + if (flags & NDR_OUT) { + ndr_print_struct(ndr, "out", "decode_NTLMv2_CLIENT_CHALLENGE"); + ndr->depth++; + ndr->depth--; + } + ndr->depth--; +} + +static const struct ndr_interface_call ntlmssp_calls[] = { + { + "decode_NEGOTIATE_MESSAGE", + sizeof(struct decode_NEGOTIATE_MESSAGE), + (ndr_push_flags_fn_t) ndr_push_decode_NEGOTIATE_MESSAGE, + (ndr_pull_flags_fn_t) ndr_pull_decode_NEGOTIATE_MESSAGE, + (ndr_print_function_t) ndr_print_decode_NEGOTIATE_MESSAGE, + false, + }, + { + "decode_CHALLENGE_MESSAGE", + sizeof(struct decode_CHALLENGE_MESSAGE), + (ndr_push_flags_fn_t) ndr_push_decode_CHALLENGE_MESSAGE, + (ndr_pull_flags_fn_t) ndr_pull_decode_CHALLENGE_MESSAGE, + (ndr_print_function_t) ndr_print_decode_CHALLENGE_MESSAGE, + false, + }, + { + "decode_AUTHENTICATE_MESSAGE", + sizeof(struct decode_AUTHENTICATE_MESSAGE), + (ndr_push_flags_fn_t) ndr_push_decode_AUTHENTICATE_MESSAGE, + (ndr_pull_flags_fn_t) ndr_pull_decode_AUTHENTICATE_MESSAGE, + (ndr_print_function_t) ndr_print_decode_AUTHENTICATE_MESSAGE, + false, + }, + { + "decode_NTLMv2_CLIENT_CHALLENGE", + sizeof(struct decode_NTLMv2_CLIENT_CHALLENGE), + (ndr_push_flags_fn_t) ndr_push_decode_NTLMv2_CLIENT_CHALLENGE, + (ndr_pull_flags_fn_t) ndr_pull_decode_NTLMv2_CLIENT_CHALLENGE, + (ndr_print_function_t) ndr_print_decode_NTLMv2_CLIENT_CHALLENGE, + false, + }, + { NULL, 0, NULL, NULL, NULL, false } +}; + +static const char * const ntlmssp_endpoint_strings[] = { + "ncacn_np:[\\pipe\\ntlmssp]", +}; + +static const struct ndr_interface_string_array ntlmssp_endpoints = { + .count = 1, + .names = ntlmssp_endpoint_strings +}; + +static const char * const ntlmssp_authservice_strings[] = { + "host", +}; + +static const struct ndr_interface_string_array ntlmssp_authservices = { + .count = 1, + .names = ntlmssp_authservice_strings +}; + + +const struct ndr_interface_table ndr_table_ntlmssp = { + .name = "ntlmssp", + .syntax_id = { + {0x6e746c6d,0x7373,0x700a,{0x00,0x00},{0x00,0x00,0x00,0x00}}, + NDR_NTLMSSP_VERSION + }, + .helpstring = NDR_NTLMSSP_HELPSTRING, + .num_calls = 4, + .calls = ntlmssp_calls, + .endpoints = &ntlmssp_endpoints, + .authservices = &ntlmssp_authservices +}; + diff --git a/librpc/gen_ndr/ndr_ntlmssp.h b/librpc/gen_ndr/ndr_ntlmssp.h index 514d871cc7..ab095d1cc2 100644 --- a/librpc/gen_ndr/ndr_ntlmssp.h +++ b/librpc/gen_ndr/ndr_ntlmssp.h @@ -7,7 +7,20 @@ #define _HEADER_NDR_ntlmssp #include "../librpc/ndr/ndr_ntlmssp.h" -#define NDR_NTLMSSP_CALL_COUNT (0) +#define NDR_NTLMSSP_UUID "6e746c6d-7373-700a-0000-00000000" +#define NDR_NTLMSSP_VERSION 0.0 +#define NDR_NTLMSSP_NAME "ntlmssp" +#define NDR_NTLMSSP_HELPSTRING "NTLM messages" +extern const struct ndr_interface_table ndr_table_ntlmssp; +#define NDR_DECODE_NEGOTIATE_MESSAGE (0x00) + +#define NDR_DECODE_CHALLENGE_MESSAGE (0x01) + +#define NDR_DECODE_AUTHENTICATE_MESSAGE (0x02) + +#define NDR_DECODE_NTLMV2_CLIENT_CHALLENGE (0x03) + +#define NDR_NTLMSSP_CALL_COUNT (4) void ndr_print_ntlmssp_MessageType(struct ndr_print *ndr, const char *name, enum ntlmssp_MessageType r); void ndr_print_NEGOTIATE(struct ndr_print *ndr, const char *name, uint32_t r); void ndr_print_ntlmssp_WindowsMajorVersion(struct ndr_print *ndr, const char *name, enum ntlmssp_WindowsMajorVersion r); @@ -57,4 +70,8 @@ void ndr_print_NTLMSSP_MESSAGE_SIGNATURE(struct ndr_print *ndr, const char *name enum ndr_err_code ndr_push_NTLMSSP_MESSAGE_SIGNATURE_NTLMv2(struct ndr_push *ndr, int ndr_flags, const struct NTLMSSP_MESSAGE_SIGNATURE_NTLMv2 *r); enum ndr_err_code ndr_pull_NTLMSSP_MESSAGE_SIGNATURE_NTLMv2(struct ndr_pull *ndr, int ndr_flags, struct NTLMSSP_MESSAGE_SIGNATURE_NTLMv2 *r); void ndr_print_NTLMSSP_MESSAGE_SIGNATURE_NTLMv2(struct ndr_print *ndr, const char *name, const struct NTLMSSP_MESSAGE_SIGNATURE_NTLMv2 *r); +void ndr_print_decode_NEGOTIATE_MESSAGE(struct ndr_print *ndr, const char *name, int flags, const struct decode_NEGOTIATE_MESSAGE *r); +void ndr_print_decode_CHALLENGE_MESSAGE(struct ndr_print *ndr, const char *name, int flags, const struct decode_CHALLENGE_MESSAGE *r); +void ndr_print_decode_AUTHENTICATE_MESSAGE(struct ndr_print *ndr, const char *name, int flags, const struct decode_AUTHENTICATE_MESSAGE *r); +void ndr_print_decode_NTLMv2_CLIENT_CHALLENGE(struct ndr_print *ndr, const char *name, int flags, const struct decode_NTLMv2_CLIENT_CHALLENGE *r); #endif /* _HEADER_NDR_ntlmssp */ diff --git a/librpc/gen_ndr/ntlmssp.h b/librpc/gen_ndr/ntlmssp.h index 6e5020f282..4509915974 100644 --- a/librpc/gen_ndr/ntlmssp.h +++ b/librpc/gen_ndr/ntlmssp.h @@ -282,4 +282,36 @@ struct NTLMSSP_MESSAGE_SIGNATURE_NTLMv2 { uint32_t SeqNum; }/* [public,flag(LIBNDR_PRINT_ARRAY_HEX)] */; + +struct decode_NEGOTIATE_MESSAGE { + struct { + struct NEGOTIATE_MESSAGE negotiate; + } in; + +}; + + +struct decode_CHALLENGE_MESSAGE { + struct { + struct CHALLENGE_MESSAGE challenge; + } in; + +}; + + +struct decode_AUTHENTICATE_MESSAGE { + struct { + struct AUTHENTICATE_MESSAGE authenticate; + } in; + +}; + + +struct decode_NTLMv2_CLIENT_CHALLENGE { + struct { + struct NTLMv2_CLIENT_CHALLENGE challenge; + } in; + +}; + #endif /* _HEADER_ntlmssp */ -- cgit