diff options
author | Günther Deschner <gd@samba.org> | 2009-09-03 02:06:34 +0200 |
---|---|---|
committer | Günther Deschner <gd@samba.org> | 2009-09-08 22:27:41 +0200 |
commit | 2b16380a0e22cc455f698e59cd94bfd899c989d0 (patch) | |
tree | cf4be7e67c3d20a784e8d35d9e2d762e643afec9 | |
parent | 4b6e9a8e49bb0f63eed65fd84c0aa28b394482cd (diff) | |
download | samba-2b16380a0e22cc455f698e59cd94bfd899c989d0.tar.gz samba-2b16380a0e22cc455f698e59cd94bfd899c989d0.tar.bz2 samba-2b16380a0e22cc455f698e59cd94bfd899c989d0.zip |
ntlmssp: add some void decode calls (useful for ndrdump).
Guenther
-rw-r--r-- | librpc/gen_ndr/ndr_ntlmssp.c | 232 | ||||
-rw-r--r-- | librpc/gen_ndr/ndr_ntlmssp.h | 19 | ||||
-rw-r--r-- | librpc/gen_ndr/ntlmssp.h | 32 | ||||
-rw-r--r-- | librpc/idl/ntlmssp.idl | 23 | ||||
-rw-r--r-- | source4/librpc/config.mk | 8 |
5 files changed, 311 insertions, 3 deletions
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 */ diff --git a/librpc/idl/ntlmssp.idl b/librpc/idl/ntlmssp.idl index dd42da0925..0bb30bb22e 100644 --- a/librpc/idl/ntlmssp.idl +++ b/librpc/idl/ntlmssp.idl @@ -6,7 +6,9 @@ [ pointer_default(unique), - helper("../librpc/ndr/ndr_ntlmssp.h") + helper("../librpc/ndr/ndr_ntlmssp.h"), + helpstring("NTLM messages"), + uuid("6e746c6d-7373-700a-0000-00000000") ] interface ntlmssp { @@ -270,4 +272,23 @@ interface ntlmssp uint8 Checksum[8]; uint32 SeqNum; } NTLMSSP_MESSAGE_SIGNATURE_NTLMv2; + + /* some ndrdump helpers */ + + void decode_NEGOTIATE_MESSAGE( + [in] NEGOTIATE_MESSAGE negotiate + ); + + void decode_CHALLENGE_MESSAGE( + [in] CHALLENGE_MESSAGE challenge + ); + + void decode_AUTHENTICATE_MESSAGE( + [in] AUTHENTICATE_MESSAGE authenticate + ); + + void decode_NTLMv2_CLIENT_CHALLENGE( + [in] NTLMv2_CLIENT_CHALLENGE challenge + ); + } diff --git a/source4/librpc/config.mk b/source4/librpc/config.mk index e51aa61d3a..ae5e86a578 100644 --- a/source4/librpc/config.mk +++ b/source4/librpc/config.mk @@ -291,6 +291,11 @@ PUBLIC_DEPENDENCIES = LIBNDR NDR_STANDARD NDR_WINBIND_OBJ_FILES = $(gen_ndrsrcdir)/ndr_winbind.o #PUBLIC_HEADERS += $(gen_ndrsrcdir)/winbind.h +[SUBSYSTEM::NDR_NTLMSSP] +PUBLIC_DEPENDENCIES = LIBNDR NDR_STANDARD + +NDR_NTLMSSP_OBJ_FILES = ../librpc/gen_ndr/ndr_ntlmssp.o ../librpc/ndr/ndr_ntlmssp.o + $(librpcsrcdir)/idl-deps: $(PERL) $(librpcsrcdir)/idl-deps.pl $(wildcard $(librpcsrcdir)/idl/*.idl ../librpc/idl/*.idl) >$@ @@ -346,7 +351,8 @@ PUBLIC_DEPENDENCIES = \ NDR_SASL_HELPERS NDR_NOTIFY NDR_WINBIND \ NDR_FRSRPC NDR_FRSAPI NDR_FRSTRANS \ NDR_NFS4ACL NDR_NTP_SIGND \ - NDR_DCOM NDR_WMI NDR_NAMED_PIPE_AUTH + NDR_DCOM NDR_WMI NDR_NAMED_PIPE_AUTH \ + NDR_NTLMSSP NDR_TABLE_OBJ_FILES = ../librpc/ndr/ndr_table.o $(gen_ndrsrcdir)/tables.o |