Rework service init functions to pass down service name. This is
[ira/wip.git] / source / nbt_server / nbt_server.c
index abb4593b2cb76dfebbbf4dd4a6b5743e6a92598f..bcdc63e984dbfe3610fa4748c3b85bad2e62f9c6 100644 (file)
@@ -28,6 +28,7 @@
 #include "lib/socket/netif.h"
 #include "auth/auth.h"
 #include "dsdb/samdb/samdb.h"
+#include "param/param.h"
 
 /*
   startup the nbtd task
@@ -36,8 +37,11 @@ static void nbtd_task_init(struct task_server *task)
 {
        struct nbtd_server *nbtsrv;
        NTSTATUS status;
+       struct interface *ifaces;
 
-       if (iface_count() == 0) {
+       load_interfaces(task, lp_interfaces(task->lp_ctx), &ifaces);
+
+       if (iface_count(ifaces) == 0) {
                task_server_terminate(task, "nbtd: no network interfaces configured");
                return;
        }
@@ -56,13 +60,13 @@ static void nbtd_task_init(struct task_server *task)
        nbtsrv->wins_interface  = NULL;
 
        /* start listening on the configured network interfaces */
-       status = nbtd_startup_interfaces(nbtsrv);
+       status = nbtd_startup_interfaces(nbtsrv, task->lp_ctx, ifaces);
        if (!NT_STATUS_IS_OK(status)) {
                task_server_terminate(task, "nbtd failed to setup interfaces");
                return;
        }
 
-       nbtsrv->sam_ctx = samdb_connect(nbtsrv, anonymous_session(nbtsrv));
+       nbtsrv->sam_ctx = samdb_connect(nbtsrv, task->lp_ctx, anonymous_session(nbtsrv, task->lp_ctx));
        if (nbtsrv->sam_ctx == NULL) {
                task_server_terminate(task, "nbtd failed to open samdb");
                return;
@@ -81,17 +85,16 @@ static void nbtd_task_init(struct task_server *task)
        nbtd_register_names(nbtsrv);
 
        irpc_add_name(task->msg_ctx, "nbt_server");
-
-
 }
 
 
 /*
   initialise the nbt server
  */
-static NTSTATUS nbtd_init(struct event_context *event_ctx, const struct model_ops *model_ops)
+static NTSTATUS nbtd_init(struct event_context *event_ctx, struct loadparm_context *lp_ctx, const struct model_ops *model_ops)
 {
-       return task_server_startup(event_ctx, model_ops, nbtd_task_init);
+       return task_server_startup(event_ctx, lp_ctx, "nbt",
+                                  model_ops, nbtd_task_init);
 }