summaryrefslogtreecommitdiffstats
path: root/source/printing
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2004-08-18 13:55:58 +0000
committerGerald Carter <jerry@samba.org>2004-08-18 13:55:58 +0000
commit32f7e8f3995b38a10f64720f3d30fccddd55396f (patch)
treec4a75ae6089a5db827259e266a424a503146036f /source/printing
parentb565dce1e0427351c1f2011806ba8e01b574377b (diff)
downloadsamba-32f7e8f3995b38a10f64720f3d30fccddd55396f.tar.gz
samba-32f7e8f3995b38a10f64720f3d30fccddd55396f.tar.xz
samba-32f7e8f3995b38a10f64720f3d30fccddd55396f.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
Diffstat (limited to 'source/printing')
-rw-r--r--source/printing/nt_printing.c33
-rw-r--r--source/printing/printing.c2
2 files changed, 34 insertions, 1 deletions
diff --git a/source/printing/nt_printing.c b/source/printing/nt_printing.c
index 1c88bf27a88..b54e1f738d9 100644
--- a/source/printing/nt_printing.c
+++ b/source/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/source/printing/printing.c b/source/printing/printing.c
index 10ca7e47e71..31cb0faa9b0 100644
--- a/source/printing/printing.c
+++ b/source/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);