1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-02 09:47:23 +03:00

printing: Avoid a few references to background_lpq_updater_pid

We have the bgqd in the pidfile now

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Tue May 11 23:45:21 UTC 2021 on sn-devel-184
This commit is contained in:
Volker Lendecke 2021-04-30 21:52:00 +02:00 committed by Jeremy Allison
parent bad19e208c
commit 4d54b602bd
5 changed files with 23 additions and 19 deletions

View File

@ -21,6 +21,7 @@
#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"
@ -29,7 +30,6 @@
#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"
@ -201,18 +201,7 @@ static void forward_drv_upgrade_printer_msg(struct messaging_context *msg,
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);
}
/****************************************************************************

View File

@ -1553,8 +1553,6 @@ void print_queue_receive(struct messaging_context *msg,
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)
{
@ -1679,8 +1677,7 @@ static void print_queue_update(struct messaging_context *msg_ctx,
/* 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 );

View File

@ -41,6 +41,7 @@
#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.
@ -483,3 +484,17 @@ void printing_subsystem_update(struct tevent_context *ev_ctx,
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);
}

View File

@ -36,6 +36,10 @@ void printing_subsystem_update(struct tevent_context *ev_ctx,
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(

View File

@ -554,8 +554,7 @@ static void print_queue_forward(struct messaging_context *msg,
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)