Skip to content

Commit

Permalink
s3/s4: smbd, rpc, ldap, cldap, kdc services.
Browse files Browse the repository at this point in the history
Allow us to start if we bind to *either* :: or 0.0.0.0.

Allows us to cope with systems configured as only IPv4
or only IPv6.

Signed-off-by: Jeremy Allison <[email protected]>
Reviewed-By: Amitay Isaacs <[email protected]>
Reviewed-By: Alexander Bokovoy <[email protected]>

Autobuild-User(master): Jeremy Allison <[email protected]>
Autobuild-Date(master): Sat Jun  7 01:01:44 CEST 2014 on sn-devel-104
  • Loading branch information
jrasamba committed Jun 6, 2014
1 parent 7091755 commit 4633114
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 12 deletions.
16 changes: 10 additions & 6 deletions source3/smbd/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -862,12 +862,16 @@ static bool open_sockets_smbd(struct smbd_parent_context *parent,
continue;
}

if (!smbd_open_one_socket(parent,
ev_ctx,
&ss,
port)) {
return false;
}
/*
* If we fail to open any sockets
* in this loop the parent-sockets == NULL
* case below will prevent us from starting.
*/

(void)smbd_open_one_socket(parent,
ev_ctx,
&ss,
port);
}
}
}
Expand Down
8 changes: 7 additions & 1 deletion source4/cldap_server/cldap_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,19 @@ 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)) {
int num_binds = 0;
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]);
NT_STATUS_NOT_OK_RETURN(status);
if (NT_STATUS_IS_OK(status)) {
num_binds++;
}
}
talloc_free(wcard);
if (num_binds == 0) {
return NT_STATUS_INVALID_PARAMETER_MIX;
}
}

/* now we have to also listen on the specific interfaces,
Expand Down
9 changes: 8 additions & 1 deletion source4/dns_server/dns_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,7 @@ static NTSTATUS dns_startup_interfaces(struct dns_server *dns,
NT_STATUS_NOT_OK_RETURN(status);
}
} else {
int num_binds = 0;
char **wcard;
wcard = iface_list_wildcard(tmp_ctx);
if (wcard == NULL) {
Expand All @@ -702,7 +703,13 @@ static NTSTATUS dns_startup_interfaces(struct dns_server *dns,
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);
if (NT_STATUS_IS_OK(status)) {
num_binds++;
}
}
if (num_binds == 0) {
talloc_free(tmp_ctx);
return NT_STATUS_INVALID_PARAMETER_MIX;
}
}

Expand Down
12 changes: 10 additions & 2 deletions source4/kdc/kdc.c
Original file line number Diff line number Diff line change
Expand Up @@ -733,24 +733,32 @@ 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)) {
int num_binds = 0;
char **wcard = iface_list_wildcard(kdc);
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 (NT_STATUS_IS_OK(status)) {
num_binds++;
}
}

if (kpasswd_port) {
status = kdc_add_socket(kdc, model_ops,
"kpasswd", wcard[i], kpasswd_port,
kpasswdd_process, false);
NT_STATUS_NOT_OK_RETURN(status);
if (NT_STATUS_IS_OK(status)) {
num_binds++;
}
}
}
talloc_free(wcard);
if (num_binds == 0) {
return NT_STATUS_INVALID_PARAMETER_MIX;
}
done_wildcard = true;
}

Expand Down
8 changes: 7 additions & 1 deletion source4/ldap_server/ldap_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -964,16 +964,22 @@ static void ldapsrv_task_init(struct task_server *task)
} else {
char **wcard;
int i;
int num_binds = 0;
wcard = iface_list_wildcard(task);
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;
if (NT_STATUS_IS_OK(status)) {
num_binds++;
}
}
talloc_free(wcard);
if (num_binds == 0) {
goto failed;
}
}

ldapi_path = lpcfg_private_path(ldap_service, task->lp_ctx, "ldapi");
Expand Down
8 changes: 7 additions & 1 deletion source4/rpc_server/dcerpc_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -1829,13 +1829,19 @@ static NTSTATUS dcesrv_add_ep_tcp(struct dcesrv_context *dce_ctx,
} else {
char **wcard;
int i;
int num_binds = 0;
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]);
NT_STATUS_NOT_OK_RETURN(status);
if (NT_STATUS_IS_OK(status)) {
num_binds++;
}
}
talloc_free(wcard);
if (num_binds == 0) {
return NT_STATUS_INVALID_PARAMETER_MIX;
}
}

return NT_STATUS_OK;
Expand Down

0 comments on commit 4633114

Please sign in to comment.