summaryrefslogtreecommitdiff
path: root/source4/nbt_server/wins
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2007-12-11 22:23:14 +0100
committerStefan Metzmacher <metze@samba.org>2007-12-21 05:49:32 +0100
commit6f2252dace1629d7b5c5637b103caa28d2c89b07 (patch)
treefc09abaf04401ef510d55866066738840d052ebf /source4/nbt_server/wins
parentf9948d18d73fb8d8711c3b5a46b1d83c881a0084 (diff)
downloadsamba-6f2252dace1629d7b5c5637b103caa28d2c89b07.tar.gz
samba-6f2252dace1629d7b5c5637b103caa28d2c89b07.tar.bz2
samba-6f2252dace1629d7b5c5637b103caa28d2c89b07.zip
r26401: Don't cache interfaces context in libnetif.
(This used to be commit 9f975417cc66bfd4589da38bfd23731dbe0e6153)
Diffstat (limited to 'source4/nbt_server/wins')
-rw-r--r--source4/nbt_server/wins/wins_dns_proxy.c11
-rw-r--r--source4/nbt_server/wins/wins_ldb.c4
-rw-r--r--source4/nbt_server/wins/winsdb.c7
-rw-r--r--source4/nbt_server/wins/winsserver.c12
4 files changed, 21 insertions, 13 deletions
diff --git a/source4/nbt_server/wins/wins_dns_proxy.c b/source4/nbt_server/wins/wins_dns_proxy.c
index 24bcf1f3d1..3322ad55fd 100644
--- a/source4/nbt_server/wins/wins_dns_proxy.c
+++ b/source4/nbt_server/wins/wins_dns_proxy.c
@@ -72,10 +72,7 @@ void nbtd_wins_dns_proxy_query(struct nbt_name_socket *nbtsock,
struct nbtd_interface);
struct wins_dns_proxy_state *s;
struct composite_context *creq;
- const char *methods[] = {
- "host",
- NULL
- };
+ struct resolve_context *resolve_ctx;
s = talloc(nbtsock, struct wins_dns_proxy_state);
if (!s) goto failed;
@@ -86,7 +83,11 @@ void nbtd_wins_dns_proxy_query(struct nbt_name_socket *nbtsock,
goto failed;
}
- creq = resolve_name_send(name, iface->nbtsrv->task->event_ctx, methods);
+ resolve_ctx = resolve_context_init(s);
+ if (resolve_ctx == NULL) goto failed;
+ resolve_context_add_host_method(resolve_ctx);
+
+ creq = resolve_name_send(resolve_ctx, name, iface->nbtsrv->task->event_ctx);
if (!creq) goto failed;
creq->async.fn = nbtd_wins_dns_proxy_handler;
diff --git a/source4/nbt_server/wins/wins_ldb.c b/source4/nbt_server/wins/wins_ldb.c
index 7caab34aaa..6fef218056 100644
--- a/source4/nbt_server/wins/wins_ldb.c
+++ b/source4/nbt_server/wins/wins_ldb.c
@@ -90,7 +90,9 @@ static int wins_ldb_init(struct ldb_module *ctx)
owner = lp_parm_string(lp_ctx, NULL, "winsdb", "local_owner");
if (!owner) {
- owner = iface_n_ip(lp_ctx, 0);
+ struct interface *ifaces;
+ load_interfaces(lp_interfaces(lp_ctx), &ifaces);
+ owner = iface_n_ip(ifaces, 0);
if (!owner) {
owner = "0.0.0.0";
}
diff --git a/source4/nbt_server/wins/winsdb.c b/source4/nbt_server/wins/winsdb.c
index 428b154731..7de5bba468 100644
--- a/source4/nbt_server/wins/winsdb.c
+++ b/source4/nbt_server/wins/winsdb.c
@@ -1011,10 +1011,10 @@ failed:
}
struct winsdb_handle *winsdb_connect(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx,
+ const char *owner,
enum winsdb_handle_caller caller)
{
struct winsdb_handle *h = NULL;
- const char *owner;
unsigned int flags = 0;
bool ret;
int ldb_err;
@@ -1033,11 +1033,6 @@ struct winsdb_handle *winsdb_connect(TALLOC_CTX *mem_ctx, struct loadparm_contex
h->caller = caller;
h->hook_script = lp_wins_hook(lp_ctx);
- owner = lp_parm_string(lp_ctx, NULL, "winsdb", "local_owner");
- if (!owner) {
- owner = iface_n_ip(lp_ctx, 0);
- }
-
h->local_owner = talloc_strdup(h, owner);
if (!h->local_owner) goto failed;
diff --git a/source4/nbt_server/wins/winsserver.c b/source4/nbt_server/wins/winsserver.c
index 98262a2f84..e24ad85376 100644
--- a/source4/nbt_server/wins/winsserver.c
+++ b/source4/nbt_server/wins/winsserver.c
@@ -33,6 +33,7 @@
#include "lib/socket/netif.h"
#include "lib/ldb/include/ldb.h"
#include "param/param.h"
+#include "libcli/resolve/resolve.h"
/*
work out the ttl we will use given a client requested ttl
@@ -958,6 +959,7 @@ void nbtd_winsserver_request(struct nbt_name_socket *nbtsock,
NTSTATUS nbtd_winsserver_init(struct nbtd_server *nbtsrv)
{
uint32_t tmp;
+ const char *owner;
if (!lp_wins_support(nbtsrv->task->lp_ctx)) {
nbtsrv->winssrv = NULL;
@@ -974,8 +976,16 @@ NTSTATUS nbtd_winsserver_init(struct nbtd_server *nbtsrv)
tmp = lp_parm_int(nbtsrv->task->lp_ctx, NULL, "wreplsrv"," tombstone_timeout", 1*24*60*60);
nbtsrv->winssrv->config.tombstone_timeout = tmp;
+ owner = lp_parm_string(nbtsrv->task->lp_ctx, NULL, "winsdb", "local_owner");
+
+ if (owner == NULL) {
+ struct interface *ifaces;
+ load_interfaces(lp_interfaces(nbtsrv->task->lp_ctx), &ifaces);
+ owner = iface_n_ip(ifaces, 0);
+ }
+
nbtsrv->winssrv->wins_db = winsdb_connect(nbtsrv->winssrv, nbtsrv->task->lp_ctx,
- WINSDB_HANDLE_CALLER_NBTD);
+ owner, WINSDB_HANDLE_CALLER_NBTD);
if (!nbtsrv->winssrv->wins_db) {
return NT_STATUS_INTERNAL_DB_ERROR;
}