]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
printing: drop pcap_cache_loaded() guard around load_printers()
authorDavid Disseldorp <ddiss@samba.org>
Tue, 29 Jan 2019 00:50:15 +0000 (01:50 +0100)
committerKarolin Seeger <kseeger@samba.org>
Thu, 21 Feb 2019 11:31:46 +0000 (12:31 +0100)
Add the pcap_cache_loaded() check to load_printers() and return early
if it returns false. This simplifies callers in preparation for checking
lp_load_printers() in the printcap cache update code-path.

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

Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Noel Power <npower@samba.org>
(cherry picked from commit 0ae7c3144a30910adb1e54cf46d54d42a1036839)

source3/printing/load.c
source3/printing/queue_process.c
source3/printing/spoolssd.c

index 238998d920d7d2b943b01734d4ef78c1e4394cf4..131f0d3fccb4765686c2ff4f2f53e74e3cb46f97 100644 (file)
@@ -65,7 +65,9 @@ load automatic printer services from pre-populated pcap cache
 void load_printers(struct tevent_context *ev,
                   struct messaging_context *msg_ctx)
 {
-       SMB_ASSERT(pcap_cache_loaded(NULL));
+       if (!pcap_cache_loaded(NULL)) {
+               return;
+       }
 
        add_auto_printers();
 
index 24708c1953773e5d849ae0007dce0f35e0676ea2..4fe6c576a1955292eab40af5eac8f1ade2ccffd5 100644 (file)
@@ -482,9 +482,7 @@ void printing_subsystem_update(struct tevent_context *ev_ctx,
                               bool force)
 {
        if (background_lpq_updater_pid != -1) {
-               if (pcap_cache_loaded(NULL)) {
-                       load_printers(ev_ctx, msg_ctx);
-               }
+               load_printers(ev_ctx, msg_ctx);
                if (force) {
                        /* Send a sighup to the background process.
                         * this will force it to reload printers */
index 2b08d580f356c1755ef1e5649d4083192c21e4df..8135c7ee77a11e025cf8868bbe063494e5e0baec 100644 (file)
@@ -292,9 +292,7 @@ static bool spoolss_child_init(struct tevent_context *ev_ctx,
         * If so then we probably missed a message and should load_printers()
         * ourselves. If pcap has not been loaded yet, then ignore, we will get
         * a message as soon as the bq process completes the reload. */
-       if (pcap_cache_loaded(NULL)) {
-               load_printers(ev_ctx, msg_ctx);
-       }
+       load_printers(ev_ctx, msg_ctx);
 
        /* try to reinit rpc queues */
        spoolss_cb.init = spoolss_init_cb;
@@ -703,9 +701,7 @@ pid_t start_spoolssd(struct tevent_context *ev_ctx,
         * If pcap has not been loaded yet, then ignore, as we will reload on
         * client enumeration anyway.
         */
-       if (pcap_cache_loaded(NULL)) {
-               load_printers(ev_ctx, msg_ctx);
-       }
+       load_printers(ev_ctx, msg_ctx);
 
        mem_ctx = talloc_new(NULL);
        if (mem_ctx == NULL) {