diff options
Diffstat (limited to 'source3/rpc_server')
-rw-r--r-- | source3/rpc_server/rpc_server.c | 44 | ||||
-rw-r--r-- | source3/rpc_server/rpc_server.h | 21 |
2 files changed, 65 insertions, 0 deletions
diff --git a/source3/rpc_server/rpc_server.c b/source3/rpc_server/rpc_server.c index 2e6bfa53e2..5136fb82a3 100644 --- a/source3/rpc_server/rpc_server.c +++ b/source3/rpc_server/rpc_server.c @@ -36,6 +36,50 @@ #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 1d368c324c..79c15deaed 100644 --- a/source3/rpc_server/rpc_server.h +++ b/source3/rpc_server/rpc_server.h @@ -20,6 +20,27 @@ #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); |