summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2005-02-04 02:16:59 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:09:31 -0500
commitc832e57ceb0be2acb96f187884f63d071c9e787f (patch)
treea5845d61e5fc3ddce6d2b83686bd75fcd5528236
parent1b27d0ce12c12a6ee4fd208789572442f2edd4fc (diff)
downloadsamba-c832e57ceb0be2acb96f187884f63d071c9e787f.tar.gz
samba-c832e57ceb0be2acb96f187884f63d071c9e787f.tar.bz2
samba-c832e57ceb0be2acb96f187884f63d071c9e787f.zip
r5213: do our name broadcast refresh requests as register packets not refresh
packets, as w2k3 and Samba3 do not defend against broadcast name refresh packets (This used to be commit 3935b5f7c57be46042110911ba5b00ac39b0f41a)
-rw-r--r--source4/nbt_server/register.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/source4/nbt_server/register.c b/source4/nbt_server/register.c
index 7464b2fbe2..f05c8a4f82 100644
--- a/source4/nbt_server/register.c
+++ b/source4/nbt_server/register.c
@@ -76,19 +76,24 @@ static void name_refresh_handler(struct event_context *ev, struct timed_event *t
{
struct nbt_iface_name *iname = talloc_get_type(private, struct nbt_iface_name);
struct nbt_interface *iface = iname->iface;
- struct nbt_name_refresh io;
+ struct nbt_name_register io;
struct nbt_name_request *req;
- /* setup a name refresh request */
+ /* setup a single name register request. Notice that we don't
+ use a name refresh request, as Windows and Samba3 do not
+ defend against broadcast name refresh packets. So for this
+ to be of any use at all, we need to refresh using name
+ registration packets */
io.in.name = iname->name;
io.in.dest_addr = iface->bcast_address;
io.in.address = iface->ip_address;
io.in.nb_flags = iname->nb_flags;
io.in.ttl = iname->ttl;
+ io.in.register_demand = False;
io.in.broadcast = True;
io.in.timeout = 3;
- req = nbt_name_refresh_send(iface->nbtsock, &io);
+ req = nbt_name_register_send(iface->nbtsock, &io);
if (req == NULL) return;
req->async.fn = refresh_completion_handler;
@@ -108,7 +113,7 @@ static void nbtd_start_refresh_timer(struct nbt_iface_name *iname)
event_add_timed(iname->iface->nbtsrv->task->event_ctx,
iname,
- timeval_current_ofs(refresh_time, 0),
+ timeval_add(&iname->registration_time, refresh_time, 0),
name_refresh_handler, iname);
}