1
0
mirror of https://github.com/samba-team/samba.git synced 2025-03-26 18:50:30 +03:00

s3:printing: Move pcap_cache_loaded() to load.c

A future patch will remove the PRINTING dependency from smbd, but in
delete_and_reload_printers() we still reference it.

Maybe at some later stage we can remove reload_printers() overall, we
don't really need to load the full printer list into every smbd. All
we need is to load them on-demand for explicit listing functions, but
there we can throw them away again. And when someone connects to the
printer, we can also load them on demand.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
This commit is contained in:
Volker Lendecke 2021-06-16 08:31:56 +02:00
parent 3aee4c171c
commit c2b8cf05c3
4 changed files with 16 additions and 16 deletions

View File

@ -92,3 +92,18 @@ void load_printers(void)
nt_errstr(status));
}
}
bool pcap_cache_loaded(time_t *_last_change)
{
NTSTATUS status;
time_t last;
status = printer_list_get_last_refresh(&last);
if (!NT_STATUS_IS_OK(status)) {
return false;
}
if (_last_change != NULL) {
*_last_change = last;
}
return true;
}

View File

@ -22,6 +22,7 @@
/* The following definitions come from printing/load.c */
bool pcap_cache_loaded(time_t *_last_change);
void load_printers(void);
#endif /* _PRINTING_LOAD_H_ */

View File

@ -83,21 +83,6 @@ void pcap_cache_destroy_specific(struct pcap_cache **pp_cache)
*pp_cache = NULL;
}
bool pcap_cache_loaded(time_t *_last_change)
{
NTSTATUS status;
time_t last;
status = printer_list_get_last_refresh(&last);
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)
{
const struct pcap_cache *p;

View File

@ -35,7 +35,6 @@ 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(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 *);