summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mdw@samba.org>2012-08-12 18:08:20 +0200
committerKai Blin <kai@samba.org>2012-09-23 23:44:03 +0200
commit5f973631b6ba6666ecf5f026d07dded9da15650e (patch)
treeca6440c1c361bf6769c157d96bd1d4bfcb9cb95b
parent9e6070b5fcc17f0e866367c4d3f4dfcb95be6c46 (diff)
downloadsamba-5f973631b6ba6666ecf5f026d07dded9da15650e.tar.gz
samba-5f973631b6ba6666ecf5f026d07dded9da15650e.tar.bz2
samba-5f973631b6ba6666ecf5f026d07dded9da15650e.zip
s4:dns_server - introduce the wildcard binding feature
We need the wildcard binding feature otherwise we might get bound to a private interface in case of multiple interfaces and no "interfaces" parameter in smb.conf. Code taken from source4/ldap_server/ldap_server.c Signed-off-by: Kai Blin <kai@samba.org> Autobuild-User(master): Kai Blin <kai@samba.org> Autobuild-Date(master): Sun Sep 23 23:44:03 CEST 2012 on sn-devel-104
-rw-r--r--source4/dns_server/dns_server.c38
1 files changed, 28 insertions, 10 deletions
diff --git a/source4/dns_server/dns_server.c b/source4/dns_server/dns_server.c
index c88ea83f3f..dbdc300f90 100644
--- a/source4/dns_server/dns_server.c
+++ b/source4/dns_server/dns_server.c
@@ -669,13 +669,29 @@ static NTSTATUS dns_startup_interfaces(struct dns_server *dns, struct loadparm_c
return NT_STATUS_INTERNAL_ERROR;
}
- num_interfaces = iface_list_count(ifaces);
+ if (ifaces != NULL) {
+ num_interfaces = iface_list_count(ifaces);
- for (i=0; i<num_interfaces; i++) {
- const char *address = talloc_strdup(tmp_ctx, iface_list_n_ip(ifaces, i));
+ for (i=0; i<num_interfaces; i++) {
+ const char *address = talloc_strdup(tmp_ctx,
+ iface_list_n_ip(ifaces, i));
- status = dns_add_socket(dns, model_ops, "dns", address, DNS_SERVICE_PORT);
- NT_STATUS_NOT_OK_RETURN(status);
+ status = dns_add_socket(dns, model_ops, "dns", address,
+ DNS_SERVICE_PORT);
+ NT_STATUS_NOT_OK_RETURN(status);
+ }
+ } else {
+ const char **wcard;
+ wcard = iface_list_wildcard(tmp_ctx, lp_ctx);
+ if (wcard == NULL) {
+ DEBUG(0, ("No wildcard address available\n"));
+ return NT_STATUS_INTERNAL_ERROR;
+ }
+ for (i = 0; wcard[i] != NULL; i++) {
+ status = dns_add_socket(dns, model_ops, "dns", wcard[i],
+ DNS_SERVICE_PORT);
+ NT_STATUS_NOT_OK_RETURN(status);
+ }
}
talloc_free(tmp_ctx);
@@ -729,7 +745,7 @@ static void dns_task_init(struct task_server *task)
{
struct dns_server *dns;
NTSTATUS status;
- struct interface *ifaces;
+ struct interface *ifaces = NULL;
int ret;
struct ldb_result *res;
static const char * const attrs[] = { "name", NULL};
@@ -747,11 +763,13 @@ static void dns_task_init(struct task_server *task)
break;
}
- load_interface_list(task, task->lp_ctx, &ifaces);
+ if (lpcfg_interfaces(task->lp_ctx) && lpcfg_bind_interfaces_only(task->lp_ctx)) {
+ load_interface_list(task, task->lp_ctx, &ifaces);
- if (iface_list_count(ifaces) == 0) {
- task_server_terminate(task, "dns: no network interfaces configured", false);
- return;
+ if (iface_list_count(ifaces) == 0) {
+ task_server_terminate(task, "dns: no network interfaces configured", false);
+ return;
+ }
}
task_server_set_title(task, "task[dns]");