diff options
Diffstat (limited to 'source3')
-rw-r--r-- | source3/Makefile.in | 7 | ||||
-rw-r--r-- | source3/rpc_server/rpc_config.c | 115 | ||||
-rw-r--r-- | source3/rpc_server/rpc_config.h | 71 | ||||
-rw-r--r-- | source3/rpc_server/rpc_server.c | 45 | ||||
-rw-r--r-- | source3/rpc_server/rpc_server.h | 21 | ||||
-rw-r--r-- | source3/rpc_server/rpc_service_setup.c | 49 | ||||
-rw-r--r-- | source3/rpc_server/rpc_service_setup.h | 23 | ||||
-rwxr-xr-x[-rw-r--r--] | source3/rpc_server/wscript_build | 7 |
8 files changed, 198 insertions, 140 deletions
diff --git a/source3/Makefile.in b/source3/Makefile.in index 197aa1d87e..0332508d02 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -738,6 +738,8 @@ RPC_NCACN_NP = rpc_server/srv_pipe_register.o rpc_server/rpc_ncacn_np.o \ rpc_server/rpc_handles.o rpc_server/rpc_contexts.o \ rpc_server/srv_access_check.o +RPC_CONFIG = rpc_server/rpc_config.o + RPC_SERVICE = rpc_server/rpc_server.o RPC_CRYPTO = rpc_server/dcesrv_ntlmssp.o \ @@ -745,7 +747,7 @@ RPC_CRYPTO = rpc_server/dcesrv_ntlmssp.o \ rpc_server/dcesrv_spnego.o RPC_PIPE_OBJ = rpc_server/srv_pipe.o rpc_server/srv_pipe_hnd.o \ - $(RPC_NCACN_NP) $(RPC_SERVICE) $(RPC_CRYPTO) + $(RPC_CONFIG) $(RPC_NCACN_NP) $(RPC_SERVICE) $(RPC_CRYPTO) RPC_RPCECHO_OBJ = rpc_server/echo/srv_echo_nt.o librpc/gen_ndr/srv_echo.o @@ -1465,7 +1467,8 @@ WINBINDD_OBJ = \ $(PROFILE_OBJ) $(SLCACHE_OBJ) $(SMBLDAP_OBJ) \ $(LIBADS_OBJ) $(KRBCLIENT_OBJ) $(POPT_LIB_OBJ) \ $(DCUTIL_OBJ) $(IDMAP_OBJ) $(NSS_INFO_OBJ) \ - $(RPC_NCACN_NP) $(RPC_SAMR_OBJ) $(RPC_LSARPC_OBJ) \ + $(RPC_CONFIG) $(RPC_NCACN_NP) \ + $(RPC_SAMR_OBJ) $(RPC_LSARPC_OBJ) \ $(NPA_TSTREAM_OBJ) \ $(AFS_OBJ) $(AFS_SETTOKEN_OBJ) \ $(LIBADS_SERVER_OBJ) \ diff --git a/source3/rpc_server/rpc_config.c b/source3/rpc_server/rpc_config.c new file mode 100644 index 0000000000..a706a11cea --- /dev/null +++ b/source3/rpc_server/rpc_config.c @@ -0,0 +1,115 @@ +/* + Unix SMB/Netbios implementation. + Generic infrstructure for RPC Daemons + Copyright (C) Simo Sorce 2011 + Copyright (C) Andreas Schneider 2011 + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. +*/ + +#include "includes.h" +#include "rpc_server/rpc_config.h" + +/* the default is "embedded" so this table + * lists only services that are not using + * the default in order to keep enumerating it + * in rpc_service_mode() as short as possible + */ +struct rpc_service_defaults { + const char *name; + const char *def_mode; +} rpc_service_defaults[] = { + { "epmapper", "external" }, + /* { "spoolss", "embedded" }, */ + /* { "lsarpc", "embedded" }, */ + /* { "samr", "embedded" }, */ + /* { "netlogon", "embedded" }, */ + + { NULL, NULL } +}; + +enum rpc_service_mode_e rpc_service_mode(const char *name) +{ + const char *rpcsrv_type; + enum rpc_service_mode_e state; + const char *def; + int i; + + def = "embedded"; + for (i = 0; rpc_service_defaults[i].name; i++) { + if (strcasecmp_m(name, rpc_service_defaults[i].name) == 0) { + def = rpc_service_defaults[i].def_mode; + } + } + + rpcsrv_type = lp_parm_const_string(GLOBAL_SECTION_SNUM, + "rpc_server", name, def); + + if (strcasecmp_m(rpcsrv_type, "embedded") == 0) { + state = RPC_SERVICE_MODE_EMBEDDED; + } else if (strcasecmp_m(rpcsrv_type, "external") == 0) { + state = RPC_SERVICE_MODE_EXTERNAL; + } else if (strcasecmp(rpcsrv_type, "daemon") == 0) { + state = RPC_SERVICE_MODE_DAEMON; + } else { + state = RPC_SERVICE_MODE_DISABLED; + } + + return state; +} + + +/* the default is "embedded" so this table + * lists only daemons that are not using + * the default in order to keep enumerating it + * in rpc_daemon_type() as short as possible + */ +struct rpc_daemon_defaults { + const char *name; + const char *def_type; +} rpc_daemon_defaults[] = { + { "epmd", "fork" }, + /* { "spoolssd", "embedded" }, */ + /* { "lsasd", "embedded" }, */ + + { NULL, NULL } +}; + +enum rpc_daemon_type_e rpc_daemon_type(const char *name) +{ + const char *rpcsrv_type; + enum rpc_daemon_type_e type; + const char *def; + int i; + + def = "embedded"; + for (i = 0; rpc_daemon_defaults[i].name; i++) { + if (strcasecmp_m(name, rpc_daemon_defaults[i].name) == 0) { + def = rpc_daemon_defaults[i].def_type; + } + } + + rpcsrv_type = lp_parm_const_string(GLOBAL_SECTION_SNUM, + "rpc_daemon", name, def); + + if (strcasecmp_m(rpcsrv_type, "embedded") == 0) { + type = RPC_DAEMON_EMBEDDED; + } else if (strcasecmp_m(rpcsrv_type, "fork") == 0) { + type = RPC_DAEMON_FORK; + } else { + type = RPC_DAEMON_DISABLED; + } + + return type; +} diff --git a/source3/rpc_server/rpc_config.h b/source3/rpc_server/rpc_config.h new file mode 100644 index 0000000000..4d85d59590 --- /dev/null +++ b/source3/rpc_server/rpc_config.h @@ -0,0 +1,71 @@ +/* + * Unix SMB/CIFS implementation. + * + * SMBD RPC service config + * + * Copyright (c) 2011 Andreas Schneider <asn@samba.org> + * Copyright (C) 2011 Simo Sorce <idra@samba.org> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef _RPC_CONFIG_H +#define _RPC_CONFIG_H + +enum rpc_service_mode_e { + RPC_SERVICE_MODE_DISABLED = 0, + RPC_SERVICE_MODE_EMBEDDED, + RPC_SERVICE_MODE_EXTERNAL, + RPC_SERVICE_MODE_DAEMON +}; + +/** + * @brief Get the mode in which service pipes are configured. + * + * @param name Name of the service + * @param def_mode The default mode for the service + * + * @return The actual configured mode. + */ +enum rpc_service_mode_e rpc_service_mode(const char *name); + +#define rpc_epmapper_mode() rpc_service_mode("epmapper") +#define rpc_spoolss_mode() rpc_service_mode("spoolss") +#define rpc_lsarpc_mode() rpc_service_mode("lsarpc") +#define rpc_samr_mode() rpc_service_mode("samr") +#define rpc_netlogon_mode() rpc_service_mode("netlogon") + + + +enum rpc_daemon_type_e { + RPC_DAEMON_DISABLED = 0, + RPC_DAEMON_EMBEDDED, + RPC_DAEMON_FORK +}; + +/** + * @brief Get the mode in which a server is started. + * + * @param name Name of the rpc server + * @param def_type The default type for the server + * + * @return The actual configured type. + */ +enum rpc_daemon_type_e rpc_daemon_type(const char *name); + +#define rpc_epmapper_daemon() rpc_daemon_type("epmd") +#define rpc_spoolss_daemon() rpc_daemon_type("spoolssd") +#define rpc_lsasd_daemon() rpc_daemon_type("lsasd") + +#endif /* _RPC_CONFIG_H */ diff --git a/source3/rpc_server/rpc_server.c b/source3/rpc_server/rpc_server.c index 5136fb82a3..43f1b3d605 100644 --- a/source3/rpc_server/rpc_server.c +++ b/source3/rpc_server/rpc_server.c @@ -22,6 +22,7 @@ #include "includes.h" #include "rpc_server/rpc_pipes.h" #include "rpc_server/rpc_server.h" +#include "rpc_server/rpc_config.h" #include "rpc_dce.h" #include "librpc/gen_ndr/netlogon.h" #include "librpc/gen_ndr/auth.h" @@ -36,50 +37,6 @@ #define SERVER_TCP_LOW_PORT 1024 #define SERVER_TCP_HIGH_PORT 1300 -/* the default is "embedded" so this table - * lists only daemons that are not using - * the default in order to keep enumerating it - * in rpc_daemon_type() as short as possible - */ -struct rpc_daemon_defaults { - const char *name; - const char *def_type; -} rpc_daemon_defaults[] = { - { "epmd", "fork" }, - /* { "spoolssd", "embedded" }, */ - /* { "lsasd", "embedded" }, */ - - { NULL, NULL } -}; - -enum rpc_daemon_type_e rpc_daemon_type(const char *name) -{ - const char *rpcsrv_type; - enum rpc_daemon_type_e type; - const char *def; - int i; - - def = "embedded"; - for (i = 0; rpc_daemon_defaults[i].name; i++) { - if (strcasecmp_m(name, rpc_daemon_defaults[i].name) == 0) { - def = rpc_daemon_defaults[i].def_type; - } - } - - rpcsrv_type = lp_parm_const_string(GLOBAL_SECTION_SNUM, - "rpc_daemon", name, def); - - if (strcasecmp_m(rpcsrv_type, "embedded") == 0) { - type = RPC_DAEMON_EMBEDDED; - } else if (strcasecmp_m(rpcsrv_type, "fork") == 0) { - type = RPC_DAEMON_FORK; - } else { - type = RPC_DAEMON_DISABLED; - } - - return type; -} - static NTSTATUS auth_anonymous_session_info(TALLOC_CTX *mem_ctx, struct auth_session_info **session_info) { diff --git a/source3/rpc_server/rpc_server.h b/source3/rpc_server/rpc_server.h index 79c15deaed..1d368c324c 100644 --- a/source3/rpc_server/rpc_server.h +++ b/source3/rpc_server/rpc_server.h @@ -20,27 +20,6 @@ #ifndef _RPC_SERVER_H_ #define _RPC_SERVER_H_ -enum rpc_daemon_type_e { - RPC_DAEMON_DISABLED = 0, - RPC_DAEMON_EMBEDDED, - RPC_DAEMON_FORK -}; - -/** - * @brief Get the mode in which a server is started. - * - * @param name Name of the rpc server - * @param def_type The default type for the server - * - * @return The actual configured type. - */ -enum rpc_daemon_type_e rpc_daemon_type(const char *name); - -#define rpc_epmapper_daemon() rpc_daemon_type("epmd") -#define rpc_spoolss_daemon() rpc_daemon_type("spoolssd") -#define rpc_lsasd_daemon() rpc_daemon_type("lsasd") - - struct pipes_struct; typedef bool (*dcerpc_ncacn_disconnect_fn)(struct pipes_struct *p); diff --git a/source3/rpc_server/rpc_service_setup.c b/source3/rpc_server/rpc_service_setup.c index 0600262543..1314d111fe 100644 --- a/source3/rpc_server/rpc_service_setup.c +++ b/source3/rpc_server/rpc_service_setup.c @@ -50,56 +50,9 @@ #include "rpc_server/rpc_service_setup.h" #include "rpc_server/rpc_ep_register.h" #include "rpc_server/rpc_server.h" +#include "rpc_server/rpc_config.h" #include "rpc_server/epmapper/srv_epmapper.h" -/* the default is "embedded" so this table - * lists only services that are not using - * the default in order to keep enumerating it - * in rpc_service_mode() as short as possible - */ -struct rpc_service_defaults { - const char *name; - const char *def_mode; -} rpc_service_defaults[] = { - { "epmapper", "external" }, - /* { "spoolss", "embedded" }, */ - /* { "lsarpc", "embedded" }, */ - /* { "samr", "embedded" }, */ - /* { "netlogon", "embedded" }, */ - - { NULL, NULL } -}; - -enum rpc_service_mode_e rpc_service_mode(const char *name) -{ - const char *rpcsrv_type; - enum rpc_service_mode_e state; - const char *def; - int i; - - def = "embedded"; - for (i = 0; rpc_service_defaults[i].name; i++) { - if (strcasecmp_m(name, rpc_service_defaults[i].name) == 0) { - def = rpc_service_defaults[i].def_mode; - } - } - - rpcsrv_type = lp_parm_const_string(GLOBAL_SECTION_SNUM, - "rpc_server", name, def); - - if (strcasecmp_m(rpcsrv_type, "embedded") == 0) { - state = RPC_SERVICE_MODE_EMBEDDED; - } else if (strcasecmp_m(rpcsrv_type, "external") == 0) { - state = RPC_SERVICE_MODE_EXTERNAL; - } else if (strcasecmp(rpcsrv_type, "daemon") == 0) { - state = RPC_SERVICE_MODE_DAEMON; - } else { - state = RPC_SERVICE_MODE_DISABLED; - } - - return state; -} - static bool rpc_setup_epmapper(struct tevent_context *ev_ctx, struct messaging_context *msg_ctx) { diff --git a/source3/rpc_server/rpc_service_setup.h b/source3/rpc_server/rpc_service_setup.h index 908c0e48b8..2e27995261 100644 --- a/source3/rpc_server/rpc_service_setup.h +++ b/source3/rpc_server/rpc_service_setup.h @@ -24,29 +24,6 @@ struct ndr_interface_table; -enum rpc_service_mode_e { - RPC_SERVICE_MODE_DISABLED = 0, - RPC_SERVICE_MODE_EMBEDDED, - RPC_SERVICE_MODE_EXTERNAL, - RPC_SERVICE_MODE_DAEMON -}; - -/** - * @brief Get the mode in which a service is started. - * - * @param name Name of the service - * @param def_mode The default mode for the service - * - * @return The actual configured mode. - */ -enum rpc_service_mode_e rpc_service_mode(const char *name); - -#define rpc_epmapper_mode() rpc_service_mode("epmapper") -#define rpc_spoolss_mode() rpc_service_mode("spoolss") -#define rpc_lsarpc_mode() rpc_service_mode("lsarpc") -#define rpc_samr_mode() rpc_service_mode("samr") -#define rpc_netlogon_mode() rpc_service_mode("netlogon") - /** * @brief Register an endpoint at the endpoint mapper. * diff --git a/source3/rpc_server/wscript_build b/source3/rpc_server/wscript_build index 894f393c58..b15e3d1c6d 100644..100755 --- a/source3/rpc_server/wscript_build +++ b/source3/rpc_server/wscript_build @@ -25,9 +25,12 @@ bld.SAMBA3_SUBSYSTEM('rpc', deps='RPC_PIPE_REGISTER', vars=locals()) +bld.SAMBA3_SUBSYSTEM('RPC_CONFIG', + source='rpc_config.c') + bld.SAMBA3_SUBSYSTEM('RPC_NCACN_NP', source='rpc_ncacn_np.c rpc_handles.c rpc_contexts.c', - deps='auth auth_sam_reply RPC_PIPE_REGISTER npa_tstream') + deps='RPC_CONFIG auth auth_sam_reply RPC_PIPE_REGISTER npa_tstream') bld.SAMBA3_SUBSYSTEM('RPC_SERVICE', source='rpc_server.c', @@ -130,7 +133,7 @@ bld.SAMBA3_SUBSYSTEM('RPC_EPMAPPER', bld.SAMBA3_SUBSYSTEM('RPC_SERVER', source='srv_pipe_hnd.c srv_pipe.c rpc_sock_helper.c rpc_service_setup.c', - deps='''RPC_NCACN_NP RPC_SERVICE RPC_CRYPTO + deps='''RPC_CONFIG RPC_NCACN_NP RPC_SERVICE RPC_CRYPTO RPC_SAMR RPC_LSARPC RPC_WINREG RPC_INITSHUTDOWN RPC_DSSETUP RPC_WKSSVC RPC_SVCCTL RPC_NTSVCS RPC_NETLOGON RPC_NETDFS RPC_SRVSVC RPC_SPOOLSS |