diff options
author | David Disseldorp <ddiss@samba.org> | 2014-07-23 12:12:34 +0200 |
---|---|---|
committer | Karolin Seeger <kseeger@samba.org> | 2014-09-01 21:34:11 +0200 |
commit | 5a647c5258f57c93563a4e962aa712221874bf2d (patch) | |
tree | 87bc68d5216cd2e37e08be9ef82fca7475dedadc /source3 | |
parent | b8042f8cd59197887013ad23efd3ebb7d6138aff (diff) | |
download | samba-5a647c5258f57c93563a4e962aa712221874bf2d.tar.gz |
printing: return last change time with pcap_cache_loaded()
Bug: https://bugzilla.samba.org/show_bug.cgi?id=10652
Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
(cherry picked from commit 30ce835670a6aeca6fb960ea7c4fe1b982bdd5b0)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/printing/load.c | 2 | ||||
-rw-r--r-- | source3/printing/pcap.c | 10 | ||||
-rw-r--r-- | source3/printing/pcap.h | 2 | ||||
-rw-r--r-- | source3/printing/queue_process.c | 2 | ||||
-rw-r--r-- | source3/printing/spoolssd.c | 4 |
5 files changed, 13 insertions, 7 deletions
diff --git a/source3/printing/load.c b/source3/printing/load.c index 2ba3b2e106..238998d920 100644 --- a/source3/printing/load.c +++ b/source3/printing/load.c @@ -65,7 +65,7 @@ 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()); + SMB_ASSERT(pcap_cache_loaded(NULL)); add_auto_printers(); diff --git a/source3/printing/pcap.c b/source3/printing/pcap.c index 9c44584a4d..c5524ad53d 100644 --- a/source3/printing/pcap.c +++ b/source3/printing/pcap.c @@ -83,13 +83,19 @@ void pcap_cache_destroy_specific(struct pcap_cache **pp_cache) *pp_cache = NULL; } -bool pcap_cache_loaded(void) +bool pcap_cache_loaded(time_t *_last_change) { NTSTATUS status; time_t last; status = printer_list_get_last_refresh(&last); - return NT_STATUS_IS_OK(status); + if (!NT_STATUS_IS_OK(status)) { + return false; + } + if (_last_change != NULL) { + *_last_change = last; + } + return true; } bool pcap_cache_replace(const struct pcap_cache *pcache) diff --git a/source3/printing/pcap.h b/source3/printing/pcap.h index 7dccf84b37..8fc9e9de31 100644 --- a/source3/printing/pcap.h +++ b/source3/printing/pcap.h @@ -35,7 +35,7 @@ struct pcap_cache; bool pcap_cache_add_specific(struct pcap_cache **ppcache, const char *name, const char *comment, const char *location); void pcap_cache_destroy_specific(struct pcap_cache **ppcache); -bool pcap_cache_loaded(void); +bool pcap_cache_loaded(time_t *_last_change); bool pcap_cache_replace(const struct pcap_cache *cache); void pcap_printer_fn_specific(const struct pcap_cache *, void (*fn)(const char *, const char *, const char *, void *), void *); void pcap_printer_read_fn(void (*fn)(const char *, const char *, const char *, void *), void *); diff --git a/source3/printing/queue_process.c b/source3/printing/queue_process.c index aa0d0fb6a8..24d361c2bf 100644 --- a/source3/printing/queue_process.c +++ b/source3/printing/queue_process.c @@ -390,7 +390,7 @@ void printing_subsystem_update(struct tevent_context *ev_ctx, bool force) { if (background_lpq_updater_pid != -1) { - if (pcap_cache_loaded()) { + if (pcap_cache_loaded(NULL)) { load_printers(ev_ctx, msg_ctx); } if (force) { diff --git a/source3/printing/spoolssd.c b/source3/printing/spoolssd.c index c9c8a6972e..59f560cd3b 100644 --- a/source3/printing/spoolssd.c +++ b/source3/printing/spoolssd.c @@ -304,7 +304,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()) { + if (pcap_cache_loaded(NULL)) { load_printers(ev_ctx, msg_ctx); } @@ -724,7 +724,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()) { + if (pcap_cache_loaded(NULL)) { load_printers(ev_ctx, msg_ctx); } |