summaryrefslogtreecommitdiff
path: root/source4/nbt_server
diff options
context:
space:
mode:
Diffstat (limited to 'source4/nbt_server')
-rw-r--r--source4/nbt_server/interfaces.c21
-rw-r--r--source4/nbt_server/nbt_server.c2
2 files changed, 13 insertions, 10 deletions
diff --git a/source4/nbt_server/interfaces.c b/source4/nbt_server/interfaces.c
index 2f51cc3dec..c40cd6322c 100644
--- a/source4/nbt_server/interfaces.c
+++ b/source4/nbt_server/interfaces.c
@@ -98,6 +98,7 @@ struct nbtd_iface_name *nbtd_find_iname(struct nbtd_interface *iface,
start listening on the given address
*/
static NTSTATUS nbtd_add_socket(struct nbtd_server *nbtsrv,
+ struct loadparm_context *lp_ctx,
const char *bind_address,
const char *address,
const char *bcast,
@@ -136,7 +137,7 @@ static NTSTATUS nbtd_add_socket(struct nbtd_server *nbtsrv,
}
bcast_address = socket_address_from_strings(bcast_nbtsock, bcast_nbtsock->sock->backend_name,
- bcast, lp_nbt_port(global_loadparm));
+ bcast, lp_nbt_port(lp_ctx));
if (!bcast_address) {
talloc_free(iface);
return NT_STATUS_NO_MEMORY;
@@ -145,7 +146,7 @@ static NTSTATUS nbtd_add_socket(struct nbtd_server *nbtsrv,
status = socket_listen(bcast_nbtsock->sock, bcast_address, 0, 0);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("Failed to bind to %s:%d - %s\n",
- bcast, lp_nbt_port(global_loadparm), nt_errstr(status)));
+ bcast, lp_nbt_port(lp_ctx), nt_errstr(status)));
talloc_free(iface);
return status;
}
@@ -163,12 +164,12 @@ static NTSTATUS nbtd_add_socket(struct nbtd_server *nbtsrv,
unicast_address = socket_address_from_strings(iface->nbtsock,
iface->nbtsock->sock->backend_name,
- bind_address, lp_nbt_port(global_loadparm));
+ bind_address, lp_nbt_port(lp_ctx));
status = socket_listen(iface->nbtsock->sock, unicast_address, 0, 0);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("Failed to bind to %s:%d - %s\n",
- bind_address, lp_nbt_port(global_loadparm), nt_errstr(status)));
+ bind_address, lp_nbt_port(lp_ctx), nt_errstr(status)));
talloc_free(iface);
return status;
}
@@ -215,7 +216,7 @@ static NTSTATUS nbtd_add_wins_socket(struct nbtd_server *nbtsrv)
/*
setup our listening sockets on the configured network interfaces
*/
-NTSTATUS nbtd_startup_interfaces(struct nbtd_server *nbtsrv)
+NTSTATUS nbtd_startup_interfaces(struct nbtd_server *nbtsrv, struct loadparm_context *lp_ctx)
{
int num_interfaces = iface_count();
int i;
@@ -224,7 +225,7 @@ NTSTATUS nbtd_startup_interfaces(struct nbtd_server *nbtsrv)
/* if we are allowing incoming packets from any address, then
we also need to bind to the wildcard address */
- if (!lp_bind_interfaces_only(global_loadparm)) {
+ if (!lp_bind_interfaces_only(lp_ctx)) {
const char *primary_address;
/* the primary address is the address we will return
@@ -234,12 +235,13 @@ NTSTATUS nbtd_startup_interfaces(struct nbtd_server *nbtsrv)
primary_address = iface_n_ip(0);
} else {
primary_address = inet_ntoa(interpret_addr2(
- lp_netbios_name(global_loadparm)));
+ lp_netbios_name(lp_ctx)));
}
primary_address = talloc_strdup(tmp_ctx, primary_address);
NT_STATUS_HAVE_NO_MEMORY(primary_address);
status = nbtd_add_socket(nbtsrv,
+ lp_ctx,
"0.0.0.0",
primary_address,
talloc_strdup(tmp_ctx, "255.255.255.255"),
@@ -258,11 +260,12 @@ NTSTATUS nbtd_startup_interfaces(struct nbtd_server *nbtsrv)
bcast = talloc_strdup(tmp_ctx, bcast);
netmask = talloc_strdup(tmp_ctx, iface_n_netmask(i));
- status = nbtd_add_socket(nbtsrv, address, address, bcast, netmask);
+ status = nbtd_add_socket(nbtsrv, lp_ctx,
+ address, address, bcast, netmask);
NT_STATUS_NOT_OK_RETURN(status);
}
- if (lp_wins_server_list(global_loadparm)) {
+ if (lp_wins_server_list(lp_ctx)) {
status = nbtd_add_wins_socket(nbtsrv);
NT_STATUS_NOT_OK_RETURN(status);
}
diff --git a/source4/nbt_server/nbt_server.c b/source4/nbt_server/nbt_server.c
index 30c64db129..e06457f47f 100644
--- a/source4/nbt_server/nbt_server.c
+++ b/source4/nbt_server/nbt_server.c
@@ -57,7 +57,7 @@ static void nbtd_task_init(struct task_server *task)
nbtsrv->wins_interface = NULL;
/* start listening on the configured network interfaces */
- status = nbtd_startup_interfaces(nbtsrv);
+ status = nbtd_startup_interfaces(nbtsrv, task->lp_ctx);
if (!NT_STATUS_IS_OK(status)) {
task_server_terminate(task, "nbtd failed to setup interfaces");
return;