summaryrefslogtreecommitdiff
path: root/source3/printing
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2004-08-18 13:55:58 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:52:23 -0500
commit1842fde7d10a6faccae1a24ebc67f8452a5a828e (patch)
tree1bb8a33a0ef7bea01532731ccbd965f5590e29a2 /source3/printing
parent5cd11b7127afed6a1e4e540721fa15d45aec471b (diff)
downloadsamba-1842fde7d10a6faccae1a24ebc67f8452a5a828e.tar.gz
samba-1842fde7d10a6faccae1a24ebc67f8452a5a828e.tar.bz2
samba-1842fde7d10a6faccae1a24ebc67f8452a5a828e.zip
r1885: tighten the cache consistency with the ntprinters.tdb entry an the in memory cache associated with open printer handles; also make sure that register_messages_flags() doesn't overwrite the originally registers flags
(This used to be commit 540daf71d8ad189af5dd6d45aa1ce2b3d67da752)
Diffstat (limited to 'source3/printing')
-rw-r--r--source3/printing/nt_printing.c33
-rw-r--r--source3/printing/printing.c2
2 files changed, 34 insertions, 1 deletions
diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c
index 1c88bf27a8..b54e1f738d 100644
--- a/source3/printing/nt_printing.c
+++ b/source3/printing/nt_printing.c
@@ -365,6 +365,17 @@ BOOL nt_printing_init(void)
message_register( MSG_PRINTERDATA_INIT_RESET, reset_all_printerdata );
+ /*
+ * register callback to handle invalidating the printer cache
+ * between smbd processes.
+ */
+
+ message_register( MSG_PRINTER_MOD, receive_printer_mod_msg);
+
+ /* of course, none of the message callbacks matter if you don't
+ tell messages.c that you interested in receiving PRINT_GENERAL
+ msgs. This is done in claim_connection() */
+
return True;
}
@@ -3458,6 +3469,27 @@ static uint32 rev_changeid(void)
#endif
}
+/********************************************************************
+ Send a message to all smbds about the printer that just changed
+ ********************************************************************/
+
+static BOOL send_printer_mod_msg( char* printername )
+{
+ int len = strlen(printername);
+
+ if (!len)
+ return False;
+
+ DEBUG(10,("send_printer_mod_msg: Sending message about printer change [%s]\n",
+ printername));
+
+ /* spam everyone that we just changed this printer */
+
+ message_send_all( conn_tdb_ctx(), MSG_PRINTER_MOD, printername, len+1, False, NULL );
+
+ return True;
+}
+
/*
* The function below are the high level ones.
* only those ones must be called from the spoolss code.
@@ -3481,6 +3513,7 @@ WERROR mod_a_printer(NT_PRINTER_INFO_LEVEL printer, uint32 level)
*/
invalidate_printer_hnd_cache( printer.info_2->sharename );
+ send_printer_mod_msg( printer.info_2->sharename );
switch (level) {
case 2:
diff --git a/source3/printing/printing.c b/source3/printing/printing.c
index 10ca7e47e7..31cb0faa9b 100644
--- a/source3/printing/printing.c
+++ b/source3/printing/printing.c
@@ -1183,7 +1183,7 @@ void start_background_queue(void)
DEBUG(5,("start_background_queue: background LPQ thread started\n"));
claim_connection( NULL, "smbd lpq backend", 0, False,
- FLAG_MSG_GENERAL|FLAG_MSG_SMBD|FLAG_MSG_PRINTING );
+ FLAG_MSG_GENERAL|FLAG_MSG_SMBD|FLAG_MSG_PRINT_GENERAL);
if (!locking_init(0)) {
exit(1);