s3-lanman: fix api_DosPrintQEnum().
authorGünther Deschner <gd@samba.org>
Mon, 3 May 2010 11:42:32 +0000 (13:42 +0200)
committerGünther Deschner <gd@samba.org>
Mon, 3 May 2010 12:45:26 +0000 (14:45 +0200)
This was a subtile bug where the OpenPrinter call (called directly via
dispatcher table) was modifiying r->in.printername in a way that all printers on
a server had the printername stripped off the server unc. Once we switch to full
NDR marshalling in inter RAP<->RPC server communication there is no danger
anymore to have these kind of nasty effects.

Guenther

source3/smbd/lanman.c

index 954c9c84badb284961b48f759dc7a3dcb06ddc96..ec87dbb0b87b48fe1dbd2c487b70fa5bb3aedb43 100644 (file)
@@ -1071,12 +1071,18 @@ static bool api_DosPrintQEnum(connection_struct *conn, uint16 vuid,
 
                uint32_t num_jobs;
                struct policy_handle handle;
+               const char *printername;
+
+               printername = talloc_strdup(mem_ctx, printer_info[i].info2.printername);
+               if (printername == NULL) {
+                       goto err;
+               }
 
                ZERO_STRUCT(handle);
                ZERO_STRUCT(devmode_ctr);
 
                status = rpccli_spoolss_OpenPrinter(cli, mem_ctx,
-                                                   printer_info[i].info2.printername,
+                                                   printername,
                                                    NULL,
                                                    devmode_ctr,
                                                    SEC_FLAG_MAXIMUM_ALLOWED,