summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2011-08-10 15:23:20 -0400
committerSimo Sorce <idra@samba.org>2011-08-21 09:05:03 -0400
commit23e7e1c15862070b2296b9f24eb5b7e70f2058c4 (patch)
tree9795aa869770bb7698ff380dd3baabf57bf51867
parent11cbe24ac8415bdddef6d2c67cacc578cea850ad (diff)
downloadsamba-23e7e1c15862070b2296b9f24eb5b7e70f2058c4.tar.gz
samba-23e7e1c15862070b2296b9f24eb5b7e70f2058c4.tar.bz2
samba-23e7e1c15862070b2296b9f24eb5b7e70f2058c4.zip
s3-rpc_server: Replace RPC_SERVICE_MODE_DAEMON checks
Use rpc_daemon_type() macros where appropriate instead. Signed-off-by: Andreas Schneider <asn@samba.org> Signed-off-by: Simo Sorce <idra@samba.org>
-rw-r--r--source3/printing/queue_process.c5
-rw-r--r--source3/rpc_server/rpc_config.c2
-rw-r--r--source3/rpc_server/rpc_config.h3
-rw-r--r--source3/rpc_server/rpc_service_setup.c21
-rw-r--r--source3/smbd/server.c14
5 files changed, 25 insertions, 20 deletions
diff --git a/source3/printing/queue_process.c b/source3/printing/queue_process.c
index 9039e5cd08..bd26b02031 100644
--- a/source3/printing/queue_process.c
+++ b/source3/printing/queue_process.c
@@ -29,7 +29,7 @@
#include "serverid.h"
#include "locking/proto.h"
#include "smbd/proto.h"
-#include "rpc_server/rpc_service_setup.h"
+#include "rpc_server/rpc_config.h"
#include "printing/load.h"
extern pid_t start_spoolssd(struct event_context *ev_ctx,
@@ -317,7 +317,6 @@ bool printing_subsystem_init(struct tevent_context *ev_ctx,
bool start_daemons,
bool background_queue)
{
- enum rpc_service_mode_e spoolss_mode = rpc_spoolss_mode();
pid_t pid = -1;
if (!print_backend_init(msg_ctx)) {
@@ -326,7 +325,7 @@ bool printing_subsystem_init(struct tevent_context *ev_ctx,
/* start spoolss daemon */
/* start as a separate daemon only if enabled */
- if (start_daemons && spoolss_mode == RPC_SERVICE_MODE_DAEMON) {
+ if (start_daemons && rpc_spoolss_daemon() == RPC_DAEMON_FORK) {
pid = start_spoolssd(ev_ctx, msg_ctx);
diff --git a/source3/rpc_server/rpc_config.c b/source3/rpc_server/rpc_config.c
index a706a11cea..76df479cf4 100644
--- a/source3/rpc_server/rpc_config.c
+++ b/source3/rpc_server/rpc_config.c
@@ -60,8 +60,6 @@ enum rpc_service_mode_e rpc_service_mode(const char *name)
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;
}
diff --git a/source3/rpc_server/rpc_config.h b/source3/rpc_server/rpc_config.h
index 4d85d59590..d1c26dd366 100644
--- a/source3/rpc_server/rpc_config.h
+++ b/source3/rpc_server/rpc_config.h
@@ -26,8 +26,7 @@
enum rpc_service_mode_e {
RPC_SERVICE_MODE_DISABLED = 0,
RPC_SERVICE_MODE_EMBEDDED,
- RPC_SERVICE_MODE_EXTERNAL,
- RPC_SERVICE_MODE_DAEMON
+ RPC_SERVICE_MODE_EXTERNAL
};
/**
diff --git a/source3/rpc_server/rpc_service_setup.c b/source3/rpc_server/rpc_service_setup.c
index 1314d111fe..29d7bf238a 100644
--- a/source3/rpc_server/rpc_service_setup.c
+++ b/source3/rpc_server/rpc_service_setup.c
@@ -57,9 +57,11 @@ static bool rpc_setup_epmapper(struct tevent_context *ev_ctx,
struct messaging_context *msg_ctx)
{
enum rpc_service_mode_e epm_mode = rpc_epmapper_mode();
+ enum rpc_daemon_type_e epm_type = rpc_epmapper_daemon();
NTSTATUS status;
- if (epm_mode != RPC_SERVICE_MODE_DISABLED) {
+ if (epm_mode != RPC_SERVICE_MODE_DISABLED &&
+ epm_type != RPC_DAEMON_DISABLED) {
status = rpc_epmapper_init(NULL);
if (!NT_STATUS_IS_OK(status)) {
return false;
@@ -192,6 +194,7 @@ static bool rpc_setup_lsarpc(struct tevent_context *ev_ctx,
struct dcerpc_binding_vector *v2;
enum rpc_service_mode_e epm_mode = rpc_epmapper_mode();
enum rpc_service_mode_e lsarpc_mode = rpc_lsarpc_mode();
+ enum rpc_daemon_type_e lsasd_type = rpc_lsasd_daemon();
NTSTATUS status;
bool ok;
@@ -201,6 +204,7 @@ static bool rpc_setup_lsarpc(struct tevent_context *ev_ctx,
}
if (lsarpc_mode == RPC_SERVICE_MODE_EMBEDDED &&
+ lsasd_type != RPC_DAEMON_DISABLED &&
epm_mode != RPC_SERVICE_MODE_DISABLED) {
v2 = dcerpc_binding_vector_dup(talloc_tos(), v);
if (v2 == NULL) {
@@ -251,6 +255,7 @@ static bool rpc_setup_samr(struct tevent_context *ev_ctx,
struct dcerpc_binding_vector *v2;
enum rpc_service_mode_e epm_mode = rpc_epmapper_mode();
enum rpc_service_mode_e samr_mode = rpc_samr_mode();
+ enum rpc_daemon_type_e lsasd_type = rpc_lsasd_daemon();
NTSTATUS status;
bool ok;
@@ -260,6 +265,7 @@ static bool rpc_setup_samr(struct tevent_context *ev_ctx,
}
if (samr_mode == RPC_SERVICE_MODE_EMBEDDED &&
+ lsasd_type != RPC_DAEMON_DISABLED &&
epm_mode != RPC_SERVICE_MODE_DISABLED) {
v2 = dcerpc_binding_vector_dup(talloc_tos(), v);
if (v2 == NULL) {
@@ -310,6 +316,7 @@ static bool rpc_setup_netlogon(struct tevent_context *ev_ctx,
struct dcerpc_binding_vector *v2;
enum rpc_service_mode_e epm_mode = rpc_epmapper_mode();
enum rpc_service_mode_e netlogon_mode = rpc_netlogon_mode();
+ enum rpc_daemon_type_e lsasd_type = rpc_lsasd_daemon();
NTSTATUS status;
bool ok;
@@ -319,6 +326,7 @@ static bool rpc_setup_netlogon(struct tevent_context *ev_ctx,
}
if (netlogon_mode == RPC_SERVICE_MODE_EMBEDDED &&
+ lsasd_type != RPC_DAEMON_DISABLED &&
epm_mode != RPC_SERVICE_MODE_DISABLED) {
v2 = dcerpc_binding_vector_dup(talloc_tos(), v);
if (v2 == NULL) {
@@ -621,28 +629,29 @@ static bool rpc_setup_spoolss(struct tevent_context *ev_ctx,
struct rpc_srv_callbacks spoolss_cb;
struct dcerpc_binding_vector *v;
enum rpc_service_mode_e spoolss_mode = rpc_spoolss_mode();
- NTSTATUS status;
+ enum rpc_daemon_type_e spoolss_type = rpc_spoolss_daemon();
+ NTSTATUS status = NT_STATUS_UNSUCCESSFUL;
if (_lp_disable_spoolss() ||
+ spoolss_type == RPC_DAEMON_DISABLED ||
spoolss_mode == RPC_SERVICE_MODE_DISABLED) {
return true;
}
- if (spoolss_mode == RPC_SERVICE_MODE_EMBEDDED) {
+ if (spoolss_type == RPC_DAEMON_EMBEDDED) {
spoolss_cb.init = spoolss_init_cb;
spoolss_cb.shutdown = spoolss_shutdown_cb;
spoolss_cb.private_data = msg_ctx;
status = rpc_spoolss_init(&spoolss_cb);
- } else if (spoolss_mode == RPC_SERVICE_MODE_EXTERNAL ||
- spoolss_mode == RPC_SERVICE_MODE_DAEMON) {
+ } else if (spoolss_type == RPC_DAEMON_FORK) {
status = rpc_spoolss_init(NULL);
}
if (!NT_STATUS_IS_OK(status)) {
return false;
}
- if (spoolss_mode == RPC_SERVICE_MODE_EMBEDDED) {
+ if (spoolss_type == RPC_DAEMON_EMBEDDED) {
enum rpc_service_mode_e epm_mode = rpc_epmapper_mode();
if (epm_mode != RPC_SERVICE_MODE_DISABLED) {
diff --git a/source3/smbd/server.c b/source3/smbd/server.c
index f6d2657289..cc53f69626 100644
--- a/source3/smbd/server.c
+++ b/source3/smbd/server.c
@@ -33,6 +33,7 @@
#include "ctdbd_conn.h"
#include "printing/queue_process.h"
#include "rpc_server/rpc_service_setup.h"
+#include "rpc_server/rpc_config.h"
#include "serverid.h"
#include "passdb.h"
#include "auth.h"
@@ -1210,9 +1211,7 @@ extern void build_options(bool screen);
}
if (is_daemon && !interactive) {
- enum rpc_service_mode_e epm_mode = rpc_epmapper_mode();
-
- if (epm_mode == RPC_SERVICE_MODE_DAEMON) {
+ if (rpc_epmapper_daemon() == RPC_DAEMON_FORK) {
start_epmd(ev_ctx, msg_ctx);
}
}
@@ -1225,20 +1224,21 @@ extern void build_options(bool screen);
* -- bad things will happen if smbd is launched via inetd
* and we fork a copy of ourselves here */
if (is_daemon && !interactive) {
- enum rpc_service_mode_e lsarpc_mode = rpc_lsarpc_mode();
- if (lsarpc_mode == RPC_SERVICE_MODE_DAEMON) {
+ if (rpc_lsasd_daemon() == RPC_DAEMON_FORK) {
start_lsasd(ev_ctx, msg_ctx);
}
- if (!_lp_disable_spoolss()) {
+ if (!_lp_disable_spoolss() &&
+ (rpc_spoolss_daemon() != RPC_DAEMON_DISABLED)) {
bool bgq = lp_parm_bool(-1, "smbd", "backgroundqueue", true);
if (!printing_subsystem_init(ev_ctx, msg_ctx, true, bgq)) {
exit(1);
}
}
- } else if (!_lp_disable_spoolss()) {
+ } else if (!_lp_disable_spoolss() &&
+ (rpc_spoolss_daemon() != RPC_DAEMON_DISABLED)) {
if (!printing_subsystem_init(ev_ctx, msg_ctx, false, false)) {
exit(1);
}