From 1842fde7d10a6faccae1a24ebc67f8452a5a828e Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Wed, 18 Aug 2004 13:55:58 +0000 Subject: 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) --- source3/rpc_server/srv_spoolss_nt.c | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) (limited to 'source3/rpc_server') diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c index ccff65688a..5775b3ab49 100644 --- a/source3/rpc_server/srv_spoolss_nt.c +++ b/source3/rpc_server/srv_spoolss_nt.c @@ -180,7 +180,7 @@ static void srv_spoolss_replycloseprinter(int snum, POLICY_HND *handle) /* Tell the connections db we're no longer interested in * printer notify messages. */ - register_message_flags( False, FLAG_MSG_PRINTING ); + register_message_flags( False, FLAG_MSG_PRINT_NOTIFY ); } smb_connections--; @@ -1194,12 +1194,6 @@ static void receive_notify2_message_list(int msg_type, pid_t src, void *msg, siz notify2_unpack_msg( ¬ify, &msg_tv, msg_ptr, msg_len ); msg_ptr += msg_len; - /* we don't know if the change was from us or not so kill - any cached printer objects */ - - if ( notify.type == PRINTER_NOTIFY_TYPE ) - invalidate_printer_hnd_cache( notify.printer ); - /* add to correct list in container */ notify_msg_ctr_addmsg( &messages, ¬ify ); @@ -1226,6 +1220,22 @@ static void receive_notify2_message_list(int msg_type, pid_t src, void *msg, siz return; } +/******************************************************************** + callback to MSG_PRINTER_CHANGED. When a printer is changed by + one smbd, all of processes must clear their printer cache immediately. + ********************************************************************/ + +void receive_printer_mod_msg(int msg_type, pid_t src, void *buf, size_t len) +{ + fstring printername; + + fstrcpy( printername, buf ); + + DEBUG(10,("receive_printer_mod_msg: Printer change [%s]\n", printername )); + + invalidate_printer_hnd_cache( printername ); +} + /******************************************************************** Send a message to ourself about new driver being installed so we can upgrade the information for each printer bound to this @@ -2641,7 +2651,7 @@ static BOOL srv_spoolss_replyopenprinter(int snum, const char *printer, message_register(MSG_PRINTER_NOTIFY2, receive_notify2_message_list); /* Tell the connections db we're now interested in printer * notify messages. */ - register_message_flags( True, FLAG_MSG_PRINTING ); + register_message_flags( True, FLAG_MSG_PRINT_NOTIFY ); } /* -- cgit