From 7c6c366150022d6a745dcf18ed67bd264bc9c55d Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 6 Apr 2005 11:17:08 +0000 Subject: r6223: added a bit more datagram infrastructure and the beginnings of a test suite. The NBT-DGRAM test does a UDP/138 netlogon request, to which a windows server sends a reply, but the windows server sends the reply to the wrong port (it always sends to 138), so the test suite doesn't see it. (This used to be commit a7634625dbc944dd8256a822be290010f341a571) --- source4/libcli/dgram/netlogon.c | 58 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 source4/libcli/dgram/netlogon.c (limited to 'source4/libcli/dgram/netlogon.c') diff --git a/source4/libcli/dgram/netlogon.c b/source4/libcli/dgram/netlogon.c new file mode 100644 index 0000000000..1f3a3d6c62 --- /dev/null +++ b/source4/libcli/dgram/netlogon.c @@ -0,0 +1,58 @@ +/* + Unix SMB/CIFS implementation. + + handling for netlogon dgram requests + + Copyright (C) Andrew Tridgell 2005 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +*/ + +#include "includes.h" +#include "lib/events/events.h" +#include "dlinklist.h" +#include "libcli/nbt/libnbt.h" +#include "libcli/dgram/libdgram.h" +#include "lib/socket/socket.h" +#include "librpc/gen_ndr/ndr_nbt.h" + +/* + send a netlogon mailslot request +*/ +NTSTATUS dgram_mailslot_netlogon_send(struct nbt_dgram_socket *dgmsock, + struct nbt_name *dest_name, + const char *dest_address, + struct nbt_name *src_name, + struct nbt_netlogon_packet *request) +{ + NTSTATUS status; + DATA_BLOB blob; + TALLOC_CTX *tmp_ctx = talloc_new(dgmsock); + + status = ndr_push_struct_blob(&blob, tmp_ctx, request, + (ndr_push_flags_fn_t)ndr_push_nbt_netlogon_packet); + if (!NT_STATUS_IS_OK(status)) { + talloc_free(tmp_ctx); + return status; + } + + + status = dgram_mailslot_send(dgmsock, DGRAM_DIRECT_UNIQUE, + "\\MAILSLOT\\NET\\NETLOGON", + dest_name, dest_address, src_name, &blob); + talloc_free(tmp_ctx); + return status; +} + -- cgit From f83e6ded9d31f819dba5e59e15c703d292716206 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 8 Apr 2005 05:34:13 +0000 Subject: r6245: receive and parse the GETDC response in the NBT-DGRAM test. The test now tries to bind to port 138 if possible, so if you run it as root and smbd/nmbd is not running then it works against windows servers (This used to be commit 52ccdb79bc922be52c24dd393323dbbee83a2aea) --- source4/libcli/dgram/netlogon.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'source4/libcli/dgram/netlogon.c') diff --git a/source4/libcli/dgram/netlogon.c b/source4/libcli/dgram/netlogon.c index 1f3a3d6c62..c76264eea4 100644 --- a/source4/libcli/dgram/netlogon.c +++ b/source4/libcli/dgram/netlogon.c @@ -56,3 +56,19 @@ NTSTATUS dgram_mailslot_netlogon_send(struct nbt_dgram_socket *dgmsock, return status; } + +/* + parse a netlogon response. The packet must be a valid mailslot packet +*/ +NTSTATUS dgram_mailslot_netlogon_parse(struct dgram_mailslot_handler *dgmslot, + TALLOC_CTX *mem_ctx, + struct nbt_dgram_packet *dgram, + struct nbt_netlogon_packet *netlogon) +{ + DATA_BLOB *data = &dgram->data.msg.body.smb.body.trans.data; + NTSTATUS status; + + status = ndr_pull_struct_blob(data, mem_ctx, netlogon, + (ndr_pull_flags_fn_t)ndr_pull_nbt_netlogon_packet); + return status; +} -- cgit From b0ca8ed4559efae38933f49a638e7b51ae8bf0c8 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 8 Apr 2005 08:57:09 +0000 Subject: r6247: added the server side code for receiving mailslot requests, and parsing incoming netlogon requests. No replies are sent yet. (This used to be commit 3b34df6a674cd2aeddc354cdadae3f0e1c000d45) --- source4/libcli/dgram/netlogon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/libcli/dgram/netlogon.c') diff --git a/source4/libcli/dgram/netlogon.c b/source4/libcli/dgram/netlogon.c index c76264eea4..a0218e2cb5 100644 --- a/source4/libcli/dgram/netlogon.c +++ b/source4/libcli/dgram/netlogon.c @@ -50,7 +50,7 @@ NTSTATUS dgram_mailslot_netlogon_send(struct nbt_dgram_socket *dgmsock, status = dgram_mailslot_send(dgmsock, DGRAM_DIRECT_UNIQUE, - "\\MAILSLOT\\NET\\NETLOGON", + NBT_MAILSLOT_NETLOGON, dest_name, dest_address, src_name, &blob); talloc_free(tmp_ctx); return status; -- cgit From ce7eb419307de28b6a674948a70960a39e0c38f8 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 8 Apr 2005 09:38:16 +0000 Subject: r6248: added parsing of type 10 UAS announce netlogon packets (This used to be commit d7e6e395cedef47dc182094c91f764e248b9b149) --- source4/libcli/dgram/netlogon.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'source4/libcli/dgram/netlogon.c') diff --git a/source4/libcli/dgram/netlogon.c b/source4/libcli/dgram/netlogon.c index a0218e2cb5..869e99e2fc 100644 --- a/source4/libcli/dgram/netlogon.c +++ b/source4/libcli/dgram/netlogon.c @@ -70,5 +70,12 @@ NTSTATUS dgram_mailslot_netlogon_parse(struct dgram_mailslot_handler *dgmslot, status = ndr_pull_struct_blob(data, mem_ctx, netlogon, (ndr_pull_flags_fn_t)ndr_pull_nbt_netlogon_packet); + if (!NT_STATUS_IS_OK(status)) { + DEBUG(0,("Failed to parse netlogon packet of length %d\n", + data->length)); +#if 0 + file_save("netlogon.dat", data->data, data->length); +#endif + } return status; } -- cgit From b708e87a63947bc963d17592ac88022b708816c3 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 10 Apr 2005 23:09:38 +0000 Subject: r6288: the nbt dgram server now responds to GETDC requests. It works with our test suite, but doesn't yet seem to satisfy a nt4 client. I'm investigating. (This used to be commit 406217262dff5adb5d0cb0028198e08f66cc85f4) --- source4/libcli/dgram/netlogon.c | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) (limited to 'source4/libcli/dgram/netlogon.c') diff --git a/source4/libcli/dgram/netlogon.c b/source4/libcli/dgram/netlogon.c index 869e99e2fc..138cc0d484 100644 --- a/source4/libcli/dgram/netlogon.c +++ b/source4/libcli/dgram/netlogon.c @@ -34,6 +34,7 @@ NTSTATUS dgram_mailslot_netlogon_send(struct nbt_dgram_socket *dgmsock, struct nbt_name *dest_name, const char *dest_address, + int dest_port, struct nbt_name *src_name, struct nbt_netlogon_packet *request) { @@ -51,7 +52,37 @@ NTSTATUS dgram_mailslot_netlogon_send(struct nbt_dgram_socket *dgmsock, status = dgram_mailslot_send(dgmsock, DGRAM_DIRECT_UNIQUE, NBT_MAILSLOT_NETLOGON, - dest_name, dest_address, src_name, &blob); + dest_name, dest_address, dest_port, + src_name, &blob); + talloc_free(tmp_ctx); + return status; +} + + +/* + send a netlogon mailslot reply +*/ +NTSTATUS dgram_mailslot_netlogon_reply(struct nbt_dgram_socket *dgmsock, + struct nbt_dgram_packet *request, + const char *mailslot_name, + struct nbt_netlogon_packet *reply) +{ + NTSTATUS status; + DATA_BLOB blob; + TALLOC_CTX *tmp_ctx = talloc_new(dgmsock); + + status = ndr_push_struct_blob(&blob, tmp_ctx, reply, + (ndr_push_flags_fn_t)ndr_push_nbt_netlogon_packet); + if (!NT_STATUS_IS_OK(status)) { + talloc_free(tmp_ctx); + return status; + } + + status = dgram_mailslot_send(dgmsock, DGRAM_DIRECT_UNIQUE, + mailslot_name, + &request->data.msg.source_name, + request->source, request->src_port, + &request->data.msg.dest_name, &blob); talloc_free(tmp_ctx); return status; } -- cgit From b6fd09d80504d55be98b167cd12b5507573d32db Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 13 Apr 2005 03:43:17 +0000 Subject: r6320: some minor netlogon datagram fixes - NT4 can now join a Samba4 domain without Samba3 nmbd (This used to be commit 4507bdc339505e91118d403948946f4a98a4f562) --- source4/libcli/dgram/netlogon.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'source4/libcli/dgram/netlogon.c') diff --git a/source4/libcli/dgram/netlogon.c b/source4/libcli/dgram/netlogon.c index 138cc0d484..a030ca73c2 100644 --- a/source4/libcli/dgram/netlogon.c +++ b/source4/libcli/dgram/netlogon.c @@ -70,6 +70,7 @@ NTSTATUS dgram_mailslot_netlogon_reply(struct nbt_dgram_socket *dgmsock, NTSTATUS status; DATA_BLOB blob; TALLOC_CTX *tmp_ctx = talloc_new(dgmsock); + struct nbt_name myname; status = ndr_push_struct_blob(&blob, tmp_ctx, reply, (ndr_push_flags_fn_t)ndr_push_nbt_netlogon_packet); @@ -78,11 +79,15 @@ NTSTATUS dgram_mailslot_netlogon_reply(struct nbt_dgram_socket *dgmsock, return status; } + myname.name = lp_netbios_name(); + myname.type = NBT_NAME_CLIENT; + myname.scope = NULL; + status = dgram_mailslot_send(dgmsock, DGRAM_DIRECT_UNIQUE, mailslot_name, &request->data.msg.source_name, request->source, request->src_port, - &request->data.msg.dest_name, &blob); + &myname, &blob); talloc_free(tmp_ctx); return status; } -- cgit From 63ddff3d7b59fef8c8f2340803b85cde33a49402 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 13 Apr 2005 05:50:02 +0000 Subject: r6323: added server side support for dgram NTLOGON requests. NT4 workstations can now login to a Samba4 domain. (This used to be commit df146d64ebce6b462c08a1f30919390fcf8196cb) --- source4/libcli/dgram/netlogon.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source4/libcli/dgram/netlogon.c') diff --git a/source4/libcli/dgram/netlogon.c b/source4/libcli/dgram/netlogon.c index a030ca73c2..208117845b 100644 --- a/source4/libcli/dgram/netlogon.c +++ b/source4/libcli/dgram/netlogon.c @@ -101,16 +101,16 @@ NTSTATUS dgram_mailslot_netlogon_parse(struct dgram_mailslot_handler *dgmslot, struct nbt_dgram_packet *dgram, struct nbt_netlogon_packet *netlogon) { - DATA_BLOB *data = &dgram->data.msg.body.smb.body.trans.data; + DATA_BLOB data = dgram_mailslot_data(dgram); NTSTATUS status; - status = ndr_pull_struct_blob(data, mem_ctx, netlogon, + status = ndr_pull_struct_blob(&data, mem_ctx, netlogon, (ndr_pull_flags_fn_t)ndr_pull_nbt_netlogon_packet); if (!NT_STATUS_IS_OK(status)) { DEBUG(0,("Failed to parse netlogon packet of length %d\n", - data->length)); + data.length)); #if 0 - file_save("netlogon.dat", data->data, data->length); + file_save("netlogon.dat", data.data, data.length); #endif } return status; -- cgit From 8c4e06004cf5e95ea861440ef0ec0b4ddacf4c10 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Thu, 14 Apr 2005 05:55:32 +0000 Subject: r6335: at debug level 10, save netlogon and ntlogon packets that fail to parse (This used to be commit c29279355c679e821665d028f207ee9ed6f857ef) --- source4/libcli/dgram/netlogon.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source4/libcli/dgram/netlogon.c') diff --git a/source4/libcli/dgram/netlogon.c b/source4/libcli/dgram/netlogon.c index 208117845b..6e939725d0 100644 --- a/source4/libcli/dgram/netlogon.c +++ b/source4/libcli/dgram/netlogon.c @@ -109,9 +109,9 @@ NTSTATUS dgram_mailslot_netlogon_parse(struct dgram_mailslot_handler *dgmslot, if (!NT_STATUS_IS_OK(status)) { DEBUG(0,("Failed to parse netlogon packet of length %d\n", data.length)); -#if 0 - file_save("netlogon.dat", data.data, data.length); -#endif + if (DEBUGLVL(10)) { + file_save("netlogon.dat", data.data, data.length); + } } return status; } -- cgit From 2b7fe67f4d02f861c9a4bfe823e648f0a995e613 Mon Sep 17 00:00:00 2001 From: Tim Potter Date: Sun, 22 May 2005 10:23:01 +0000 Subject: r6933: Add a couple of helper functions for creating nbt names. (This used to be commit b896daf11c3efb1b3ca939575da9dab82b395777) --- source4/libcli/dgram/netlogon.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'source4/libcli/dgram/netlogon.c') diff --git a/source4/libcli/dgram/netlogon.c b/source4/libcli/dgram/netlogon.c index 6e939725d0..9d3a0dbed9 100644 --- a/source4/libcli/dgram/netlogon.c +++ b/source4/libcli/dgram/netlogon.c @@ -79,9 +79,7 @@ NTSTATUS dgram_mailslot_netlogon_reply(struct nbt_dgram_socket *dgmsock, return status; } - myname.name = lp_netbios_name(); - myname.type = NBT_NAME_CLIENT; - myname.scope = NULL; + make_nbt_name_client(&myname, lp_netbios_name()); status = dgram_mailslot_send(dgmsock, DGRAM_DIRECT_UNIQUE, mailslot_name, -- cgit From e835621799647ee70630b389fb53d15b15d68355 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Sun, 17 Jul 2005 09:20:52 +0000 Subject: r8520: fixed a pile of warnings from the build farm gcc -Wall output on S390. This is an attempt to avoid the panic we're seeing in the automatic builds. The main fixes are: - assumptions that sizeof(size_t) == sizeof(int), mostly in printf formats - use of NULL format statements to perform dn searches. - assumption that sizeof() returns an int (This used to be commit a58ea6b3854973b694d2b1e22323ed7eb00e3a3f) --- source4/libcli/dgram/netlogon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/libcli/dgram/netlogon.c') diff --git a/source4/libcli/dgram/netlogon.c b/source4/libcli/dgram/netlogon.c index 9d3a0dbed9..dda77689de 100644 --- a/source4/libcli/dgram/netlogon.c +++ b/source4/libcli/dgram/netlogon.c @@ -106,7 +106,7 @@ NTSTATUS dgram_mailslot_netlogon_parse(struct dgram_mailslot_handler *dgmslot, (ndr_pull_flags_fn_t)ndr_pull_nbt_netlogon_packet); if (!NT_STATUS_IS_OK(status)) { DEBUG(0,("Failed to parse netlogon packet of length %d\n", - data.length)); + (int)data.length)); if (DEBUGLVL(10)) { file_save("netlogon.dat", data.data, data.length); } -- cgit From fccbbf354634b31c9c3cb2bca15843f13e3b77f9 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 14 Oct 2005 12:22:15 +0000 Subject: r10997: r11980@SERNOX (orig r10037): metze | 2005-09-05 14:21:40 +0200 add struct nbt_peer_socket and use it instead of passing const char *addr, uint16 port everyhwere (tridge: can you review this please, (make test works) metze (This used to be commit a599d7a4ae881c94be2c2d908a398838549942bb) --- source4/libcli/dgram/netlogon.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'source4/libcli/dgram/netlogon.c') diff --git a/source4/libcli/dgram/netlogon.c b/source4/libcli/dgram/netlogon.c index dda77689de..0627fe900c 100644 --- a/source4/libcli/dgram/netlogon.c +++ b/source4/libcli/dgram/netlogon.c @@ -33,8 +33,7 @@ */ NTSTATUS dgram_mailslot_netlogon_send(struct nbt_dgram_socket *dgmsock, struct nbt_name *dest_name, - const char *dest_address, - int dest_port, + const struct nbt_peer_socket *dest, struct nbt_name *src_name, struct nbt_netlogon_packet *request) { @@ -52,7 +51,7 @@ NTSTATUS dgram_mailslot_netlogon_send(struct nbt_dgram_socket *dgmsock, status = dgram_mailslot_send(dgmsock, DGRAM_DIRECT_UNIQUE, NBT_MAILSLOT_NETLOGON, - dest_name, dest_address, dest_port, + dest_name, dest, src_name, &blob); talloc_free(tmp_ctx); return status; @@ -71,6 +70,7 @@ NTSTATUS dgram_mailslot_netlogon_reply(struct nbt_dgram_socket *dgmsock, DATA_BLOB blob; TALLOC_CTX *tmp_ctx = talloc_new(dgmsock); struct nbt_name myname; + struct nbt_peer_socket dest; status = ndr_push_struct_blob(&blob, tmp_ctx, reply, (ndr_push_flags_fn_t)ndr_push_nbt_netlogon_packet); @@ -81,10 +81,12 @@ NTSTATUS dgram_mailslot_netlogon_reply(struct nbt_dgram_socket *dgmsock, make_nbt_name_client(&myname, lp_netbios_name()); + dest.port = request->src_port; + dest.addr = request->src_addr; status = dgram_mailslot_send(dgmsock, DGRAM_DIRECT_UNIQUE, mailslot_name, &request->data.msg.source_name, - request->source, request->src_port, + &dest, &myname, &blob); talloc_free(tmp_ctx); return status; -- cgit From d4de4c2d210d2e8c9b5aedf70695594809ad6a0b Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 30 Dec 2005 13:16:54 +0000 Subject: r12608: Remove some unused #include lines. (This used to be commit 70e7449318aa0e9d2639c76730a7d1683b2f4981) --- source4/libcli/dgram/netlogon.c | 5 ----- 1 file changed, 5 deletions(-) (limited to 'source4/libcli/dgram/netlogon.c') diff --git a/source4/libcli/dgram/netlogon.c b/source4/libcli/dgram/netlogon.c index 0627fe900c..dffeae2007 100644 --- a/source4/libcli/dgram/netlogon.c +++ b/source4/libcli/dgram/netlogon.c @@ -21,12 +21,7 @@ */ #include "includes.h" -#include "lib/events/events.h" -#include "dlinklist.h" -#include "libcli/nbt/libnbt.h" #include "libcli/dgram/libdgram.h" -#include "lib/socket/socket.h" -#include "librpc/gen_ndr/ndr_nbt.h" /* send a netlogon mailslot request -- cgit From f55ea8bb3dca868e21663cd90eaea7a35cd7886c Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 9 Jan 2006 22:12:53 +0000 Subject: r12804: This patch reworks the Samba4 sockets layer to use a socket_address structure that is more generic than just 'IP/port'. It now passes make test, and has been reviewed and updated by metze. (Thankyou *very* much). This passes 'make test' as well as kerberos use (not currently in the testsuite). The original purpose of this patch was to have Samba able to pass a socket address stucture from the BSD layer into the kerberos routines and back again. It also removes nbt_peer_addr, which was being used for a similar purpose. It is a large change, but worthwhile I feel. Andrew Bartlett (This used to be commit 88198c4881d8620a37086f80e4da5a5b71c5bbb2) --- source4/libcli/dgram/netlogon.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'source4/libcli/dgram/netlogon.c') diff --git a/source4/libcli/dgram/netlogon.c b/source4/libcli/dgram/netlogon.c index dffeae2007..6ad4c28811 100644 --- a/source4/libcli/dgram/netlogon.c +++ b/source4/libcli/dgram/netlogon.c @@ -22,13 +22,14 @@ #include "includes.h" #include "libcli/dgram/libdgram.h" +#include "lib/socket/socket.h" /* send a netlogon mailslot request */ NTSTATUS dgram_mailslot_netlogon_send(struct nbt_dgram_socket *dgmsock, struct nbt_name *dest_name, - const struct nbt_peer_socket *dest, + struct socket_address *dest, struct nbt_name *src_name, struct nbt_netlogon_packet *request) { @@ -65,7 +66,7 @@ NTSTATUS dgram_mailslot_netlogon_reply(struct nbt_dgram_socket *dgmsock, DATA_BLOB blob; TALLOC_CTX *tmp_ctx = talloc_new(dgmsock); struct nbt_name myname; - struct nbt_peer_socket dest; + struct socket_address *dest; status = ndr_push_struct_blob(&blob, tmp_ctx, reply, (ndr_push_flags_fn_t)ndr_push_nbt_netlogon_packet); @@ -76,12 +77,17 @@ NTSTATUS dgram_mailslot_netlogon_reply(struct nbt_dgram_socket *dgmsock, make_nbt_name_client(&myname, lp_netbios_name()); - dest.port = request->src_port; - dest.addr = request->src_addr; + dest = socket_address_from_strings(tmp_ctx, dgmsock->sock->backend_name, + request->src_addr, request->src_port); + if (!dest) { + talloc_free(tmp_ctx); + return NT_STATUS_NO_MEMORY; + } + status = dgram_mailslot_send(dgmsock, DGRAM_DIRECT_UNIQUE, mailslot_name, &request->data.msg.source_name, - &dest, + dest, &myname, &blob); talloc_free(tmp_ctx); return status; -- cgit From 4ac2be99588b48b0652a524bf12fb1aa9c3f5fbb Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 7 Mar 2006 11:07:23 +0000 Subject: r13924: Split more prototypes out of include/proto.h + initial work on header file dependencies (This used to be commit 122835876748a3eaf5e8d31ad1abddab9acb8781) --- source4/libcli/dgram/netlogon.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/libcli/dgram/netlogon.c') diff --git a/source4/libcli/dgram/netlogon.c b/source4/libcli/dgram/netlogon.c index 6ad4c28811..df8c63fa87 100644 --- a/source4/libcli/dgram/netlogon.c +++ b/source4/libcli/dgram/netlogon.c @@ -23,6 +23,7 @@ #include "includes.h" #include "libcli/dgram/libdgram.h" #include "lib/socket/socket.h" +#include "libcli/resolve/resolve.h" /* send a netlogon mailslot request -- cgit From 8528016978b084213ef53d66e1b6e831b1a01acc Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 16 Mar 2006 00:23:11 +0000 Subject: r14464: Don't include ndr_BASENAME.h files unless strictly required, instead try to include just the BASENAME.h files (containing only structs) (This used to be commit 3dd477ca5147f28a962b8437e2611a8222d706bd) --- source4/libcli/dgram/netlogon.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/libcli/dgram/netlogon.c') diff --git a/source4/libcli/dgram/netlogon.c b/source4/libcli/dgram/netlogon.c index df8c63fa87..08b9b0e641 100644 --- a/source4/libcli/dgram/netlogon.c +++ b/source4/libcli/dgram/netlogon.c @@ -24,6 +24,7 @@ #include "libcli/dgram/libdgram.h" #include "lib/socket/socket.h" #include "libcli/resolve/resolve.h" +#include "librpc/gen_ndr/ndr_nbt.h" /* send a netlogon mailslot request -- cgit From 0479a2f1cbae51fcd8dbdc3c148c808421fb4d25 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 10 Jul 2007 02:07:03 +0000 Subject: r23792: convert Samba4 to GPLv3 There are still a few tidyups of old FSF addresses to come (in both s3 and s4). More commits soon. (This used to be commit fcf38a38ac691abd0fa51b89dc951a08e89fdafa) --- source4/libcli/dgram/netlogon.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'source4/libcli/dgram/netlogon.c') diff --git a/source4/libcli/dgram/netlogon.c b/source4/libcli/dgram/netlogon.c index 08b9b0e641..df47a34a0e 100644 --- a/source4/libcli/dgram/netlogon.c +++ b/source4/libcli/dgram/netlogon.c @@ -7,7 +7,7 @@ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -16,8 +16,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + along with this program. If not, see . */ #include "includes.h" -- cgit From ffeee68e4b72dd94fee57366bd8d38b8c284c3d4 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 8 Sep 2007 12:42:09 +0000 Subject: r25026: Move param/param.h out of includes.h (This used to be commit abe8349f9b4387961ff3665d8c589d61cd2edf31) --- source4/libcli/dgram/netlogon.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/libcli/dgram/netlogon.c') diff --git a/source4/libcli/dgram/netlogon.c b/source4/libcli/dgram/netlogon.c index df47a34a0e..79acf609f6 100644 --- a/source4/libcli/dgram/netlogon.c +++ b/source4/libcli/dgram/netlogon.c @@ -24,6 +24,7 @@ #include "lib/socket/socket.h" #include "libcli/resolve/resolve.h" #include "librpc/gen_ndr/ndr_nbt.h" +#include "param/param.h" /* send a netlogon mailslot request -- cgit From 37d53832a4623653f706e77985a79d84bd7c6694 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 28 Sep 2007 01:17:46 +0000 Subject: r25398: Parse loadparm context to all lp_*() functions. (This used to be commit 3fcc960839c6e5ca4de2c3c042f12f369ac5f238) --- source4/libcli/dgram/netlogon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/libcli/dgram/netlogon.c') diff --git a/source4/libcli/dgram/netlogon.c b/source4/libcli/dgram/netlogon.c index 79acf609f6..46f6e50e7b 100644 --- a/source4/libcli/dgram/netlogon.c +++ b/source4/libcli/dgram/netlogon.c @@ -77,7 +77,7 @@ NTSTATUS dgram_mailslot_netlogon_reply(struct nbt_dgram_socket *dgmsock, return status; } - make_nbt_name_client(&myname, lp_netbios_name()); + make_nbt_name_client(&myname, lp_netbios_name(global_loadparm)); dest = socket_address_from_strings(tmp_ctx, dgmsock->sock->backend_name, request->src_addr, request->src_port); -- cgit From 64fc66306bdc95b619dc3b8f2318e7d08125e6a5 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Sat, 3 Nov 2007 09:40:32 +0100 Subject: r25819: make the success case more clear metze (This used to be commit 6495fe220d488ce86d53b148f76f9fe669d4bbad) --- source4/libcli/dgram/netlogon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/libcli/dgram/netlogon.c') diff --git a/source4/libcli/dgram/netlogon.c b/source4/libcli/dgram/netlogon.c index 46f6e50e7b..2e5aa26d67 100644 --- a/source4/libcli/dgram/netlogon.c +++ b/source4/libcli/dgram/netlogon.c @@ -116,5 +116,5 @@ NTSTATUS dgram_mailslot_netlogon_parse(struct dgram_mailslot_handler *dgmslot, file_save("netlogon.dat", data.data, data.length); } } - return status; + return NT_STATUS_OK; } -- cgit From c77b796a3f93c68e3fe05baafdad1e53f48e50d4 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Sat, 3 Nov 2007 09:42:18 +0100 Subject: r25820: but still return the error... (sorry, this should have been one commit) metze (This used to be commit 01c5ec7eb44956c1722d884bb97ce7730d4fc451) --- source4/libcli/dgram/netlogon.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/libcli/dgram/netlogon.c') diff --git a/source4/libcli/dgram/netlogon.c b/source4/libcli/dgram/netlogon.c index 2e5aa26d67..3a5510b408 100644 --- a/source4/libcli/dgram/netlogon.c +++ b/source4/libcli/dgram/netlogon.c @@ -115,6 +115,7 @@ NTSTATUS dgram_mailslot_netlogon_parse(struct dgram_mailslot_handler *dgmslot, if (DEBUGLVL(10)) { file_save("netlogon.dat", data.data, data.length); } + return status; } return NT_STATUS_OK; } -- cgit From 529763a9aa192a6785ba878aceeb1683c2510913 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 9 Nov 2007 19:24:51 +0100 Subject: r25920: ndr: change NTSTAUS into enum ndr_err_code (samba4 callers) lib/messaging/ lib/registry/ lib/ldb-samba/ librpc/rpc/ auth/auth_winbind.c auth/gensec/ auth/kerberos/ dsdb/repl/ dsdb/samdb/ dsdb/schema/ torture/ cluster/ctdb/ kdc/ ntvfs/ipc/ torture/rap/ ntvfs/ utils/getntacl.c ntptr/ smb_server/ libcli/wrepl/ wrepl_server/ libcli/cldap/ libcli/dgram/ libcli/ldap/ libcli/raw/ libcli/nbt/ libnet/ winbind/ rpc_server/ metze (This used to be commit 6223c7fddc972687eb577e04fc1c8e0604c35435) --- source4/libcli/dgram/netlogon.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) (limited to 'source4/libcli/dgram/netlogon.c') diff --git a/source4/libcli/dgram/netlogon.c b/source4/libcli/dgram/netlogon.c index 3a5510b408..f89c2c5644 100644 --- a/source4/libcli/dgram/netlogon.c +++ b/source4/libcli/dgram/netlogon.c @@ -36,14 +36,15 @@ NTSTATUS dgram_mailslot_netlogon_send(struct nbt_dgram_socket *dgmsock, struct nbt_netlogon_packet *request) { NTSTATUS status; + enum ndr_err_code ndr_err; DATA_BLOB blob; TALLOC_CTX *tmp_ctx = talloc_new(dgmsock); - status = ndr_push_struct_blob(&blob, tmp_ctx, request, + ndr_err = ndr_push_struct_blob(&blob, tmp_ctx, request, (ndr_push_flags_fn_t)ndr_push_nbt_netlogon_packet); - if (!NT_STATUS_IS_OK(status)) { + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(tmp_ctx); - return status; + return ndr_map_error2ntstatus(ndr_err); } @@ -65,16 +66,17 @@ NTSTATUS dgram_mailslot_netlogon_reply(struct nbt_dgram_socket *dgmsock, struct nbt_netlogon_packet *reply) { NTSTATUS status; + enum ndr_err_code ndr_err; DATA_BLOB blob; TALLOC_CTX *tmp_ctx = talloc_new(dgmsock); struct nbt_name myname; struct socket_address *dest; - status = ndr_push_struct_blob(&blob, tmp_ctx, reply, + ndr_err = ndr_push_struct_blob(&blob, tmp_ctx, reply, (ndr_push_flags_fn_t)ndr_push_nbt_netlogon_packet); - if (!NT_STATUS_IS_OK(status)) { + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(tmp_ctx); - return status; + return ndr_map_error2ntstatus(ndr_err); } make_nbt_name_client(&myname, lp_netbios_name(global_loadparm)); @@ -105,13 +107,14 @@ NTSTATUS dgram_mailslot_netlogon_parse(struct dgram_mailslot_handler *dgmslot, struct nbt_netlogon_packet *netlogon) { DATA_BLOB data = dgram_mailslot_data(dgram); - NTSTATUS status; + enum ndr_err_code ndr_err; - status = ndr_pull_struct_blob(&data, mem_ctx, netlogon, + ndr_err = ndr_pull_struct_blob(&data, mem_ctx, netlogon, (ndr_pull_flags_fn_t)ndr_pull_nbt_netlogon_packet); - if (!NT_STATUS_IS_OK(status)) { - DEBUG(0,("Failed to parse netlogon packet of length %d\n", - (int)data.length)); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + NTSTATUS status = ndr_map_error2ntstatus(ndr_err); + DEBUG(0,("Failed to parse netlogon packet of length %d: %s\n", + (int)data.length, nt_errstr(status))); if (DEBUGLVL(10)) { file_save("netlogon.dat", data.data, data.length); } -- cgit From d378cf4c15e09b980f874bb103b28e89d9dd3a26 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 6 Dec 2007 16:36:54 +0100 Subject: r26310: Remove more uses of global_loadparm. (This used to be commit 9d806da113b5f0688b6193dfdee9b8765e18b38f) --- source4/libcli/dgram/netlogon.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source4/libcli/dgram/netlogon.c') diff --git a/source4/libcli/dgram/netlogon.c b/source4/libcli/dgram/netlogon.c index f89c2c5644..92a66cddff 100644 --- a/source4/libcli/dgram/netlogon.c +++ b/source4/libcli/dgram/netlogon.c @@ -62,6 +62,7 @@ NTSTATUS dgram_mailslot_netlogon_send(struct nbt_dgram_socket *dgmsock, */ NTSTATUS dgram_mailslot_netlogon_reply(struct nbt_dgram_socket *dgmsock, struct nbt_dgram_packet *request, + const char *my_netbios_name, const char *mailslot_name, struct nbt_netlogon_packet *reply) { @@ -79,7 +80,7 @@ NTSTATUS dgram_mailslot_netlogon_reply(struct nbt_dgram_socket *dgmsock, return ndr_map_error2ntstatus(ndr_err); } - make_nbt_name_client(&myname, lp_netbios_name(global_loadparm)); + make_nbt_name_client(&myname, my_netbios_name); dest = socket_address_from_strings(tmp_ctx, dgmsock->sock->backend_name, request->src_addr, request->src_port); -- cgit From 86dc05e99f124db47f2743d1fc23117a7f5145ab Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 1 Jan 2008 22:05:05 -0600 Subject: r26638: libndr: Require explicitly specifying iconv_convenience for ndr_struct_push_blob(). (This used to be commit 61ad78ac98937ef7a9aa32075a91a1c95b7606b3) --- source4/libcli/dgram/netlogon.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'source4/libcli/dgram/netlogon.c') diff --git a/source4/libcli/dgram/netlogon.c b/source4/libcli/dgram/netlogon.c index 92a66cddff..161d48cbbc 100644 --- a/source4/libcli/dgram/netlogon.c +++ b/source4/libcli/dgram/netlogon.c @@ -40,7 +40,9 @@ NTSTATUS dgram_mailslot_netlogon_send(struct nbt_dgram_socket *dgmsock, DATA_BLOB blob; TALLOC_CTX *tmp_ctx = talloc_new(dgmsock); - ndr_err = ndr_push_struct_blob(&blob, tmp_ctx, request, + ndr_err = ndr_push_struct_blob(&blob, tmp_ctx, + lp_iconv_convenience(global_loadparm), + request, (ndr_push_flags_fn_t)ndr_push_nbt_netlogon_packet); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(tmp_ctx); @@ -73,7 +75,9 @@ NTSTATUS dgram_mailslot_netlogon_reply(struct nbt_dgram_socket *dgmsock, struct nbt_name myname; struct socket_address *dest; - ndr_err = ndr_push_struct_blob(&blob, tmp_ctx, reply, + ndr_err = ndr_push_struct_blob(&blob, tmp_ctx, + lp_iconv_convenience(global_loadparm), + reply, (ndr_push_flags_fn_t)ndr_push_nbt_netlogon_packet); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { talloc_free(tmp_ctx); -- cgit From 7d5f0e0893d42b56145a3ffa34e3b4b9906cbd91 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Tue, 1 Jan 2008 22:05:13 -0600 Subject: r26639: librpc: Pass iconv convenience on from RPC connection to NDR library, so it can be overridden by OpenChange. (This used to be commit 2f29f80e07adef1f020173f2cd6d947d0ef505ce) --- source4/libcli/dgram/netlogon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/libcli/dgram/netlogon.c') diff --git a/source4/libcli/dgram/netlogon.c b/source4/libcli/dgram/netlogon.c index 161d48cbbc..670af4ea63 100644 --- a/source4/libcli/dgram/netlogon.c +++ b/source4/libcli/dgram/netlogon.c @@ -114,7 +114,7 @@ NTSTATUS dgram_mailslot_netlogon_parse(struct dgram_mailslot_handler *dgmslot, DATA_BLOB data = dgram_mailslot_data(dgram); enum ndr_err_code ndr_err; - ndr_err = ndr_pull_struct_blob(&data, mem_ctx, netlogon, + ndr_err = ndr_pull_struct_blob(&data, mem_ctx, lp_iconv_convenience(global_loadparm), netlogon, (ndr_pull_flags_fn_t)ndr_pull_nbt_netlogon_packet); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { NTSTATUS status = ndr_map_error2ntstatus(ndr_err); -- cgit From 921b17648456027b6b46a582aa1d13024a5e9a90 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 21 Feb 2008 14:50:57 +0100 Subject: Remove more uses of global_loadparm. (This used to be commit 47d05ecf6fef66c90994f666b8c63e2e7b5a6cd8) --- source4/libcli/dgram/netlogon.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source4/libcli/dgram/netlogon.c') diff --git a/source4/libcli/dgram/netlogon.c b/source4/libcli/dgram/netlogon.c index 670af4ea63..5c7dedc7bb 100644 --- a/source4/libcli/dgram/netlogon.c +++ b/source4/libcli/dgram/netlogon.c @@ -41,7 +41,7 @@ NTSTATUS dgram_mailslot_netlogon_send(struct nbt_dgram_socket *dgmsock, TALLOC_CTX *tmp_ctx = talloc_new(dgmsock); ndr_err = ndr_push_struct_blob(&blob, tmp_ctx, - lp_iconv_convenience(global_loadparm), + dgmsock->iconv_convenience, request, (ndr_push_flags_fn_t)ndr_push_nbt_netlogon_packet); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { @@ -76,7 +76,7 @@ NTSTATUS dgram_mailslot_netlogon_reply(struct nbt_dgram_socket *dgmsock, struct socket_address *dest; ndr_err = ndr_push_struct_blob(&blob, tmp_ctx, - lp_iconv_convenience(global_loadparm), + dgmsock->iconv_convenience, reply, (ndr_push_flags_fn_t)ndr_push_nbt_netlogon_packet); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { @@ -114,7 +114,7 @@ NTSTATUS dgram_mailslot_netlogon_parse(struct dgram_mailslot_handler *dgmslot, DATA_BLOB data = dgram_mailslot_data(dgram); enum ndr_err_code ndr_err; - ndr_err = ndr_pull_struct_blob(&data, mem_ctx, lp_iconv_convenience(global_loadparm), netlogon, + ndr_err = ndr_pull_struct_blob(&data, mem_ctx, dgmslot->dgmsock->iconv_convenience, netlogon, (ndr_pull_flags_fn_t)ndr_pull_nbt_netlogon_packet); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { NTSTATUS status = ndr_map_error2ntstatus(ndr_err); -- cgit From 58e7f253eafecca6934162034e88ee19b103c6ee Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Fri, 16 May 2008 13:03:01 +1000 Subject: Rework the CLDAP and NBT netlogon requests and responses. This now matches section 7.3.3 of the MS-ATDS specification, and all our current tests pass against windows. There is still more testing to do, and the server implementation to complete. Andrew Bartlett (This used to be commit 431d0c03965cbee85691cd0dc1e2a509c1a2b717) --- source4/libcli/dgram/netlogon.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) (limited to 'source4/libcli/dgram/netlogon.c') diff --git a/source4/libcli/dgram/netlogon.c b/source4/libcli/dgram/netlogon.c index 5c7dedc7bb..c097127083 100644 --- a/source4/libcli/dgram/netlogon.c +++ b/source4/libcli/dgram/netlogon.c @@ -32,6 +32,7 @@ NTSTATUS dgram_mailslot_netlogon_send(struct nbt_dgram_socket *dgmsock, struct nbt_name *dest_name, struct socket_address *dest, + const char *mailslot, struct nbt_name *src_name, struct nbt_netlogon_packet *request) { @@ -51,7 +52,7 @@ NTSTATUS dgram_mailslot_netlogon_send(struct nbt_dgram_socket *dgmsock, status = dgram_mailslot_send(dgmsock, DGRAM_DIRECT_UNIQUE, - NBT_MAILSLOT_NETLOGON, + mailslot, dest_name, dest, src_name, &blob); talloc_free(tmp_ctx); @@ -109,21 +110,16 @@ NTSTATUS dgram_mailslot_netlogon_reply(struct nbt_dgram_socket *dgmsock, NTSTATUS dgram_mailslot_netlogon_parse(struct dgram_mailslot_handler *dgmslot, TALLOC_CTX *mem_ctx, struct nbt_dgram_packet *dgram, - struct nbt_netlogon_packet *netlogon) + struct nbt_netlogon_response *netlogon) { + NTSTATUS status; DATA_BLOB data = dgram_mailslot_data(dgram); - enum ndr_err_code ndr_err; - - ndr_err = ndr_pull_struct_blob(&data, mem_ctx, dgmslot->dgmsock->iconv_convenience, netlogon, - (ndr_pull_flags_fn_t)ndr_pull_nbt_netlogon_packet); - if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { - NTSTATUS status = ndr_map_error2ntstatus(ndr_err); - DEBUG(0,("Failed to parse netlogon packet of length %d: %s\n", - (int)data.length, nt_errstr(status))); - if (DEBUGLVL(10)) { - file_save("netlogon.dat", data.data, data.length); - } + + status = pull_nbt_netlogon_response(&data, mem_ctx, dgmslot->dgmsock->iconv_convenience, netlogon); + if (!NT_STATUS_IS_OK(status)) { return status; } + return NT_STATUS_OK; } + -- cgit From 7c0eea48f35dfb4cbc06fbaabf767612b30121eb Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Sat, 17 May 2008 12:38:58 +1000 Subject: Put back the old netlogn parsing code - for the request only This gives us seperate parsing functions for requests and replies. Andrew Bartlett (This used to be commit d2d3d15a8edd58cda7543feebdeb52178400615b) --- source4/libcli/dgram/netlogon.c | 41 +++++++++++++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 10 deletions(-) (limited to 'source4/libcli/dgram/netlogon.c') diff --git a/source4/libcli/dgram/netlogon.c b/source4/libcli/dgram/netlogon.c index c097127083..b37d4a2ee6 100644 --- a/source4/libcli/dgram/netlogon.c +++ b/source4/libcli/dgram/netlogon.c @@ -67,22 +67,18 @@ NTSTATUS dgram_mailslot_netlogon_reply(struct nbt_dgram_socket *dgmsock, struct nbt_dgram_packet *request, const char *my_netbios_name, const char *mailslot_name, - struct nbt_netlogon_packet *reply) + struct nbt_netlogon_response *reply) { NTSTATUS status; - enum ndr_err_code ndr_err; DATA_BLOB blob; TALLOC_CTX *tmp_ctx = talloc_new(dgmsock); struct nbt_name myname; struct socket_address *dest; - ndr_err = ndr_push_struct_blob(&blob, tmp_ctx, - dgmsock->iconv_convenience, - reply, - (ndr_push_flags_fn_t)ndr_push_nbt_netlogon_packet); - if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { - talloc_free(tmp_ctx); - return ndr_map_error2ntstatus(ndr_err); + status = push_nbt_netlogon_response(&blob, tmp_ctx, dgmsock->iconv_convenience, + reply); + if (!NT_STATUS_IS_OK(status)) { + return status; } make_nbt_name_client(&myname, my_netbios_name); @@ -107,7 +103,32 @@ NTSTATUS dgram_mailslot_netlogon_reply(struct nbt_dgram_socket *dgmsock, /* parse a netlogon response. The packet must be a valid mailslot packet */ -NTSTATUS dgram_mailslot_netlogon_parse(struct dgram_mailslot_handler *dgmslot, +NTSTATUS dgram_mailslot_netlogon_parse_request(struct dgram_mailslot_handler *dgmslot, + TALLOC_CTX *mem_ctx, + struct nbt_dgram_packet *dgram, + struct nbt_netlogon_packet *netlogon) +{ + DATA_BLOB data = dgram_mailslot_data(dgram); + enum ndr_err_code ndr_err; + + ndr_err = ndr_pull_struct_blob(&data, mem_ctx, dgmslot->dgmsock->iconv_convenience, netlogon, + (ndr_pull_flags_fn_t)ndr_pull_nbt_netlogon_packet); + if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { + NTSTATUS status = ndr_map_error2ntstatus(ndr_err); + DEBUG(0,("Failed to parse netlogon packet of length %d: %s\n", + (int)data.length, nt_errstr(status))); + if (DEBUGLVL(10)) { + file_save("netlogon.dat", data.data, data.length); + } + return status; + } + return NT_STATUS_OK; +} + +/* + parse a netlogon response. The packet must be a valid mailslot packet +*/ +NTSTATUS dgram_mailslot_netlogon_parse_response(struct dgram_mailslot_handler *dgmslot, TALLOC_CTX *mem_ctx, struct nbt_dgram_packet *dgram, struct nbt_netlogon_response *netlogon) -- cgit