[PATCH v2 9/9] printing: reload printer shares on OpenPrinter

David Disseldorp ddiss at samba.org
Thu Aug 7 09:40:40 MDT 2014


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 <ddiss at samba.org>
---
 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 391bb01..b8a6d77 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();
-- 
1.8.4.5



More information about the samba-technical mailing list