summaryrefslogtreecommitdiff
path: root/source3/rpc_server
diff options
context:
space:
mode:
authorGerald Carter <jerry@samba.org>2003-01-11 02:38:36 +0000
committerGerald Carter <jerry@samba.org>2003-01-11 02:38:36 +0000
commit071af8f007efc20c23959d140a87cc09363aae83 (patch)
treed791fda875827a93367d35e319930d64d632eb3f /source3/rpc_server
parentbb697d25c7592d63074266092d458cec28ef23dc (diff)
downloadsamba-071af8f007efc20c23959d140a87cc09363aae83.tar.gz
samba-071af8f007efc20c23959d140a87cc09363aae83.tar.bz2
samba-071af8f007efc20c23959d140a87cc09363aae83.zip
[merge] make sure to update print queue cache during timeout_processing() to send notify events; CR 1491
(This used to be commit f8a915b14d63e4fdb99235053eeb896ef9492068)
Diffstat (limited to 'source3/rpc_server')
-rw-r--r--source3/rpc_server/srv_spoolss_nt.c49
1 files changed, 40 insertions, 9 deletions
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index 279bbb86ff..a289de78de 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -79,8 +79,10 @@ typedef struct _Printer{
uint32 printerlocal;
SPOOL_NOTIFY_OPTION *option;
POLICY_HND client_hnd;
- uint32 client_connected;
+ BOOL client_connected;
uint32 change;
+ /* are we in a FindNextPrinterChangeNotify() call? */
+ BOOL fnpcn;
} notify;
struct {
fstring machine;
@@ -90,6 +92,7 @@ typedef struct _Printer{
/* devmode sent in the OpenPrinter() call */
NT_DEVICEMODE *nt_devmode;
+
} Printer_entry;
static Printer_entry *printers_list;
@@ -932,7 +935,7 @@ static void send_notify2_changes( SPOOLSS_NOTIFY_MSG_CTR *ctr, uint32 idx )
SPOOL_NOTIFY_INFO_DATA *data;
uint32 data_len = 0;
uint32 id;
- int i;
+ int i, event_index;
/* Is there notification on this handle? */
@@ -955,6 +958,8 @@ static void send_notify2_changes( SPOOLSS_NOTIFY_MSG_CTR *ctr, uint32 idx )
data = talloc( mem_ctx, msg_group->num_msgs*sizeof(SPOOL_NOTIFY_INFO_DATA) );
ZERO_STRUCTP(data);
+ event_index = 0;
+
/* build the array of change notifications */
for ( i=0; i<msg_group->num_msgs; i++ )
@@ -1005,17 +1010,13 @@ static void send_notify2_changes( SPOOLSS_NOTIFY_MSG_CTR *ctr, uint32 idx )
switch(msg->type) {
case PRINTER_NOTIFY_TYPE:
- if ( !printer_notify_table[msg->field].fn )
- goto done;
+ if ( printer_notify_table[msg->field].fn )
printer_notify_table[msg->field].fn(msg, &data[data_len], mem_ctx);
-
break;
case JOB_NOTIFY_TYPE:
- if ( !job_notify_table[msg->field].fn )
- goto done;
+ if ( job_notify_table[msg->field].fn )
job_notify_table[msg->field].fn(msg, &data[data_len], mem_ctx);
-
break;
default:
@@ -1229,6 +1230,32 @@ void do_drv_upgrade_printer(int msg_type, pid_t src, void *buf, size_t len)
}
/********************************************************************
+ Update the cahce for all printq's with a registered client
+ connection
+ ********************************************************************/
+
+void update_monitored_printq_cache( void )
+{
+ Printer_entry *printer = printers_list;
+ int snum;
+
+ /* loop through all printers and update the cache where
+ client_connected == True */
+ while ( printer )
+ {
+ if ( (printer->printer_type == PRINTER_HANDLE_IS_PRINTER)
+ && printer->notify.client_connected )
+ {
+ snum = print_queue_snum(printer->dev.handlename);
+ print_queue_status( snum, NULL, NULL );
+ }
+
+ printer = printer->next;
+ }
+
+ return;
+}
+/********************************************************************
Send a message to ourself about new driver being installed
so we can upgrade the information for each printer bound to this
driver
@@ -3727,6 +3754,8 @@ WERROR _spoolss_rfnpcnex( pipes_struct *p, SPOOL_Q_RFNPCNEX *q_u, SPOOL_R_RFNPCN
/* We need to keep track of the change value to send back in
RRPCN replies otherwise our updates are ignored. */
+ Printer->notify.fnpcn = True;
+
if (Printer->notify.client_connected) {
DEBUG(10,("_spoolss_rfnpcnex: Saving change value in request [%x]\n", q_u->change));
Printer->notify.change = q_u->change;
@@ -3744,7 +3773,9 @@ WERROR _spoolss_rfnpcnex( pipes_struct *p, SPOOL_Q_RFNPCNEX *q_u, SPOOL_R_RFNPCN
break;
}
- done:
+ Printer->notify.fnpcn = False;
+
+done:
return result;
}