summaryrefslogtreecommitdiff
path: root/source4/nbt_server
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-01-31 03:14:15 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:09:24 -0500
commit5e6082b4b0e8d47d8634cf1b0c5bb460d0b6dbd1 (patch)
tree9d9e7ff4684f3ba69a32621e0e5f4418e570490c /source4/nbt_server
parent5269fb13a92850b5f22bf9f7640568d5946a43d5 (diff)
downloadsamba-5e6082b4b0e8d47d8634cf1b0c5bb460d0b6dbd1.tar.gz
samba-5e6082b4b0e8d47d8634cf1b0c5bb460d0b6dbd1.tar.bz2
samba-5e6082b4b0e8d47d8634cf1b0c5bb460d0b6dbd1.zip
r5117: used a composite function to add 4 stage name registration. We send 3
broadcast name registration demands per name per interface at 1 second intervals, then send a name overwrite request and demand. Any name conflict replies are reported. (This used to be commit d656fba6f1a2e9d8c03893741327e5fb59c5271e)
Diffstat (limited to 'source4/nbt_server')
-rw-r--r--source4/nbt_server/register.c31
1 files changed, 11 insertions, 20 deletions
diff --git a/source4/nbt_server/register.c b/source4/nbt_server/register.c
index 9a416e37aa..7f7c291cf0 100644
--- a/source4/nbt_server/register.c
+++ b/source4/nbt_server/register.c
@@ -23,6 +23,8 @@
#include "includes.h"
#include "dlinklist.h"
#include "nbt_server/nbt_server.h"
+#include "libcli/raw/libcliraw.h"
+#include "libcli/composite/composite.h"
/*
start a timer to refresh this name
@@ -35,14 +37,13 @@ static void nbt_start_refresh_timer(struct nbt_iface_name *iname)
/*
a name registration has completed
*/
-static void nbt_register_handler(struct nbt_name_request *req)
+static void nbt_register_handler(struct smbcli_composite *req)
{
struct nbt_iface_name *iname = talloc_get_type(req->async.private, struct nbt_iface_name);
NTSTATUS status;
- struct nbt_name_register io;
- status = nbt_name_register_recv(req, iname, &io);
- if (NT_STATUS_EQUAL(status, NT_STATUS_IO_TIMEOUT)) {
+ status = nbt_name_register_bcast_recv(req);
+ if (NT_STATUS_IS_OK(status)) {
/* good - nobody complained about our registration */
iname->nb_flags |= NBT_NM_ACTIVE;
DEBUG(3,("Registered %s<%02x> on interface %s\n",
@@ -51,19 +52,12 @@ static void nbt_register_handler(struct nbt_name_request *req)
return;
}
- if (!NT_STATUS_IS_OK(status)) {
- DEBUG(1,("Error registering %s<%02x> on interface %s - %s\n",
- iname->name.name, iname->name.type, iname->iface->bcast_address,
- nt_errstr(status)));
- return;
- }
-
/* someone must have replied with an objection! */
iname->nb_flags |= NBT_NM_CONFLICT;
-
- DEBUG(1,("Name conflict registering %s<%02x> on interface %s - rcode %d from %s for %s\n",
+
+ DEBUG(1,("Error registering %s<%02x> on interface %s - %s\n",
iname->name.name, iname->name.type, iname->iface->bcast_address,
- io.out.rcode, io.out.reply_from, io.out.reply_addr));
+ nt_errstr(status)));
}
@@ -76,8 +70,8 @@ static void nbt_register_name_iface(struct nbt_interface *iface,
{
struct nbt_iface_name *iname;
const char *scope = lp_netbios_scope();
- struct nbt_name_register io;
- struct nbt_name_request *req;
+ struct nbt_name_register_bcast io;
+ struct smbcli_composite *req;
iname = talloc(iface, struct nbt_iface_name);
if (!iname) return;
@@ -108,12 +102,9 @@ static void nbt_register_name_iface(struct nbt_interface *iface,
io.in.dest_addr = iface->bcast_address;
io.in.address = iface->ip_address;
io.in.nb_flags = nb_flags;
- io.in.register_demand = False;
- io.in.broadcast = True;
io.in.ttl = iname->ttl;
- io.in.timeout = 1;
- req = nbt_name_register_send(iface->nbtsock, &io);
+ req = nbt_name_register_bcast_send(iface->nbtsock, &io);
if (req == NULL) return;
req->async.fn = nbt_register_handler;