Skip to content

Commit

Permalink
s4:lib/socket: simplify iface_list_wildcard() and its callers
Browse files Browse the repository at this point in the history
Bug: https://bugzilla.samba.org/show_bug.cgi?id=10464
Signed-off-by: Stefan Metzmacher <[email protected]>

Change-Id: Ib317d71dea01fc8ef6b6a26455f15a8a175d59f6
Reviewed-by: Andrew Bartlett <[email protected]>

Autobuild-User(master): Andrew Bartlett <[email protected]>
Autobuild-Date(master): Fri Mar  7 02:18:17 CET 2014 on sn-devel-104
  • Loading branch information
metze-samba authored and abartlet committed Mar 7, 2014
1 parent a571fe5 commit f7883ae
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion source4/cldap_server/cldap_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ 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)) {
const char **wcard = iface_list_wildcard(cldapd, lp_ctx);
char **wcard = iface_list_wildcard(cldapd);
NT_STATUS_HAVE_NO_MEMORY(wcard);
for (i=0; wcard[i]; i++) {
status = cldapd_add_socket(cldapd, lp_ctx, wcard[i]);
Expand Down
8 changes: 4 additions & 4 deletions source4/dns_server/dns_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ static NTSTATUS dns_add_socket(struct dns_server *dns,
/*
setup our listening sockets on the configured network interfaces
*/
static NTSTATUS dns_startup_interfaces(struct dns_server *dns, struct loadparm_context *lp_ctx,
static NTSTATUS dns_startup_interfaces(struct dns_server *dns,
struct interface *ifaces)
{
const struct model_ops *model_ops;
Expand Down Expand Up @@ -687,8 +687,8 @@ static NTSTATUS dns_startup_interfaces(struct dns_server *dns, struct loadparm_c
NT_STATUS_NOT_OK_RETURN(status);
}
} else {
const char **wcard;
wcard = iface_list_wildcard(tmp_ctx, lp_ctx);
char **wcard;
wcard = iface_list_wildcard(tmp_ctx);
if (wcard == NULL) {
DEBUG(0, ("No wildcard address available\n"));
return NT_STATUS_INTERNAL_ERROR;
Expand Down Expand Up @@ -891,7 +891,7 @@ static void dns_task_init(struct task_server *task)
DLIST_ADD_END(dns->zones, z, NULL);
}

status = dns_startup_interfaces(dns, task->lp_ctx, ifaces);
status = dns_startup_interfaces(dns, ifaces);
if (!NT_STATUS_IS_OK(status)) {
task_server_terminate(task, "dns failed to setup interfaces", true);
return;
Expand Down
2 changes: 1 addition & 1 deletion source4/kdc/kdc.c
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,7 @@ 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)) {
const char **wcard = iface_list_wildcard(kdc, lp_ctx);
char **wcard = iface_list_wildcard(kdc);
NT_STATUS_HAVE_NO_MEMORY(wcard);
for (i=0; wcard[i]; i++) {
if (kdc_port) {
Expand Down
4 changes: 2 additions & 2 deletions source4/ldap_server/ldap_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -962,9 +962,9 @@ static void ldapsrv_task_init(struct task_server *task)
if (!NT_STATUS_IS_OK(status)) goto failed;
}
} else {
const char **wcard;
char **wcard;
int i;
wcard = iface_list_wildcard(task, task->lp_ctx);
wcard = iface_list_wildcard(task);
if (wcard == NULL) {
DEBUG(0,("No wildcard addresses available\n"));
goto failed;
Expand Down
4 changes: 2 additions & 2 deletions source4/lib/socket/interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -503,13 +503,13 @@ bool iface_list_same_net(const char *ip1, const char *ip2, const char *netmask)
return the list of wildcard interfaces
this will include the IPv4 0.0.0.0, and may include IPv6 ::
*/
const char **iface_list_wildcard(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx)
char **iface_list_wildcard(TALLOC_CTX *mem_ctx)
{
char **ret;
#ifdef HAVE_IPV6
ret = str_list_make(mem_ctx, "::,0.0.0.0", NULL);
#else
ret = str_list_make(mem_ctx, "0.0.0.0", NULL);
#endif
return discard_const_p(const char *, ret);
return ret;
}
4 changes: 2 additions & 2 deletions source4/rpc_server/dcerpc_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -1824,9 +1824,9 @@ static NTSTATUS dcesrv_add_ep_tcp(struct dcesrv_context *dce_ctx,
NT_STATUS_NOT_OK_RETURN(status);
}
} else {
const char **wcard;
char **wcard;
int i;
wcard = iface_list_wildcard(dce_ctx, lp_ctx);
wcard = iface_list_wildcard(dce_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]);
Expand Down
4 changes: 2 additions & 2 deletions source4/smb_server/service_smb.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ static void smbsrv_task_init(struct task_server *task)
if (!NT_STATUS_IS_OK(status)) goto failed;
}
} else {
const char **wcard;
char **wcard;
int i;
wcard = iface_list_wildcard(task, task->lp_ctx);
wcard = iface_list_wildcard(task);
if (wcard == NULL) {
DEBUG(0,("No wildcard addresses available\n"));
goto failed;
Expand Down
4 changes: 2 additions & 2 deletions source4/web_server/web_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -336,9 +336,9 @@ static void websrv_task_init(struct task_server *task)

talloc_free(ifaces);
} else {
const char **wcard;
char **wcard;
int i;
wcard = iface_list_wildcard(task, task->lp_ctx);
wcard = iface_list_wildcard(task);
if (wcard == NULL) {
DEBUG(0,("No wildcard addresses available\n"));
goto failed;
Expand Down

0 comments on commit f7883ae

Please sign in to comment.