diff options
author | Andrew Tridgell <tridge@samba.org> | 2005-01-30 00:54:57 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:09:22 -0500 |
commit | 55d4d36993293fee914a009f1d8f05810e347f2b (patch) | |
tree | 587a9bafd1c8df901aad8766acb0fe9ef4c3d8c0 /source4/rpc_server/dcerpc_server.c | |
parent | 5540449f1cd9d9a6efab59f2bf47be4e1487ffc2 (diff) | |
download | samba-55d4d36993293fee914a009f1d8f05810e347f2b.tar.gz samba-55d4d36993293fee914a009f1d8f05810e347f2b.tar.bz2 samba-55d4d36993293fee914a009f1d8f05810e347f2b.zip |
r5102: This is a major simplification of the logic for controlling top level
servers in smbd. The old code still contained a fairly bit of legacy
from the time when smbd was only handling SMB connection. The new code
gets rid of all of the smb_server specific code in smbd/, and creates
a much simpler infrastructures for new server code.
Major changes include:
- simplified the process model code a lot.
- got rid of the top level server and service structures
completely. The top level context is now the event_context. This
got rid of service.h and server.h completely (they were the most
confusing parts of the old code)
- added service_stream.[ch] for the helper functions that are
specific to stream type services (services that handle streams, and
use a logically separate process per connection)
- got rid of the builtin idle_handler code in the service logic, as
none of the servers were using it, and it can easily be handled by
a server in future by adding its own timed_event to the event
context.
- fixed some major memory leaks in the rpc server code.
- added registration of servers, rather than hard coding our list of
possible servers. This allows for servers as modules in the future.
- temporarily disabled the winbind code until I add the helper
functions for that type of server
- added error checking on service startup. If a configured server
fails to startup then smbd doesn't startup.
- cleaned up the command line handling in smbd, removing unused options
(This used to be commit cf6a46c3cbde7b1eb1b86bd3882b953a2de3a42e)
Diffstat (limited to 'source4/rpc_server/dcerpc_server.c')
-rw-r--r-- | source4/rpc_server/dcerpc_server.c | 81 |
1 files changed, 18 insertions, 63 deletions
diff --git a/source4/rpc_server/dcerpc_server.c b/source4/rpc_server/dcerpc_server.c index 575c073e46..c21ab3d883 100644 --- a/source4/rpc_server/dcerpc_server.c +++ b/source4/rpc_server/dcerpc_server.c @@ -28,6 +28,7 @@ #include "dlinklist.h" #include "rpc_server/dcerpc_server.h" #include "events.h" +#include "smbd/service_stream.h" /* see if two endpoints match @@ -299,7 +300,7 @@ static int dcesrv_endpoint_destructor(void *ptr) NTSTATUS dcesrv_endpoint_connect(struct dcesrv_context *dce_ctx, TALLOC_CTX *mem_ctx, const struct dcesrv_endpoint *ep, - struct server_connection *srv_conn, + struct stream_connection *srv_conn, struct dcesrv_connection **_p) { struct dcesrv_connection *p; @@ -333,7 +334,7 @@ NTSTATUS dcesrv_endpoint_search_connect(struct dcesrv_context *dce_ctx, TALLOC_CTX *mem_ctx, const struct dcerpc_binding *ep_description, struct auth_session_info *session_info, - struct server_connection *srv_conn, + struct stream_connection *srv_conn, struct dcesrv_connection **dce_conn_p) { NTSTATUS status; @@ -1204,7 +1205,7 @@ static NTSTATUS dcesrv_init_context(TALLOC_CTX *mem_ctx, const char **endpoint_s } /* - initialise the dcerpc server context + initialise the dcerpc server context for ncacn_np based services */ NTSTATUS dcesrv_init_ipc_context(TALLOC_CTX *mem_ctx, struct dcesrv_context **_dce_ctx) { @@ -1218,45 +1219,6 @@ NTSTATUS dcesrv_init_ipc_context(TALLOC_CTX *mem_ctx, struct dcesrv_context **_d return NT_STATUS_OK; } -static void dcesrv_init(struct server_service *service) -{ - NTSTATUS status; - struct dcesrv_context *dce_ctx; - - DEBUG(1,("dcesrv_init\n")); - - status = dcesrv_init_context(service, - lp_dcerpc_endpoint_servers(), - DCESRV_CALL_STATE_FLAG_MAY_ASYNC, - &dce_ctx); - if (!NT_STATUS_IS_OK(status)) { - return; - } - - service->service.private_data = dce_ctx; - - dcesrv_sock_init(service); - - return; -} - -static void dcesrv_accept(struct server_connection *srv_conn) -{ - dcesrv_sock_accept(srv_conn); -} - -static void dcesrv_recv(struct server_connection *srv_conn, - struct timeval t, uint16_t flags) -{ - dcesrv_sock_recv(srv_conn, t, flags); -} - -static void dcesrv_send(struct server_connection *srv_conn, - struct timeval t, uint16_t flags) -{ - dcesrv_sock_send(srv_conn, t, flags); -} - /* the list of currently registered DCERPC endpoint servers. */ static struct ep_server { @@ -1338,32 +1300,25 @@ const struct dcesrv_critical_sizes *dcerpc_module_version(void) return &critical_sizes; } -static const struct server_stream_ops dcesrv_stream_ops = { - .name = "rpc", - .socket_init = NULL, - .accept_connection = dcesrv_accept, - .recv_handler = dcesrv_recv, - .send_handler = dcesrv_send, - .idle_handler = NULL, - .close_connection = NULL -}; - -const struct server_stream_ops *dcesrv_get_stream_ops(void) +/* + initialise the dcerpc server context for socket based services +*/ +static NTSTATUS dcesrv_init(struct event_context *event_context, const struct model_ops *model_ops) { - return &dcesrv_stream_ops; -} + NTSTATUS status; + struct dcesrv_context *dce_ctx; -static const struct server_service_ops dcesrv_ops = { - .name = "rpc", - .service_init = dcesrv_init, -}; + status = dcesrv_init_context(event_context, + lp_dcerpc_endpoint_servers(), + DCESRV_CALL_STATE_FLAG_MAY_ASYNC, + &dce_ctx); + NT_STATUS_NOT_OK_RETURN(status); -const struct server_service_ops *dcesrv_get_ops(void) -{ - return &dcesrv_ops; + return dcesrv_sock_init(dce_ctx, event_context, model_ops); } + NTSTATUS server_service_rpc_init(void) { - return NT_STATUS_OK; + return register_server_service("rpc", dcesrv_init); } |