sync 3.0 into HEAD for the last time
[samba.git] / source / rpc_server / srv_spoolss_nt.c
index 8237298ebb7ad92b3e26fa8550951c2ff12867ad..7159527a7d8d3ead86460427c71711adf6083d87 100644 (file)
@@ -387,7 +387,6 @@ static WERROR delete_printer_handle(pipes_struct *p, POLICY_HND *hnd)
                char *cmd = lp_deleteprinter_cmd();
                pstring command;
                int ret;
-               int i;
 
                /* Printer->dev.handlename equals portname equals sharename */
                slprintf(command, sizeof(command)-1, "%s \"%s\"", cmd,
@@ -406,7 +405,7 @@ static WERROR delete_printer_handle(pipes_struct *p, POLICY_HND *hnd)
                /* go ahead and re-read the services immediately */
                reload_services( False );
 
-               if ( ( i = lp_servicenumber( Printer->dev.handlename ) ) < 0 )
+               if ( lp_servicenumber( Printer->dev.handlename )  < 0 )
                        return WERR_ACCESS_DENIED;
        }
 
@@ -957,7 +956,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, event_index;
+               int     i;
 
                /* Is there notification on this handle? */
 
@@ -980,8 +979,6 @@ 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 */
                
                sending_msg_count = 0;
@@ -2671,6 +2668,8 @@ static BOOL srv_spoolss_replyopenprinter(int snum, const char *printer,
 
                fstrcpy(unix_printer, printer+2); /* the +2 is to strip the leading 2 backslashs */
 
+               ZERO_STRUCT(notify_cli);
+
                if(!spoolss_connect_to_client(&notify_cli, client_ip, unix_printer))
                        return False;
                        
@@ -3753,7 +3752,6 @@ static WERROR printserver_notify_info(pipes_struct *p, POLICY_HND *hnd,
        Printer_entry *Printer=find_printer_index_by_hnd(p, hnd);
        int n_services=lp_numservices();
        int i;
-       uint32 id;
        SPOOL_NOTIFY_OPTION *option;
        SPOOL_NOTIFY_OPTION_TYPE *option_type;
 
@@ -3763,7 +3761,6 @@ static WERROR printserver_notify_info(pipes_struct *p, POLICY_HND *hnd,
                return WERR_BADFID;
 
        option=Printer->notify.option;
-       id=1;
        info->version=2;
        info->data=NULL;
        info->count=0;
@@ -6192,12 +6189,9 @@ static WERROR publish_or_unpublish_printer(pipes_struct *p, POLICY_HND *handle,
        SPOOL_PRINTER_INFO_LEVEL_7 *info7 = info->info_7;
        int snum;
        Printer_entry *Printer = find_printer_index_by_hnd(p, handle);
-       WERROR result;
 
        DEBUG(5,("publish_or_unpublish_printer, action = %d\n",info7->action));
 
-       result = WERR_OK;
-
        if (!Printer)
                return WERR_BADFID;
 
@@ -7100,7 +7094,6 @@ static void fill_port_2(PORT_INFO_2 *port, const char *name)
        init_unistr(&port->port_name, name);
        init_unistr(&port->monitor_name, "Local Monitor");
        init_unistr(&port->description, "Local Port");
-#define PORT_TYPE_WRITE 1
        port->port_type=PORT_TYPE_WRITE;
        port->reserved=0x0;     
 }
@@ -7723,7 +7716,6 @@ WERROR _spoolss_enumprinterdata(pipes_struct *p, SPOOL_Q_ENUMPRINTERDATA *q_u, S
 
        NT_PRINTER_INFO_LEVEL *printer = NULL;
        
-       uint32          param_index;
        uint32          biggest_valuesize;
        uint32          biggest_datasize;
        uint32          data_len;
@@ -7772,7 +7764,6 @@ WERROR _spoolss_enumprinterdata(pipes_struct *p, SPOOL_Q_ENUMPRINTERDATA *q_u, S
        {
                DEBUGADD(6,("Activating NT mega-hack to find sizes\n"));
 
-               param_index       = 0;
                biggest_valuesize = 0;
                biggest_datasize  = 0;
                                
@@ -8032,6 +8023,9 @@ WERROR _spoolss_deleteprinterdata(pipes_struct *p, SPOOL_Q_DELETEPRINTERDATA *q_
        unistr2_to_ascii( valuename, value, sizeof(valuename)-1 );
 
        status = delete_printer_dataex( printer, SPOOL_PRINTERDATA_KEY, valuename );
+       
+       if ( W_ERROR_IS_OK(status) )
+               mod_a_printer( *printer, 2 );
 
        free_a_printer(&printer, 2);
 
@@ -8895,6 +8889,9 @@ WERROR _spoolss_deleteprinterdataex(pipes_struct *p, SPOOL_Q_DELETEPRINTERDATAEX
 
        status = delete_printer_dataex( printer, keyname, valuename );
 
+       if ( W_ERROR_IS_OK(status) )
+               mod_a_printer( *printer, 2 );
+               
        free_a_printer(&printer, 2);
 
        return status;
@@ -9186,12 +9183,11 @@ static WERROR getprintprocessordirectory_level_1(UNISTR2 *name,
 {
        pstring path;
        pstring long_archi;
-        const char *short_archi;
        PRINTPROCESSOR_DIRECTORY_1 *info=NULL;
 
        unistr2_to_ascii(long_archi, environment, sizeof(long_archi)-1);
 
-       if (!(short_archi = get_short_archi(long_archi)))
+       if (!get_short_archi(long_archi))
                return WERR_INVALID_ENVIRONMENT;
 
        if((info=(PRINTPROCESSOR_DIRECTORY_1 *)malloc(sizeof(PRINTPROCESSOR_DIRECTORY_1))) == NULL)