* CR1868: only send a change notify message if we have something
authorGerald Carter <jerry@samba.org>
Mon, 3 Mar 2003 16:34:19 +0000 (16:34 +0000)
committerGerald Carter <jerry@samba.org>
Mon, 3 Mar 2003 16:34:19 +0000 (16:34 +0000)
  that changed that the client is monitoring.

* couple of comments abnout how we need to validate driver names
  on SetPrinter() and AddPrinter()

* up the debug level on some overly verbose dev mode parsing messages
(This used to be commit 7377d671e8a95ac2ab0452f564b18b2a098699cb)

source3/rpc_parse/parse_spoolss.c
source3/rpc_server/srv_spoolss_nt.c

index 47737908f02be11d66695f9d9e98c821b80ade0f..0545f89ff7a27aee5797bad28fd6effe62a009ac 100644 (file)
@@ -789,7 +789,7 @@ BOOL spoolss_io_devmode(const char *desc, prs_struct *ps, int depth, DEVICEMODE
        
        while ((available_space > 0)  && (i < DM_NUM_OPTIONAL_FIELDS))
        {
-               DEBUG(10, ("spoolss_io_devmode: [%d] bytes left to parse in devmode\n", available_space));
+               DEBUG(11, ("spoolss_io_devmode: [%d] bytes left to parse in devmode\n", available_space));
                if (!prs_uint32(opt_fields[i].name, ps, depth, opt_fields[i].field))
                        return False;
                available_space -= sizeof(uint32);
index b3218329308f54489fdfb847e47e67f9a8361770..4090800fc9e986316b26803eea2abb699e0f1b0d 100644 (file)
@@ -900,7 +900,7 @@ static void send_notify2_changes( SPOOLSS_NOTIFY_MSG_CTR *ctr, uint32 idx )
        TALLOC_CTX               *mem_ctx = notify_ctr_getctx( ctr );
        SPOOLSS_NOTIFY_MSG_GROUP *msg_group = notify_ctr_getgroup( ctr, idx );
        SPOOLSS_NOTIFY_MSG       *messages;
-       
+       int                      sending_msg_count;
        
        if ( !msg_group ) {
                DEBUG(5,("send_notify2_changes() called with no msg group!\n"));
@@ -949,6 +949,8 @@ static void send_notify2_changes( SPOOLSS_NOTIFY_MSG_CTR *ctr, uint32 idx )
                
                /* build the array of change notifications */
                
+               sending_msg_count = 0;
+               
                for ( i=0; i<msg_group->num_msgs; i++ ) {
                        SPOOLSS_NOTIFY_MSG      *msg = &messages[i];
                        
@@ -957,6 +959,8 @@ static void send_notify2_changes( SPOOLSS_NOTIFY_MSG_CTR *ctr, uint32 idx )
                        if (!is_monitoring_event(p, msg->type, msg->field))
                                continue;
 
+                       sending_msg_count++;
+                       
                        
                        DEBUG(10,("process_notify2_message: Sending message type [%x] field [%x] for printer [%s]\n",
                                msg->type, msg->field, p->dev.handlename));
@@ -1012,9 +1016,11 @@ static void send_notify2_changes( SPOOLSS_NOTIFY_MSG_CTR *ctr, uint32 idx )
                        data_len++;
                }
 
+               if ( sending_msg_count ) {
                cli_spoolss_rrpcn( &notify_cli, mem_ctx, &p->notify.client_hnd, 
                                data_len, data, p->notify.change, 0 );
        }
+       }
        
 done:
        DEBUG(8,("send_notify2_changes: Exit...\n"));
@@ -5886,6 +5892,9 @@ static WERROR update_printer(pipes_struct *p, POLICY_HND *handle, uint32 level,
                goto done;
        }
 
+       /* FIXME!!! If the driver has changed we really should verify that 
+          it is installed before doing much else   --jerry */
+
        /* Check calling user has permission to update printer description */
 
        if (Printer->access_granted != PRINTER_ACCESS_ADMINISTER) {
@@ -7177,6 +7186,9 @@ static WERROR spoolss_addprinterex_level_2( pipes_struct *p, const UNISTR2 *uni_
                free_a_printer(&printer, 2);
                return WERR_PRINTER_ALREADY_EXISTS;
        }
+       
+       /* FIXME!!!  smbd should check to see if the driver is installed before
+          trying to add a printer like this  --jerry */
 
        if (*lp_addprinter_cmd() ) {
                if ( !add_printer_hook(printer) ) {