svn commit: samba r26265 - in branches/SAMBA_4_0: .
source/nbt_server source/rpc_server
jelmer at samba.org
jelmer at samba.org
Mon Dec 3 18:47:44 GMT 2007
Author: jelmer
Date: 2007-12-03 18:47:42 +0000 (Mon, 03 Dec 2007)
New Revision: 26265
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=26265
Log:
Use task-provided loadparm context in nbt and rpc servers.
Modified:
branches/SAMBA_4_0/
branches/SAMBA_4_0/source/nbt_server/interfaces.c
branches/SAMBA_4_0/source/nbt_server/nbt_server.c
branches/SAMBA_4_0/source/rpc_server/service_rpc.c
Changeset:
Property changes on: branches/SAMBA_4_0
___________________________________________________________________
Name: bzr:revision-info
...skipped...
Name: bzr:revision-id:v3-trunk0
...skipped...
Modified: branches/SAMBA_4_0/source/nbt_server/interfaces.c
===================================================================
--- branches/SAMBA_4_0/source/nbt_server/interfaces.c 2007-12-03 18:47:35 UTC (rev 26264)
+++ branches/SAMBA_4_0/source/nbt_server/interfaces.c 2007-12-03 18:47:42 UTC (rev 26265)
@@ -98,6 +98,7 @@
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 @@
}
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 @@
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 @@
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 @@
/*
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 @@
/* 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 @@
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 @@
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);
}
Modified: branches/SAMBA_4_0/source/nbt_server/nbt_server.c
===================================================================
--- branches/SAMBA_4_0/source/nbt_server/nbt_server.c 2007-12-03 18:47:35 UTC (rev 26264)
+++ branches/SAMBA_4_0/source/nbt_server/nbt_server.c 2007-12-03 18:47:42 UTC (rev 26265)
@@ -57,7 +57,7 @@
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;
Modified: branches/SAMBA_4_0/source/rpc_server/service_rpc.c
===================================================================
--- branches/SAMBA_4_0/source/rpc_server/service_rpc.c 2007-12-03 18:47:35 UTC (rev 26264)
+++ branches/SAMBA_4_0/source/rpc_server/service_rpc.c 2007-12-03 18:47:42 UTC (rev 26265)
@@ -216,7 +216,9 @@
-static NTSTATUS dcesrv_add_ep_unix(struct dcesrv_context *dce_ctx, struct dcesrv_endpoint *e,
+static NTSTATUS dcesrv_add_ep_unix(struct dcesrv_context *dce_ctx,
+ struct loadparm_context *lp_ctx,
+ struct dcesrv_endpoint *e,
struct event_context *event_ctx, const struct model_ops *model_ops)
{
struct dcesrv_socket_context *dcesrv_sock;
@@ -241,8 +243,10 @@
return status;
}
-static NTSTATUS dcesrv_add_ep_ncalrpc(struct dcesrv_context *dce_ctx, struct dcesrv_endpoint *e,
- struct event_context *event_ctx, const struct model_ops *model_ops)
+static NTSTATUS dcesrv_add_ep_ncalrpc(struct dcesrv_context *dce_ctx,
+ struct loadparm_context *lp_ctx,
+ struct dcesrv_endpoint *e,
+ struct event_context *event_ctx, const struct model_ops *model_ops)
{
struct dcesrv_socket_context *dcesrv_sock;
uint16_t port = 1;
@@ -256,7 +260,7 @@
e->ep_description->endpoint = talloc_strdup(dce_ctx, "DEFAULT");
}
- full_path = talloc_asprintf(dce_ctx, "%s/%s", lp_ncalrpc_dir(global_loadparm),
+ full_path = talloc_asprintf(dce_ctx, "%s/%s", lp_ncalrpc_dir(lp_ctx),
e->ep_description->endpoint);
dcesrv_sock = talloc(event_ctx, struct dcesrv_socket_context);
@@ -310,8 +314,10 @@
return status;
}
-static NTSTATUS dcesrv_add_ep_np(struct dcesrv_context *dce_ctx, struct dcesrv_endpoint *e,
- struct event_context *event_ctx, const struct model_ops *model_ops)
+static NTSTATUS dcesrv_add_ep_np(struct dcesrv_context *dce_ctx,
+ struct loadparm_context *lp_ctx,
+ struct dcesrv_endpoint *e,
+ struct event_context *event_ctx, const struct model_ops *model_ops)
{
NTSTATUS status;
@@ -357,13 +363,15 @@
return status;
}
-static NTSTATUS dcesrv_add_ep_tcp(struct dcesrv_context *dce_ctx, struct dcesrv_endpoint *e,
- struct event_context *event_ctx, const struct model_ops *model_ops)
+static NTSTATUS dcesrv_add_ep_tcp(struct dcesrv_context *dce_ctx,
+ struct loadparm_context *lp_ctx,
+ struct dcesrv_endpoint *e,
+ struct event_context *event_ctx, const struct model_ops *model_ops)
{
NTSTATUS status;
/* Add TCP/IP sockets */
- if (lp_interfaces(global_loadparm) && lp_bind_interfaces_only(global_loadparm)) {
+ if (lp_interfaces(lp_ctx) && lp_bind_interfaces_only(lp_ctx)) {
int num_interfaces = iface_count();
int i;
for(i = 0; i < num_interfaces; i++) {
@@ -373,7 +381,7 @@
}
} else {
status = add_socket_rpc_tcp_iface(dce_ctx, e, event_ctx, model_ops,
- lp_socket_address(global_loadparm));
+ lp_socket_address(lp_ctx));
NT_STATUS_NOT_OK_RETURN(status);
}
@@ -381,21 +389,23 @@
}
-static NTSTATUS dcesrv_add_ep(struct dcesrv_context *dce_ctx, struct dcesrv_endpoint *e,
+static NTSTATUS dcesrv_add_ep(struct dcesrv_context *dce_ctx,
+ struct loadparm_context *lp_ctx,
+ struct dcesrv_endpoint *e,
struct event_context *event_ctx, const struct model_ops *model_ops)
{
switch (e->ep_description->transport) {
case NCACN_UNIX_STREAM:
- return dcesrv_add_ep_unix(dce_ctx, e, event_ctx, model_ops);
+ return dcesrv_add_ep_unix(dce_ctx, lp_ctx, e, event_ctx, model_ops);
case NCALRPC:
- return dcesrv_add_ep_ncalrpc(dce_ctx, e, event_ctx, model_ops);
+ return dcesrv_add_ep_ncalrpc(dce_ctx, lp_ctx, e, event_ctx, model_ops);
case NCACN_IP_TCP:
- return dcesrv_add_ep_tcp(dce_ctx, e, event_ctx, model_ops);
+ return dcesrv_add_ep_tcp(dce_ctx, lp_ctx, e, event_ctx, model_ops);
case NCACN_NP:
- return dcesrv_add_ep_np(dce_ctx, e, event_ctx, model_ops);
+ return dcesrv_add_ep_np(dce_ctx, lp_ctx, e, event_ctx, model_ops);
default:
return NT_STATUS_NOT_SUPPORTED;
@@ -424,7 +434,7 @@
}
for (e=dce_ctx->endpoint_list;e;e=e->next) {
- status = dcesrv_add_ep(dce_ctx, e, task->event_ctx, task->model_ops);
+ status = dcesrv_add_ep(dce_ctx, task->lp_ctx, e, task->event_ctx, task->model_ops);
if (!NT_STATUS_IS_OK(status)) goto failed;
}
More information about the samba-cvs
mailing list