diff options
author | David Disseldorp <ddiss@suse.de> | 2010-12-19 19:52:08 +0100 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2011-01-07 15:37:39 -0800 |
commit | 04248c2cfaa5a1728ef58fc8ca231fd1309ca694 (patch) | |
tree | 81e3be76291d3fdbf5f1e29869c6ef82f7305193 /source3/smbd | |
parent | 3a14c97459ea21f4a3ecefabfd676cb9839a162f (diff) | |
download | samba-04248c2cfaa5a1728ef58fc8ca231fd1309ca694.tar.gz samba-04248c2cfaa5a1728ef58fc8ca231fd1309ca694.tar.bz2 samba-04248c2cfaa5a1728ef58fc8ca231fd1309ca694.zip |
s3-printing: reload shares after pcap cache fill
Since commit eada8f8a, updates to the cups pcap cache are performed
asynchronously - cups_cache_reload() forks a child process to request
cups printer information and notify the parent smbd on completion.
Currently printer shares are reloaded immediately following the call to
cups_cache_reload(), this occurs prior to smbd receiving new cups pcap
information from the child process. Such behaviour can result in stale
print shares as outlined in bug 7836.
This fix ensures print shares are only reloaded after new pcap data has
been received.
Pair-Programmed-With: Lars Müller <lars@samba.org>
Diffstat (limited to 'source3/smbd')
-rw-r--r-- | source3/smbd/process.c | 3 | ||||
-rw-r--r-- | source3/smbd/server.c | 3 | ||||
-rw-r--r-- | source3/smbd/server_reload.c | 13 |
3 files changed, 12 insertions, 7 deletions
diff --git a/source3/smbd/process.c b/source3/smbd/process.c index 150b2dd2cb..2992576702 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -2259,7 +2259,8 @@ static void check_reload(struct smbd_server_connection *sconn, time_t t) || (t-last_printer_reload_time < 0) ) { DEBUG( 3,( "Printcap cache time expired.\n")); - reload_printers(sconn->msg_ctx); + pcap_cache_reload(server_event_context(), + sconn->msg_ctx, &reload_printers); last_printer_reload_time = t; } } diff --git a/source3/smbd/server.c b/source3/smbd/server.c index 1b9e793e4c..16aa055b35 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -1238,7 +1238,8 @@ extern void build_options(bool screen); } /* Publish nt printers, this requires a working winreg pipe */ - reload_printers(smbd_messaging_context()); + pcap_cache_reload(server_event_context(), smbd_messaging_context(), + &reload_printers); /* only start the background queue daemon if we are running as a daemon -- bad things will happen if diff --git a/source3/smbd/server_reload.c b/source3/smbd/server_reload.c index 38d1f3a354..2b74e7a0d4 100644 --- a/source3/smbd/server_reload.c +++ b/source3/smbd/server_reload.c @@ -25,11 +25,13 @@ #include "smbd/globals.h" #include "librpc/gen_ndr/messaging.h" #include "nt_printing.h" +#include "printing/pcap.h" /**************************************************************************** - Reload printers + purge stale printers and reload from pre-populated pcap cache **************************************************************************/ -void reload_printers(struct messaging_context *msg_ctx) +void reload_printers(struct tevent_context *ev, + struct messaging_context *msg_ctx) { struct auth_serversupplied_info *server_info = NULL; struct spoolss_PrinterInfo2 *pinfo2 = NULL; @@ -40,7 +42,8 @@ void reload_printers(struct messaging_context *msg_ctx) NTSTATUS status; bool skip = false; - pcap_cache_reload(server_event_context(), msg_ctx); + SMB_ASSERT(pcap_cache_loaded()); + DEBUG(10, ("reloading printer services from pcap cache\n")); status = make_server_info_system(talloc_tos(), &server_info); if (!NT_STATUS_IS_OK(status)) { @@ -79,7 +82,7 @@ void reload_printers(struct messaging_context *msg_ctx) } } - load_printers(server_event_context(), msg_ctx); + load_printers(ev, msg_ctx); TALLOC_FREE(server_info); } @@ -111,7 +114,7 @@ bool reload_services(struct messaging_context *msg_ctx, int smb_sock, ret = lp_load(get_dyn_CONFIGFILE(), False, False, True, True); - reload_printers(msg_ctx); + pcap_cache_reload(server_event_context(), msg_ctx, &reload_printers); /* perhaps the config filename is now set */ if (!test) |