summaryrefslogtreecommitdiffstats
path: root/source3/smbd/server_reload.c
diff options
context:
space:
mode:
authorDavid Disseldorp <ddiss@suse.de>2010-12-19 19:52:08 +0100
committerJeremy Allison <jra@samba.org>2011-01-07 15:37:39 -0800
commit04248c2cfaa5a1728ef58fc8ca231fd1309ca694 (patch)
tree81e3be76291d3fdbf5f1e29869c6ef82f7305193 /source3/smbd/server_reload.c
parent3a14c97459ea21f4a3ecefabfd676cb9839a162f (diff)
downloadsamba-04248c2cfaa5a1728ef58fc8ca231fd1309ca694.tar.gz
samba-04248c2cfaa5a1728ef58fc8ca231fd1309ca694.tar.xz
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/server_reload.c')
-rw-r--r--source3/smbd/server_reload.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/source3/smbd/server_reload.c b/source3/smbd/server_reload.c
index 38d1f3a354a..2b74e7a0d49 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)