Rework service init functions to pass down service name. This is
[ira/wip.git] / source / web_server / web_server.c
index be7b6aabdf0770652ae390e55c76f69207fdc42d..bd212cff7d28df7fcaa37c7703a2f0b60fad60c4 100644 (file)
@@ -251,21 +251,30 @@ static void websrv_task_init(struct task_server *task)
        if (!model_ops) goto failed;
 
        if (lp_interfaces(task->lp_ctx) && lp_bind_interfaces_only(task->lp_ctx)) {
-               int num_interfaces = iface_count();
+               int num_interfaces;
                int i;
+               struct interface *ifaces;
+
+               load_interfaces(NULL, lp_interfaces(task->lp_ctx), &ifaces);
+
+               num_interfaces = iface_count(ifaces);
                for(i = 0; i < num_interfaces; i++) {
-                       const char *address = iface_n_ip(i);
-                       status = stream_setup_socket(task->event_ctx, model_ops, 
+                       const char *address = iface_n_ip(ifaces, i);
+                       status = stream_setup_socket(task->event_ctx, 
+                                                    task->lp_ctx, model_ops, 
                                                     &web_stream_ops, 
                                                     "ipv4", address, 
-                                                    &port, task);
+                                                    &port, lp_socket_options(task->lp_ctx), 
+                                                    task);
                        if (!NT_STATUS_IS_OK(status)) goto failed;
                }
+
+               talloc_free(ifaces);
        } else {
-               status = stream_setup_socket(task->event_ctx, model_ops, 
-                                            &web_stream_ops, 
+               status = stream_setup_socket(task->event_ctx, task->lp_ctx,
+                                            model_ops, &web_stream_ops, 
                                             "ipv4", lp_socket_address(task->lp_ctx), 
-                                            &port, task);
+                                            &port, lp_socket_options(task->lp_ctx), task);
                if (!NT_STATUS_IS_OK(status)) goto failed;
        }
 
@@ -289,7 +298,8 @@ static NTSTATUS websrv_init(struct event_context *event_context,
                            struct loadparm_context *lp_ctx,
                            const struct model_ops *model_ops)
 {      
-       return task_server_startup(event_context, model_ops, websrv_task_init);
+       return task_server_startup(event_context, lp_ctx, "web", 
+                                  model_ops, websrv_task_init);
 }
 
 /* called at smbd startup - register ourselves as a server service */