summaryrefslogtreecommitdiff
path: root/source4/nbt_server/dgram
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-04-13 05:07:04 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:11:31 -0500
commitf06e39e30866207162656801210d2f574166d4df (patch)
treec4e53864d0f2fcedbfc75aa0d8d1faa1f4e667e5 /source4/nbt_server/dgram
parentb6fd09d80504d55be98b167cd12b5507573d32db (diff)
downloadsamba-f06e39e30866207162656801210d2f574166d4df.tar.gz
samba-f06e39e30866207162656801210d2f574166d4df.tar.bz2
samba-f06e39e30866207162656801210d2f574166d4df.zip
r6321: added IDL and test suite for NBT dgram 'sam logon' request (sent by
clients when a user tries to login) (This used to be commit 08ded62156b387457bc56b5910e1ddc813b375bd)
Diffstat (limited to 'source4/nbt_server/dgram')
-rw-r--r--source4/nbt_server/dgram/ntlogon.c76
-rw-r--r--source4/nbt_server/dgram/request.c1
2 files changed, 77 insertions, 0 deletions
diff --git a/source4/nbt_server/dgram/ntlogon.c b/source4/nbt_server/dgram/ntlogon.c
new file mode 100644
index 0000000000..d035c2f00a
--- /dev/null
+++ b/source4/nbt_server/dgram/ntlogon.c
@@ -0,0 +1,76 @@
+/*
+ Unix SMB/CIFS implementation.
+
+ NBT datagram ntlogon server
+
+ 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 "dlinklist.h"
+#include "nbt_server/nbt_server.h"
+#include "smbd/service_task.h"
+#include "lib/socket/socket.h"
+
+/*
+ handle incoming ntlogon mailslot requests
+*/
+void nbtd_mailslot_ntlogon_handler(struct dgram_mailslot_handler *dgmslot,
+ struct nbt_dgram_packet *packet,
+ const char *src_address, int src_port)
+{
+ NTSTATUS status = NT_STATUS_NO_MEMORY;
+ struct nbtd_interface *iface =
+ talloc_get_type(dgmslot->private, struct nbtd_interface);
+ struct nbt_ntlogon_packet *ntlogon =
+ talloc(dgmslot, struct nbt_ntlogon_packet);
+ struct nbtd_iface_name *iname;
+ struct nbt_name *name = &packet->data.msg.dest_name;
+
+ if (ntlogon == NULL) goto failed;
+
+ /*
+ see if the we are listening on the destination netbios name
+ */
+ iname = nbtd_find_iname(iface, name, 0);
+ if (iname == NULL) {
+ status = NT_STATUS_BAD_NETWORK_NAME;
+ goto failed;
+ }
+
+ DEBUG(2,("ntlogon request to %s from %s:%d\n",
+ nbt_name_string(ntlogon, name), src_address, src_port));
+ status = dgram_mailslot_ntlogon_parse(dgmslot, ntlogon, packet, ntlogon);
+ if (!NT_STATUS_IS_OK(status)) goto failed;
+
+ NDR_PRINT_DEBUG(nbt_ntlogon_packet, ntlogon);
+
+ switch (ntlogon->command) {
+ default:
+ DEBUG(2,("unknown ntlogon op %d from %s:%d\n",
+ ntlogon->command, src_address, src_port));
+ break;
+ }
+
+ talloc_free(ntlogon);
+ return;
+
+failed:
+ DEBUG(2,("nbtd ntlogon handler failed from %s:%d - %s\n",
+ src_address, src_port, nt_errstr(status)));
+ talloc_free(ntlogon);
+}
diff --git a/source4/nbt_server/dgram/request.c b/source4/nbt_server/dgram/request.c
index 59b94bcecb..f59193bec5 100644
--- a/source4/nbt_server/dgram/request.c
+++ b/source4/nbt_server/dgram/request.c
@@ -34,6 +34,7 @@ static const struct {
dgram_mailslot_handler_t handler;
} mailslot_handlers[] = {
{ NBT_MAILSLOT_NETLOGON, nbtd_mailslot_netlogon_handler },
+ { NBT_MAILSLOT_NTLOGON, nbtd_mailslot_ntlogon_handler },
{ NBT_MAILSLOT_BROWSE, nbtd_mailslot_browse_handler }
};