#include "includes.h"
#include "printing/nt_printing_tdb.h"
+#include "printing/queue_process.h"
#include "../librpc/gen_ndr/ndr_spoolss.h"
#include "rpc_server/spoolss/srv_spoolss_util.h"
#include "nt_printing.h"
#include "../libcli/security/security.h"
#include "passdb/machine_sid.h"
#include "smbd/smbd.h"
-#include "smbd/globals.h"
#include "auth.h"
#include "messages.h"
#include "rpc_server/spoolss/srv_spoolss_nt.h"
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);
+ send_to_bgqd(msg, msg_type, data->data, data->length);
}
/****************************************************************************
update the internal database from the system print queue for a queue
****************************************************************************/
-extern pid_t background_lpq_updater_pid;
-
static void print_queue_update(struct messaging_context *msg_ctx,
int snum, bool force)
{
/* finally send the message */
- messaging_send_buf(msg_ctx, pid_to_procid(background_lpq_updater_pid),
- MSG_PRINTER_UPDATE, (uint8_t *)buffer, len);
+ send_to_bgqd(msg_ctx, MSG_PRINTER_UPDATE, (uint8_t *)buffer, len);
SAFE_FREE( buffer );
#include "nt_printing.h"
#include "util_event.h"
#include "lib/global_contexts.h"
+#include "lib/util/pidfile.h"
/**
* @brief Purge stale printers and reload from pre-populated pcap cache.
pcap_cache_reload(ev_ctx, msg_ctx,
delete_and_reload_printers_full);
}
+
+void send_to_bgqd(struct messaging_context *msg_ctx,
+ uint32_t msg_type,
+ const uint8_t *buf,
+ size_t buflen)
+{
+ pid_t bgqd = pidfile_pid(lp_pid_directory(), "samba-bgqd");
+
+ if (bgqd == -1) {
+ return;
+ }
+ messaging_send_buf(
+ msg_ctx, pid_to_procid(bgqd), msg_type, buf, buflen);
+}
pid_t start_background_queue(struct tevent_context *ev,
struct messaging_context *msg,
char *logfile);
+void send_to_bgqd(struct messaging_context *msg_ctx,
+ uint32_t msg_type,
+ const uint8_t *buf,
+ size_t buflen);
struct bq_state;
struct bq_state *register_printing_bq_handlers(
struct server_id server_id,
DATA_BLOB *data)
{
- messaging_send_buf(msg, pid_to_procid(background_lpq_updater_pid),
- MSG_PRINTER_UPDATE, data->data, data->length);
+ send_to_bgqd(msg, msg_type, data->data, data->length);
}
static char *get_bq_logfile(void)