mirror of
https://github.com/samba-team/samba.git
synced 2025-01-12 09:18:10 +03:00
Remove useless layer of indirection, where every service called
task_service_init() manually. Now this is called from service.c for
all services.
Andrew Bartlett
(This used to be commit 9c9a4731ca
)
This commit is contained in:
parent
b3c5fbec47
commit
0f8eeb81ec
source4
cldap_server
dsdb/repl
kdc
ldap_server
nbt_server
rpc_server
smb_server
smbd
web_server
winbind
wrepl_server
@ -204,19 +204,10 @@ static void cldapd_task_init(struct task_server *task)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
initialise the cldapd server
|
||||
*/
|
||||
static NTSTATUS cldapd_init(struct event_context *event_ctx, struct loadparm_context *lp_ctx, const struct model_ops *model_ops)
|
||||
{
|
||||
return task_server_startup(event_ctx, lp_ctx, "cldap", model_ops, cldapd_task_init);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
register ourselves as a available server
|
||||
*/
|
||||
NTSTATUS server_service_cldapd_init(void)
|
||||
{
|
||||
return register_server_service("cldap", cldapd_init);
|
||||
return register_server_service("cldap", cldapd_task_init);
|
||||
}
|
||||
|
@ -180,18 +180,10 @@ static void dreplsrv_task_init(struct task_server *task)
|
||||
irpc_add_name(task->msg_ctx, "dreplsrv");
|
||||
}
|
||||
|
||||
/*
|
||||
initialise the dsdb replicator service
|
||||
*/
|
||||
static NTSTATUS dreplsrv_init(struct event_context *event_ctx, struct loadparm_context *lp_ctx, const struct model_ops *model_ops)
|
||||
{
|
||||
return task_server_startup(event_ctx, lp_ctx, "drepl", model_ops, dreplsrv_task_init);
|
||||
}
|
||||
|
||||
/*
|
||||
register ourselves as a available server
|
||||
*/
|
||||
NTSTATUS server_service_drepl_init(void)
|
||||
{
|
||||
return register_server_service("drepl", dreplsrv_init);
|
||||
return register_server_service("drepl", dreplsrv_task_init);
|
||||
}
|
||||
|
@ -660,18 +660,8 @@ static void kdc_task_init(struct task_server *task)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
called on startup of the KDC service
|
||||
*/
|
||||
static NTSTATUS kdc_init(struct event_context *event_ctx,
|
||||
struct loadparm_context *lp_ctx,
|
||||
const struct model_ops *model_ops)
|
||||
{
|
||||
return task_server_startup(event_ctx, lp_ctx, "kdc", model_ops, kdc_task_init);
|
||||
}
|
||||
|
||||
/* called at smbd startup - register ourselves as a server service */
|
||||
NTSTATUS server_service_kdc_init(void)
|
||||
{
|
||||
return register_server_service("kdc", kdc_init);
|
||||
return register_server_service("kdc", kdc_task_init);
|
||||
}
|
||||
|
@ -576,20 +576,8 @@ failed:
|
||||
task_server_terminate(task, "Failed to startup ldap server task");
|
||||
}
|
||||
|
||||
/*
|
||||
called on startup of the web server service It's job is to start
|
||||
listening on all configured sockets
|
||||
*/
|
||||
static NTSTATUS ldapsrv_init(struct event_context *event_context,
|
||||
struct loadparm_context *lp_ctx,
|
||||
const struct model_ops *model_ops)
|
||||
{
|
||||
return task_server_startup(event_context, lp_ctx, "ldap", model_ops,
|
||||
ldapsrv_task_init);
|
||||
}
|
||||
|
||||
|
||||
NTSTATUS server_service_ldap_init(void)
|
||||
{
|
||||
return register_server_service("ldap", ldapsrv_init);
|
||||
return register_server_service("ldap", ldapsrv_task_init);
|
||||
}
|
||||
|
@ -88,20 +88,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, lp_ctx, "nbt",
|
||||
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);
|
||||
}
|
||||
|
@ -457,18 +457,6 @@ 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,
|
||||
struct loadparm_context *lp_ctx,
|
||||
const struct model_ops *model_ops)
|
||||
{
|
||||
return task_server_startup(event_context, lp_ctx, "rpc",
|
||||
model_ops, dcesrv_task_init);
|
||||
}
|
||||
|
||||
NTSTATUS server_service_rpc_init(void)
|
||||
{
|
||||
init_module_fn static_init[] = { STATIC_dcerpc_server_MODULES };
|
||||
@ -479,5 +467,5 @@ NTSTATUS server_service_rpc_init(void)
|
||||
|
||||
talloc_free(shared_init);
|
||||
|
||||
return register_server_service("rpc", dcesrv_init);
|
||||
return register_server_service("rpc", dcesrv_task_init);
|
||||
}
|
||||
|
@ -250,20 +250,8 @@ 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,
|
||||
struct loadparm_context *lp_ctx,
|
||||
const struct model_ops *model_ops)
|
||||
{
|
||||
return task_server_startup(event_context, lp_ctx, "smb",
|
||||
model_ops, smbsrv_task_init);
|
||||
}
|
||||
|
||||
/* called at smbd startup - register ourselves as a server service */
|
||||
NTSTATUS server_service_smb_init(void)
|
||||
{
|
||||
return register_server_service("smb", smbsrv_init);
|
||||
return register_server_service("smb", smbsrv_task_init);
|
||||
}
|
||||
|
@ -30,20 +30,20 @@
|
||||
static struct registered_server {
|
||||
struct registered_server *next, *prev;
|
||||
const char *service_name;
|
||||
NTSTATUS (*service_init)(struct event_context *, struct loadparm_context *lp_ctx, const struct model_ops *);
|
||||
void (*task_init)(struct task_server *);
|
||||
} *registered_servers;
|
||||
|
||||
/*
|
||||
register a server service.
|
||||
*/
|
||||
NTSTATUS register_server_service(const char *name,
|
||||
NTSTATUS (*service_init)(struct event_context *, struct loadparm_context *lp_ctx, const struct model_ops *))
|
||||
void (*task_init)(struct task_server *))
|
||||
{
|
||||
struct registered_server *srv;
|
||||
srv = talloc(talloc_autofree_context(), struct registered_server);
|
||||
NT_STATUS_HAVE_NO_MEMORY(srv);
|
||||
srv->service_name = name;
|
||||
srv->service_init = service_init;
|
||||
srv->task_init = task_init;
|
||||
DLIST_ADD_END(registered_servers, srv, struct registered_server *);
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
@ -53,14 +53,15 @@ NTSTATUS register_server_service(const char *name,
|
||||
initialise a server service
|
||||
*/
|
||||
static NTSTATUS server_service_init(const char *name,
|
||||
struct event_context *event_ctx,
|
||||
struct event_context *event_context,
|
||||
struct loadparm_context *lp_ctx,
|
||||
const struct model_ops *model_ops)
|
||||
{
|
||||
struct registered_server *srv;
|
||||
for (srv=registered_servers; srv; srv=srv->next) {
|
||||
if (strcasecmp(name, srv->service_name) == 0) {
|
||||
return srv->service_init(event_ctx, lp_ctx, model_ops);
|
||||
return task_server_startup(event_context, lp_ctx, srv->service_name,
|
||||
model_ops, srv->task_init);
|
||||
}
|
||||
}
|
||||
return NT_STATUS_INVALID_SYSTEM_SERVICE;
|
||||
|
@ -290,20 +290,8 @@ failed:
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
called on startup of the web server service It's job is to start
|
||||
listening on all configured sockets
|
||||
*/
|
||||
static NTSTATUS websrv_init(struct event_context *event_context,
|
||||
struct loadparm_context *lp_ctx,
|
||||
const struct model_ops *model_ops)
|
||||
{
|
||||
return task_server_startup(event_context, lp_ctx, "web",
|
||||
model_ops, websrv_task_init);
|
||||
}
|
||||
|
||||
/* called at smbd startup - register ourselves as a server service */
|
||||
NTSTATUS server_service_web_init(void)
|
||||
{
|
||||
return register_server_service("web", websrv_init);
|
||||
return register_server_service("web", websrv_task_init);
|
||||
}
|
||||
|
@ -201,21 +201,10 @@ nomem:
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
initialise the winbind server
|
||||
*/
|
||||
static NTSTATUS winbind_init(struct event_context *event_ctx,
|
||||
struct loadparm_context *lp_ctx,
|
||||
const struct model_ops *model_ops)
|
||||
{
|
||||
return task_server_startup(event_ctx, lp_ctx, "winbind",
|
||||
model_ops, winbind_task_init);
|
||||
}
|
||||
|
||||
/*
|
||||
register ourselves as a available server
|
||||
*/
|
||||
NTSTATUS server_service_winbind_init(void)
|
||||
{
|
||||
return register_server_service("winbind", winbind_init);
|
||||
return register_server_service("winbind", winbind_task_init);
|
||||
}
|
||||
|
@ -453,6 +453,10 @@ static void wreplsrv_task_init(struct task_server *task)
|
||||
NTSTATUS status;
|
||||
struct wreplsrv_service *service;
|
||||
|
||||
if (!lp_wins_support(task->lp_ctx)) {
|
||||
return;
|
||||
}
|
||||
|
||||
task_server_set_title(task, "task[wreplsrv]");
|
||||
|
||||
service = talloc_zero(task, struct wreplsrv_service);
|
||||
@ -501,23 +505,10 @@ static void wreplsrv_task_init(struct task_server *task)
|
||||
irpc_add_name(task->msg_ctx, "wrepl_server");
|
||||
}
|
||||
|
||||
/*
|
||||
initialise the WREPL server
|
||||
*/
|
||||
static NTSTATUS wreplsrv_init(struct event_context *event_ctx, struct loadparm_context *lp_ctx, const struct model_ops *model_ops)
|
||||
{
|
||||
if (!lp_wins_support(lp_ctx)) {
|
||||
return NT_STATUS_OK;
|
||||
}
|
||||
|
||||
return task_server_startup(event_ctx, lp_ctx, "wrepl",
|
||||
model_ops, wreplsrv_task_init);
|
||||
}
|
||||
|
||||
/*
|
||||
register ourselves as a available server
|
||||
*/
|
||||
NTSTATUS server_service_wrepl_init(void)
|
||||
{
|
||||
return register_server_service("wrepl", wreplsrv_init);
|
||||
return register_server_service("wrepl", wreplsrv_task_init);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user