summaryrefslogtreecommitdiff
path: root/source4/cldap_server
diff options
context:
space:
mode:
authorJelmer Vernooij <jelmer@samba.org>2007-12-02 21:32:08 +0100
committerStefan Metzmacher <metze@samba.org>2007-12-21 05:47:13 +0100
commit934e932387ea5668ec000bcefe4ec86935297339 (patch)
treeb101a7e8ff027df768ef9612ca9a7b84f12a7b8a /source4/cldap_server
parent7e298580e06a5b9a0c1210937af47f277849080e (diff)
downloadsamba-934e932387ea5668ec000bcefe4ec86935297339.tar.gz
samba-934e932387ea5668ec000bcefe4ec86935297339.tar.bz2
samba-934e932387ea5668ec000bcefe4ec86935297339.zip
r26235: Avoid global_loadparm.
(This used to be commit e9039782204389cc827e76da319d5ccf6d33be46)
Diffstat (limited to 'source4/cldap_server')
-rw-r--r--source4/cldap_server/cldap_server.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/source4/cldap_server/cldap_server.c b/source4/cldap_server/cldap_server.c
index d43669a9e1..b43137c8df 100644
--- a/source4/cldap_server/cldap_server.c
+++ b/source4/cldap_server/cldap_server.c
@@ -84,7 +84,8 @@ static void cldapd_request_handler(struct cldap_socket *cldap,
/*
start listening on the given address
*/
-static NTSTATUS cldapd_add_socket(struct cldapd_server *cldapd, const char *address)
+static NTSTATUS cldapd_add_socket(struct cldapd_server *cldapd, struct loadparm_context *lp_ctx,
+ const char *address)
{
struct cldap_socket *cldapsock;
struct socket_address *socket_address;
@@ -95,7 +96,7 @@ static NTSTATUS cldapd_add_socket(struct cldapd_server *cldapd, const char *addr
NT_STATUS_HAVE_NO_MEMORY(cldapsock);
socket_address = socket_address_from_strings(cldapsock, cldapsock->sock->backend_name,
- address, lp_cldap_port(global_loadparm));
+ address, lp_cldap_port(lp_ctx));
if (!socket_address) {
talloc_free(cldapsock);
return NT_STATUS_NO_MEMORY;
@@ -104,7 +105,7 @@ static NTSTATUS cldapd_add_socket(struct cldapd_server *cldapd, const char *addr
status = socket_listen(cldapsock->sock, socket_address, 0, 0);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("Failed to bind to %s:%d - %s\n",
- address, lp_cldap_port(global_loadparm), nt_errstr(status)));
+ address, lp_cldap_port(lp_ctx), nt_errstr(status)));
talloc_free(cldapsock);
return status;
}
@@ -120,7 +121,7 @@ static NTSTATUS cldapd_add_socket(struct cldapd_server *cldapd, const char *addr
/*
setup our listening sockets on the configured network interfaces
*/
-static NTSTATUS cldapd_startup_interfaces(struct cldapd_server *cldapd)
+static NTSTATUS cldapd_startup_interfaces(struct cldapd_server *cldapd, struct loadparm_context *lp_ctx)
{
int num_interfaces = iface_count();
TALLOC_CTX *tmp_ctx = talloc_new(cldapd);
@@ -128,15 +129,15 @@ static NTSTATUS cldapd_startup_interfaces(struct cldapd_server *cldapd)
/* if we are allowing incoming packets from any address, then
we need to bind to the wildcard address */
- if (!lp_bind_interfaces_only(global_loadparm)) {
- status = cldapd_add_socket(cldapd, "0.0.0.0");
+ if (!lp_bind_interfaces_only(lp_ctx)) {
+ status = cldapd_add_socket(cldapd, lp_ctx, "0.0.0.0");
NT_STATUS_NOT_OK_RETURN(status);
} else {
int i;
for (i=0; i<num_interfaces; i++) {
const char *address = talloc_strdup(tmp_ctx, iface_n_ip(i));
- status = cldapd_add_socket(cldapd, address);
+ status = cldapd_add_socket(cldapd, lp_ctx, address);
NT_STATUS_NOT_OK_RETURN(status);
}
}
@@ -187,7 +188,7 @@ static void cldapd_task_init(struct task_server *task)
}
/* start listening on the configured network interfaces */
- status = cldapd_startup_interfaces(cldapd);
+ status = cldapd_startup_interfaces(cldapd, task->lp_ctx);
if (!NT_STATUS_IS_OK(status)) {
task_server_terminate(task, "cldapd failed to setup interfaces");
return;