diff options
Diffstat (limited to 'source4/web_server/web_server.c')
-rw-r--r-- | source4/web_server/web_server.c | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/source4/web_server/web_server.c b/source4/web_server/web_server.c index 338cc2b57a..cdf6f9b7d0 100644 --- a/source4/web_server/web_server.c +++ b/source4/web_server/web_server.c @@ -248,15 +248,14 @@ static void websrv_send(struct stream_connection *conn, uint16_t flags) */ static void websrv_accept(struct stream_connection *conn) { - struct task_server *task = talloc_get_type(conn->private_data, struct task_server); - struct web_server_data *wdata = talloc_get_type(task->private_data, struct web_server_data); + struct web_server_data *wdata = talloc_get_type(conn->private_data, struct web_server_data); struct websrv_context *web; struct socket_context *tls_socket; web = talloc_zero(conn, struct websrv_context); if (web == NULL) goto failed; - web->task = task; + web->task = wdata->task; web->conn = conn; conn->private_data = web; talloc_set_destructor(web, websrv_destructor); @@ -312,6 +311,7 @@ static void websrv_task_init(struct task_server *task) wdata = talloc_zero(task, struct web_server_data); if (wdata == NULL) goto failed; + wdata->task = task; task->private_data = wdata; if (lpcfg_interfaces(task->lp_ctx) && lpcfg_bind_interfaces_only(task->lp_ctx)) { @@ -319,16 +319,16 @@ static void websrv_task_init(struct task_server *task) int i; struct interface *ifaces; - load_interfaces(NULL, lpcfg_interfaces(task->lp_ctx), &ifaces); + load_interface_list(NULL, task->lp_ctx, &ifaces); - num_interfaces = iface_count(ifaces); + num_interfaces = iface_list_count(ifaces); for(i = 0; i < num_interfaces; i++) { - const char *address = iface_n_ip(ifaces, i); + const char *address = iface_list_n_ip(ifaces, i); status = stream_setup_socket(task, task->event_ctx, task->lp_ctx, model_ops, &web_stream_ops, - "ipv4", address, + "ip", address, &port, lpcfg_socket_options(task->lp_ctx), task); if (!NT_STATUS_IS_OK(status)) goto failed; @@ -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); |