source4/: Fix prototypes for all functions in various subsystems.
[sfrench/samba-autobuild/.git] / source4 / smb_server / smb_samba3.c
index 259d29039de9a4e6582edf53c53f2da6eaa7d45e..b0ed38cf6a88e8a4e4cc02975a07842f8a43b453 100644 (file)
 */
 
 #include "includes.h"
 */
 
 #include "includes.h"
-#include "smbd/service_task.h"
-#include "smbd/service_stream.h"
 #include "smbd/service.h"
 #include "smbd/service.h"
-#include "lib/messaging/irpc.h"
-#include "lib/stream/packet.h"
-#include "lib/socket/socket.h"
 #include "libcli/smb2/smb2.h"
 #include "libcli/smb2/smb2.h"
-#include "smb_server/smb2/smb2_server.h"
 #include "system/network.h"
 #include "lib/socket/netif.h"
 #include "system/network.h"
 #include "lib/socket/netif.h"
-#include "param/share.h"
-#include "dsdb/samdb/samdb.h"
 #include "param/param.h"
 #include "dynconfig/dynconfig.h"
 #include "smbd/process_model.h"
 
 #include "param/param.h"
 #include "dynconfig/dynconfig.h"
 #include "smbd/process_model.h"
 
+NTSTATUS server_service_samba3_smb_init(void);
+
 /*
   initialise a server_context from a open socket and register a event handler
   for reading from that socket
 /*
   initialise a server_context from a open socket and register a event handler
   for reading from that socket
@@ -57,7 +51,7 @@ static void samba3_smb_accept(struct stream_connection *conn)
                close(i);
        }
 
                close(i);
        }
 
-       prog = lp_parm_string(conn->lp_ctx, NULL, "samba3", "smbd");
+       prog = lpcfg_parm_string(conn->lp_ctx, NULL, "samba3", "smbd");
 
        if (prog == NULL) {
                argv[0] = talloc_asprintf(conn, "%s/%s", dyn_BINDIR, "smbd3");
 
        if (prog == NULL) {
                argv[0] = talloc_asprintf(conn, "%s/%s", dyn_BINDIR, "smbd3");
@@ -72,7 +66,7 @@ static void samba3_smb_accept(struct stream_connection *conn)
        }
        argv[1] = NULL;
 
        }
        argv[1] = NULL;
 
-       execve(argv[0], argv, environ);
+       execv(argv[0], argv);
 
        /*
         * Should never get here
 
        /*
         * Should never get here
@@ -94,22 +88,23 @@ static const struct stream_server_ops samba3_smb_stream_ops = {
 /*
   setup a listening socket on all the SMB ports for a particular address
 */
 /*
   setup a listening socket on all the SMB ports for a particular address
 */
-static NTSTATUS samba3_add_socket(struct event_context *event_context,
+static NTSTATUS samba3_add_socket(struct task_server *task,
+                                 struct tevent_context *event_context,
                                  struct loadparm_context *lp_ctx,
                                  const struct model_ops *model_ops,
                                  const char *address)
 {
                                  struct loadparm_context *lp_ctx,
                                  const struct model_ops *model_ops,
                                  const char *address)
 {
-       const char **ports = lp_smb_ports(lp_ctx);
+       const char **ports = lpcfg_smb_ports(lp_ctx);
        int i;
        NTSTATUS status;
 
        for (i=0;ports[i];i++) {
                uint16_t port = atoi(ports[i]);
                if (port == 0) continue;
        int i;
        NTSTATUS status;
 
        for (i=0;ports[i];i++) {
                uint16_t port = atoi(ports[i]);
                if (port == 0) continue;
-               status = stream_setup_socket(event_context, lp_ctx,
+               status = stream_setup_socket(task, event_context, lp_ctx,
                                             model_ops, &samba3_smb_stream_ops,
                                             "ip", address, &port,
                                             model_ops, &samba3_smb_stream_ops,
                                             "ip", address, &port,
-                                            lp_socket_options(lp_ctx),
+                                            lpcfg_socket_options(lp_ctx),
                                             NULL);
                NT_STATUS_NOT_OK_RETURN(status);
        }
                                             NULL);
                NT_STATUS_NOT_OK_RETURN(status);
        }
@@ -126,7 +121,7 @@ static void samba3_smb_task_init(struct task_server *task)
        NTSTATUS status;
        const struct model_ops *model_ops;
 
        NTSTATUS status;
        const struct model_ops *model_ops;
 
-       model_ops = process_model_startup(task->event_ctx, "standard");
+       model_ops = process_model_startup("standard");
 
        if (model_ops == NULL) {
                goto failed;
 
        if (model_ops == NULL) {
                goto failed;
@@ -134,13 +129,13 @@ static void samba3_smb_task_init(struct task_server *task)
 
        task_server_set_title(task, "task[samba3_smb]");
 
 
        task_server_set_title(task, "task[samba3_smb]");
 
-       if (lp_interfaces(task->lp_ctx)
-           && lp_bind_interfaces_only(task->lp_ctx)) {
+       if (lpcfg_interfaces(task->lp_ctx)
+           && lpcfg_bind_interfaces_only(task->lp_ctx)) {
                int num_interfaces;
                int i;
                struct interface *ifaces;
 
                int num_interfaces;
                int i;
                struct interface *ifaces;
 
-               load_interfaces(task, lp_interfaces(task->lp_ctx), &ifaces);
+               load_interfaces(task, lpcfg_interfaces(task->lp_ctx), &ifaces);
 
                num_interfaces = iface_count(ifaces);
 
 
                num_interfaces = iface_count(ifaces);
 
@@ -150,22 +145,24 @@ static void samba3_smb_task_init(struct task_server *task)
                */
                for(i = 0; i < num_interfaces; i++) {
                        const char *address = iface_n_ip(ifaces, i);
                */
                for(i = 0; i < num_interfaces; i++) {
                        const char *address = iface_n_ip(ifaces, i);
-                       status = samba3_add_socket(task->event_ctx,
+                       status = samba3_add_socket(task,
+                                                  task->event_ctx,
                                                   task->lp_ctx,
                                                   model_ops, address);
                        if (!NT_STATUS_IS_OK(status)) goto failed;
                }
        } else {
                                                   task->lp_ctx,
                                                   model_ops, address);
                        if (!NT_STATUS_IS_OK(status)) goto failed;
                }
        } else {
-               /* Just bind to lp_socket_address() (usually 0.0.0.0) */
-               status = samba3_add_socket(task->event_ctx, task->lp_ctx,
+               /* Just bind to lpcfg_socket_address() (usually 0.0.0.0) */
+               status = samba3_add_socket(task,
+                                          task->event_ctx, task->lp_ctx,
                                           model_ops,
                                           model_ops,
-                                          lp_socket_address(task->lp_ctx));
+                                          lpcfg_socket_address(task->lp_ctx));
                if (!NT_STATUS_IS_OK(status)) goto failed;
        }
 
        return;
 failed:
                if (!NT_STATUS_IS_OK(status)) goto failed;
        }
 
        return;
 failed:
-       task_server_terminate(task, "Failed to startup samba3 smb task");
+       task_server_terminate(task, "Failed to startup samba3 smb task", true);
 }
 
 /* called at smbd startup - register ourselves as a server service */
 }
 
 /* called at smbd startup - register ourselves as a server service */