The first of Martin Zielinski <mz@seh.de> Vista printing patches.
[samba.git] / source / rpc_server / srv_spoolss_nt.c
index 3758c8fd63ed9cbaeb2198f913599198e71af486..a7b477e17d5e2ba336224eb0213ecfeab7352852 100644 (file)
@@ -164,7 +164,7 @@ static void srv_spoolss_replycloseprinter(int snum, POLICY_HND *handle)
        /* if it's the last connection, deconnect the IPC$ share */
        if (smb_connections==1) {
 
-               cli_shutdown( notify_cli_pipe->cli );
+               cli_shutdown( rpc_pipe_np_smb_conn(notify_cli_pipe) );
                notify_cli_pipe = NULL; /* The above call shuts downn the pipe also. */
 
                messaging_deregister(smbd_messaging_context(),
@@ -521,7 +521,13 @@ static bool set_printer_hnd_name(Printer_entry *Printer, char *handlename)
                fstrcpy(sname, lp_servicename(snum));
 
                printer = NULL;
-               result = get_a_printer( NULL, &printer, 2, sname );
+
+               /* This call doesn't fill in the location or comment from
+                * a CUPS server for efficiency with large numbers of printers.
+                * JRA.
+                */
+
+               result = get_a_printer_search( NULL, &printer, 2, sname );
                if ( !W_ERROR_IS_OK(result) ) {
                        DEBUG(0,("set_printer_hnd_name: failed to lookup printer [%s] -- result [%s]\n",
                                sname, dos_errstr(result)));
@@ -2603,10 +2609,6 @@ static bool spoolss_connect_to_client(struct rpc_pipe_client **pp_pipe,
                return False;
        }
 
-       /* make sure to save the cli_state pointer.  Keep its own talloc_ctx */
-
-       (*pp_pipe)->cli = the_cli;
-
        return True;
 }
 
@@ -6033,7 +6035,11 @@ static WERROR update_printer_sec(POLICY_HND *handle, uint32 level,
        /* NT seems to like setting the security descriptor even though
           nothing may have actually changed. */
 
-       nt_printing_getsec(p->mem_ctx, Printer->sharename, &old_secdesc_ctr);
+       if ( !nt_printing_getsec(p->mem_ctx, Printer->sharename, &old_secdesc_ctr)) {
+               DEBUG(2,("update_printer_sec: nt_printing_getsec() failed\n"));
+               result = WERR_BADFID;
+               goto done;
+       }
 
        if (DEBUGLEVEL >= 10) {
                SEC_ACL *the_acl;
@@ -9620,13 +9626,16 @@ WERROR _spoolss_enumprinterdataex(pipes_struct *p, SPOOL_Q_ENUMPRINTERDATAEX *q_
 
        /* copy data into the reply */
 
-       r_u->ctr.size           = r_u->needed;
+       /* mz: Vista x64 returns 0x6f7 (The stub received bad data), if the
+          response buffer size is != the offered buffer size
+
+               r_u->ctr.size           = r_u->needed;
+       */
+       r_u->ctr.size           = in_size;
 
        r_u->ctr.size_of_array  = r_u->returned;
        r_u->ctr.values         = enum_values;
 
-
-
 done:
        if ( printer )
        free_a_printer(&printer, 2);