summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2011-08-10 15:02:24 -0400
committerSimo Sorce <idra@samba.org>2011-08-21 09:05:03 -0400
commit5a4e0dd853d2e5fb12031a59665966d14d07bbfc (patch)
treeb460d3a2ce6af6a0b4089aae9ab05f0164eea999 /source3
parent9738ee40158e9e368f8fcf7db3294c408750dab0 (diff)
downloadsamba-5a4e0dd853d2e5fb12031a59665966d14d07bbfc.tar.gz
samba-5a4e0dd853d2e5fb12031a59665966d14d07bbfc.tar.bz2
samba-5a4e0dd853d2e5fb12031a59665966d14d07bbfc.zip
s3-rpc_server: Add helper to define/retrieve daemons configuration
Wtith this set of helper functions we make it easy to configure if we want to use an embedded rpc server, or if we want to fork one. Or even just disable it and let a third party server be used when the service is configured as "external". Signed-off-by: Andreas Schneider <asn@samba.org> Signed-off-by: Simo Sorce <idra@samba.org>
Diffstat (limited to 'source3')
-rw-r--r--source3/rpc_server/rpc_server.c44
-rw-r--r--source3/rpc_server/rpc_server.h21
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);