From 1ad71f79eb473822d36d9629cf52c2fca4c53752 Mon Sep 17 00:00:00 2001 From: David Disseldorp Date: Tue, 5 Aug 2014 17:33:33 +0200 Subject: [PATCH] printing: reload printer shares on OpenPrinter The printer share inventory should be reloaded on open _and_ enumeration, as there are some clients, such as cupsaddsmb, that do not perform an enumeration prior to access. Bug: https://bugzilla.samba.org/show_bug.cgi?id=10652 Signed-off-by: David Disseldorp Reviewed-by: Andreas Schneider Autobuild-User(master): Andreas Schneider Autobuild-Date(master): Fri Aug 8 16:33:50 CEST 2014 on sn-devel-104 --- source3/rpc_server/spoolss/srv_spoolss_nt.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/source3/rpc_server/spoolss/srv_spoolss_nt.c b/source3/rpc_server/spoolss/srv_spoolss_nt.c index 391bb01d3ec..b8a6d7711e9 100644 --- a/source3/rpc_server/spoolss/srv_spoolss_nt.c +++ b/source3/rpc_server/spoolss/srv_spoolss_nt.c @@ -1720,6 +1720,16 @@ WERROR _spoolss_OpenPrinterEx(struct pipes_struct *p, return WERR_INVALID_PARAM; } + /* + * The printcap printer share inventory is updated on client + * enumeration. For clients that do not perform enumeration prior to + * access, such as cupssmbadd, we reinitialise the printer share + * inventory on open as well. + */ + become_root(); + delete_and_reload_printers(server_event_context(), p->msg_ctx); + unbecome_root(); + /* some sanity check because you can open a printer or a print server */ /* aka: \\server\printer or \\server */ @@ -4316,7 +4326,7 @@ static WERROR enum_all_printers_info_level(TALLOC_CTX *mem_ctx, } /* - * printer shares are only updated on client enumeration. The background + * printer shares are updated on client enumeration. The background * printer process updates printer_list.tdb at regular intervals. */ become_root(); -- 2.34.1