summaryrefslogtreecommitdiff
path: root/source4/cldap_server/cldap_server.c
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/cldap_server/cldap_server.c
parentf9948d18d73fb8d8711c3b5a46b1d83c881a0084 (diff)
downloadsamba-6f2252dace1629d7b5c5637b103caa28d2c89b07.tar.gz
r26401: Don't cache interfaces context in libnetif.
(This used to be commit 9f975417cc66bfd4589da38bfd23731dbe0e6153)
Diffstat (limited to 'source4/cldap_server/cldap_server.c')
-rw-r--r--source4/cldap_server/cldap_server.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/source4/cldap_server/cldap_server.c b/source4/cldap_server/cldap_server.c
index d71e933b5f0..8f6c9410f8c 100644
--- a/source4/cldap_server/cldap_server.c
+++ b/source4/cldap_server/cldap_server.c
@@ -121,12 +121,15 @@ static NTSTATUS cldapd_add_socket(struct cldapd_server *cldapd, struct loadparm_
/*
setup our listening sockets on the configured network interfaces
*/
-static NTSTATUS cldapd_startup_interfaces(struct cldapd_server *cldapd, struct loadparm_context *lp_ctx)
+static NTSTATUS cldapd_startup_interfaces(struct cldapd_server *cldapd, struct loadparm_context *lp_ctx,
+ struct interface *ifaces)
{
- int num_interfaces = iface_count(lp_ctx);
+ int num_interfaces;
TALLOC_CTX *tmp_ctx = talloc_new(cldapd);
NTSTATUS status;
+ num_interfaces = iface_count(ifaces);
+
/* if we are allowing incoming packets from any address, then
we need to bind to the wildcard address */
if (!lp_bind_interfaces_only(lp_ctx)) {
@@ -136,7 +139,7 @@ static NTSTATUS cldapd_startup_interfaces(struct cldapd_server *cldapd, struct l
int i;
for (i=0; i<num_interfaces; i++) {
- const char *address = talloc_strdup(tmp_ctx, iface_n_ip(lp_ctx, i));
+ const char *address = talloc_strdup(tmp_ctx, iface_n_ip(ifaces, i));
status = cldapd_add_socket(cldapd, lp_ctx, address);
NT_STATUS_NOT_OK_RETURN(status);
}
@@ -154,8 +157,11 @@ static void cldapd_task_init(struct task_server *task)
{
struct cldapd_server *cldapd;
NTSTATUS status;
+ struct interface *ifaces;
+
+ load_interfaces(lp_interfaces(task->lp_ctx), &ifaces);
- if (iface_count(task->lp_ctx) == 0) {
+ if (iface_count(ifaces) == 0) {
task_server_terminate(task, "cldapd: no network interfaces configured");
return;
}
@@ -188,7 +194,7 @@ static void cldapd_task_init(struct task_server *task)
}
/* start listening on the configured network interfaces */
- status = cldapd_startup_interfaces(cldapd, task->lp_ctx);
+ status = cldapd_startup_interfaces(cldapd, task->lp_ctx, ifaces);
if (!NT_STATUS_IS_OK(status)) {
task_server_terminate(task, "cldapd failed to setup interfaces");
return;