diff options
author | Andrew Tridgell <tridge@samba.org> | 2011-05-12 12:35:02 +0200 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2011-06-06 12:26:10 +1000 |
commit | dc8c8fd9e4f85974cd0665e613d4422ba8dd900e (patch) | |
tree | 0f1f60584986c4648ace8af742d2023fe5c87dc8 /source4 | |
parent | d510687408c03291df767e0ccacebcd4a360646c (diff) | |
download | samba-dc8c8fd9e4f85974cd0665e613d4422ba8dd900e.tar.gz samba-dc8c8fd9e4f85974cd0665e613d4422ba8dd900e.tar.bz2 samba-dc8c8fd9e4f85974cd0665e613d4422ba8dd900e.zip |
s4-ipv6: use iface_list_wildcard() to listen on IPv6
when we need to listen on a wildcard address, we now listen on a list
of sockets, usually 0.0.0.0 and ::
Diffstat (limited to 'source4')
-rw-r--r-- | source4/cldap_server/cldap_server.c | 9 | ||||
-rw-r--r-- | source4/kdc/kdc.c | 29 | ||||
-rw-r--r-- | source4/ldap_server/ldap_server.c | 15 | ||||
-rw-r--r-- | source4/rpc_server/dcerpc_server.c | 12 | ||||
-rw-r--r-- | source4/smb_server/service_smb.c | 15 | ||||
-rw-r--r-- | source4/smb_server/smb_samba3.c | 21 | ||||
-rw-r--r-- | source4/web_server/web_server.c | 24 |
7 files changed, 89 insertions, 36 deletions
diff --git a/source4/cldap_server/cldap_server.c b/source4/cldap_server/cldap_server.c index 8e79af407e..d5aa9f410f 100644 --- a/source4/cldap_server/cldap_server.c +++ b/source4/cldap_server/cldap_server.c @@ -158,8 +158,13 @@ static NTSTATUS cldapd_startup_interfaces(struct cldapd_server *cldapd, struct l /* 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, diff --git a/source4/kdc/kdc.c b/source4/kdc/kdc.c index 02c6f925a9..5620c0b288 100644 --- a/source4/kdc/kdc.c +++ b/source4/kdc/kdc.c @@ -734,19 +734,24 @@ static NTSTATUS kdc_startup_interfaces(struct kdc_server *kdc, struct loadparm_c /* 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)) { - if (kdc_port) { - status = kdc_add_socket(kdc, model_ops, - "kdc", "0.0.0.0", kdc_port, - kdc_process, false); - NT_STATUS_NOT_OK_RETURN(status); - } - - if (kpasswd_port) { - status = kdc_add_socket(kdc, model_ops, - "kpasswd", "0.0.0.0", kpasswd_port, - kpasswdd_process, false); - NT_STATUS_NOT_OK_RETURN(status); + const char **wcard = iface_list_wildcard(kdc, lp_ctx); + NT_STATUS_HAVE_NO_MEMORY(wcard); + for (i=0; wcard[i]; i++) { + if (kdc_port) { + status = kdc_add_socket(kdc, model_ops, + "kdc", wcard[i], kdc_port, + kdc_process, false); + NT_STATUS_NOT_OK_RETURN(status); + } + + if (kpasswd_port) { + status = kdc_add_socket(kdc, model_ops, + "kpasswd", wcard[i], kpasswd_port, + kpasswdd_process, false); + NT_STATUS_NOT_OK_RETURN(status); + } } + talloc_free(wcard); done_wildcard = true; } diff --git a/source4/ldap_server/ldap_server.c b/source4/ldap_server/ldap_server.c index 01846add64..605a4a3cc2 100644 --- a/source4/ldap_server/ldap_server.c +++ b/source4/ldap_server/ldap_server.c @@ -964,9 +964,18 @@ static void ldapsrv_task_init(struct task_server *task) if (!NT_STATUS_IS_OK(status)) goto failed; } } else { - status = add_socket(task, task->lp_ctx, model_ops, - lpcfg_socket_address(task->lp_ctx), ldap_service); - if (!NT_STATUS_IS_OK(status)) goto failed; + const char **wcard; + int i; + wcard = iface_list_wildcard(task, task->lp_ctx); + if (wcard == NULL) { + DEBUG(0,("No wildcard addresses available\n")); + goto failed; + } + for (i=0; wcard[i]; i++) { + status = add_socket(task, task->lp_ctx, model_ops, wcard[i], ldap_service); + if (!NT_STATUS_IS_OK(status)) goto failed; + } + talloc_free(wcard); } ldapi_path = lpcfg_private_path(ldap_service, task->lp_ctx, "ldapi"); diff --git a/source4/rpc_server/dcerpc_server.c b/source4/rpc_server/dcerpc_server.c index fcf3f2f7e6..762221dc5b 100644 --- a/source4/rpc_server/dcerpc_server.c +++ b/source4/rpc_server/dcerpc_server.c @@ -1687,9 +1687,15 @@ static NTSTATUS dcesrv_add_ep_tcp(struct dcesrv_context *dce_ctx, NT_STATUS_NOT_OK_RETURN(status); } } else { - status = add_socket_rpc_tcp_iface(dce_ctx, e, event_ctx, model_ops, - lpcfg_socket_address(lp_ctx)); - NT_STATUS_NOT_OK_RETURN(status); + const char **wcard; + int i; + wcard = iface_list_wildcard(dce_ctx, lp_ctx); + NT_STATUS_HAVE_NO_MEMORY(wcard); + for (i=0; wcard[i]; i++) { + status = add_socket_rpc_tcp_iface(dce_ctx, e, event_ctx, model_ops, wcard[i]); + NT_STATUS_NOT_OK_RETURN(status); + } + talloc_free(wcard); } return NT_STATUS_OK; diff --git a/source4/smb_server/service_smb.c b/source4/smb_server/service_smb.c index 4866695865..d2833d9be6 100644 --- a/source4/smb_server/service_smb.c +++ b/source4/smb_server/service_smb.c @@ -63,9 +63,18 @@ static void smbsrv_task_init(struct task_server *task) } } else { /* Just bind to lpcfg_socket_address() (usually 0.0.0.0) */ - status = smbsrv_add_socket(task, task->event_ctx, task->lp_ctx, task->model_ops, - lpcfg_socket_address(task->lp_ctx)); - if (!NT_STATUS_IS_OK(status)) goto failed; + const char **wcard; + int i; + wcard = iface_list_wildcard(task, task->lp_ctx); + if (wcard == NULL) { + DEBUG(0,("No wildcard addresses available\n")); + goto failed; + } + for (i=0; wcard[i]; i++) { + status = smbsrv_add_socket(task, task->event_ctx, task->lp_ctx, task->model_ops, wcard[i]); + if (!NT_STATUS_IS_OK(status)) goto failed; + } + talloc_free(wcard); } return; diff --git a/source4/smb_server/smb_samba3.c b/source4/smb_server/smb_samba3.c index 86e67ec20d..35630ade05 100644 --- a/source4/smb_server/smb_samba3.c +++ b/source4/smb_server/smb_samba3.c @@ -152,12 +152,21 @@ static void samba3_smb_task_init(struct task_server *task) if (!NT_STATUS_IS_OK(status)) goto failed; } } else { - /* Just bind to lpcfg_socket_address() (usually 0.0.0.0) */ - status = samba3_add_socket(task, - task->event_ctx, task->lp_ctx, - model_ops, - lpcfg_socket_address(task->lp_ctx)); - if (!NT_STATUS_IS_OK(status)) goto failed; + const char **wcard; + int i; + wcard = iface_list_wildcard(task, task->lp_ctx); + if (wcard == NULL) { + DEBUG(0,("No wildcard addresses available\n")); + goto failed; + } + for (i=0; wcard[i]; i++) { + status = samba3_add_socket(task, + task->event_ctx, task->lp_ctx, + model_ops, + wcard[i]); + if (!NT_STATUS_IS_OK(status)) goto failed; + } + talloc_free(wcard); } return; diff --git a/source4/web_server/web_server.c b/source4/web_server/web_server.c index ab8f63b2ec..c43b2cfc7b 100644 --- a/source4/web_server/web_server.c +++ b/source4/web_server/web_server.c @@ -336,13 +336,23 @@ static void websrv_task_init(struct task_server *task) talloc_free(ifaces); } else { - status = stream_setup_socket(task, task->event_ctx, - task->lp_ctx, model_ops, - &web_stream_ops, - "ipv4", lpcfg_socket_address(task->lp_ctx), - &port, lpcfg_socket_options(task->lp_ctx), - task); - if (!NT_STATUS_IS_OK(status)) goto failed; + const char **wcard; + int i; + wcard = iface_list_wildcard(task, task->lp_ctx); + if (wcard == NULL) { + DEBUG(0,("No wildcard addresses available\n")); + goto failed; + } + for (i=0; wcard[i]; i++) { + status = stream_setup_socket(task, task->event_ctx, + task->lp_ctx, model_ops, + &web_stream_ops, + "ip", wcard[i], + &port, lpcfg_socket_options(task->lp_ctx), + wdata); + if (!NT_STATUS_IS_OK(status)) goto failed; + } + talloc_free(wcard); } wdata->tls_params = tls_initialise(wdata, task->lp_ctx); |