summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--source3/printing/nt_printing.c29
-rw-r--r--source3/printing/queue_process.c6
-rw-r--r--source3/rpc_server/spoolss/srv_spoolss_nt.c1
3 files changed, 34 insertions, 2 deletions
diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c
index 376dcfafa8..6a5f2d744a 100644
--- a/source3/printing/nt_printing.c
+++ b/source3/printing/nt_printing.c
@@ -132,6 +132,31 @@ static bool print_driver_directories_init(void)
}
/****************************************************************************
+ Forward a MSG_PRINTER_DRVUPGRADE message from another smbd to the
+ background lpq updater.
+****************************************************************************/
+
+static void forward_drv_upgrade_printer_msg(struct messaging_context *msg,
+ void *private_data,
+ uint32_t msg_type,
+ struct server_id server_id,
+ DATA_BLOB *data)
+{
+ extern pid_t background_lpq_updater_pid;
+
+ if (background_lpq_updater_pid == -1) {
+ DEBUG(3,("no background lpq queue updater\n"));
+ return;
+ }
+
+ messaging_send_buf(msg,
+ pid_to_procid(background_lpq_updater_pid),
+ MSG_PRINTER_DRVUPGRADE,
+ data->data,
+ data->length);
+}
+
+/****************************************************************************
Open the NT printing tdbs. Done once before fork().
****************************************************************************/
@@ -149,10 +174,10 @@ bool nt_printing_init(struct messaging_context *msg_ctx)
/*
* register callback to handle updating printers as new
- * drivers are installed
+ * drivers are installed. Forwards to background lpq updater.
*/
messaging_register(msg_ctx, NULL, MSG_PRINTER_DRVUPGRADE,
- do_drv_upgrade_printer);
+ forward_drv_upgrade_printer_msg);
/* of course, none of the message callbacks matter if you don't
tell messages.c that you interested in receiving PRINT_GENERAL
diff --git a/source3/printing/queue_process.c b/source3/printing/queue_process.c
index bc6c33f9a8..aa0d0fb6a8 100644
--- a/source3/printing/queue_process.c
+++ b/source3/printing/queue_process.c
@@ -32,6 +32,7 @@
#include "smbd/smbd.h"
#include "rpc_server/rpc_config.h"
#include "printing/load.h"
+#include "rpc_server/spoolss/srv_spoolss_nt.h"
extern pid_t start_spoolssd(struct tevent_context *ev_ctx,
struct messaging_context *msg_ctx);
@@ -314,6 +315,11 @@ pid_t start_background_queue(struct tevent_context *ev,
bq_smb_conf_updated);
messaging_register(msg_ctx, NULL, MSG_PRINTER_UPDATE,
print_queue_receive);
+ /* Remove previous forwarder message set in parent. */
+ messaging_deregister(msg_ctx, MSG_PRINTER_DRVUPGRADE, NULL);
+
+ messaging_register(msg_ctx, NULL, MSG_PRINTER_DRVUPGRADE,
+ do_drv_upgrade_printer);
fde = tevent_add_fd(ev, ev, pause_pipe[1], TEVENT_FD_READ,
printing_pause_fd_handler,
diff --git a/source3/rpc_server/spoolss/srv_spoolss_nt.c b/source3/rpc_server/spoolss/srv_spoolss_nt.c
index dc90b7708e..1305b1006e 100644
--- a/source3/rpc_server/spoolss/srv_spoolss_nt.c
+++ b/source3/rpc_server/spoolss/srv_spoolss_nt.c
@@ -1515,6 +1515,7 @@ void srv_spoolss_cleanup(void)
/**********************************************************************
callback to receive a MSG_PRINTER_DRVUPGRADE message and interate
over all printers, upgrading ones as necessary
+ This is now *ONLY* called inside the background lpq updater. JRA.
**********************************************************************/
void do_drv_upgrade_printer(struct messaging_context *msg,