diff options
Diffstat (limited to 'source3/printing')
-rw-r--r-- | source3/printing/nt_printing.c | 33 | ||||
-rw-r--r-- | source3/printing/printing.c | 2 |
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); |