2 Unix SMB/Netbios implementation.
3 Generic infrastructure for RPC Daemons
4 Copyright (C) Simo Sorce 2011
5 Copyright (C) Andreas Schneider 2011
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #include "rpc_server/rpc_config.h"
24 /* the default is "embedded" so this table
25 * lists only services that are not using
26 * the default in order to keep enumerating it
27 * in rpc_service_mode() as short as possible
29 struct rpc_service_defaults
{
32 } rpc_service_defaults
[] = {
33 { "epmapper", "disabled" },
34 { "mdssvc", "disabled" },
35 /* { "spoolss", "embedded" }, */
36 /* { "lsarpc", "embedded" }, */
37 /* { "samr", "embedded" }, */
38 /* { "netlogon", "embedded" }, */
39 { "fssagentrpc", "external" },
44 enum rpc_service_mode_e
rpc_service_mode(const char *name
)
46 const char *pipe_name
= name
;
47 const char *rpcsrv_type
;
48 enum rpc_service_mode_e state
;
50 enum server_role server_role
= lp_server_role();
53 /* Handle pipes with multiple names */
54 if (strcmp(pipe_name
, "lsass") == 0) {
56 } else if (strcmp(pipe_name
, "plugplay") == 0) {
60 def
= lp_parm_const_string(GLOBAL_SECTION_SNUM
,
61 "rpc_server", "default", NULL
);
63 for (i
= 0; rpc_service_defaults
[i
].name
; i
++) {
64 if (strcasecmp_m(pipe_name
, rpc_service_defaults
[i
].name
) == 0) {
65 def
= rpc_service_defaults
[i
].def_mode
;
69 /* if the default is unspecified then use 'embedded' */
76 * Only enable the netlogon server by default if we are a
77 * classic/NT4 domain controller
79 if (strcasecmp_m(name
, "netlogon") == 0) {
80 switch (server_role
) {
82 case ROLE_DOMAIN_MEMBER
:
90 rpcsrv_type
= lp_parm_const_string(GLOBAL_SECTION_SNUM
,
91 "rpc_server", pipe_name
, def
);
93 if (strcasecmp_m(rpcsrv_type
, "embedded") == 0) {
94 state
= RPC_SERVICE_MODE_EMBEDDED
;
95 } else if (strcasecmp_m(rpcsrv_type
, "external") == 0) {
96 state
= RPC_SERVICE_MODE_EXTERNAL
;
98 state
= RPC_SERVICE_MODE_DISABLED
;
105 /* the default is "embedded" so this table
106 * lists only daemons that are not using
107 * the default in order to keep enumerating it
108 * in rpc_daemon_type() as short as possible
110 struct rpc_daemon_defaults
{
112 const char *def_type
;
113 } rpc_daemon_defaults
[] = {
114 { "epmd", "disabled" },
115 /* { "spoolssd", "embedded" }, */
116 /* { "lsasd", "embedded" }, */
117 { "fssd", "disabled" },
122 enum rpc_daemon_type_e
rpc_daemon_type(const char *name
)
124 const char *rpcsrv_type
;
125 enum rpc_daemon_type_e type
;
130 for (i
= 0; rpc_daemon_defaults
[i
].name
; i
++) {
131 if (strcasecmp_m(name
, rpc_daemon_defaults
[i
].name
) == 0) {
132 def
= rpc_daemon_defaults
[i
].def_type
;
136 rpcsrv_type
= lp_parm_const_string(GLOBAL_SECTION_SNUM
,
137 "rpc_daemon", name
, def
);
139 if (strcasecmp_m(rpcsrv_type
, "embedded") == 0) {
140 type
= RPC_DAEMON_EMBEDDED
;
141 } else if (strcasecmp_m(rpcsrv_type
, "fork") == 0) {
142 type
= RPC_DAEMON_FORK
;
144 type
= RPC_DAEMON_DISABLED
;