From b0fc1bfbcbacc61350fdd6e96306fe49d7fc0d6f Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 18 Feb 2005 23:53:52 +0000 Subject: r5454: moved the WINS server code into its own directory (This used to be commit 0bb997127fe6c49361d9f1eaeda5d9321601a52a) --- source4/nbt_server/wins/winsclient.c | 231 +++++++++++++++++++++++++++++++++++ 1 file changed, 231 insertions(+) create mode 100644 source4/nbt_server/wins/winsclient.c (limited to 'source4/nbt_server/wins/winsclient.c') diff --git a/source4/nbt_server/wins/winsclient.c b/source4/nbt_server/wins/winsclient.c new file mode 100644 index 0000000000..cfb68a3aaf --- /dev/null +++ b/source4/nbt_server/wins/winsclient.c @@ -0,0 +1,231 @@ +/* + Unix SMB/CIFS implementation. + + wins client name registration and refresh + + 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 "nbt_server/nbt_server.h" +#include "libcli/raw/libcliraw.h" +#include "libcli/composite/composite.h" +#include "lib/events/events.h" +#include "smbd/service_task.h" + + +/* we send WINS client requests using our primary network interface +*/ +static struct nbt_name_socket *wins_socket(struct nbtd_interface *iface) +{ + struct nbtd_server *nbtsrv = iface->nbtsrv; + return nbtsrv->interfaces->nbtsock; +} + + +static void nbtd_wins_refresh(struct event_context *ev, struct timed_event *te, + struct timeval t, void *private); + +/* + retry a WINS name registration +*/ +static void nbtd_wins_register_retry(struct event_context *ev, struct timed_event *te, + struct timeval t, void *private) +{ + struct nbtd_iface_name *iname = talloc_get_type(private, struct nbtd_iface_name); + nbtd_winsclient_register(iname); +} + + +/* + called when a wins name refresh has completed +*/ +static void nbtd_wins_refresh_handler(struct composite_context *c) +{ + NTSTATUS status; + struct nbt_name_refresh_wins io; + struct nbtd_iface_name *iname = talloc_get_type(c->async.private, + struct nbtd_iface_name); + TALLOC_CTX *tmp_ctx = talloc_new(iname); + + status = nbt_name_refresh_wins_recv(c, tmp_ctx, &io); + if (NT_STATUS_EQUAL(status, NT_STATUS_IO_TIMEOUT)) { + /* our WINS server is dead - start registration over + from scratch */ + DEBUG(2,("Failed to refresh %s with WINS server %s\n", + nbt_name_string(tmp_ctx, &iname->name), iname->wins_server)); + talloc_free(tmp_ctx); + nbtd_winsclient_register(iname); + return; + } + + if (!NT_STATUS_IS_OK(status)) { + DEBUG(1,("Name refresh failure with WINS for %s - %s\n", + nbt_name_string(tmp_ctx, &iname->name), nt_errstr(status))); + talloc_free(tmp_ctx); + return; + } + + if (io.out.rcode != 0) { + DEBUG(1,("WINS server %s rejected name refresh of %s - %s\n", + io.out.wins_server, nbt_name_string(tmp_ctx, &iname->name), + nt_errstr(nbt_rcode_to_ntstatus(io.out.rcode)))); + iname->nb_flags |= NBT_NM_CONFLICT; + talloc_free(tmp_ctx); + return; + } + + DEBUG(4,("Refreshed name %s with WINS server %s\n", + nbt_name_string(tmp_ctx, &iname->name), iname->wins_server)); + /* success - start a periodic name refresh */ + iname->nb_flags |= NBT_NM_ACTIVE; + if (iname->wins_server) { + talloc_free(iname->wins_server); + } + iname->wins_server = talloc_steal(iname, io.out.wins_server); + + iname->registration_time = timeval_current(); + event_add_timed(iname->iface->nbtsrv->task->event_ctx, + iname, + timeval_add(&iname->registration_time, iname->ttl/2, 0), + nbtd_wins_refresh, + iname); + + talloc_free(tmp_ctx); +} + + +/* + refresh a WINS name registration +*/ +static void nbtd_wins_refresh(struct event_context *ev, struct timed_event *te, + struct timeval t, void *private) +{ + struct nbtd_iface_name *iname = talloc_get_type(private, struct nbtd_iface_name); + struct nbtd_interface *iface = iname->iface; + struct nbt_name_refresh_wins io; + struct composite_context *c; + TALLOC_CTX *tmp_ctx = talloc_new(iname); + + /* setup a wins name refresh request */ + io.in.name = iname->name; + io.in.wins_servers = str_list_make(tmp_ctx, iname->wins_server, NULL); + io.in.addresses = nbtd_address_list(iface, tmp_ctx); + io.in.nb_flags = iname->nb_flags; + io.in.ttl = iname->ttl; + + c = nbt_name_refresh_wins_send(wins_socket(iface), &io); + if (c == NULL) { + talloc_free(tmp_ctx); + return; + } + talloc_steal(c, io.in.addresses); + + c->async.fn = nbtd_wins_refresh_handler; + c->async.private = iname; + + talloc_free(tmp_ctx); +} + + +/* + called when a wins name register has completed +*/ +static void nbtd_wins_register_handler(struct composite_context *c) +{ + NTSTATUS status; + struct nbt_name_register_wins io; + struct nbtd_iface_name *iname = talloc_get_type(c->async.private, + struct nbtd_iface_name); + TALLOC_CTX *tmp_ctx = talloc_new(iname); + + status = nbt_name_register_wins_recv(c, tmp_ctx, &io); + if (NT_STATUS_EQUAL(status, NT_STATUS_IO_TIMEOUT)) { + /* none of the WINS servers responded - try again + periodically */ + int wins_retry_time = lp_parm_int(-1, "nbtd", "wins_retry", 300); + event_add_timed(iname->iface->nbtsrv->task->event_ctx, + iname, + timeval_current_ofs(wins_retry_time, 0), + nbtd_wins_register_retry, + iname); + talloc_free(tmp_ctx); + return; + } + + if (!NT_STATUS_IS_OK(status)) { + DEBUG(1,("Name register failure with WINS for %s - %s\n", + nbt_name_string(tmp_ctx, &iname->name), nt_errstr(status))); + talloc_free(tmp_ctx); + return; + } + + if (io.out.rcode != 0) { + DEBUG(1,("WINS server %s rejected name register of %s - %s\n", + io.out.wins_server, nbt_name_string(tmp_ctx, &iname->name), + nt_errstr(nbt_rcode_to_ntstatus(io.out.rcode)))); + iname->nb_flags |= NBT_NM_CONFLICT; + talloc_free(tmp_ctx); + return; + } + + /* success - start a periodic name refresh */ + iname->nb_flags |= NBT_NM_ACTIVE; + if (iname->wins_server) { + talloc_free(iname->wins_server); + } + iname->wins_server = talloc_steal(iname, io.out.wins_server); + + iname->registration_time = timeval_current(); + event_add_timed(iname->iface->nbtsrv->task->event_ctx, + iname, + timeval_add(&iname->registration_time, iname->ttl/2, 0), + nbtd_wins_refresh, + iname); + + DEBUG(3,("Registered %s with WINS server %s\n", + nbt_name_string(tmp_ctx, &iname->name), iname->wins_server)); + + talloc_free(tmp_ctx); +} + +/* + register a name with our WINS servers +*/ +void nbtd_winsclient_register(struct nbtd_iface_name *iname) +{ + struct nbtd_interface *iface = iname->iface; + struct nbt_name_register_wins io; + struct composite_context *c; + + /* setup a wins name register request */ + io.in.name = iname->name; + io.in.wins_servers = lp_wins_server_list(); + io.in.addresses = nbtd_address_list(iface, iname); + io.in.nb_flags = iname->nb_flags; + io.in.ttl = iname->ttl; + + c = nbt_name_register_wins_send(wins_socket(iface), &io); + if (c == NULL) { + talloc_free(io.in.addresses); + return; + } + talloc_steal(c, io.in.addresses); + + c->async.fn = nbtd_wins_register_handler; + c->async.private = iname; +} -- cgit From ab4d635b92b116b02b88843b4ec4f5b7517bab1a Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Mon, 26 Sep 2005 11:47:55 +0000 Subject: r10504: - seperate implementation specific stuff, from the generic composite stuff. - don't use SMBCLI_REQUEST_* state's in the genreic composite stuff - move monitor_fn to libnet. NOTE: I have maybe found some bugs, in code that is dirrectly in DONE or ERROR state in the _send() function. I haven't fixed this bugs in this commit! We may need some composite_trigger_*() functions or so. And maybe some other generic helper functions... metze (This used to be commit 4527815a0a9b96e460f301cb1f0c0b3964c166fc) --- source4/nbt_server/wins/winsclient.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) (limited to 'source4/nbt_server/wins/winsclient.c') diff --git a/source4/nbt_server/wins/winsclient.c b/source4/nbt_server/wins/winsclient.c index cfb68a3aaf..fdfdc8f0ed 100644 --- a/source4/nbt_server/wins/winsclient.c +++ b/source4/nbt_server/wins/winsclient.c @@ -22,7 +22,6 @@ #include "includes.h" #include "nbt_server/nbt_server.h" -#include "libcli/raw/libcliraw.h" #include "libcli/composite/composite.h" #include "lib/events/events.h" #include "smbd/service_task.h" @@ -38,15 +37,15 @@ static struct nbt_name_socket *wins_socket(struct nbtd_interface *iface) static void nbtd_wins_refresh(struct event_context *ev, struct timed_event *te, - struct timeval t, void *private); + struct timeval t, void *private_data); /* retry a WINS name registration */ static void nbtd_wins_register_retry(struct event_context *ev, struct timed_event *te, - struct timeval t, void *private) + struct timeval t, void *private_data) { - struct nbtd_iface_name *iname = talloc_get_type(private, struct nbtd_iface_name); + struct nbtd_iface_name *iname = talloc_get_type(private_data, struct nbtd_iface_name); nbtd_winsclient_register(iname); } @@ -58,7 +57,7 @@ static void nbtd_wins_refresh_handler(struct composite_context *c) { NTSTATUS status; struct nbt_name_refresh_wins io; - struct nbtd_iface_name *iname = talloc_get_type(c->async.private, + struct nbtd_iface_name *iname = talloc_get_type(c->async.private_data, struct nbtd_iface_name); TALLOC_CTX *tmp_ctx = talloc_new(iname); @@ -78,7 +77,7 @@ static void nbtd_wins_refresh_handler(struct composite_context *c) nbt_name_string(tmp_ctx, &iname->name), nt_errstr(status))); talloc_free(tmp_ctx); return; - } + } if (io.out.rcode != 0) { DEBUG(1,("WINS server %s rejected name refresh of %s - %s\n", @@ -113,9 +112,9 @@ static void nbtd_wins_refresh_handler(struct composite_context *c) refresh a WINS name registration */ static void nbtd_wins_refresh(struct event_context *ev, struct timed_event *te, - struct timeval t, void *private) + struct timeval t, void *private_data) { - struct nbtd_iface_name *iname = talloc_get_type(private, struct nbtd_iface_name); + struct nbtd_iface_name *iname = talloc_get_type(private_data, struct nbtd_iface_name); struct nbtd_interface *iface = iname->iface; struct nbt_name_refresh_wins io; struct composite_context *c; @@ -136,7 +135,7 @@ static void nbtd_wins_refresh(struct event_context *ev, struct timed_event *te, talloc_steal(c, io.in.addresses); c->async.fn = nbtd_wins_refresh_handler; - c->async.private = iname; + c->async.private_data = iname; talloc_free(tmp_ctx); } @@ -149,7 +148,7 @@ static void nbtd_wins_register_handler(struct composite_context *c) { NTSTATUS status; struct nbt_name_register_wins io; - struct nbtd_iface_name *iname = talloc_get_type(c->async.private, + struct nbtd_iface_name *iname = talloc_get_type(c->async.private_data, struct nbtd_iface_name); TALLOC_CTX *tmp_ctx = talloc_new(iname); @@ -227,5 +226,5 @@ void nbtd_winsclient_register(struct nbtd_iface_name *iname) talloc_steal(c, io.in.addresses); c->async.fn = nbtd_wins_register_handler; - c->async.private = iname; + c->async.private_data = iname; } -- cgit From ac4ee3e20b3823bb7b6cb35ce8855b8313f0fa8d Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 22 Dec 2005 22:03:25 +0000 Subject: r12440: fix crash bugs metze (This used to be commit c7049f8bb60d075921e1ac4d04bf1a216cd0a5f2) --- source4/nbt_server/wins/winsclient.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'source4/nbt_server/wins/winsclient.c') diff --git a/source4/nbt_server/wins/winsclient.c b/source4/nbt_server/wins/winsclient.c index fdfdc8f0ed..6bf328d146 100644 --- a/source4/nbt_server/wins/winsclient.c +++ b/source4/nbt_server/wins/winsclient.c @@ -127,6 +127,11 @@ static void nbtd_wins_refresh(struct event_context *ev, struct timed_event *te, io.in.nb_flags = iname->nb_flags; io.in.ttl = iname->ttl; + if (!io.in.addresses) { + talloc_free(tmp_ctx); + return; + } + c = nbt_name_refresh_wins_send(wins_socket(iface), &io); if (c == NULL) { talloc_free(tmp_ctx); @@ -218,6 +223,10 @@ void nbtd_winsclient_register(struct nbtd_iface_name *iname) io.in.nb_flags = iname->nb_flags; io.in.ttl = iname->ttl; + if (!io.in.addresses) { + return; + } + c = nbt_name_register_wins_send(wins_socket(iface), &io); if (c == NULL) { talloc_free(io.in.addresses); -- cgit From ab8cd4470c392e04e458eed378b857db00e97f13 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Fri, 30 Dec 2005 12:43:11 +0000 Subject: r12607: fix the build metze (This used to be commit 5cc955bf5400a415e462853cff47a69ef206a548) --- source4/nbt_server/wins/winsclient.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/nbt_server/wins/winsclient.c') diff --git a/source4/nbt_server/wins/winsclient.c b/source4/nbt_server/wins/winsclient.c index 6bf328d146..2538105fb8 100644 --- a/source4/nbt_server/wins/winsclient.c +++ b/source4/nbt_server/wins/winsclient.c @@ -22,6 +22,7 @@ #include "includes.h" #include "nbt_server/nbt_server.h" +#include "nbt_server/wins/winsserver.h" #include "libcli/composite/composite.h" #include "lib/events/events.h" #include "smbd/service_task.h" -- cgit From ba4df97eb943ebd2edb7d62adcb2f807f45c51da Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Wed, 18 Jan 2006 16:27:29 +0000 Subject: r13005: - use nbtd:max_refresh_time=12345 also for name refresh with a wins server metze (This used to be commit 5e3639edaf551068466caaf48faa9b2bbfed1041) --- source4/nbt_server/wins/winsclient.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) (limited to 'source4/nbt_server/wins/winsclient.c') diff --git a/source4/nbt_server/wins/winsclient.c b/source4/nbt_server/wins/winsclient.c index 2538105fb8..70cc0e9ae8 100644 --- a/source4/nbt_server/wins/winsclient.c +++ b/source4/nbt_server/wins/winsclient.c @@ -27,6 +27,7 @@ #include "lib/events/events.h" #include "smbd/service_task.h" +static void nbtd_wins_refresh_handler(struct composite_context *c); /* we send WINS client requests using our primary network interface */ @@ -50,6 +51,21 @@ static void nbtd_wins_register_retry(struct event_context *ev, struct timed_even nbtd_winsclient_register(iname); } +/* + start a timer to refresh this name +*/ +static void nbtd_wins_start_refresh_timer(struct nbtd_iface_name *iname) +{ + uint32_t refresh_time; + uint32_t max_refresh_time = lp_parm_int(-1, "nbtd", "max_refresh_time", 7200); + + refresh_time = MIN(max_refresh_time, iname->ttl/2); + + event_add_timed(iname->iface->nbtsrv->task->event_ctx, + iname, + timeval_add(&iname->registration_time, refresh_time, 0), + nbtd_wins_refresh, iname); +} /* called when a wins name refresh has completed @@ -99,11 +115,7 @@ static void nbtd_wins_refresh_handler(struct composite_context *c) iname->wins_server = talloc_steal(iname, io.out.wins_server); iname->registration_time = timeval_current(); - event_add_timed(iname->iface->nbtsrv->task->event_ctx, - iname, - timeval_add(&iname->registration_time, iname->ttl/2, 0), - nbtd_wins_refresh, - iname); + nbtd_wins_start_refresh_timer(iname); talloc_free(tmp_ctx); } @@ -196,11 +208,7 @@ static void nbtd_wins_register_handler(struct composite_context *c) iname->wins_server = talloc_steal(iname, io.out.wins_server); iname->registration_time = timeval_current(); - event_add_timed(iname->iface->nbtsrv->task->event_ctx, - iname, - timeval_add(&iname->registration_time, iname->ttl/2, 0), - nbtd_wins_refresh, - iname); + nbtd_wins_start_refresh_timer(iname); DEBUG(3,("Registered %s with WINS server %s\n", nbt_name_string(tmp_ctx, &iname->name), iname->wins_server)); -- 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/wins/winsclient.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/nbt_server/wins/winsclient.c') diff --git a/source4/nbt_server/wins/winsclient.c b/source4/nbt_server/wins/winsclient.c index 70cc0e9ae8..bfaf1edbde 100644 --- a/source4/nbt_server/wins/winsclient.c +++ b/source4/nbt_server/wins/winsclient.c @@ -25,6 +25,7 @@ #include "nbt_server/wins/winsserver.h" #include "libcli/composite/composite.h" #include "lib/events/events.h" +#include "librpc/gen_ndr/ndr_nbt.h" #include "smbd/service_task.h" static void nbtd_wins_refresh_handler(struct composite_context *c); -- cgit From 1713b43c1a28aadfecf641dfdd6e070ef3dfba1b Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 24 Aug 2006 11:24:06 +0000 Subject: r17792: io.out.winsserver is a const char *, and iname->winserver = talloc_steal(iname, io.out.winsserver) generated a warning, so I changed iname->winsserver to also be a const char *. then a talloc_free(iname->winsserver) would generate a warning, but we can steal it into the tmp_ctx without a warning and that gets free'ed a few lines later. metze (This used to be commit fdef17f81e5fc48cca3dd7611d6d5007147473b1) --- source4/nbt_server/wins/winsclient.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'source4/nbt_server/wins/winsclient.c') diff --git a/source4/nbt_server/wins/winsclient.c b/source4/nbt_server/wins/winsclient.c index bfaf1edbde..458d1a434d 100644 --- a/source4/nbt_server/wins/winsclient.c +++ b/source4/nbt_server/wins/winsclient.c @@ -111,7 +111,11 @@ static void nbtd_wins_refresh_handler(struct composite_context *c) /* success - start a periodic name refresh */ iname->nb_flags |= NBT_NM_ACTIVE; if (iname->wins_server) { - talloc_free(iname->wins_server); + /* + * talloc_free() would generate a warning, + * so steal it into the tmp context + */ + talloc_steal(tmp_ctx, iname->wins_server); } iname->wins_server = talloc_steal(iname, io.out.wins_server); @@ -204,7 +208,11 @@ static void nbtd_wins_register_handler(struct composite_context *c) /* success - start a periodic name refresh */ iname->nb_flags |= NBT_NM_ACTIVE; if (iname->wins_server) { - talloc_free(iname->wins_server); + /* + * talloc_free() would generate a warning, + * so steal it into the tmp context + */ + talloc_steal(tmp_ctx, iname->wins_server); } iname->wins_server = talloc_steal(iname, io.out.wins_server); -- 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/wins/winsclient.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'source4/nbt_server/wins/winsclient.c') diff --git a/source4/nbt_server/wins/winsclient.c b/source4/nbt_server/wins/winsclient.c index 458d1a434d..3c599022d4 100644 --- a/source4/nbt_server/wins/winsclient.c +++ b/source4/nbt_server/wins/winsclient.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/wins/winsclient.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/nbt_server/wins/winsclient.c') diff --git a/source4/nbt_server/wins/winsclient.c b/source4/nbt_server/wins/winsclient.c index 3c599022d4..279462289d 100644 --- a/source4/nbt_server/wins/winsclient.c +++ b/source4/nbt_server/wins/winsclient.c @@ -26,6 +26,7 @@ #include "lib/events/events.h" #include "librpc/gen_ndr/ndr_nbt.h" #include "smbd/service_task.h" +#include "param/param.h" static void nbtd_wins_refresh_handler(struct composite_context *c); -- cgit From 98b57d5eb61094a9c88e2f7d90d3e21b7e74e9d8 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 8 Sep 2007 16:46:30 +0000 Subject: r25035: Fix some more warnings, use service pointer rather than service number in more places. (This used to be commit df9cebcb97e20564359097148665bd519f31bc6f) --- source4/nbt_server/wins/winsclient.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source4/nbt_server/wins/winsclient.c') diff --git a/source4/nbt_server/wins/winsclient.c b/source4/nbt_server/wins/winsclient.c index 279462289d..e18885c327 100644 --- a/source4/nbt_server/wins/winsclient.c +++ b/source4/nbt_server/wins/winsclient.c @@ -58,7 +58,7 @@ static void nbtd_wins_register_retry(struct event_context *ev, struct timed_even static void nbtd_wins_start_refresh_timer(struct nbtd_iface_name *iname) { uint32_t refresh_time; - uint32_t max_refresh_time = lp_parm_int(-1, "nbtd", "max_refresh_time", 7200); + uint32_t max_refresh_time = lp_parm_int(NULL, "nbtd", "max_refresh_time", 7200); refresh_time = MIN(max_refresh_time, iname->ttl/2); @@ -179,7 +179,7 @@ static void nbtd_wins_register_handler(struct composite_context *c) if (NT_STATUS_EQUAL(status, NT_STATUS_IO_TIMEOUT)) { /* none of the WINS servers responded - try again periodically */ - int wins_retry_time = lp_parm_int(-1, "nbtd", "wins_retry", 300); + int wins_retry_time = lp_parm_int(NULL, "nbtd", "wins_retry", 300); event_add_timed(iname->iface->nbtsrv->task->event_ctx, iname, timeval_current_ofs(wins_retry_time, 0), -- 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/wins/winsclient.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'source4/nbt_server/wins/winsclient.c') diff --git a/source4/nbt_server/wins/winsclient.c b/source4/nbt_server/wins/winsclient.c index e18885c327..1dd934cc92 100644 --- a/source4/nbt_server/wins/winsclient.c +++ b/source4/nbt_server/wins/winsclient.c @@ -236,7 +236,7 @@ void nbtd_winsclient_register(struct nbtd_iface_name *iname) /* setup a wins name register request */ io.in.name = iname->name; - io.in.wins_servers = lp_wins_server_list(); + io.in.wins_servers = lp_wins_server_list(global_loadparm); io.in.addresses = nbtd_address_list(iface, iname); io.in.nb_flags = iname->nb_flags; io.in.ttl = iname->ttl; -- cgit From 60a1046c5c5783799bd64fe18e03534670f83d82 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 29 Sep 2007 18:00:19 +0000 Subject: r25430: Add the loadparm context to all parametric options. (This used to be commit fd697d77c9fe67a00939a1f04b35c451316fff58) --- source4/nbt_server/wins/winsclient.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source4/nbt_server/wins/winsclient.c') diff --git a/source4/nbt_server/wins/winsclient.c b/source4/nbt_server/wins/winsclient.c index 1dd934cc92..d1342c3766 100644 --- a/source4/nbt_server/wins/winsclient.c +++ b/source4/nbt_server/wins/winsclient.c @@ -58,7 +58,7 @@ static void nbtd_wins_register_retry(struct event_context *ev, struct timed_even static void nbtd_wins_start_refresh_timer(struct nbtd_iface_name *iname) { uint32_t refresh_time; - uint32_t max_refresh_time = lp_parm_int(NULL, "nbtd", "max_refresh_time", 7200); + uint32_t max_refresh_time = lp_parm_int(global_loadparm, NULL, "nbtd", "max_refresh_time", 7200); refresh_time = MIN(max_refresh_time, iname->ttl/2); @@ -179,7 +179,7 @@ static void nbtd_wins_register_handler(struct composite_context *c) if (NT_STATUS_EQUAL(status, NT_STATUS_IO_TIMEOUT)) { /* none of the WINS servers responded - try again periodically */ - int wins_retry_time = lp_parm_int(NULL, "nbtd", "wins_retry", 300); + int wins_retry_time = lp_parm_int(global_loadparm, NULL, "nbtd", "wins_retry", 300); event_add_timed(iname->iface->nbtsrv->task->event_ctx, iname, timeval_current_ofs(wins_retry_time, 0), -- 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/wins/winsclient.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source4/nbt_server/wins/winsclient.c') diff --git a/source4/nbt_server/wins/winsclient.c b/source4/nbt_server/wins/winsclient.c index d1342c3766..046be28515 100644 --- a/source4/nbt_server/wins/winsclient.c +++ b/source4/nbt_server/wins/winsclient.c @@ -58,7 +58,7 @@ static void nbtd_wins_register_retry(struct event_context *ev, struct timed_even static void nbtd_wins_start_refresh_timer(struct nbtd_iface_name *iname) { uint32_t refresh_time; - uint32_t max_refresh_time = lp_parm_int(global_loadparm, NULL, "nbtd", "max_refresh_time", 7200); + uint32_t max_refresh_time = lp_parm_int(iname->iface->nbtsrv->task->lp_ctx, NULL, "nbtd", "max_refresh_time", 7200); refresh_time = MIN(max_refresh_time, iname->ttl/2); @@ -179,7 +179,7 @@ static void nbtd_wins_register_handler(struct composite_context *c) if (NT_STATUS_EQUAL(status, NT_STATUS_IO_TIMEOUT)) { /* none of the WINS servers responded - try again periodically */ - int wins_retry_time = lp_parm_int(global_loadparm, NULL, "nbtd", "wins_retry", 300); + int wins_retry_time = lp_parm_int(iname->iface->nbtsrv->task->lp_ctx, NULL, "nbtd", "wins_retry", 300); event_add_timed(iname->iface->nbtsrv->task->event_ctx, iname, timeval_current_ofs(wins_retry_time, 0), @@ -236,7 +236,7 @@ void nbtd_winsclient_register(struct nbtd_iface_name *iname) /* setup a wins name register request */ io.in.name = iname->name; - io.in.wins_servers = lp_wins_server_list(global_loadparm); + io.in.wins_servers = lp_wins_server_list(iname->iface->nbtsrv->task->lp_ctx); io.in.addresses = nbtd_address_list(iface, iname); io.in.nb_flags = iname->nb_flags; io.in.ttl = iname->ttl; -- cgit From 33582dffcc2d348dc042edfdcccee7500b21d928 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 12 Dec 2007 02:15:20 +0100 Subject: r26408: Remove use of global_loadparm. (This used to be commit f933b4362124bfdd25544b4e27992d9ca4405848) --- source4/nbt_server/wins/winsclient.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/nbt_server/wins/winsclient.c') diff --git a/source4/nbt_server/wins/winsclient.c b/source4/nbt_server/wins/winsclient.c index 046be28515..001ad58f62 100644 --- a/source4/nbt_server/wins/winsclient.c +++ b/source4/nbt_server/wins/winsclient.c @@ -141,6 +141,7 @@ static void nbtd_wins_refresh(struct event_context *ev, struct timed_event *te, /* setup a wins name refresh request */ io.in.name = iname->name; io.in.wins_servers = str_list_make(tmp_ctx, iname->wins_server, NULL); + io.in.wins_port = lp_nbt_port(iface->nbtsrv->task->lp_ctx); io.in.addresses = nbtd_address_list(iface, tmp_ctx); io.in.nb_flags = iname->nb_flags; io.in.ttl = iname->ttl; -- cgit From 4b0199a5493ea2b88558cc40871e63c1dc8dbb56 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 12 Dec 2007 02:15:29 +0100 Subject: r26409: Pass smb ports along. (This used to be commit 2833f320de1f1fd39c710ad0a61c3fa1bb1df31f) --- source4/nbt_server/wins/winsclient.c | 1 + 1 file changed, 1 insertion(+) (limited to 'source4/nbt_server/wins/winsclient.c') diff --git a/source4/nbt_server/wins/winsclient.c b/source4/nbt_server/wins/winsclient.c index 001ad58f62..1d07f4a60a 100644 --- a/source4/nbt_server/wins/winsclient.c +++ b/source4/nbt_server/wins/winsclient.c @@ -237,6 +237,7 @@ void nbtd_winsclient_register(struct nbtd_iface_name *iname) /* setup a wins name register request */ io.in.name = iname->name; + io.in.wins_port = lp_nbt_port(iname->iface->nbtsrv->task->lp_ctx); io.in.wins_servers = lp_wins_server_list(iname->iface->nbtsrv->task->lp_ctx); io.in.addresses = nbtd_address_list(iface, iname); io.in.nb_flags = iname->nb_flags; -- cgit