source4/: Fix prototypes for all functions in various subsystems.
[sfrench/samba-autobuild/.git] / source4 / nbt_server / nbt_server.c
index c7fb3b286a447ba12a805fe86b70b06c0588a42a..6dbdaf9f54c5b1aad77f320b896912c3c7b277c1 100644 (file)
@@ -30,6 +30,8 @@
 #include "dsdb/samdb/samdb.h"
 #include "param/param.h"
 
+NTSTATUS server_service_nbtd_init(void);
+
 /*
   startup the nbtd task
 */
@@ -39,10 +41,10 @@ static void nbtd_task_init(struct task_server *task)
        NTSTATUS status;
        struct interface *ifaces;
 
-       load_interfaces(task, lp_interfaces(task->lp_ctx), &ifaces);
+       load_interfaces(task, lpcfg_interfaces(task->lp_ctx), &ifaces);
 
        if (iface_count(ifaces) == 0) {
-               task_server_terminate(task, "nbtd: no network interfaces configured");
+               task_server_terminate(task, "nbtd: no network interfaces configured", false);
                return;
        }
 
@@ -50,7 +52,7 @@ static void nbtd_task_init(struct task_server *task)
 
        nbtsrv = talloc(task, struct nbtd_server);
        if (nbtsrv == NULL) {
-               task_server_terminate(task, "nbtd: out of memory");
+               task_server_terminate(task, "nbtd: out of memory", true);
                return;
        }
 
@@ -62,20 +64,20 @@ static void nbtd_task_init(struct task_server *task)
        /* start listening on the configured network interfaces */
        status = nbtd_startup_interfaces(nbtsrv, task->lp_ctx, ifaces);
        if (!NT_STATUS_IS_OK(status)) {
-               task_server_terminate(task, "nbtd failed to setup interfaces");
+               task_server_terminate(task, "nbtd failed to setup interfaces", true);
                return;
        }
 
-       nbtsrv->sam_ctx = samdb_connect(nbtsrv, task->lp_ctx, anonymous_session(nbtsrv, task->lp_ctx));
+       nbtsrv->sam_ctx = samdb_connect(nbtsrv, task->event_ctx, task->lp_ctx, system_session(task->lp_ctx), 0);
        if (nbtsrv->sam_ctx == NULL) {
-               task_server_terminate(task, "nbtd failed to open samdb");
+               task_server_terminate(task, "nbtd failed to open samdb", true);
                return;
        }
 
        /* start the WINS server, if appropriate */
        status = nbtd_winsserver_init(nbtsrv);
        if (!NT_STATUS_IS_OK(status)) {
-               task_server_terminate(task, "nbtd failed to start WINS server");
+               task_server_terminate(task, "nbtd failed to start WINS server", true);
                return;
        }
 
@@ -88,19 +90,10 @@ static void nbtd_task_init(struct task_server *task)
 }
 
 
-/*
-  initialise the nbt server
- */
-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);
-}
-
-
 /*
   register ourselves as a available server
 */
 NTSTATUS server_service_nbtd_init(void)
 {
-       return register_server_service("nbt", nbtd_init);
+       return register_server_service("nbt", nbtd_task_init);
 }