summaryrefslogtreecommitdiffstats
path: root/source4/cldap_server
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2011-06-24 16:26:23 +1000
committerAndrew Bartlett <abartlet@samba.org>2011-06-24 16:26:23 +1000
commit6da26870e0ae5acd6ff49a30ec2f6886b44d095e (patch)
tree850c71039563c16a5d563c47e7ba2ab645baf198 /source4/cldap_server
parent6925a799d04c6fa59dd2ddef1f5510f9bb7d17d1 (diff)
parent2610c05b5b95cc7036b3d6dfb894c6cfbdb68483 (diff)
downloadsamba-4.0.0alpha16.tar.gz
samba-4.0.0alpha16.tar.xz
samba-4.0.0alpha16.zip
Merge 2610c05b5b95cc7036b3d6dfb894c6cfbdb68483 as Samba-4.0alpha16samba-4.0.0alpha16
Diffstat (limited to 'source4/cldap_server')
-rw-r--r--source4/cldap_server/cldap_server.c19
-rw-r--r--source4/cldap_server/netlogon.c20
2 files changed, 23 insertions, 16 deletions
diff --git a/source4/cldap_server/cldap_server.c b/source4/cldap_server/cldap_server.c
index 43eadf5affc..d3e8b7fffa4 100644
--- a/source4/cldap_server/cldap_server.c
+++ b/source4/cldap_server/cldap_server.c
@@ -116,7 +116,7 @@ static NTSTATUS cldapd_add_socket(struct cldapd_server *cldapd, struct loadparm_
lpcfg_cldap_port(lp_ctx),
&socket_address);
if (ret != 0) {
- status = map_nt_error_from_unix(errno);
+ status = map_nt_error_from_unix_common(errno);
DEBUG(0,("invalid address %s:%d - %s:%s\n",
address, lpcfg_cldap_port(lp_ctx),
gai_strerror(ret), nt_errstr(status)));
@@ -153,19 +153,24 @@ static NTSTATUS cldapd_startup_interfaces(struct cldapd_server *cldapd, struct l
TALLOC_CTX *tmp_ctx = talloc_new(cldapd);
NTSTATUS status;
- num_interfaces = iface_count(ifaces);
+ num_interfaces = iface_list_count(ifaces);
/* if we are allowing incoming packets from any address, then
we need to bind to the wildcard address */
if (!lpcfg_bind_interfaces_only(lp_ctx)) {
- status = cldapd_add_socket(cldapd, lp_ctx, "0.0.0.0");
- NT_STATUS_NOT_OK_RETURN(status);
+ const char **wcard = iface_list_wildcard(cldapd, lp_ctx);
+ NT_STATUS_HAVE_NO_MEMORY(wcard);
+ for (i=0; wcard[i]; i++) {
+ status = cldapd_add_socket(cldapd, lp_ctx, wcard[i]);
+ NT_STATUS_NOT_OK_RETURN(status);
+ }
+ talloc_free(wcard);
}
/* now we have to also listen on the specific interfaces,
so that replies always come from the right IP */
for (i=0; i<num_interfaces; i++) {
- const char *address = talloc_strdup(tmp_ctx, iface_n_ip(ifaces, i));
+ const char *address = talloc_strdup(tmp_ctx, iface_list_n_ip(ifaces, i));
status = cldapd_add_socket(cldapd, lp_ctx, address);
NT_STATUS_NOT_OK_RETURN(status);
}
@@ -184,9 +189,9 @@ static void cldapd_task_init(struct task_server *task)
NTSTATUS status;
struct interface *ifaces;
- load_interfaces(task, lpcfg_interfaces(task->lp_ctx), &ifaces);
+ load_interface_list(task, task->lp_ctx, &ifaces);
- if (iface_count(ifaces) == 0) {
+ if (iface_list_count(ifaces) == 0) {
task_server_terminate(task, "cldapd: no network interfaces configured", false);
return;
}
diff --git a/source4/cldap_server/netlogon.c b/source4/cldap_server/netlogon.c
index 6e455e46bd7..77f50ff3e66 100644
--- a/source4/cldap_server/netlogon.c
+++ b/source4/cldap_server/netlogon.c
@@ -37,6 +37,7 @@
#include "param/param.h"
#include "../lib/tsocket/tsocket.h"
#include "libds/common/flag_mapping.h"
+#include "lib/util/util_net.h"
/*
fill in the cldap netlogon union for a given version
@@ -291,17 +292,18 @@ NTSTATUS fill_netlogon_samlogon_response(struct ldb_context *sam_ctx,
client_site = samdb_client_site_name(sam_ctx, mem_ctx,
src_address, NULL);
NT_STATUS_HAVE_NO_MEMORY(client_site);
- load_interfaces(mem_ctx, lpcfg_interfaces(lp_ctx), &ifaces);
- /*
- * TODO: the caller should pass the address which the client
- * used to trigger this call, as the client is able to reach
- * this ip.
- */
+ load_interface_list(mem_ctx, lp_ctx, &ifaces);
+
if (src_address) {
- pdc_ip = iface_best_ip(ifaces, src_address);
+ pdc_ip = iface_list_best_ip(ifaces, src_address);
} else {
- pdc_ip = iface_n_ip(ifaces, 0);
+ pdc_ip = iface_list_first_v4(ifaces);
+ }
+ if (pdc_ip == NULL || !is_ipaddress_v4(pdc_ip)) {
+ /* this matches windows behaviour */
+ pdc_ip = "127.0.0.1";
}
+
ZERO_STRUCTP(netlogon);
/* check if either of these bits is present */
@@ -325,7 +327,7 @@ NTSTATUS fill_netlogon_samlogon_response(struct ldb_context *sam_ctx,
netlogon->data.nt5_ex.server_site = server_site;
netlogon->data.nt5_ex.client_site = client_site;
if (version & NETLOGON_NT_VERSION_5EX_WITH_IP) {
- /* Clearly this needs to be fixed up for IPv6 */
+ /* note that this is always a IPV4 address */
extra_flags = NETLOGON_NT_VERSION_5EX_WITH_IP;
netlogon->data.nt5_ex.sockaddr.sockaddr_family = 2;
netlogon->data.nt5_ex.sockaddr.pdc_ip = pdc_ip;