The Samba-Bugzilla – Attachment 14830 Details for
Bug 13766
printcap still processed with "load printers" disabled in smb.conf
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
backport for 4.8.next (load_printers() takes ev and msg contexts)
bso13766_load_printers_48t.patchset (text/plain), 4.63 KB, created by
David Disseldorp
on 2019-02-06 23:49:31 UTC
(
hide
)
Description:
backport for 4.8.next (load_printers() takes ev and msg contexts)
Filename:
MIME Type:
Creator:
David Disseldorp
Created:
2019-02-06 23:49:31 UTC
Size:
4.63 KB
patch
obsolete
>From c51d125feefc969b50aabd10085b2e854b576d4a Mon Sep 17 00:00:00 2001 >From: David Disseldorp <ddiss@samba.org> >Date: Tue, 29 Jan 2019 01:50:15 +0100 >Subject: [PATCH 1/2] printing: drop pcap_cache_loaded() guard around > load_printers() > >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 | 4 +++- > source3/printing/queue_process.c | 4 +--- > source3/printing/spoolssd.c | 8 ++------ > 3 files changed, 6 insertions(+), 10 deletions(-) > >diff --git a/source3/printing/load.c b/source3/printing/load.c >index 238998d920d..131f0d3fccb 100644 >--- a/source3/printing/load.c >+++ b/source3/printing/load.c >@@ -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(); > >diff --git a/source3/printing/queue_process.c b/source3/printing/queue_process.c >index 24708c19537..4fe6c576a19 100644 >--- a/source3/printing/queue_process.c >+++ b/source3/printing/queue_process.c >@@ -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 */ >diff --git a/source3/printing/spoolssd.c b/source3/printing/spoolssd.c >index 2b08d580f35..8135c7ee77a 100644 >--- a/source3/printing/spoolssd.c >+++ b/source3/printing/spoolssd.c >@@ -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) { >-- >2.13.7 > > >From 32029109078954790f65816dcaf75925cda5984e Mon Sep 17 00:00:00 2001 >From: David Disseldorp <ddiss@samba.org> >Date: Tue, 29 Jan 2019 01:55:04 +0100 >Subject: [PATCH 2/2] printing: check lp_load_printers() prior to pcap cache > update > >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 > >(cherry picked from commit 6a77237c50dd258521f356af0b5dc9942dd5592e) >--- > source3/printing/pcap.c | 5 +++++ > source3/printing/queue_process.c | 2 +- > 2 files changed, 6 insertions(+), 1 deletion(-) > >diff --git a/source3/printing/pcap.c b/source3/printing/pcap.c >index 726111816d6..d771cd9dfeb 100644 >--- a/source3/printing/pcap.c >+++ b/source3/printing/pcap.c >@@ -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")); >diff --git a/source3/printing/queue_process.c b/source3/printing/queue_process.c >index 4fe6c576a19..ce4e0bcda09 100644 >--- a/source3/printing/queue_process.c >+++ b/source3/printing/queue_process.c >@@ -171,7 +171,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; > } >-- >2.13.7 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Flags:
asn
:
review+
gd
:
review+
Actions:
View
Attachments on
bug 13766
:
14804
|
14829
| 14830