mirror of
https://github.com/samba-team/samba.git
synced 2025-01-28 17:47:29 +03:00
r14096: setup a service task for smbsrv and dcesrv
metze (This used to be commit 7ad522c7acfe276d08bf59e851697fe93fa622db)
This commit is contained in:
parent
2239cb4ec4
commit
bfcaa4000e
@ -27,6 +27,7 @@
|
|||||||
#include "dlinklist.h"
|
#include "dlinklist.h"
|
||||||
#include "rpc_server/dcerpc_server.h"
|
#include "rpc_server/dcerpc_server.h"
|
||||||
#include "lib/events/events.h"
|
#include "lib/events/events.h"
|
||||||
|
#include "smbd/service_task.h"
|
||||||
#include "smbd/service_stream.h"
|
#include "smbd/service_stream.h"
|
||||||
#include "smbd/service.h"
|
#include "smbd/service.h"
|
||||||
#include "system/filesys.h"
|
#include "system/filesys.h"
|
||||||
@ -1272,18 +1273,20 @@ const struct dcesrv_critical_sizes *dcerpc_module_version(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
initialise the dcerpc server context
|
open the dcerpc server sockets
|
||||||
*/
|
*/
|
||||||
static NTSTATUS dcesrv_init(struct event_context *event_context, const struct model_ops *model_ops)
|
static void dcesrv_task_init(struct task_server *task)
|
||||||
{
|
{
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
struct dcesrv_context *dce_ctx;
|
struct dcesrv_context *dce_ctx;
|
||||||
struct dcesrv_endpoint *e;
|
struct dcesrv_endpoint *e;
|
||||||
|
|
||||||
status = dcesrv_init_context(event_context,
|
task_server_set_title(task, "task[dcesrv]");
|
||||||
|
|
||||||
|
status = dcesrv_init_context(task->event_ctx,
|
||||||
lp_dcerpc_endpoint_servers(),
|
lp_dcerpc_endpoint_servers(),
|
||||||
&dce_ctx);
|
&dce_ctx);
|
||||||
NT_STATUS_NOT_OK_RETURN(status);
|
if (!NT_STATUS_IS_OK(status)) goto failed;
|
||||||
|
|
||||||
/* Make sure the directory for NCALRPC exists */
|
/* Make sure the directory for NCALRPC exists */
|
||||||
if (!directory_exist(lp_ncalrpc_dir())) {
|
if (!directory_exist(lp_ncalrpc_dir())) {
|
||||||
@ -1293,31 +1296,44 @@ static NTSTATUS dcesrv_init(struct event_context *event_context, const struct mo
|
|||||||
for (e=dce_ctx->endpoint_list;e;e=e->next) {
|
for (e=dce_ctx->endpoint_list;e;e=e->next) {
|
||||||
switch (e->ep_description->transport) {
|
switch (e->ep_description->transport) {
|
||||||
case NCACN_UNIX_STREAM:
|
case NCACN_UNIX_STREAM:
|
||||||
status = dcesrv_add_ep_unix(dce_ctx, e, event_context, model_ops);
|
status = dcesrv_add_ep_unix(dce_ctx, e, task->event_ctx, task->model_ops);
|
||||||
NT_STATUS_NOT_OK_RETURN(status);
|
if (!NT_STATUS_IS_OK(status)) goto failed;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NCALRPC:
|
case NCALRPC:
|
||||||
status = dcesrv_add_ep_ncalrpc(dce_ctx, e, event_context, model_ops);
|
status = dcesrv_add_ep_ncalrpc(dce_ctx, e, task->event_ctx, task->model_ops);
|
||||||
NT_STATUS_NOT_OK_RETURN(status);
|
if (!NT_STATUS_IS_OK(status)) goto failed;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NCACN_IP_TCP:
|
case NCACN_IP_TCP:
|
||||||
status = dcesrv_add_ep_tcp(dce_ctx, e, event_context, model_ops);
|
status = dcesrv_add_ep_tcp(dce_ctx, e, task->event_ctx, task->model_ops);
|
||||||
NT_STATUS_NOT_OK_RETURN(status);
|
if (!NT_STATUS_IS_OK(status)) goto failed;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NCACN_NP:
|
case NCACN_NP:
|
||||||
/* FIXME: status = dcesrv_add_ep_np(dce_ctx, e, event_context, model_ops);
|
/* FIXME: status = dcesrv_add_ep_np(dce_ctx, e, task->event_ctx, task->model_ops);
|
||||||
NT_STATUS_NOT_OK_RETURN(status); */
|
if (!NT_STATUS_IS_OK(status)) goto failed;
|
||||||
break;
|
*/ break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return NT_STATUS_NOT_SUPPORTED;
|
status = NT_STATUS_NOT_SUPPORTED;
|
||||||
|
if (!NT_STATUS_IS_OK(status)) goto failed;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return NT_STATUS_OK;
|
return;
|
||||||
|
failed:
|
||||||
|
task_server_terminate(task, "Failed to startup dcerpc server task");
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
called on startup of the smb server service It's job is to start
|
||||||
|
listening on all configured sockets
|
||||||
|
*/
|
||||||
|
static NTSTATUS dcesrv_init(struct event_context *event_context,
|
||||||
|
const struct model_ops *model_ops)
|
||||||
|
{
|
||||||
|
return task_server_startup(event_context, model_ops, dcesrv_task_init);
|
||||||
}
|
}
|
||||||
|
|
||||||
NTSTATUS server_service_rpc_init(void)
|
NTSTATUS server_service_rpc_init(void)
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
|
#include "smbd/service_task.h"
|
||||||
#include "smbd/service_stream.h"
|
#include "smbd/service_stream.h"
|
||||||
#include "smbd/service.h"
|
#include "smbd/service.h"
|
||||||
#include "smb_server/smb_server.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
|
open the smb server sockets
|
||||||
listening on all configured 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;
|
NTSTATUS status;
|
||||||
|
|
||||||
|
task_server_set_title(task, "task[smbsrv]");
|
||||||
|
|
||||||
if (lp_interfaces() && lp_bind_interfaces_only()) {
|
if (lp_interfaces() && lp_bind_interfaces_only()) {
|
||||||
int num_interfaces = iface_count();
|
int num_interfaces = iface_count();
|
||||||
int i;
|
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++) {
|
for(i = 0; i < num_interfaces; i++) {
|
||||||
const char *address = iface_n_ip(i);
|
const char *address = iface_n_ip(i);
|
||||||
status = smb_add_socket(event_context, model_ops, address);
|
status = smb_add_socket(task->event_ctx, task->model_ops, address);
|
||||||
NT_STATUS_NOT_OK_RETURN(status);
|
if (!NT_STATUS_IS_OK(status)) goto failed;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Just bind to lp_socket_address() (usually 0.0.0.0) */
|
/* Just bind to lp_socket_address() (usually 0.0.0.0) */
|
||||||
status = smb_add_socket(event_context, model_ops, lp_socket_address());
|
status = smb_add_socket(task->event_ctx, task->model_ops, lp_socket_address());
|
||||||
NT_STATUS_NOT_OK_RETURN(status);
|
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 */
|
/* called at smbd startup - register ourselves as a server service */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user