diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2007-12-11 22:23:14 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2007-12-21 05:49:32 +0100 |
commit | 6f2252dace1629d7b5c5637b103caa28d2c89b07 (patch) | |
tree | fc09abaf04401ef510d55866066738840d052ebf /source4/cldap_server | |
parent | f9948d18d73fb8d8711c3b5a46b1d83c881a0084 (diff) | |
download | samba-6f2252dace1629d7b5c5637b103caa28d2c89b07.tar.gz samba-6f2252dace1629d7b5c5637b103caa28d2c89b07.tar.xz samba-6f2252dace1629d7b5c5637b103caa28d2c89b07.zip |
r26401: Don't cache interfaces context in libnetif.
(This used to be commit 9f975417cc66bfd4589da38bfd23731dbe0e6153)
Diffstat (limited to 'source4/cldap_server')
-rw-r--r-- | source4/cldap_server/cldap_server.c | 16 | ||||
-rw-r--r-- | source4/cldap_server/netlogon.c | 4 |
2 files changed, 14 insertions, 6 deletions
diff --git a/source4/cldap_server/cldap_server.c b/source4/cldap_server/cldap_server.c index d71e933b5f..8f6c9410f8 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; diff --git a/source4/cldap_server/netlogon.c b/source4/cldap_server/netlogon.c index d1f001e333..1c2b51aed7 100644 --- a/source4/cldap_server/netlogon.c +++ b/source4/cldap_server/netlogon.c @@ -64,6 +64,7 @@ static NTSTATUS cldapd_netlogon_fill(struct cldapd_server *cldapd, const char *client_site; const char *pdc_ip; struct ldb_dn *partitions_basedn; + struct interface *ifaces; partitions_basedn = samdb_partitions_dn(cldapd->samctx, mem_ctx); @@ -187,7 +188,8 @@ static NTSTATUS cldapd_netlogon_fill(struct cldapd_server *cldapd, lp_workgroup(lp_ctx)); server_site = "Default-First-Site-Name"; client_site = "Default-First-Site-Name"; - pdc_ip = iface_best_ip(lp_ctx, src_address); + load_interfaces(lp_interfaces(lp_ctx), &ifaces); + pdc_ip = iface_best_ip(ifaces, src_address); ZERO_STRUCTP(netlogon); |