Bug 10267 - Windows 8 printing via local printer drivers does not work
Summary: Windows 8 printing via local printer drivers does not work
Status: RESOLVED FIXED
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: Printing (show other bugs)
Version: 4.1.0
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Karolin Seeger
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-11-14 09:51 UTC by Arvid Requate
Modified: 2013-11-26 19:30 UTC (History)
0 users

See Also:


Attachments
windows8_printer_driver_v4_XPS_PASS.patch (587 bytes, patch)
2013-11-14 09:51 UTC, Arvid Requate
no flags Details
windows8_printer_driver_v4_XPS_PASS.patch (2.81 KB, patch)
2013-11-18 17:15 UTC, Arvid Requate
no flags Details
patch for 4.1, straight cherry-pick from master (1.46 KB, patch)
2013-11-21 14:26 UTC, David Disseldorp
kseeger: review? (gd)
asn: review+
Details
patch for 4.0, straight cherry-pick from master (1.46 KB, patch)
2013-11-21 14:27 UTC, David Disseldorp
kseeger: review? (gd)
asn: review+
Details
patch for 3.6, straight cherry-pick from master (1.46 KB, patch)
2013-11-21 14:27 UTC, David Disseldorp
kseeger: review? (gd)
asn: review+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Arvid Requate 2013-11-14 09:51:45 UTC
Created attachment 9420 [details]
windows8_printer_driver_v4_XPS_PASS.patch

Sppolss silently drops print jobs sent from a Windows 8 machine when generated using a printer which was installed with Windows 8 native local printer drivers. The attached patch fixes this problem.

Analysis: The new v4 driver model used in Windows 8 declares print jobs intended to bypass the XPS processing layer by setting datatype to "XPS_PASS" instead of "RAW" ( see e.g. http://www.microsoft.com/whdc/device/print/XPSDrv_FilterPipe.mspx ).

The attached patch makes srv_spoolss_nt accept this datatype.



This is the log.smbd level 10 output of the issue without the patch:
=============================================================================
+[2013/11/07 07:38:48.432465,  1, pid=20933, effective(0, 5000), real(0, 0)] ../librpc/ndr/ndr.c:333(ndr_print_function_debug)
+       spoolss_StartDocPrinter: struct spoolss_StartDocPrinter
+          in: struct spoolss_StartDocPrinter
+              handle                   : *
+                  handle: struct policy_handle
+                      handle_type              : 0x00000000 (0)
+                      uuid                     : 000000ed-0000-0000-7b52-7735c5510000
+              info_ctr                 : *
+                  info_ctr: struct spoolss_DocumentInfoCtr
+                      level                    : 0x00000001 (1)
+                      info                     : union spoolss_DocumentInfo(case 1)
+                      info1                    : *
+                          info1: struct spoolss_DocumentInfo1
+                              document_name            : *
+                                  document_name            : 'Testseite'
+                              output_file              : NULL
+                              datatype                 : *
+                                  datatype                 : 'XPS_PASS'
+[2013/11/07 07:38:48.433186,  6, pid=20933, effective(0, 5000), real(0, 0), class=rpc_srv] ../source3/rpc_server/rpc_handles.c:337(find_policy_by_hnd_internal)
+  Found policy hnd[2] [0000] 00 00 00 00 ED 00 00 00   00 00 00 00 7B 52 77 35   ........ ....{Rw5
+  [0010] C5 51 00 00                                       .Q.. 
+[2013/11/07 07:38:48.433348,  1, pid=20933, effective(0, 5000), real(0, 0)] ../librpc/ndr/ndr.c:333(ndr_print_function_debug)
+       spoolss_StartDocPrinter: struct spoolss_StartDocPrinter
+          out: struct spoolss_StartDocPrinter
+              job_id                   : *
+                  job_id                   : 0x00000000 (0)
+              result                   : WERR_INVALID_DATATYPE
=============================================================================
Comment 1 David Disseldorp 2013-11-14 10:14:34 UTC
Thanks for your analysis and patch Arvid!

A couple of minor comments on the patch:
- please add a code comment with your analysis
- split the check across multiple lines

e.g.
                /*
                 * The v4 driver model used in Windows 8 declares print jobs 
                 * intended to bypass the XPS processing layer by setting
                 * datatype to "XPS_PASS" instead of "RAW".
                 */ 
                if ((strcmp(info_1->datatype, "RAW") != 0)
                 && (strcmp(info_1->datatype, "XPS_PASS") != 0)) {

A corresponding smbtorture test would also be ideal.
Comment 2 David Disseldorp 2013-11-18 14:27:40 UTC
(In reply to comment #1)
> Thanks for your analysis and patch Arvid!
> 
> A couple of minor comments on the patch:
> - please add a code comment with your analysis
> - split the check across multiple lines

Ping, were you able to address these points Arvid? I'd like to get your fix upstream as soon as possible.
Comment 3 Arvid Requate 2013-11-18 17:15:05 UTC
Created attachment 9433 [details]
windows8_printer_driver_v4_XPS_PASS.patch

I'm not sure about the torture test, I tried to follow the wiki page but didn't have time to test this yet.
Comment 4 David Disseldorp 2013-11-21 14:26:23 UTC
Created attachment 9458 [details]
patch for 4.1, straight cherry-pick from master
Comment 5 David Disseldorp 2013-11-21 14:27:20 UTC
Created attachment 9459 [details]
patch for 4.0, straight cherry-pick from master
Comment 6 David Disseldorp 2013-11-21 14:27:44 UTC
Created attachment 9460 [details]
patch for 3.6, straight cherry-pick from master
Comment 7 David Disseldorp 2013-11-21 14:30:23 UTC
Arvid's fix is now in master as b2815b4c8c3e436a79fb7f07be285a417fd6e8cb.

@Karolin, please merge the attached patches to the corresponding maintenance branches.
Comment 8 Karolin Seeger 2013-11-22 10:32:00 UTC
(In reply to comment #7)
> Arvid's fix is now in master as b2815b4c8c3e436a79fb7f07be285a417fd6e8cb.
> 
> @Karolin, please merge the attached patches to the corresponding maintenance
> branches.

Sorry, I need second review first...
Comment 9 Karolin Seeger 2013-11-22 10:52:44 UTC
Pushed to autobuild-v4-1-test, autobuild-v4-0-test and v3-6-test.
Comment 10 Karolin Seeger 2013-11-26 19:30:28 UTC
Pushed to v4-1-test and v4-0-test.
Closing out bug report.

Thanks!