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/nbt_server/dgram/request.c | 113 +++++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 source4/nbt_server/dgram/request.c (limited to 'source4/nbt_server/dgram/request.c') diff --git a/source4/nbt_server/dgram/request.c b/source4/nbt_server/dgram/request.c new file mode 100644 index 0000000000..59b94bcecb --- /dev/null +++ b/source4/nbt_server/dgram/request.c @@ -0,0 +1,113 @@ +/* + Unix SMB/CIFS implementation. + + NBT datagram 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" + +/* + a list of mailslots that we have static handlers for +*/ +static const struct { + const char *mailslot_name; + dgram_mailslot_handler_t handler; +} mailslot_handlers[] = { + { NBT_MAILSLOT_NETLOGON, nbtd_mailslot_netlogon_handler }, + { NBT_MAILSLOT_BROWSE, nbtd_mailslot_browse_handler } +}; + +/* + receive an incoming dgram request. This is used for general datagram + requests. Mailslot requests for our listening mailslots + are handled in the specific mailslot handlers +*/ +void dgram_request_handler(struct nbt_dgram_socket *dgmsock, + struct nbt_dgram_packet *packet, + const char *src_address, int src_port) +{ + DEBUG(0,("General datagram request from %s:%d\n", src_address, src_port)); + NDR_PRINT_DEBUG(nbt_dgram_packet, packet); +} + + +/* + setup the port 138 datagram listener for a given interface +*/ +NTSTATUS nbtd_dgram_setup(struct nbtd_interface *iface, const char *bind_address) +{ + struct nbt_dgram_socket *bcast_dgmsock; + struct nbtd_server *nbtsrv = iface->nbtsrv; + NTSTATUS status; + /* the list of mailslots that we are interested in */ + int i; + + /* listen for broadcasts on port 138 */ + bcast_dgmsock = nbt_dgram_socket_init(iface, nbtsrv->task->event_ctx); + NT_STATUS_HAVE_NO_MEMORY(bcast_dgmsock); + + status = socket_listen(bcast_dgmsock->sock, iface->bcast_address, + lp_dgram_port(), 0, 0); + if (!NT_STATUS_IS_OK(status)) { + DEBUG(0,("Failed to bind to %s:%d - %s\n", + iface->bcast_address, lp_dgram_port(), nt_errstr(status))); + talloc_free(iface); + return status; + } + + dgram_set_incoming_handler(bcast_dgmsock, dgram_request_handler, iface); + + /* listen for unicasts on port 138 */ + iface->dgmsock = nbt_dgram_socket_init(iface, nbtsrv->task->event_ctx); + NT_STATUS_HAVE_NO_MEMORY(iface->dgmsock); + + status = socket_listen(iface->dgmsock->sock, bind_address, + lp_dgram_port(), 0, 0); + if (!NT_STATUS_IS_OK(status)) { + DEBUG(0,("Failed to bind to %s:%d - %s\n", + bind_address, lp_dgram_port(), nt_errstr(status))); + talloc_free(iface); + return status; + } + dgram_set_incoming_handler(iface->dgmsock, dgram_request_handler, iface); + + + for (i=0;idgmsock, + mailslot_handlers[i].mailslot_name, + mailslot_handlers[i].handler, iface); + NT_STATUS_HAVE_NO_MEMORY(dgmslot); + } + + return NT_STATUS_OK; +} -- cgit From f06e39e30866207162656801210d2f574166d4df Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Wed, 13 Apr 2005 05:07:04 +0000 Subject: 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) --- source4/nbt_server/dgram/request.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/nbt_server/dgram/request.c') 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 } }; -- cgit From 9bf7217aa21e4d11fa40e7bdc6cc69ea82ff83f0 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Mon, 27 Jun 2005 19:32:52 +0000 Subject: r7955: we should not free a struct which is passed as a parameter, to a function the caller should free it MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit this fixed a double free bug noticed by Дейтер Александр Валериевич   metze (This used to be commit ee1a5d5419f4d79af5c447a6b397a0f4dc89310a) --- source4/nbt_server/dgram/request.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'source4/nbt_server/dgram/request.c') diff --git a/source4/nbt_server/dgram/request.c b/source4/nbt_server/dgram/request.c index f59193bec5..8ccdeabf71 100644 --- a/source4/nbt_server/dgram/request.c +++ b/source4/nbt_server/dgram/request.c @@ -72,7 +72,6 @@ NTSTATUS nbtd_dgram_setup(struct nbtd_interface *iface, const char *bind_address if (!NT_STATUS_IS_OK(status)) { DEBUG(0,("Failed to bind to %s:%d - %s\n", iface->bcast_address, lp_dgram_port(), nt_errstr(status))); - talloc_free(iface); return status; } @@ -87,7 +86,6 @@ NTSTATUS nbtd_dgram_setup(struct nbtd_interface *iface, const char *bind_address if (!NT_STATUS_IS_OK(status)) { DEBUG(0,("Failed to bind to %s:%d - %s\n", bind_address, lp_dgram_port(), nt_errstr(status))); - talloc_free(iface); return status; } dgram_set_incoming_handler(iface->dgmsock, dgram_request_handler, iface); -- cgit From 3cdaf4c9065f94e931c62cef1f718d3884488aa1 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 10 Nov 2005 15:51:57 +0000 Subject: r11648: fix some bugs... metze (This used to be commit 475eb4cc96aa147897fd6b0d5b5cc0509fb1d2a0) --- source4/nbt_server/dgram/request.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source4/nbt_server/dgram/request.c') diff --git a/source4/nbt_server/dgram/request.c b/source4/nbt_server/dgram/request.c index 8ccdeabf71..9517ab2387 100644 --- a/source4/nbt_server/dgram/request.c +++ b/source4/nbt_server/dgram/request.c @@ -44,10 +44,10 @@ static const struct { are handled in the specific mailslot handlers */ void dgram_request_handler(struct nbt_dgram_socket *dgmsock, - struct nbt_dgram_packet *packet, - const char *src_address, int src_port) + struct nbt_dgram_packet *packet, + const struct nbt_peer_socket *src) { - DEBUG(0,("General datagram request from %s:%d\n", src_address, src_port)); + DEBUG(0,("General datagram request from %s:%d\n", src->addr, src->port)); NDR_PRINT_DEBUG(nbt_dgram_packet, packet); } -- 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/nbt_server/dgram/request.c | 1 - 1 file changed, 1 deletion(-) (limited to 'source4/nbt_server/dgram/request.c') diff --git a/source4/nbt_server/dgram/request.c b/source4/nbt_server/dgram/request.c index 9517ab2387..25b08eb5cf 100644 --- a/source4/nbt_server/dgram/request.c +++ b/source4/nbt_server/dgram/request.c @@ -21,7 +21,6 @@ */ #include "includes.h" -#include "dlinklist.h" #include "nbt_server/nbt_server.h" #include "smbd/service_task.h" #include "lib/socket/socket.h" -- 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/nbt_server/dgram/request.c | 39 +++++++++++++++++++++++++++++++------- 1 file changed, 32 insertions(+), 7 deletions(-) (limited to 'source4/nbt_server/dgram/request.c') diff --git a/source4/nbt_server/dgram/request.c b/source4/nbt_server/dgram/request.c index 25b08eb5cf..7a1f7c42d8 100644 --- a/source4/nbt_server/dgram/request.c +++ b/source4/nbt_server/dgram/request.c @@ -44,7 +44,7 @@ static const struct { */ void dgram_request_handler(struct nbt_dgram_socket *dgmsock, struct nbt_dgram_packet *packet, - const struct nbt_peer_socket *src) + struct socket_address *src) { DEBUG(0,("General datagram request from %s:%d\n", src->addr, src->port)); NDR_PRINT_DEBUG(nbt_dgram_packet, packet); @@ -58,37 +58,62 @@ NTSTATUS nbtd_dgram_setup(struct nbtd_interface *iface, const char *bind_address { struct nbt_dgram_socket *bcast_dgmsock; struct nbtd_server *nbtsrv = iface->nbtsrv; + struct socket_address *bcast_addr, *bind_addr; NTSTATUS status; + TALLOC_CTX *tmp_ctx = talloc_new(iface); /* the list of mailslots that we are interested in */ int i; + if (!tmp_ctx) { + return NT_STATUS_NO_MEMORY; + } + /* listen for broadcasts on port 138 */ bcast_dgmsock = nbt_dgram_socket_init(iface, nbtsrv->task->event_ctx); - NT_STATUS_HAVE_NO_MEMORY(bcast_dgmsock); + if (!bcast_dgmsock) { + talloc_free(tmp_ctx); + return NT_STATUS_NO_MEMORY; + } - status = socket_listen(bcast_dgmsock->sock, iface->bcast_address, - lp_dgram_port(), 0, 0); + bcast_addr = socket_address_from_strings(tmp_ctx, bcast_dgmsock->sock->backend_name, + iface->bcast_address, + lp_dgram_port()); + + status = socket_listen(bcast_dgmsock->sock, bcast_addr, 0, 0); if (!NT_STATUS_IS_OK(status)) { + talloc_free(tmp_ctx); DEBUG(0,("Failed to bind to %s:%d - %s\n", iface->bcast_address, lp_dgram_port(), nt_errstr(status))); return status; } + talloc_free(bcast_addr); dgram_set_incoming_handler(bcast_dgmsock, dgram_request_handler, iface); + bind_addr = socket_address_from_strings(tmp_ctx, bcast_dgmsock->sock->backend_name, + bind_address, + lp_dgram_port()); + /* listen for unicasts on port 138 */ iface->dgmsock = nbt_dgram_socket_init(iface, nbtsrv->task->event_ctx); - NT_STATUS_HAVE_NO_MEMORY(iface->dgmsock); + if (!iface->dgmsock) { + talloc_free(tmp_ctx); + return NT_STATUS_NO_MEMORY; + } - status = socket_listen(iface->dgmsock->sock, bind_address, - lp_dgram_port(), 0, 0); + status = socket_listen(iface->dgmsock->sock, bind_addr, 0, 0); if (!NT_STATUS_IS_OK(status)) { + talloc_free(tmp_ctx); DEBUG(0,("Failed to bind to %s:%d - %s\n", bind_address, lp_dgram_port(), nt_errstr(status))); return status; } + talloc_free(bind_addr); + dgram_set_incoming_handler(iface->dgmsock, dgram_request_handler, iface); + talloc_free(tmp_ctx); + for (i=0;i Date: Mon, 16 Jan 2006 14:01:34 +0000 Subject: r12958: don't bind to '255.255.255.255' fix bug #3411 metze (This used to be commit 2cb587c779b5f70e4818fa57fcb2b8ee4a2a276b) --- source4/nbt_server/dgram/request.c | 63 +++++++++++++++++++++----------------- 1 file changed, 35 insertions(+), 28 deletions(-) (limited to 'source4/nbt_server/dgram/request.c') diff --git a/source4/nbt_server/dgram/request.c b/source4/nbt_server/dgram/request.c index 7a1f7c42d8..8dcd53b9b1 100644 --- a/source4/nbt_server/dgram/request.c +++ b/source4/nbt_server/dgram/request.c @@ -56,7 +56,7 @@ void dgram_request_handler(struct nbt_dgram_socket *dgmsock, */ NTSTATUS nbtd_dgram_setup(struct nbtd_interface *iface, const char *bind_address) { - struct nbt_dgram_socket *bcast_dgmsock; + struct nbt_dgram_socket *bcast_dgmsock = NULL; struct nbtd_server *nbtsrv = iface->nbtsrv; struct socket_address *bcast_addr, *bind_addr; NTSTATUS status; @@ -68,31 +68,31 @@ NTSTATUS nbtd_dgram_setup(struct nbtd_interface *iface, const char *bind_address return NT_STATUS_NO_MEMORY; } - /* listen for broadcasts on port 138 */ - bcast_dgmsock = nbt_dgram_socket_init(iface, nbtsrv->task->event_ctx); - if (!bcast_dgmsock) { - talloc_free(tmp_ctx); - return NT_STATUS_NO_MEMORY; - } + if (strcmp("0.0.0.0", iface->netmask) != 0) { + /* listen for broadcasts on port 138 */ + bcast_dgmsock = nbt_dgram_socket_init(iface, nbtsrv->task->event_ctx); + if (!bcast_dgmsock) { + talloc_free(tmp_ctx); + return NT_STATUS_NO_MEMORY; + } - bcast_addr = socket_address_from_strings(tmp_ctx, bcast_dgmsock->sock->backend_name, - iface->bcast_address, - lp_dgram_port()); - - status = socket_listen(bcast_dgmsock->sock, bcast_addr, 0, 0); - if (!NT_STATUS_IS_OK(status)) { - talloc_free(tmp_ctx); - DEBUG(0,("Failed to bind to %s:%d - %s\n", - iface->bcast_address, lp_dgram_port(), nt_errstr(status))); - return status; - } - talloc_free(bcast_addr); + bcast_addr = socket_address_from_strings(tmp_ctx, bcast_dgmsock->sock->backend_name, + iface->bcast_address, lp_dgram_port()); + if (!bcast_addr) { + talloc_free(tmp_ctx); + return NT_STATUS_NO_MEMORY; + } + + status = socket_listen(bcast_dgmsock->sock, bcast_addr, 0, 0); + if (!NT_STATUS_IS_OK(status)) { + talloc_free(tmp_ctx); + DEBUG(0,("Failed to bind to %s:%d - %s\n", + iface->bcast_address, lp_dgram_port(), nt_errstr(status))); + return status; + } - dgram_set_incoming_handler(bcast_dgmsock, dgram_request_handler, iface); - - bind_addr = socket_address_from_strings(tmp_ctx, bcast_dgmsock->sock->backend_name, - bind_address, - lp_dgram_port()); + dgram_set_incoming_handler(bcast_dgmsock, dgram_request_handler, iface); + } /* listen for unicasts on port 138 */ iface->dgmsock = nbt_dgram_socket_init(iface, nbtsrv->task->event_ctx); @@ -101,6 +101,13 @@ NTSTATUS nbtd_dgram_setup(struct nbtd_interface *iface, const char *bind_address return NT_STATUS_NO_MEMORY; } + bind_addr = socket_address_from_strings(tmp_ctx, iface->dgmsock->sock->backend_name, + bind_address, lp_dgram_port()); + if (!bind_addr) { + talloc_free(tmp_ctx); + return NT_STATUS_NO_MEMORY; + } + status = socket_listen(iface->dgmsock->sock, bind_addr, 0, 0); if (!NT_STATUS_IS_OK(status)) { talloc_free(tmp_ctx); @@ -108,23 +115,23 @@ NTSTATUS nbtd_dgram_setup(struct nbtd_interface *iface, const char *bind_address bind_address, lp_dgram_port(), nt_errstr(status))); return status; } - talloc_free(bind_addr); dgram_set_incoming_handler(iface->dgmsock, dgram_request_handler, iface); talloc_free(tmp_ctx); - for (i=0;idgmsock, mailslot_handlers[i].mailslot_name, -- 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/nbt_server/dgram/request.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'source4/nbt_server/dgram/request.c') diff --git a/source4/nbt_server/dgram/request.c b/source4/nbt_server/dgram/request.c index 8dcd53b9b1..f28170c106 100644 --- a/source4/nbt_server/dgram/request.c +++ b/source4/nbt_server/dgram/request.c @@ -24,6 +24,8 @@ #include "nbt_server/nbt_server.h" #include "smbd/service_task.h" #include "lib/socket/socket.h" +#include "libcli/resolve/resolve.h" +#include "nbt_server/dgram/proto.h" /* a list of mailslots that we have static handlers for -- 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/nbt_server/dgram/request.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/nbt_server/dgram/request.c') diff --git a/source4/nbt_server/dgram/request.c b/source4/nbt_server/dgram/request.c index f28170c106..d307acfb9c 100644 --- a/source4/nbt_server/dgram/request.c +++ b/source4/nbt_server/dgram/request.c @@ -26,6 +26,7 @@ #include "lib/socket/socket.h" #include "libcli/resolve/resolve.h" #include "nbt_server/dgram/proto.h" +#include "librpc/gen_ndr/ndr_nbt.h" /* a list of mailslots that we have static handlers for -- 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/nbt_server/dgram/request.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'source4/nbt_server/dgram/request.c') diff --git a/source4/nbt_server/dgram/request.c b/source4/nbt_server/dgram/request.c index d307acfb9c..bea1e84213 100644 --- a/source4/nbt_server/dgram/request.c +++ b/source4/nbt_server/dgram/request.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/nbt_server/dgram/request.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/nbt_server/dgram/request.c') diff --git a/source4/nbt_server/dgram/request.c b/source4/nbt_server/dgram/request.c index bea1e84213..da15340305 100644 --- a/source4/nbt_server/dgram/request.c +++ b/source4/nbt_server/dgram/request.c @@ -26,6 +26,7 @@ #include "libcli/resolve/resolve.h" #include "nbt_server/dgram/proto.h" #include "librpc/gen_ndr/ndr_nbt.h" +#include "param/param.h" /* a list of mailslots that we have static handlers for -- 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/nbt_server/dgram/request.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'source4/nbt_server/dgram/request.c') diff --git a/source4/nbt_server/dgram/request.c b/source4/nbt_server/dgram/request.c index da15340305..48d6e4cb3a 100644 --- a/source4/nbt_server/dgram/request.c +++ b/source4/nbt_server/dgram/request.c @@ -80,7 +80,8 @@ NTSTATUS nbtd_dgram_setup(struct nbtd_interface *iface, const char *bind_address } bcast_addr = socket_address_from_strings(tmp_ctx, bcast_dgmsock->sock->backend_name, - iface->bcast_address, lp_dgram_port()); + iface->bcast_address, + lp_dgram_port(global_loadparm)); if (!bcast_addr) { talloc_free(tmp_ctx); return NT_STATUS_NO_MEMORY; @@ -90,7 +91,8 @@ NTSTATUS nbtd_dgram_setup(struct nbtd_interface *iface, const char *bind_address if (!NT_STATUS_IS_OK(status)) { talloc_free(tmp_ctx); DEBUG(0,("Failed to bind to %s:%d - %s\n", - iface->bcast_address, lp_dgram_port(), nt_errstr(status))); + iface->bcast_address, lp_dgram_port(global_loadparm), + nt_errstr(status))); return status; } @@ -105,7 +107,7 @@ NTSTATUS nbtd_dgram_setup(struct nbtd_interface *iface, const char *bind_address } bind_addr = socket_address_from_strings(tmp_ctx, iface->dgmsock->sock->backend_name, - bind_address, lp_dgram_port()); + bind_address, lp_dgram_port(global_loadparm)); if (!bind_addr) { talloc_free(tmp_ctx); return NT_STATUS_NO_MEMORY; @@ -115,7 +117,7 @@ NTSTATUS nbtd_dgram_setup(struct nbtd_interface *iface, const char *bind_address if (!NT_STATUS_IS_OK(status)) { talloc_free(tmp_ctx); DEBUG(0,("Failed to bind to %s:%d - %s\n", - bind_address, lp_dgram_port(), nt_errstr(status))); + bind_address, lp_dgram_port(global_loadparm), nt_errstr(status))); return status; } -- cgit From 2f5ca872a80ad872ab864061f0c6982d8605393f Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 6 Dec 2007 16:54:34 +0100 Subject: r26313: Fix more uses of static loadparm. (This used to be commit 6fd0d9d3b75546d08c24c513e05b1843d5777608) --- source4/nbt_server/dgram/request.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'source4/nbt_server/dgram/request.c') diff --git a/source4/nbt_server/dgram/request.c b/source4/nbt_server/dgram/request.c index 48d6e4cb3a..45426c31ba 100644 --- a/source4/nbt_server/dgram/request.c +++ b/source4/nbt_server/dgram/request.c @@ -81,7 +81,7 @@ NTSTATUS nbtd_dgram_setup(struct nbtd_interface *iface, const char *bind_address bcast_addr = socket_address_from_strings(tmp_ctx, bcast_dgmsock->sock->backend_name, iface->bcast_address, - lp_dgram_port(global_loadparm)); + lp_dgram_port(iface->nbtsrv->task->lp_ctx)); if (!bcast_addr) { talloc_free(tmp_ctx); return NT_STATUS_NO_MEMORY; @@ -91,7 +91,7 @@ NTSTATUS nbtd_dgram_setup(struct nbtd_interface *iface, const char *bind_address if (!NT_STATUS_IS_OK(status)) { talloc_free(tmp_ctx); DEBUG(0,("Failed to bind to %s:%d - %s\n", - iface->bcast_address, lp_dgram_port(global_loadparm), + iface->bcast_address, lp_dgram_port(iface->nbtsrv->task->lp_ctx), nt_errstr(status))); return status; } @@ -107,7 +107,7 @@ NTSTATUS nbtd_dgram_setup(struct nbtd_interface *iface, const char *bind_address } bind_addr = socket_address_from_strings(tmp_ctx, iface->dgmsock->sock->backend_name, - bind_address, lp_dgram_port(global_loadparm)); + bind_address, lp_dgram_port(iface->nbtsrv->task->lp_ctx)); if (!bind_addr) { talloc_free(tmp_ctx); return NT_STATUS_NO_MEMORY; @@ -117,7 +117,7 @@ NTSTATUS nbtd_dgram_setup(struct nbtd_interface *iface, const char *bind_address if (!NT_STATUS_IS_OK(status)) { talloc_free(tmp_ctx); DEBUG(0,("Failed to bind to %s:%d - %s\n", - bind_address, lp_dgram_port(global_loadparm), nt_errstr(status))); + bind_address, lp_dgram_port(iface->nbtsrv->task->lp_ctx), nt_errstr(status))); return status; } -- cgit From 517bf7aa4f77ac0ef421f960f5610b185f6e598e Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 21 Feb 2008 16:18:23 +0100 Subject: Remove more global_loadparm uses. (This used to be commit f920e78ea7bb8aa575e6a2ebb5cc53462fbe2fe9) --- source4/nbt_server/dgram/request.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'source4/nbt_server/dgram/request.c') diff --git a/source4/nbt_server/dgram/request.c b/source4/nbt_server/dgram/request.c index 45426c31ba..205a544209 100644 --- a/source4/nbt_server/dgram/request.c +++ b/source4/nbt_server/dgram/request.c @@ -73,7 +73,9 @@ NTSTATUS nbtd_dgram_setup(struct nbtd_interface *iface, const char *bind_address if (strcmp("0.0.0.0", iface->netmask) != 0) { /* listen for broadcasts on port 138 */ - bcast_dgmsock = nbt_dgram_socket_init(iface, nbtsrv->task->event_ctx); + bcast_dgmsock = nbt_dgram_socket_init(iface, + nbtsrv->task->event_ctx, + lp_iconv_convenience(nbtsrv->task->lp_ctx)); if (!bcast_dgmsock) { talloc_free(tmp_ctx); return NT_STATUS_NO_MEMORY; @@ -100,7 +102,8 @@ NTSTATUS nbtd_dgram_setup(struct nbtd_interface *iface, const char *bind_address } /* listen for unicasts on port 138 */ - iface->dgmsock = nbt_dgram_socket_init(iface, nbtsrv->task->event_ctx); + iface->dgmsock = nbt_dgram_socket_init(iface, nbtsrv->task->event_ctx, + lp_iconv_convenience(nbtsrv->task->lp_ctx)); if (!iface->dgmsock) { talloc_free(tmp_ctx); return NT_STATUS_NO_MEMORY; -- cgit From 4f557d7954eb80e566a91b2fe22f7b7e30e0b456 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Sat, 17 May 2008 13:24:29 +1000 Subject: Show that the NTLOGON and NETLOGON mailslots are *very* similar. Rework the mailslot infrustructure to cope, passing down the mailslot name so that we can implement both in the same callback function. Andrew Bartlett (This used to be commit 89fdd77891529aa74bb920994b8b5959aae8ac2d) --- source4/nbt_server/dgram/request.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'source4/nbt_server/dgram/request.c') diff --git a/source4/nbt_server/dgram/request.c b/source4/nbt_server/dgram/request.c index 205a544209..277b64741d 100644 --- a/source4/nbt_server/dgram/request.c +++ b/source4/nbt_server/dgram/request.c @@ -35,8 +35,10 @@ static const struct { const char *mailslot_name; dgram_mailslot_handler_t handler; } mailslot_handlers[] = { + /* Handle both NTLOGON and NETLOGON in the same function, as + * they are very similar */ { NBT_MAILSLOT_NETLOGON, nbtd_mailslot_netlogon_handler }, - { NBT_MAILSLOT_NTLOGON, nbtd_mailslot_ntlogon_handler }, + { NBT_MAILSLOT_NTLOGON, nbtd_mailslot_netlogon_handler }, { NBT_MAILSLOT_BROWSE, nbtd_mailslot_browse_handler } }; -- cgit