summaryrefslogtreecommitdiff
path: root/source4/smb_server
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2006-03-09 20:36:01 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 13:56:50 -0500
commitbfcaa4000e11c84fb31abe11a1631ea3c4ca4c31 (patch)
tree44c13eba6dcd6f64ea8ce06f8642f04cb81bff25 /source4/smb_server
parent2239cb4ec4a3594d34f5c7eeabb502d8ad027ea6 (diff)
downloadsamba-bfcaa4000e11c84fb31abe11a1631ea3c4ca4c31.tar.gz
samba-bfcaa4000e11c84fb31abe11a1631ea3c4ca4c31.tar.bz2
samba-bfcaa4000e11c84fb31abe11a1631ea3c4ca4c31.zip
r14096: setup a service task for smbsrv and dcesrv
metze (This used to be commit 7ad522c7acfe276d08bf59e851697fe93fa622db)
Diffstat (limited to 'source4/smb_server')
-rw-r--r--source4/smb_server/smb_server.c30
1 files changed, 22 insertions, 8 deletions
diff --git a/source4/smb_server/smb_server.c b/source4/smb_server/smb_server.c
index ac87cc14e0..f47063f945 100644
--- a/source4/smb_server/smb_server.c
+++ b/source4/smb_server/smb_server.c
@@ -20,6 +20,7 @@
*/
#include "includes.h"
+#include "smbd/service_task.h"
#include "smbd/service_stream.h"
#include "smbd/service.h"
#include "smb_server/smb_server.h"
@@ -183,13 +184,14 @@ static NTSTATUS smb_add_socket(struct event_context *event_context,
}
/*
- called on startup of the smb server service It's job is to start
- listening on all configured SMB server sockets
+ open the smb server sockets
*/
-static NTSTATUS smbsrv_init(struct event_context *event_context, const struct model_ops *model_ops)
+static void smbsrv_task_init(struct task_server *task)
{
NTSTATUS status;
+ task_server_set_title(task, "task[smbsrv]");
+
if (lp_interfaces() && lp_bind_interfaces_only()) {
int num_interfaces = iface_count();
int i;
@@ -200,16 +202,28 @@ static NTSTATUS smbsrv_init(struct event_context *event_context, const struct mo
*/
for(i = 0; i < num_interfaces; i++) {
const char *address = iface_n_ip(i);
- status = smb_add_socket(event_context, model_ops, address);
- NT_STATUS_NOT_OK_RETURN(status);
+ status = smb_add_socket(task->event_ctx, task->model_ops, address);
+ if (!NT_STATUS_IS_OK(status)) goto failed;
}
} else {
/* Just bind to lp_socket_address() (usually 0.0.0.0) */
- status = smb_add_socket(event_context, model_ops, lp_socket_address());
- NT_STATUS_NOT_OK_RETURN(status);
+ status = smb_add_socket(task->event_ctx, task->model_ops, lp_socket_address());
+ if (!NT_STATUS_IS_OK(status)) goto failed;
}
- return NT_STATUS_OK;
+ return;
+failed:
+ task_server_terminate(task, "Failed to startup smb server task");
+}
+
+/*
+ called on startup of the smb server service It's job is to start
+ listening on all configured sockets
+*/
+static NTSTATUS smbsrv_init(struct event_context *event_context,
+ const struct model_ops *model_ops)
+{
+ return task_server_startup(event_context, model_ops, smbsrv_task_init);
}
/* called at smbd startup - register ourselves as a server service */