#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"
#include "messages.h"
#include "smbprofile.h"
+#include "lib/id_cache.h"
+#include "lib/param/param.h"
extern void start_epmd(struct tevent_context *ev_ctx,
struct messaging_context *msg_ctx);
+extern void start_lsasd(struct event_context *ev_ctx,
+ struct messaging_context *msg_ctx);
+
#ifdef WITH_DFS
extern int dcelogin_atmost_once;
#endif /* WITH_DFS */
{
struct tevent_context *ev_ctx =
talloc_get_type_abort(private_data, struct tevent_context);
+ struct smbd_server_connection *sconn = msg_ctx_to_sconn(msg);
DEBUG(10,("smb_conf_updated: Got message saying smb.conf was "
"updated. Reloading.\n"));
change_to_root_user();
- reload_services(msg, smbd_server_conn->sock, False);
+ reload_services(msg, sconn->sock, False);
if (am_parent) {
printing_subsystem_update(ev_ctx, msg, false);
}
DEBUG(10,("Got message saying pcap was updated. Reloading.\n"));
change_to_root_user();
- reload_printers(ev_ctx, msg);
+ delete_and_reload_printers(ev_ctx, msg);
}
/*******************************************************************
}
#endif /* DEVELOPER */
+NTSTATUS messaging_send_to_children(struct messaging_context *msg_ctx,
+ uint32_t msg_type, DATA_BLOB* data)
+{
+ NTSTATUS status;
+ struct child_pid *child;
+
+ for (child = children; child != NULL; child = child->next) {
+ status = messaging_send(msg_ctx, pid_to_procid(child->pid),
+ msg_type, data);
+ if (!NT_STATUS_IS_OK(status)) {
+ return status;
+ }
+ }
+ return NT_STATUS_OK;
+}
+
/*
* Parent smbd process sets its own debug level first and then
* sends a message to all the smbd children to adjust their debug
struct server_id server_id,
DATA_BLOB *data)
{
- struct child_pid *child;
-
debug_message(msg_ctx, private_data, MSG_DEBUG, server_id, data);
- for (child = children; child != NULL; child = child->next) {
- messaging_send_buf(msg_ctx, pid_to_procid(child->pid),
- MSG_DEBUG,
- data->data,
- strlen((char *) data->data) + 1);
- }
+ messaging_send_to_children(msg_ctx, MSG_DEBUG, data);
}
static void add_child_pid(pid_t pid)
uint16_t flags,
void *private_data)
{
- struct smbd_server_connection *sconn = smbd_server_conn;
struct smbd_open_socket *s = talloc_get_type_abort(private_data,
struct smbd_open_socket);
struct messaging_context *msg_ctx = s->msg_ctx;
+ struct smbd_server_connection *sconn = msg_ctx_to_sconn(msg_ctx);
struct sockaddr_storage addr;
socklen_t in_addrlen = sizeof(addr);
int fd;
status = reinit_after_fork(msg_ctx,
ev,
- procid_self(),
true);
if (!NT_STATUS_IS_OK(status)) {
if (NT_STATUS_EQUAL(status,
"serverid.tdb");
}
- smbd_process(ev, smbd_server_conn);
+ smbd_process(ev, sconn);
exit:
exit_server_cleanly("end of child");
return;
if (!serverid_register(procid_self(),
FLAG_MSG_GENERAL|FLAG_MSG_SMBD
+ |FLAG_MSG_PRINT_GENERAL
|FLAG_MSG_DBWRAP)) {
DEBUG(0, ("open_sockets_smbd: Failed to register "
"myself in serverid.tdb\n"));
smb_pcap_updated);
brl_register_msgs(msg_ctx);
- msg_idmap_register_msgs(msg_ctx);
+ msg_idmap_register_msg(msg_ctx);
#ifdef CLUSTER_SUPPORT
if (lp_clustering()) {
status = reinit_after_fork(msg_ctx,
ev_ctx,
- procid_self(), false);
+ false);
if (!NT_STATUS_IS_OK(status)) {
DEBUG(0,("reinit_after_fork() failed\n"));
exit(1);
}
if (lp_server_role() == ROLE_DOMAIN_BDC || lp_server_role() == ROLE_DOMAIN_PDC) {
- if (!open_schannel_session_store(NULL, lp_private_dir())) {
+ struct loadparm_context *lp_ctx = loadparm_init_s3(NULL, loadparm_s3_context());
+ if (!open_schannel_session_store(NULL, lp_ctx)) {
DEBUG(0,("ERROR: Samba cannot open schannel store for secured NETLOGON operations.\n"));
exit(1);
}
+ TALLOC_FREE(lp_ctx);
}
if(!get_global_sam_sid()) {
}
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);
}
}
/* only start other daemons if we are running as a daemon
* -- bad things will happen if smbd is launched via inetd
* and we fork a copy of ourselves here */
- if (is_daemon && !interactive && !_lp_disable_spoolss()) {
- bool bgq = lp_parm_bool(-1, "smbd", "backgroundqueue", true);
+ if (is_daemon && !interactive) {
- if (!printing_subsystem_init(ev_ctx, msg_ctx, true, bgq)) {
- exit(1);
+ if (rpc_lsasd_daemon() == RPC_DAEMON_FORK) {
+ start_lsasd(ev_ctx, msg_ctx);
+ }
+
+ 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);
}