printing: check lp_load_printers() prior to pcap cache update
authorDavid Disseldorp <ddiss@samba.org>
Tue, 29 Jan 2019 00:55:04 +0000 (01:55 +0100)
committerNoel Power <npower@samba.org>
Fri, 1 Feb 2019 18:25:03 +0000 (19:25 +0100)
Avoid explicit and housekeeping timer triggered printcap cache updates
if lp_load_printers() is disabled.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=13766

Signed-off-by: David Disseldorp <ddiss@samba.org>
Autobuild-User(master): Noel Power <npower@samba.org>
Autobuild-Date(master): Fri Feb  1 19:25:03 CET 2019 on sn-devel-144

source3/printing/pcap.c
source3/printing/queue_process.c

index 726111816d6678e734d16a642bca4fe4021f8f6d..d771cd9dfeb9e11178a47db736d336cdc9d6c393 100644 (file)
@@ -139,6 +139,11 @@ void pcap_cache_reload(struct tevent_context *ev,
 
        DEBUG(3, ("reloading printcap cache\n"));
 
+       if (!lp_load_printers()) {
+               DBG_NOTICE("skipping reload - load printers disabled\n");
+               return;
+       }
+
        /* only go looking if no printcap name supplied */
        if (pcap_name == NULL || *pcap_name == 0) {
                DEBUG(0, ("No printcap file name configured!\n"));
index 197bde0108660c0b24ca56b86918f71c3e1981a7..7ac609a318ae393e2bb29960841dce92b7d3c0a5 100644 (file)
@@ -172,7 +172,7 @@ static bool printing_subsystem_queue_tasks(struct bq_state *state)
        /* cancel any existing housekeeping event */
        TALLOC_FREE(state->housekeep);
 
-       if (housekeeping_period == 0) {
+       if ((housekeeping_period == 0) || !lp_load_printers()) {
                DEBUG(4, ("background print queue housekeeping disabled\n"));
                return true;
        }